当前位置: 首页>>代码示例>>C#>>正文


C# IFeatureLayer.AddLabels方法代码示例

本文整理汇总了C#中IFeatureLayer.AddLabels方法的典型用法代码示例。如果您正苦于以下问题:C# IFeatureLayer.AddLabels方法的具体用法?C# IFeatureLayer.AddLabels怎么用?C# IFeatureLayer.AddLabels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFeatureLayer的用法示例。


在下文中一共展示了IFeatureLayer.AddLabels方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeserializeLabels

        private static void DeserializeLabels(dynamic labels, IMap map, IFeatureLayer featureLayer)
        {
            int fieldIndex = Convert.ToInt32(labels["Field"]) - 1;
            var fieldName = featureLayer.DataSet.DataTable.Columns[fieldIndex].ColumnName;

            var symbolizer = new LabelSymbolizer();
            symbolizer.FontFamily = labels["Font"];

            try
            {
                if (Convert.ToBoolean(labels["Bold"]))
                    symbolizer.FontStyle = FontStyle.Bold;
                else if (Convert.ToBoolean(labels["Italic"]))
                    symbolizer.FontStyle = FontStyle.Italic;
                else if (Convert.ToBoolean(labels["Underline"]))
                    symbolizer.FontStyle = FontStyle.Underline;
            }
            catch (RuntimeBinderException)
            {
                // ignore and continue.
                // some versions of the files don't have these properties.
            }

            symbolizer.FontColor = LegacyDeserializer.GetColor(labels["Color"]);

            LegacyHJustification typeOfJustification = (LegacyHJustification)Enum.ToObject(typeof(LegacyHJustification), Convert.ToInt32(labels["Justification"]));

            switch (typeOfJustification)
            {
                case LegacyHJustification.Center:
                    symbolizer.Orientation = ContentAlignment.MiddleCenter;
                    break;
                case LegacyHJustification.Left:
                    symbolizer.Orientation = ContentAlignment.MiddleLeft;
                    break;
                case LegacyHJustification.Right:
                    symbolizer.Orientation = ContentAlignment.MiddleRight;
                    break;
                case LegacyHJustification.None:
                case LegacyHJustification.Raw:
                default:
                    break;
            }

            try
            {
                symbolizer.DropShadowEnabled = Convert.ToBoolean(labels["UseShadows"]);
                symbolizer.DropShadowColor = LegacyDeserializer.GetColor(labels["Color"]);
            }
            catch (RuntimeBinderException) { }

            // not entirely sure if Offset from MW4 translates to OffsetX.
            try { symbolizer.OffsetX = Convert.ToInt32(labels["Offset"]); }
            catch (RuntimeBinderException) { }

            string expression = String.Format("[{0}]", fieldName);

            featureLayer.AddLabels(expression, null, symbolizer, expression);
            featureLayer.LabelLayer.UseDynamicVisibility = Convert.ToBoolean(labels["UseMinZoomLevel"]);

            try { featureLayer.LabelLayer.DynamicVisibilityWidth = Convert.ToDouble(labels["Scale"]); }
            catch (RuntimeBinderException) { }
        }
开发者ID:hanchao,项目名称:DotSpatial,代码行数:63,代码来源:LegacyLayerDeserializer.cs

示例2: AddLabels

 [Obsolete("Use featureLayer.AddLabels() instead")] // Marked in 1.7
 public static void AddLabels(this IMap map, IFeatureLayer featureLayer, string expression, Font font, Color fontColor)
 {
     featureLayer.AddLabels(expression, font, fontColor);
 }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:5,代码来源:IMapExtensions.cs


注:本文中的IFeatureLayer.AddLabels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。