Package org.locationtech.jts.geom.util
Class GeometryCombiner
- java.lang.Object
-
- org.locationtech.jts.geom.util.GeometryCombiner
-
public class GeometryCombiner extends java.lang.Object
CombinesGeometry
s to produce aGeometryCollection
of the most appropriate type. Input geometries which are already collections will have their elements extracted first. No validation of the result geometry is performed. (The only case where invalidity is possible is wherePolygonal
geometries are combined and result in a self-intersection).
-
-
Field Summary
Fields Modifier and Type Field Description private GeometryFactory
geomFactory
private java.util.Collection
inputGeoms
private boolean
skipEmpty
-
Constructor Summary
Constructors Constructor Description GeometryCombiner(java.util.Collection geoms)
Creates a new combiner for a collection of geometries
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Geometry
combine()
Computes the combination of the input geometries to produce the most appropriateGeometry
orGeometryCollection
static Geometry
combine(java.util.Collection geoms)
Combines a collection of geometries.static Geometry
combine(Geometry g0, Geometry g1)
Combines two geometries.static Geometry
combine(Geometry g0, Geometry g1, Geometry g2)
Combines three geometries.private static java.util.List
createList(java.lang.Object obj0, java.lang.Object obj1)
Creates a list from two itemsprivate static java.util.List
createList(java.lang.Object obj0, java.lang.Object obj1, java.lang.Object obj2)
Creates a list from two itemsprivate void
extractElements(Geometry geom, java.util.List elems)
static GeometryFactory
extractFactory(java.util.Collection geoms)
Extracts the GeometryFactory used by the geometries in a collection
-
-
-
Field Detail
-
geomFactory
private GeometryFactory geomFactory
-
skipEmpty
private boolean skipEmpty
-
inputGeoms
private java.util.Collection inputGeoms
-
-
Method Detail
-
combine
public static Geometry combine(java.util.Collection geoms)
Combines a collection of geometries.- Parameters:
geoms
- the geometries to combine- Returns:
- the combined geometry
-
combine
public static Geometry combine(Geometry g0, Geometry g1)
Combines two geometries.- Parameters:
g0
- a geometry to combineg1
- a geometry to combine- Returns:
- the combined geometry
-
combine
public static Geometry combine(Geometry g0, Geometry g1, Geometry g2)
Combines three geometries.- Parameters:
g0
- a geometry to combineg1
- a geometry to combineg2
- a geometry to combine- Returns:
- the combined geometry
-
createList
private static java.util.List createList(java.lang.Object obj0, java.lang.Object obj1)
Creates a list from two items- Parameters:
obj0
-obj1
-- Returns:
- a List containing the two items
-
createList
private static java.util.List createList(java.lang.Object obj0, java.lang.Object obj1, java.lang.Object obj2)
Creates a list from two items- Parameters:
obj0
-obj1
-- Returns:
- a List containing the two items
-
extractFactory
public static GeometryFactory extractFactory(java.util.Collection geoms)
Extracts the GeometryFactory used by the geometries in a collection- Parameters:
geoms
-- Returns:
- a GeometryFactory
-
combine
public Geometry combine()
Computes the combination of the input geometries to produce the most appropriateGeometry
orGeometryCollection
- Returns:
- a Geometry which is the combination of the inputs
-
extractElements
private void extractElements(Geometry geom, java.util.List elems)
-
-