Ejemplo n.º 1
0
        /// <summary>
        /// Creates a child node, remembering it as as child of this node.
        /// </summary>
        /// <param name="childWindow">The spatial extent of the new child</param>
        /// <returns>The created node is either an instance of <see cref="Node"/> (for
        /// child nodes that are quite small), or a new (smaller) instance of
        /// this class.</returns>
        Node CreateChild(Extent childWindow)
        {
            // If the child is quite small, make it a leaf node (the number here
            // means we effectively ignore the 3 low-order bytes in X & Y, meaning
            // that a leaf node will cover approx 16x16 metres on the ground).

            Node child;

            if (childWindow.Width < SMALL && childWindow.Height < SMALL)
            {
                child = new Node(childWindow);
            }
            else
            {
                child = new RectangleIndex(childWindow);
            }

            if (m_Children == null)
            {
                m_Children = new List <Node>(1);
            }

            m_Children.Add(child);
            return(child);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SpatialIndex"/> class
        /// with nothing in it.
        /// </summary>
        public SpatialIndex()
        {
            Extent all = new Extent();

            m_Points = new PointIndex();
            m_Lines = new RectangleIndex(all);
            m_Text = new RectangleIndex(all);
            m_Polygons = new RectangleIndex(all);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a child node, remembering it as as child of this node.
        /// </summary>
        /// <param name="childWindow">The spatial extent of the new child</param>
        /// <returns>The created node is either an instance of <see cref="Node"/> (for
        /// child nodes that are quite small), or a new (smaller) instance of
        /// this class.</returns>
        Node CreateChild(Extent childWindow)
        {
            // If the child is quite small, make it a leaf node (the number here
            // means we effectively ignore the 3 low-order bytes in X & Y, meaning
            // that a leaf node will cover approx 16x16 metres on the ground).

            Node child;

            if (childWindow.Width < SMALL && childWindow.Height < SMALL)
                child = new Node(childWindow);
            else
                child = new RectangleIndex(childWindow);

            if (m_Children==null)
                m_Children = new List<Node>(1);

            m_Children.Add(child);
            return child;
        }