本文整理汇总了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) { }
}
示例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);
}