Example #1
0
        /// <summary>
        /// Gets immediate children of this layer. Note that child layers may have their own children.
        /// </summary>
        /// <returns>Array of child layers. null if this layer does not have any children.</returns>
        public Layer[] GetChildren()
        {
            Runtime.InteropWrappers.SimpleArrayInt childIndices = new Rhino.Runtime.InteropWrappers.SimpleArrayInt();
            int index = LayerIndex;
            int count = UnsafeNativeMethods.CRhinoLayerNode_GetChildren(m_doc.m_docId, index, childIndices.m_ptr);

            Layer[] rc = null;
            if (count > 0)
            {
                int[] indices = childIndices.ToArray();
                count = indices.Length;
                rc    = new Layer[count];
                for (int i = 0; i < count; i++)
                {
                    rc[i] = new Layer(indices[i], m_doc);
                }
            }
            childIndices.Dispose();
            return(rc);
        }