当前位置: 首页>>代码示例>>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;未经允许,请勿转载。