QueuedTask.Run(() =>
{
//A layer may have SLD added but is not using it
//HasSymbolLayerDrawingAdded returns a tuple - to check
//the layer has SLD (not its parent) check addedOnLayer
if (featLayer.HasSymbolLayerDrawingAdded().addedOnLayer)
{
//the layer has SLD but is the layer currently using it?
//GetUseSymbolLayerDrawing returns a tuple - useOnLayer for
//the layer (and useOnParent for the parent layer)
if (!featLayer.GetUseSymbolLayerDrawing().useOnLayer)
{
//enable it
featLayer.SetUseSymbolLayerDrawing(true);
}
}
//Enable/Disable SLD on a layer parent
if (featLayer.HasSymbolLayerDrawingAdded().addedOnParent)
{
//check parent...this can be recursive
var parent = GetParentLayerWithSLD(featLayer.Parent as GroupLayer);
if (parent.GetUseSymbolLayerDrawing().useOnLayer)
parent.SetUseSymbolLayerDrawing(true);
}
/*
*
//Recursively get the parent with SLD
public GroupLayer GetParentLayerWithSLD(GroupLayer groupLayer)
{
if (groupLayer == null)
return null;
//Must be on QueuedTask
var sld_added = groupLayer.HasSymbolLayerDrawingAdded();
if (sld_added.addedOnLayer)
return groupLayer;
else if (sld_added.addedOnParent)
return GetParentLayerWithSLD(groupLayer.Parent as GroupLayer);
return null;
}
*/
});