本文整理汇总了C#中TemplateItem.SetSymbol方法的典型用法代码示例。如果您正苦于以下问题:C# TemplateItem.SetSymbol方法的具体用法?C# TemplateItem.SetSymbol怎么用?C# TemplateItem.SetSymbol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplateItem
的用法示例。
在下文中一共展示了TemplateItem.SetSymbol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RebuildTemplate
private void RebuildTemplate(FeatureLayer flayer)
{
var templates = new List<TemplateItem>();
FeatureServiceLayerInfo serviceInfo = null;
var gdbFeatureTable = flayer.FeatureTable as ArcGISFeatureTable;
if (gdbFeatureTable != null && !gdbFeatureTable.IsReadOnly && flayer.Status == LayerStatus.Initialized)
{
try
{
serviceInfo = gdbFeatureTable.ServiceInfo;
}
catch{}
}
if (serviceInfo != null)
{
var cmd = new InvokeCommand(OnItemClicked);
var renderer = flayer.Renderer ?? (serviceInfo.DrawingInfo == null ? null : serviceInfo.DrawingInfo.Renderer);
if (serviceInfo.Templates != null)
{
foreach (var template in serviceInfo.Templates)
{
var item = new TemplateItem
{
Layer = flayer,
FeatureTemplate = template,
Command = cmd,
};
templates.Add(item);
if (renderer != null)
{
var g = new Graphic(template.Prototype.Attributes ?? Enumerable.Empty<System.Collections.Generic.KeyValuePair<string, object>>()); // Need to disambiguate from winstore toolkit KeyValuePair
item.SetSymbol(renderer.GetSymbol(g));
}
}
}
if (serviceInfo.Types != null)
{
foreach (var type in serviceInfo.Types)
{
foreach (var template in type.Templates)
{
var item = new TemplateItem
{
Layer = flayer,
FeatureType = type,
FeatureTemplate = template,
Command = cmd,
};
templates.Add(item);
if (renderer != null)
{
var g = new Graphic(template.Prototype.Attributes ?? Enumerable.Empty<System.Collections.Generic.KeyValuePair<string, object>>());
item.SetSymbol(renderer.GetSymbol(g));
}
}
}
}
}
_templatesByLayer[flayer] = templates;
}