Package org.geotools.caching.spatialindex

Examples of org.geotools.caching.spatialindex.RegionNodeIdentifier


    protected void setUp() {
        grid = new GridSpatialIndex(new Region(new double[] { 0, 0 }, new double[] { 1, 1 }), 10,
                MemoryStorage.createInstance(), 200);
        n = new TestNode(grid, new Region(new double[] { 0, 0 }, new double[] { 1, 1 }));
        id = new RegionNodeIdentifier(n);
        store = createStorage();
    }
View Full Code Here


    TestNode() {
        super();
    }

    TestNode(GridSpatialIndex grid, Region mbr) {
        super(new RegionNodeIdentifier(mbr));
    }
View Full Code Here

       
        if (this.root == null){
            this.dimension = mbr.getDimension();
            //nothing read from storage so we need to create new ones
            this.store.clear();
            this.root = findUniqueInstance(new RegionNodeIdentifier(mbr));
            GridRootNode root = new GridRootNode(gridsize, (RegionNodeIdentifier)this.root);
            root.split(this);
            writeNode(root);
            this.stats.addToNodesCounter(root.getCapacity() + 1); // root has root.capacity nodes, +1 for root itself :)
        }
View Full Code Here

    public void clear() throws IllegalStateException {
        // we drop all nodes and recreate grid ; GC will do the rest
        this.store.clear();
        //create a new root node
        this.root = findUniqueInstance(new RegionNodeIdentifier(this.mbr));
        GridRootNode root = new GridRootNode(gridsize, (RegionNodeIdentifier)this.root);
       
        root.split(this);
        writeNode(root);
        this.stats.reset();
View Full Code Here

        if(bounds == null){
            return;             //cannot do anything because we need to know the bounds of the data.
        }
        this.mbr = new Region(new double[] { bounds.getMinX(), bounds.getMinY() }, new double[] { bounds.getMaxX(), bounds.getMaxY() });
        this.dimension = this.mbr.getDimension();
        NodeIdentifier id = findUniqueInstance(new RegionNodeIdentifier(this.mbr));
        //GridRootNode tmpRootNode = new GridRootNode(gridsize, (RegionNodeIdentifier)id);
       
        this.rootNode = null;
        try{
            this.rootNode = storage.get(id);
        }catch (Exception ex){
            //could not find root node in storage
        }
       
        if (this.rootNode == null){
            this.root = null;
        }else{
          this.stats.reset();
            this.root = this.rootNode.getIdentifier();
            this.gridsize = ((GridRootNode)this.rootNode).getCapacity();
       
            this.stats.addToDataCounter(((GridRootNode)this.rootNode).getCapacity() + 1)//children + 1 for root
            this.stats.addToDataCounter(this.rootNode.getDataCount());
           
            //here we need to match node identifies in the root.children list to the
            //node identifiers in the data store
            for (int i = 0; i < this.rootNode.getChildrenCount(); i ++){
              RegionNodeIdentifier cid = (RegionNodeIdentifier)findUniqueInstance(this.rootNode.getChildIdentifier(i));
                ((GridRootNode)this.rootNode).setChildIdentifier(i, cid);
                if (cid.isValid()){
                  Node n = readNode(cid);
                  this.stats.addToDataCounter(n.getDataCount());
                }
            }
        }
View Full Code Here

      nextpos[i] = pos[i] + tiles_size;
    }

    do {
      Region reg = new Region(pos, nextpos);
      RegionNodeIdentifier id = (RegionNodeIdentifier) index
          .findUniqueInstance(new RegionNodeIdentifier(reg));
      GridNode child = createNode(id);
      index.writeNode(child);
      this.children.add(child.getIdentifier());
      // id++;
    } while (increment(pos, nextpos));
View Full Code Here

    protected void setUp() {
        GridSpatialIndex grid = new GridSpatialIndex();
        r1 = new Region(new double[] { 0, 0 }, new double[] { 1, 1 });
        r2 = new Region(new double[] { -1, -1 }, new double[] { -2, -2 });
        node1 = new GridNode(new RegionNodeIdentifier(r1));
        node2 = new GridNode(new RegionNodeIdentifier(r2));
        node3 = new GridNode(new RegionNodeIdentifier(r1));
        //id1 = new RegionNodeIdentifier(node1);
        //id2 = new RegionNodeIdentifier(node2);
        //id3 = new RegionNodeIdentifier(node3);
        id1 = (RegionNodeIdentifier)node1.getIdentifier();
        id2 = (RegionNodeIdentifier)node2.getIdentifier();
View Full Code Here

    public void setUp() {
        mbr = new Region(new double[] { 0, 20 }, new double[] { 10, 30 });
        mbr3D = new Region(new double[] { 0, 20, 40 }, new double[] { 10, 30, 50 });

        index = new GridSpatialIndex(mbr, 100, MemoryStorage.createInstance(), 2000);
        node = new GridRootNode(size, new RegionNodeIdentifier( mbr));
        node3D = new GridRootNode(size3D, new RegionNodeIdentifier(mbr3D) );
        super.node = node;
    }
View Full Code Here

        return new TestSuite(GridNodeTest.class);
    }

    public void setUp() {
        mbr = new Region(new double[] { 0, 1 }, new double[] { 2, 3 });
        node = new GridNode(new RegionNodeIdentifier(mbr));
    }
View Full Code Here

    public void testConstructor() {
        assertEquals(mbr, node.getShape());
        assertEquals(new Region(mbr), node.getShape());

        GridNode child = new GridNode(new RegionNodeIdentifier(mbr));
        assertEquals(0, child.getLevel());
        assertEquals(mbr, node.getShape());
        assertEquals(new Region(mbr), node.getShape());
    }
View Full Code Here

TOP

Related Classes of org.geotools.caching.spatialindex.RegionNodeIdentifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.