예제 #1
0
        public void SplitTreeNode()
        {
            // Keine Knoten mit Unterknoten nochmals splitten...
            if (this.SubNodes.Count > 0)
            {
                return;
            }

            double w = Bounds.maxx - Bounds.minx;
            double h = Bounds.maxy - Bounds.miny;
            double minx, miny, maxx, maxy;

            if (w > h)
            {
                minx = Bounds.minx;  maxx = minx + w * SPLIT_RATIO;
                miny = Bounds.miny;  maxy = miny + h;
                SubNodes.Add(DualTreeNode.CreateNode(new Envelope(minx, miny, maxx, maxy), 0));
                minx = Bounds.maxx - w * SPLIT_RATIO;  maxx = Bounds.maxx;
                SubNodes.Add(DualTreeNode.CreateNode(new Envelope(minx, miny, maxx, maxy), 1));
            }
            else
            {
                minx = Bounds.minx;  maxx = minx + w;
                miny = Bounds.miny;  maxy = miny + h * SPLIT_RATIO;
                SubNodes.Add(DualTreeNode.CreateNode(new Envelope(minx, miny, maxx, maxy), 0));
                miny = Bounds.maxy - h * SPLIT_RATIO; maxy = Bounds.maxy;
                SubNodes.Add(DualTreeNode.CreateNode(new Envelope(minx, miny, maxx, maxy), 1));
            }

            ArrayList myShapes = this.Shapes;

            this.Shapes = new ArrayList();

            foreach (SHPObject shape in myShapes)
            {
                AddShape(shape);
            }
            myShapes = null;
        }
예제 #2
0
 public void CreateTree(IEnvelope Bounds)
 {
     _root         = DualTreeNode.CreateNode(Bounds, 0);
     _featureCount = 0;
 }