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 Constructorprotected
GeometryCollection(GeometryType type, boolean hasZ, boolean hasM)
ConstructorGeometryCollection(T geometry)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addGeometries(List<T> geometries)
Add geometriesvoid
addGeometry(T geometry)
Add a geometryGeometry
copy()
Copy the geometryboolean
equals(Object obj)
GeometryCollection<Geometry>
getAsGeometryCollection()
Get as a top level Geometry CollectionGeometryCollection<Curve>
getAsMultiCurve()
Get as a Multi Curve, aCurve
typed Geometry CollectionMultiLineString
getAsMultiLineString()
Get as aMultiLineString
, either the current instance or newly created from theLineString
geometriesMultiPoint
getAsMultiPoint()
Get as aMultiPoint
, either the current instance or newly created from thePoint
geometriesMultiPolygon
getAsMultiPolygon()
Get as aMultiPolygon
, either the current instance or newly created from thePolygon
geometriesGeometryCollection<Surface>
getAsMultiSurface()
Get as a Multi Surface, aSurface
typed Geometry CollectionGeometryType
getCollectionType()
Get the collection type by evaluating the geometriesList<T>
getGeometries()
Get the list of geometriesT
getGeometry(int n)
Returns the Nth geometryint
hashCode()
boolean
isEmpty()
Is the Geometry emptyboolean
isMultiCurve()
Determine if this geometry collection contains onlyCurve
geometriesboolean
isMultiLineString()
Determine if this geometry collection is aMultiLineString
instance or contains onlyLineString
geometriesboolean
isMultiPoint()
Determine if this geometry collection is aMultiPoint
instance or contains onlyPoint
geometriesboolean
isMultiPolygon()
Determine if this geometry collection is aMultiPolygon
instance or contains onlyPolygon
geometriesboolean
isMultiSurface()
Determine if this geometry collection contains onlySurface
geometriesboolean
isSimple()
Determine if this Geometry has no anomalous geometric points, such as self intersection or self tangencyint
numGeometries()
Get the number of geometries in the collectionvoid
setGeometries(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 aMultiPoint
instance or contains onlyPoint
geometries- 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 thePoint
geometries- Returns:
- multi point
-
isMultiLineString
public boolean isMultiLineString()
Determine if this geometry collection is aMultiLineString
instance or contains onlyLineString
geometries- 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 theLineString
geometries- Returns:
- multi line string
-
isMultiPolygon
public boolean isMultiPolygon()
Determine if this geometry collection is aMultiPolygon
instance or contains onlyPolygon
geometries- 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 thePolygon
geometries- Returns:
- multi polygon
-
isMultiCurve
public boolean isMultiCurve()
Determine if this geometry collection contains onlyCurve
geometries- Returns:
- true if contains only curves
-
getAsMultiCurve
public GeometryCollection<Curve> getAsMultiCurve()
Get as a Multi Curve, aCurve
typed Geometry Collection- Returns:
- multi curve
-
isMultiSurface
public boolean isMultiSurface()
Determine if this geometry collection contains onlySurface
geometries- Returns:
- true if contains only surfaces
-
getAsMultiSurface
public GeometryCollection<Surface> getAsMultiSurface()
Get as a Multi Surface, aSurface
typed 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
-
-