Package org.geotools.caching.spatialindex

Examples of org.geotools.caching.spatialindex.Region


    @Override
    protected AbstractSpatialIndex createIndex() {
        Storage storage = BufferedDiskStorage.createInstance();
        //        Storage storage = DiskStorage.createInstance();
        index = new GridSpatialIndex(new Region(universe), 100, storage, 2000);

        return index;
    }
View Full Code Here


        super.index = index;
        //testIntersectionQuery();
       
        //check the number of nodes
        HarvestingVisitor v = new HarvestingVisitor();
        Region query = new Region(new double[] { 0, 0 }, new double[] { 1, 1 });
        index.intersectionQuery(query, v);
        assertEquals(index.getStatistics().getNumberOfNodes(), v.visited_nodes);
       
        //the actual data count will be 0
        assertEquals(0,v.harvest.size());
View Full Code Here

        cache.readLock();

        try {
            cache.tracker.setDoRecordAccess(false);
            cache.tracker.intersectionQuery(new Region(new double[] { 0, 0 }, new double[] { 1, 1 }),
                v);
        } finally {
            cache.tracker.setDoRecordAccess(true);
            cache.readUnLock();
        }
View Full Code Here

            start = current;
        }
    }

    public void visitNode(Node n) {
        Region region = (Region) n.getShape();

        if (n.getIdentifier().isValid()) {
            graph.setStroke(VALID_STROKE);
            graph.setColor(Color.GREEN);
        } else {
            graph.setStroke(INVALID_STROKE);
            graph.setColor(Color.RED);
        }

        graph.draw(new Rectangle2D.Double(region.getLow(0), region.getLow(1),
                region.getHigh(0) - region.getLow(0), region.getHigh(1) - region.getLow(1)));
    }
View Full Code Here

   
   
    public void testRegister() {
        GridSpatialIndex index = (GridSpatialIndex)((GridFeatureCache)cache).getIndex();
        double tilesize = index.getRootNode().getTileSize();
        Region r = (Region)index.getRootNode().getShape();
       
        //matches all
        Envelope e = new Envelope(r.getLow(0), r.getHigh(0), r.getLow(1), r.getHigh(1));
        List<Envelope> matches = cache.match(e);
        assertEquals(1, matches.size());

        //matches 4 tiles
        e = new Envelope(r.getLow(0), r.getLow(0) + 2 * tilesize-0.00001, r.getLow(1), r.getLow(1) + 2 *tilesize - 0.0001);
        matches = cache.match(e);
        assertEquals(4, matches.size());

        cache.remove(e);
       
View Full Code Here

TOP

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

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.