本文整理汇总了C#中Layer.GetDefinition方法的典型用法代码示例。如果您正苦于以下问题:C# Layer.GetDefinition方法的具体用法?C# Layer.GetDefinition怎么用?C# Layer.GetDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layer
的用法示例。
在下文中一共展示了Layer.GetDefinition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddMatchingSymbolSetsToLayer
private void AddMatchingSymbolSetsToLayer(Layer layer, List<CIMFeatureTemplate> list)
{
// get layer symbol codes, "symbolset"
var symbolCodeList = new List<string>();
var fl = layer as FeatureLayer;
if (fl.GetTable().GetDatastore() is UnknownDatastore)
return;
using (var table = fl.GetTable())
{
IReadOnlyList<ArcGIS.Core.Data.Subtype> readOnlyList;
try
{
var tableDef = table.GetDefinition();
readOnlyList = tableDef.GetSubtypes();
var fieldIndex = tableDef.FindField("symbolset");
if (fieldIndex >= 0)
{
var fieldValue = tableDef.GetFields().ElementAt(fieldIndex).GetDefaultValue();
if (fieldValue != null)
{
symbolCodeList.Add(fieldValue.ToString());
}
}
}
catch (Exception e)
{
return;
}
foreach (var subtype in readOnlyList)
{
//var name = subtype.GetName();
var code = subtype.GetCode().ToString();
if (!symbolCodeList.Contains(code))
{
symbolCodeList.Add(code);
}
}
}
var filteredList = list.Where(t => symbolCodeList.Contains(t.DefaultValues["symbolset"].ToString()));
if (filteredList != null && filteredList.Any())
{
CIMBaseLayer cim = layer.GetDefinition();
var cimFL = ((CIMFeatureLayer)cim);
if (cimFL != null)
{
if (cimFL.FeatureTemplates != null && cimFL.FeatureTemplates.Any())
{
var tempList = cimFL.FeatureTemplates.ToList();
tempList.AddRange(filteredList);
cimFL.FeatureTemplates = tempList.ToArray();
}
else
{
cimFL.FeatureTemplates = filteredList.ToArray();
}
layer.SetDefinition(cim);
}
}
}
开发者ID:rkBiswal,项目名称:military-planner-application-csharp,代码行数:66,代码来源:ImportFeaturesTemplateButton.cs