public class GeometryCombiner
extends java.lang.Object
Geometry
s
to produce a GeometryCollection
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 where Polygonal
geometries
are combined and result in a self-intersection).Modifier and Type | Field and Description |
---|---|
private GeometryFactory |
geomFactory |
private java.util.Collection |
inputGeoms |
private boolean |
skipEmpty |
Constructor and Description |
---|
GeometryCombiner(java.util.Collection geoms)
Creates a new combiner for a collection of geometries
|
Modifier and Type | Method and Description |
---|---|
Geometry |
combine()
Computes the combination of the input geometries
to produce the most appropriate
Geometry or GeometryCollection |
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 items
|
private static java.util.List |
createList(java.lang.Object obj0,
java.lang.Object obj1,
java.lang.Object obj2)
Creates a list from two items
|
private 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
|
private GeometryFactory geomFactory
private boolean skipEmpty
private java.util.Collection inputGeoms
public GeometryCombiner(java.util.Collection geoms)
geoms
- the geometries to combinepublic static Geometry combine(java.util.Collection geoms)
geoms
- the geometries to combinepublic static Geometry combine(Geometry g0, Geometry g1)
g0
- a geometry to combineg1
- a geometry to combinepublic static Geometry combine(Geometry g0, Geometry g1, Geometry g2)
g0
- a geometry to combineg1
- a geometry to combineg2
- a geometry to combineprivate static java.util.List createList(java.lang.Object obj0, java.lang.Object obj1)
obj0
- obj1
- private static java.util.List createList(java.lang.Object obj0, java.lang.Object obj1, java.lang.Object obj2)
obj0
- obj1
- public static GeometryFactory extractFactory(java.util.Collection geoms)
geoms
- public Geometry combine()
Geometry
or GeometryCollection
private void extractElements(Geometry geom, java.util.List elems)