I want to programatically remove some tools from my configuration that I don't want a user to be able to use and also to set a default tool other than polygon. So below for my Active template, I ant to remove all tools but polygon and RAD Tool, then make the RAD Tool the default. I feel like I need to update the ToolOptions of the CIMEditingTemplate, but it is always null? Am I even on the correct place to accomplish this?
private static async void UpdateEditTemplates(FeatureLayer inFeatLayer)
{
try
{
await QueuedTask.Run(() =>
{
//Get CIM layer definition
if (inFeatLayer.GetDefinition() is CIMFeatureLayer layerDef && !layerDef.FeatureTemplates.IsNullOrEmpty())
{
//Get all templates on this layer
List<CIMEditingTemplate> layerTemplates = layerDef.FeatureTemplates.ToList();
//Remove templates matching a pattern
foreach (CIMEditingTemplate CIMTemp in layerTemplates)
{
//TOOL OPTIONS IS NULL?
}
//Set the templates and layer definition back on the layer
layerDef.FeatureTemplates = layerTemplates.ToArray();
inFeatLayer.SetDefinition(layerDef);
}
});
}
catch (Exception e)
{
return;
}
}
You can only do part of this at the moment.
The default template tool can be set through CIMEditingTemplate.SetDefaultToolDamlID
You can get a list of visible tools for a template with EditingFeatureTemplate.ToolIDs which returns an array of damlID's.
Tools are hidden on a template through CIMEditingTemplate.ToolFilter which takes a string array of guids.
You cant get a tool guid from the damlID in the public api. This will be enhanced in a future release...