private void addEnv(@Nullable Bounded node) {
   if (node == null) {
     return;
   }
   Envelope env = envBuff;
   env.setToNull();
   node.expand(env);
   if (env.isNull()) {
     return;
   }
   if (isPoint(env)) {
     points.add(env.getMinX(), env.getMinY());
   } else if (isOrthoLine(env)) {
     // handle the case where the envelope is given by an orthogonal line so we don't add a
     // zero area polygon
     double width = env.getWidth();
     GrowableCoordinateSequence cs = new GrowableCoordinateSequence();
     if (width == 0D) {
       cs.add(env.getMinX(), env.getMinY());
       cs.add(env.getMinX(), env.getMaxY());
     } else {
       cs.add(env.getMinX(), env.getMinY());
       cs.add(env.getMaxX(), env.getMinY());
     }
     nonPoints.add(GEOM_FACTORY.createLineString(cs));
   } else {
     nonPoints.add(JTS.toGeometry(env, GEOM_FACTORY));
   }
 }
    @Override
    public ReferencedEnvelope getBounds() {
      if (bounds == null) {
        Envelope e = new Envelope();
        e.setToNull();

        bounds = new ReferencedEnvelope(e, DefaultGeographicCRS.WGS84);
      }
      return bounds;
    }
        private void writeBuckets(Writer w, ImmutableSortedMap<Integer, Bucket> buckets)
            throws IOException {

          for (Entry<Integer, Bucket> entry : buckets.entrySet()) {
            Integer bucketIndex = entry.getKey();
            Bucket bucket = entry.getValue();
            print(w, TreeNode.BUCKET.name());
            print(w, "\t");
            print(w, bucketIndex.toString());
            print(w, "\t");
            print(w, bucket.id().toString());
            print(w, "\t");
            Envelope env = new Envelope();
            env.setToNull();
            bucket.expand(env);
            writeEnvelope(w, env);
            println(w);
          }
        }
Esempio n. 4
0
 /**
  * Makes this <code>Envelope</code> a "null" envelope, that is, the envelope of the empty
  * geometry.
  */
 @Override
 public void setToNull() {
   super.setToNull();
   minz = 0;
   maxz = -1;
 }
 protected void writeBBox(Writer w, Node node, Envelope envHelper) throws IOException {
   envHelper.setToNull();
   node.expand(envHelper);
   writeEnvelope(w, envHelper);
 }