Class UnaryUnionOp
- java.lang.Object
-
- org.meteoinfo.jts.operation.union.UnaryUnionOp
-
public class UnaryUnionOp extends java.lang.ObjectUnions aCollectionofGeometrys or a single Geometry (which may be aGeoometryCollection) together. By using this special-purpose operation over a collection of geometries it is possible to take advantage of various optimizations to improve performance. HeterogeneousGeometryCollections are fully supported.The result obeys the following contract:
- Unioning a set of
Polygons has the effect of merging the areas (i.e. the same effect as iteratively unioning all individual polygons together). - Unioning a set of
LineStrings has the effect of noding and dissolving the input linework. In this context "fully noded" means that there will be an endpoint or node in the result for every endpoint or line segment crossing in the input. "Dissolved" means that any duplicate (i.e. coincident) line segments or portions of line segments will be reduced to a single line segment in the result. This is consistent with the semantics of theGeometry.union(Geometry)operation. If merged linework is required, theLineMergerclass can be used. - Unioning a set of
Points has the effect of merging all identical points (producing a set with no duplicates).
- Unioning a set of
-
-
Constructor Summary
Constructors Constructor Description UnaryUnionOp(java.util.Collection geoms)Constructs a unary union operation for aCollectionofGeometrys, using theGeometryFactoryof the input geometries.UnaryUnionOp(java.util.Collection geoms, GeometryFactory geomFact)Constructs a unary union operation for aCollectionofGeometrys.UnaryUnionOp(Geometry geom)Constructs a unary union operation for aGeometry(which may be aGeometryCollection).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Geometryunion()Gets the union of the input geometries.static Geometryunion(java.util.Collection geoms)Computes the geometric union of aCollectionofGeometrys.static Geometryunion(java.util.Collection geoms, GeometryFactory geomFact)Computes the geometric union of aCollectionofGeometrys.static Geometryunion(Geometry geom)Constructs a unary union operation for aGeometry(which may be aGeometryCollection).
-
-
-
Constructor Detail
-
UnaryUnionOp
public UnaryUnionOp(java.util.Collection geoms, GeometryFactory geomFact)Constructs a unary union operation for aCollectionofGeometrys.- Parameters:
geoms- a collection of geometriesgeomFact- the geometry factory to use if the collection is empty
-
UnaryUnionOp
public UnaryUnionOp(java.util.Collection geoms)
Constructs a unary union operation for aCollectionofGeometrys, using theGeometryFactoryof the input geometries.- Parameters:
geoms- a collection of geometries
-
UnaryUnionOp
public UnaryUnionOp(Geometry geom)
Constructs a unary union operation for aGeometry(which may be aGeometryCollection).- Parameters:
geom-
-
-
Method Detail
-
union
public static Geometry union(java.util.Collection geoms)
Computes the geometric union of aCollectionofGeometrys.- Parameters:
geoms- a collection of geometries- Returns:
- the union of the geometries,
or
nullif the input is empty
-
union
public static Geometry union(java.util.Collection geoms, GeometryFactory geomFact)
Computes the geometric union of aCollectionofGeometrys. If no input geometries were provided but aGeometryFactorywas provided, an emptyGeometryCollectionis returned.- Parameters:
geoms- a collection of geometriesgeomFact- the geometry factory to use if the collection is empty- Returns:
- the union of the geometries, or an empty GEOMETRYCOLLECTION
-
union
public static Geometry union(Geometry geom)
Constructs a unary union operation for aGeometry(which may be aGeometryCollection).- Parameters:
geom- a geometry to union- Returns:
- the union of the elements of the geometry or an empty GEOMETRYCOLLECTION
-
union
public Geometry union()
Gets the union of the input geometries. If no input geometries were provided but aGeometryFactorywas provided, an emptyGeometryCollectionis returned. Otherwise, the return value isnull.- Returns:
- a Geometry containing the union,
or an empty GEOMETRYCOLLECTION if no geometries were provided in the input,
or
nullif no GeometryFactory was provided
-
-