Package mil.nga.sf
Class GeometryCollection<T extends Geometry>
- java.lang.Object
-
- mil.nga.sf.Geometry
-
- mil.nga.sf.GeometryCollection<T>
-
- Type Parameters:
T- geometry type
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ExtendedGeometryCollection,MultiCurve,MultiPoint,MultiSurface
public class GeometryCollection<T extends Geometry> extends Geometry
A collection of zero or more Geometry instances.- Author:
- osbornb
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description GeometryCollection()ConstructorGeometryCollection(boolean hasZ, boolean hasM)ConstructorGeometryCollection(List<T> geometries)ConstructorGeometryCollection(GeometryCollection<T> geometryCollection)Copy ConstructorprotectedGeometryCollection(GeometryType type, boolean hasZ, boolean hasM)ConstructorGeometryCollection(T geometry)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGeometries(List<T> geometries)Add geometriesvoidaddGeometry(T geometry)Add a geometryGeometrycopy()Copy the geometrybooleanequals(Object obj)GeometryCollection<Geometry>getAsGeometryCollection()Get as a top level Geometry CollectionGeometryCollection<Curve>getAsMultiCurve()Get as a Multi Curve, aCurvetyped Geometry CollectionMultiLineStringgetAsMultiLineString()Get as aMultiLineString, either the current instance or newly created from theLineStringgeometriesMultiPointgetAsMultiPoint()Get as aMultiPoint, either the current instance or newly created from thePointgeometriesMultiPolygongetAsMultiPolygon()Get as aMultiPolygon, either the current instance or newly created from thePolygongeometriesGeometryCollection<Surface>getAsMultiSurface()Get as a Multi Surface, aSurfacetyped Geometry CollectionGeometryTypegetCollectionType()Get the collection type by evaluating the geometriesList<T>getGeometries()Get the list of geometriesTgetGeometry(int n)Returns the Nth geometryinthashCode()booleanisEmpty()Is the Geometry emptybooleanisMultiCurve()Determine if this geometry collection contains onlyCurvegeometriesbooleanisMultiLineString()Determine if this geometry collection is aMultiLineStringinstance or contains onlyLineStringgeometriesbooleanisMultiPoint()Determine if this geometry collection is aMultiPointinstance or contains onlyPointgeometriesbooleanisMultiPolygon()Determine if this geometry collection is aMultiPolygoninstance or contains onlyPolygongeometriesbooleanisMultiSurface()Determine if this geometry collection contains onlySurfacegeometriesbooleanisSimple()Determine if this Geometry has no anomalous geometric points, such as self intersection or self tangencyintnumGeometries()Get the number of geometries in the collectionvoidsetGeometries(List<T> geometries)Set the geometries-
Methods inherited from class mil.nga.sf.Geometry
expandEnvelope, getCentroid, getDegreesCentroid, getDimension, getEnvelope, getGeometryType, hasM, hasZ, is3D, isMeasured, setHasM, setHasZ, updateZM
-
-
-
-
Constructor Detail
-
GeometryCollection
public GeometryCollection()
Constructor
-
GeometryCollection
public GeometryCollection(boolean hasZ, boolean hasM)Constructor- Parameters:
hasZ- has zhasM- has m
-
GeometryCollection
public GeometryCollection(List<T> geometries)
Constructor- Parameters:
geometries- list of geometries
-
GeometryCollection
public GeometryCollection(T geometry)
Constructor- Parameters:
geometry- geometry
-
GeometryCollection
public GeometryCollection(GeometryCollection<T> geometryCollection)
Copy Constructor- Parameters:
geometryCollection- geometry collection to copy
-
GeometryCollection
protected GeometryCollection(GeometryType type, boolean hasZ, boolean hasM)
Constructor- Parameters:
type- geometry typehasZ- has zhasM- has m
-
-
Method Detail
-
setGeometries
public void setGeometries(List<T> geometries)
Set the geometries- Parameters:
geometries- geometries
-
addGeometry
public void addGeometry(T geometry)
Add a geometry- Parameters:
geometry- geometry
-
addGeometries
public void addGeometries(List<T> geometries)
Add geometries- Parameters:
geometries- geometries
-
numGeometries
public int numGeometries()
Get the number of geometries in the collection- Returns:
- number of geometries
-
getGeometry
public T getGeometry(int n)
Returns the Nth geometry- Parameters:
n- nth geometry to return- Returns:
- geometry
-
getCollectionType
public GeometryType getCollectionType()
Get the collection type by evaluating the geometries- Returns:
- collection geometry type, one of:
GeometryType.MULTIPOINT,GeometryType.MULTILINESTRING,GeometryType.MULTIPOLYGON,GeometryType.MULTICURVE,GeometryType.MULTISURFACE,GeometryType.GEOMETRYCOLLECTION
-
isMultiPoint
public boolean isMultiPoint()
Determine if this geometry collection is aMultiPointinstance or contains onlyPointgeometries- Returns:
- true if a multi point or contains only points
-
getAsMultiPoint
public MultiPoint getAsMultiPoint()
Get as aMultiPoint, either the current instance or newly created from thePointgeometries- Returns:
- multi point
-
isMultiLineString
public boolean isMultiLineString()
Determine if this geometry collection is aMultiLineStringinstance or contains onlyLineStringgeometries- Returns:
- true if a multi line string or contains only line strings
-
getAsMultiLineString
public MultiLineString getAsMultiLineString()
Get as aMultiLineString, either the current instance or newly created from theLineStringgeometries- Returns:
- multi line string
-
isMultiPolygon
public boolean isMultiPolygon()
Determine if this geometry collection is aMultiPolygoninstance or contains onlyPolygongeometries- Returns:
- true if a multi polygon or contains only polygons
-
getAsMultiPolygon
public MultiPolygon getAsMultiPolygon()
Get as aMultiPolygon, either the current instance or newly created from thePolygongeometries- Returns:
- multi polygon
-
isMultiCurve
public boolean isMultiCurve()
Determine if this geometry collection contains onlyCurvegeometries- Returns:
- true if contains only curves
-
getAsMultiCurve
public GeometryCollection<Curve> getAsMultiCurve()
Get as a Multi Curve, aCurvetyped Geometry Collection- Returns:
- multi curve
-
isMultiSurface
public boolean isMultiSurface()
Determine if this geometry collection contains onlySurfacegeometries- Returns:
- true if contains only surfaces
-
getAsMultiSurface
public GeometryCollection<Surface> getAsMultiSurface()
Get as a Multi Surface, aSurfacetyped Geometry Collection- Returns:
- multi surface
-
getAsGeometryCollection
public GeometryCollection<Geometry> getAsGeometryCollection()
Get as a top level Geometry Collection- Returns:
- geometry collection
-
copy
public Geometry copy()
Copy the geometry
-
isEmpty
public boolean isEmpty()
Is the Geometry empty
-
isSimple
public boolean isSimple()
Determine if this Geometry has no anomalous geometric points, such as self intersection or self tangency
-
-