Package org.neo4j.gis.spatial.rtree

Examples of org.neo4j.gis.spatial.rtree.Envelope


  @Override
  public Envelope decodeEnvelope(PropertyContainer container) {
    Node geomNode = testIsNode(container);
    double[] bbox = (double[]) geomNode.getProperty(PROP_BBOX);
    // double xmin, double xmax, double ymin, double ymax
    return new Envelope(bbox[0], bbox[1], bbox[2], bbox[3]);
  }
View Full Code Here


    return indexNodeEnvelope.intersects(referenceEnvelope);
  }
 
  @Override
  public final boolean geometryMatches(Node geomNode) { 
    Envelope geomEnvelope = decoder.decodeEnvelope(geomNode);
    if (geomEnvelope.intersects(referenceEnvelope)) {
      return onEnvelopeIntersection(geomNode, geomEnvelope);
    }
   
    return false;
  }
View Full Code Here

  }

  @Override
  public Envelope getBoundingBox() {
    long start = System.currentTimeMillis();
    Envelope result = spatialIndex.getBoundingBox();
        long stop = System.currentTimeMillis();
        System.out.println("# exec time(getBoundingBox()): " + (stop - start) + "ms");   
        return result;
  }
View Full Code Here

  }

  private ReferencedEnvelope getEnvelope(Collection<Layer> layers) {
    CoordinateReferenceSystem crs = null;

    Envelope envelope = new Envelope();
    for (Layer layer : layers) {
      envelope.expandToInclude(layer.getIndex().getBoundingBox());
      if (crs == null) {
        crs = layer.getCoordinateReferenceSystem();
      }
    }
View Full Code Here

  public boolean isEmpty() {
    return count() == 0;
  }
 
  public Envelope getBoundingBox() {
    Envelope bbox = null;
   
    GeometryEncoder geomEncoder = layer.getGeometryEncoder();
    for (Node node: layer.getDataset().getAllGeometryNodes()) {
      if (bbox == null) {
        bbox = geomEncoder.decodeEnvelope(node);
      } else {
        bbox.expandToInclude(geomEncoder.decodeEnvelope(node));
      }
    }
   
    return bbox;
  }
View Full Code Here

    } else if (bboxProp instanceof double[]) {
          bbox = (double[]) bboxProp;
      }
   
    // Envelope parameters: xmin, xmax, ymin, ymax
    return new Envelope(bbox[0], bbox[2], bbox[1], bbox[3]);
  }
View Full Code Here

    public void setUp() throws Exception {
      super.setUp();
     
        // TODO: Rather load this from a configuration file, properties file or JRuby test code

        Envelope bbox = new Envelope(12.9, 12.99, 56.05, 56.07); // covers half of Billesholm

        addTestLayer("billesholm.osm", DataFormat.OSM, bbox);
        addTestGeometry(70423036, "Ljungsgårdsvägen", "outside top left", "(12.9599540,56.0570692), (12.9624780,56.0716282)");
        addTestGeometry(67835020, "Villagatan", "in the middle", "(12.9776065,56.0561477), (12.9814421,56.0572131)");
        addTestGeometry(60966388, "Storgatan", "crossing left edge", "(12.9682980,56.0524546), (12.9710302,56.0538436)");
       
        bbox = new Envelope(12.5, 14.1, 55.0, 56.3); // cover central Skåne
        // Bounds for sweden_administrative: 11.1194502 : 24.1585511, 55.3550515 : 69.0600767
        // Envelope bbox = new Envelope(12.85, 13.25, 55.5, 55.65); // cover Malmö
        // Envelope bbox = new Envelope(13, 14, 55, 58); // cover admin area 'Söderåsen'
        // Envelope bbox = new Envelope(7, 10, 37, 40);
View Full Code Here

            assertEnvelopeEquals(fakeIndex.getBoundingBox(), rtreeIndex.getBoundingBox());

            System.out.println("RTreeIndex count: " + rtreeIndex.count());
            assertEquals(fakeIndex.count(), rtreeIndex.count());

            Envelope bbox = layerTestEnvelope.get(layerName);

            System.out.println("Displaying test geometries for layer '" + layerName + "' including expected search results");
            for (TestGeometry testData : layerTestGeometries.get(layerName)) {
                System.out.println("\tGeometry: " + testData + " " + (testData.inOrIntersects(bbox) ? "is" : "is NOT")
                        + " inside search region");
View Full Code Here

            float bf[] = new float[4];
            int bi = 0;
            for (String bound : bounds.replaceAll("[\\(\\)\\s]+", "").split(",")) {
                bf[bi++] = Float.parseFloat(bound);
            }
            this.bounds = new Envelope(bf[0], bf[2], bf[1], bf[3]);
        }
View Full Code Here


public class Utilities {

  public static Envelope fromJtsToNeo4j(com.vividsolutions.jts.geom.Envelope envelope) {
    return new Envelope(
          envelope.getMinX(),
          envelope.getMaxX(),
          envelope.getMinY(),
          envelope.getMaxY()
        );
View Full Code Here

TOP

Related Classes of org.neo4j.gis.spatial.rtree.Envelope

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.