Exemple #1
0
        public static IEnumerable <IILayer> LayerTree(this IILayer layer)
        {
            for (int i = 0; i < layer.NumOfChildLayers; i++)
            {
                yield return(layer.GetChildLayer(i));

                foreach (var y in layer.GetChildLayer(i).LayerTree())
                {
                    yield return(y);
                }
            }
        }
Exemple #2
0
        public static bool HasNode(this IILayer layer, IINode node, bool checkInChild = true)
        {
#if MAX2020
            ITab <IINode> nodes = Loader.Global.INodeTab.Create();
#else
            ITab <IINode> nodes = Loader.Global.INodeTabNS.Create();
#endif
            IILayerProperties layerProperties = Loader.IIFPLayerManager.GetLayer(layer.Name);
            layerProperties.Nodes(nodes);

            foreach (IINode n in Tools.ITabToIEnumerable(nodes))
            {
                if (node.Handle == n.Handle)
                {
                    return(true);
                }
            }

            for (int i = 0; i < layer.NumOfChildLayers; i++)
            {
                IILayer child = layer.GetChildLayer(i);
                if (child.HasNode(node, checkInChild))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #3
0
        private void BuildLayerTreeRecusively(IILayer layer, int index, TreeNodeCollection treeNodeCollection)
        {
            for (int i = 0; i < layer.NumOfChildLayers; i++)
            {
                IILayer  childLayer = layer.GetChildLayer(i);
                TreeNode layerNode  = treeNodeCollection[index].Nodes.Add(childLayer.Name);

                if (SelectedLayers.Contains(layer))
                {
                    layerNode.Checked = true;
                }
                BuildLayerTreeRecusively(childLayer, i, treeNodeCollection[index].Nodes);
            }
        }