ESRI.ArcGIS.Client.Toolkit.DataSources.KmlLayer.GenerateVisibilityIDs C# (CSharp) Method

GenerateVisibilityIDs() public method

Generate the IDs of the folder that are currently visible.
This method is mainly useful for the webmap serializer
public GenerateVisibilityIDs ( ) : IEnumerable
return IEnumerable
        public IEnumerable<int> GenerateVisibilityIDs()
        {
            // First create an enumeration for the current layer
            IList<int> ownIDs = new List<int>();

            if (Visible)
            {
                if (_isRoot)
                {
                    ownIDs.Add(0); // ID for the root layer itself
                    if (_hasRootContainer)
                        ownIDs.Add(1); // for root container which is not shown in SL
                }
                else
                    ownIDs.Add(_folderId); // ID of the layer
            }

            // Then go recursively through the sublayers and  concat with  the visible IDs of the sublayers (but don't go through the hierarchy for networklinks (i.e. _isRoot))
            return ownIDs.Concat(ChildLayers.OfType<KmlLayer>().SelectMany(InternalGenerateVisibilityIDs)).ToArray(); // ToArray freezes the result
        }