當前位置: 首頁>>代碼示例>>C#>>正文


C# MapObject.GetEntityData方法代碼示例

本文整理匯總了C#中Sledge.DataStructures.MapObjects.MapObject.GetEntityData方法的典型用法代碼示例。如果您正苦於以下問題:C# MapObject.GetEntityData方法的具體用法?C# MapObject.GetEntityData怎麽用?C# MapObject.GetEntityData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sledge.DataStructures.MapObjects.MapObject的用法示例。


在下文中一共展示了MapObject.GetEntityData方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Render2D

        public void Render2D(Viewport2D viewport, MapObject o)
        {
            if (viewport.Zoom < 1) return;

            var entityData = o.GetEntityData();
            if (entityData == null) return;

            var start = viewport.WorldToScreen(viewport.Flatten(o.BoundingBox.Start));
            var end = viewport.WorldToScreen(viewport.Flatten(o.BoundingBox.End));
            if (start.X >= viewport.Width || end.X <= 0 || start.Y >= viewport.Height || end.Y <= 0) return;

            var text = entityData.Name;
            var nameProp = entityData.GetPropertyValue("targetname");
            if (!String.IsNullOrWhiteSpace(nameProp)) text += ": " + nameProp;

            _printer.Print(text, _printerFont, o.Colour, new RectangleF((float)start.X + 2, viewport.Height - (float)end.Y - _printerFont.Height - 6, viewport.Width, viewport.Height));
        }
開發者ID:074769,項目名稱:sledge,代碼行數:17,代碼來源:EntityTextHelper.cs

示例2: GetNodeText

 private string GetNodeText(MapObject mo)
 {
     if (mo is Solid)
     {
         return " (" + ((Solid)mo).Faces.Count + " faces)";
     }
     if (mo is Group)
     {
         return " (" + mo.Children.Count + " children)";
     }
     var ed = mo.GetEntityData();
     if (ed != null)
     {
         var targetName = ed.GetPropertyValue("targetname");
         return ": " + ed.Name + (String.IsNullOrWhiteSpace(targetName) ? "" : " (" + targetName + ")");
     }
     return "";
 }
開發者ID:jpiolho,項目名稱:sledge,代碼行數:18,代碼來源:MapTreeWindow.cs

示例3: Render2D

        public void Render2D(Viewport2D viewport, MapObject o)
        {
            if (viewport.Zoom < 1) return;

            var entityData = o.GetEntityData();
            if (entityData == null) return;

            var start = viewport.WorldToScreen(viewport.Flatten(o.BoundingBox.Start));
            var end = viewport.WorldToScreen(viewport.Flatten(o.BoundingBox.End));
            if (start.X >= viewport.Width || end.X <= 0 || start.Y >= viewport.Height || end.Y <= 0) return;

            var text = entityData.Name;
            var nameProp = entityData.GetPropertyValue("targetname");
            if (!String.IsNullOrWhiteSpace(nameProp)) text += ": " + nameProp;

            // Center the text horizontally
            var wid = _printer.Measure(text, _printerFont, new RectangleF(0, 0, viewport.Width, viewport.Height));
            var cx = (float)(start.X + (end.X - start.X) / 2);
            var bounds = new RectangleF(cx - wid.BoundingBox.Width / 2, viewport.Height - (float)end.Y - _printerFont.Height - 6, viewport.Width, viewport.Height);

            _printer.Print(text, _printerFont, o.Colour, bounds);
        }
開發者ID:silky,項目名稱:sledge,代碼行數:22,代碼來源:EntityTextHelper.cs

示例4: AddEntity

 public void AddEntity(MapObject obj, EntityData newData)
 {
     _objects.Add(new EntityReference {ID = obj.ID, Before = obj.GetEntityData().Clone(), After = newData});
 }
開發者ID:silky,項目名稱:sledge,代碼行數:4,代碼來源:EditEntityData.cs


注:本文中的Sledge.DataStructures.MapObjects.MapObject.GetEntityData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。