Example #1
0
 private void writeMDB(DualTreeNode node, ArrayList features)
 {
     /*
      * Feature feat=new Feature();
      * Polygon p=new Polygon();
      * Ring ring=new Ring();
      * ring.AddPoint(new Point(node.Bounds.minx,node.Bounds.miny));
      * ring.AddPoint(new Point(node.Bounds.maxx,node.Bounds.miny));
      * ring.AddPoint(new Point(node.Bounds.maxx,node.Bounds.maxy));
      * ring.AddPoint(new Point(node.Bounds.minx,node.Bounds.maxy));
      * //ring.AddPoint(new Point(node.Bounds.minx,node.Bounds.miny));
      * p.AddRing(ring);
      * feat.Shape=p;
      *
      * FieldValue fv=new FieldValue("ID_COUNT",node.ShapeIds.Count);
      * feat.Fields.Add(fv);
      *
      * features.Add(feat);
      *
      * foreach(DualTreeNode subNode in node.SubNodes)
      * {
      *      writeMDB(subNode,features);
      * }
      */
 }
Example #2
0
        private void writeFDB_FC_Index_nodes(DualTreeNode dnode, List <SpatialIndexNode> nodes, int NID, int PID)
        {
            SpatialIndexNode node = new SpatialIndexNode();
            Polygon          p    = new Polygon();
            Ring             ring = new Ring();

            ring.AddPoint(new Point(dnode.Bounds.minx, dnode.Bounds.miny));
            //ring.AddPoint(new Point(node.Bounds.maxx,node.Bounds.miny));
            ring.AddPoint(new Point(dnode.Bounds.maxx, dnode.Bounds.maxy));
            //ring.AddPoint(new Point(node.Bounds.minx,node.Bounds.maxy));
            //ring.AddPoint(new Point(node.Bounds.minx,node.Bounds.miny));
            p.AddRing(ring);
            node.Rectangle = p;

            node.NID  = NID;
            node.PID  = PID;
            node.Page = dnode.page;
            node.IDs  = dnode.ShapeIds;
            nodes.Add(node);

            foreach (DualTreeNode subNode in dnode.SubNodes)
            {
                writeFDB_FC_Index_nodes(subNode, nodes, _NID++, NID);
            }
        }
Example #3
0
        static public DualTreeNode CreateNode(IEnvelope Bounds, short page)
        {
            DualTreeNode node = new DualTreeNode();

            node.Bounds = new Envelope(Bounds);
            node.page   = page;

            return(node);
        }
Example #4
0
 private void write(System.IO.StreamWriter sw, DualTreeNode node, int level)
 {
     sw.WriteLine("\n\n\n" + (_nodenr++).ToString() + " node (level=" + level.ToString() + ")");
     sw.WriteLine(node.Bounds.minx.ToString() + "\t" + node.Bounds.miny.ToString() + "\t" + node.Bounds.maxx.ToString() + "\t" + node.Bounds.maxy.ToString());
     foreach (object obj in node.ShapeIds)
     {
         sw.Write(obj.ToString() + ", ");
     }
     foreach (DualTreeNode n in node.SubNodes)
     {
         write(sw, n, level + 1);
     }
 }
Example #5
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;
        }
Example #6
0
 public void CreateTree(IEnvelope Bounds)
 {
     _root         = DualTreeNode.CreateNode(Bounds, 0);
     _featureCount = 0;
 }