Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Geometry.union()


     static public Geometry union(Geometry arg0,Geometry arg1)
     {
           if (arg0 == null || arg1 == null) return null;
           Geometry _this = arg0;

           return _this.union(arg1);
     }

     static public Geometry difference(Geometry arg0,Geometry arg1)
     {
           if (arg0 == null || arg1 == null) return null;
View Full Code Here


     */
    private boolean isWorld(Literal geometry) {
        if(geometry != null) {
            Geometry g = geometry.evaluate(null, Geometry.class);
            if(g != null) {
                return JTS.toGeometry(WORLD).equalsTopo(g.union());
            }
        }
        return false;
    }
   
View Full Code Here

        Geometry result = null;
        for (Geometry g : geoms) {
            if (result == null) {
                result = g;
            } else {
                result = result.union(g);
            }
        }
        return result;
    }
View Full Code Here

    // note the following geometry collection may be invalid (say with
    // overlapping polygons)
    final Geometry geometryCollection = factory.buildGeometry(geometries);

    return geometryCollection.union();
  }

  private static Coordinate[] getWorldCoordinates(
      final double minX,
      final double minY,
View Full Code Here

        filter.getMinX(),
        filter.getMaxX(),
        filter.getMinY(),
        filter.getMaxY());
    if (bbox != null) {
      return bbox.union(new GeometryFactory().toGeometry(bounds));
    }
    else {
      return bbox(bounds);
    }
  }
View Full Code Here

      return infinity();
    }
    geom = geom.buffer(filter.getDistance());

    if (bbox != null) {
      return geom.union(bbox);
    }
    else {
      return geom;
    }
  }
View Full Code Here

                Polygon poly = JTS.toGeometry(env);
                poly.setUserData(AbstractRecordDescriptor.DEFAULT_CRS);
                if (geom == null) {
                    geom = poly;
                } else {
                    geom = geom.union(poly);
                }
            } catch (Exception e) {
                throw new IllegalArgumentException(
                        "Failed to reproject one of the bounding boxes to WGS84, "
                                + "this should never happen with valid coordinates", e);
View Full Code Here

 
  public static Geometry unionUsingGeometryCollection(Geometry a, Geometry b)                
  {  
    Geometry gc = a.getFactory().createGeometryCollection(
        new Geometry[] { a, b});
    return gc.union();
  }

}
View Full Code Here

    Geometry a = reader.read("LINESTRING(0 0, 100 100)");
    Geometry b = reader.read("LINESTRING(0 100, 100 0)");
    List lineStrings = Arrays.asList(new Object[] {a, b});
    Geometry nodedLineStrings = (LineString) lineStrings.get(0);
    for (int i = 1; i < lineStrings.size(); i++) {
      nodedLineStrings = nodedLineStrings.union((LineString)lineStrings.get(i));
    }
    assertEquals("MULTILINESTRING ((0 0, 50 50), (50 50, 100 100), (0 100, 50 50), (50 50, 100 0))", nodedLineStrings.toString());
  }

  public void testQuickPolygonUnion() throws Exception {
View Full Code Here

            this.features = features;
            Geometry union = ((Feature) features.get(0)).getGeometry();
            hashCode = ((Feature) features.get(0)).hashCode();
            for (int i = 1; i < features.size(); i++) {
                Feature feature = (Feature) features.get(i);
                union = union.union(feature.getGeometry());
                hashCode = Math.min(hashCode, feature.hashCode());
            }
            setGeometry(union);
        }
        public List getFeatures() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.