Esempio n. 1
0
 public List <QuadTreeNode <T> > Intersects(SVGBounds bounds)
 {
     return(_root.Intersects(bounds));
 }
Esempio n. 2
0
        public List <QuadTreeNode <T> > Intersects(SVGBounds bounds)
        {
            if (!this.bounds.Intersects(bounds))
            {
                return(null);
            }

            List <QuadTreeNode <T> > output = null;

            if (nodes != null && nodes.Count > 0)
            {
                output = new List <QuadTreeNode <T> >();

                for (int i = 0; i < nodes.Count; i++)
                {
                    if (nodes [i].bounds.Intersects(bounds))
                    {
                        output.Add(nodes [i]);
                    }
                }

                if (output.Count == 0)
                {
                    output = null;
                }
            }

            if (topLeft != null)
            {
                List <QuadTreeNode <T> > cellOutput = topLeft.Intersects(bounds);
                if (cellOutput != null)
                {
                    if (output == null)
                    {
                        output = new List <QuadTreeNode <T> >();
                    }
                    output.AddRange(cellOutput);
                }
            }

            if (topRight != null)
            {
                List <QuadTreeNode <T> > cellOutput = topRight.Intersects(bounds);
                if (cellOutput != null)
                {
                    if (output == null)
                    {
                        output = new List <QuadTreeNode <T> >();
                    }
                    output.AddRange(cellOutput);
                }
            }

            if (bottomLeft != null)
            {
                List <QuadTreeNode <T> > cellOutput = bottomLeft.Intersects(bounds);
                if (cellOutput != null)
                {
                    if (output == null)
                    {
                        output = new List <QuadTreeNode <T> >();
                    }
                    output.AddRange(cellOutput);
                }
            }

            if (bottomRight != null)
            {
                List <QuadTreeNode <T> > cellOutput = bottomRight.Intersects(bounds);
                if (cellOutput != null)
                {
                    if (output == null)
                    {
                        output = new List <QuadTreeNode <T> >();
                    }
                    output.AddRange(cellOutput);
                }
            }

            return(output);
        }