Ejemplo n.º 1
0
  private void checkEnvelope() {
    if (distance < 0.0) return;

    double padding = distance * MAX_ENV_DIFF_FRAC;
    if (padding == 0.0) padding = 0.001;

    Envelope expectedEnv = new Envelope(input.getEnvelopeInternal());
    expectedEnv.expandBy(distance);

    Envelope bufEnv = new Envelope(result.getEnvelopeInternal());
    bufEnv.expandBy(padding);

    if (!bufEnv.contains(expectedEnv)) {
      isValid = false;
      errorMsg = "Buffer envelope is incorrect";
      errorIndicator = input.getFactory().toGeometry(bufEnv);
    }
    report("Envelope");
  }
 /**
  * Finds all {@link PreparedGeometry}s which might interact with a query {@link Geometry}.
  *
  * @param g the geometry to query by
  * @return a list of candidate PreparedGeometrys
  */
 public List query(Geometry g) {
   return index.query(g.getEnvelopeInternal());
 }
 /**
  * Inserts a collection of Geometrys into the index.
  *
  * @param geoms a collection of Geometrys to insert
  */
 public void insert(Collection geoms) {
   for (Iterator i = geoms.iterator(); i.hasNext(); ) {
     Geometry geom = (Geometry) i.next();
     index.insert(geom.getEnvelopeInternal(), PreparedGeometryFactory.prepare(geom));
   }
 }