Package org.geolatte.geom
Class AbstractGeometryCollection<P extends Position,G extends Geometry<P>>
- java.lang.Object
-
- org.geolatte.geom.Geometry<P>
-
- org.geolatte.geom.AbstractGeometryCollection<P,G>
-
- All Implemented Interfaces:
Serializable,Iterable<G>,Complex<P,G>
- Direct Known Subclasses:
GeometryCollection,MultiLineString,MultiPoint,MultiPolygon
public abstract class AbstractGeometryCollection<P extends Position,G extends Geometry<P>> extends Geometry<P> implements Complex<P,G>
AGeometrythat is an ordered collection of some number ofGeometrys.All elements in a
GeometryCollectionmust be in the sameCoordinateReferenceSystem, which is also theCoordinateReferenceSystemfor theGeometryCollection.- Author:
- Karel Maesen, Geovise BVBA, 2011
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Geometry<P>[]geometries
-
Constructor Summary
Constructors Constructor Description AbstractGeometryCollection(G... geometries)Constructs aGeometryCollectionfrom the specifiedGeometrys.AbstractGeometryCollection(CoordinateReferenceSystem<P> crs)Constructs an emptyGeometryCollection
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(GeometryVisitor<P> visitor)Accepts theGeometryVisitor, and will pass it to it's constituentGeometries.G[]components()Returns the componentsClass<? extends Geometry>getComponentType()Returns theClassof which all constituentGeometrys are instances.intgetDimension()Returns the topological dimension of this instance.GgetGeometryN(int num)Returns theGeometryelement at the specified (zero-based) position in thisGeometryCollection.GeometryTypegetGeometryType()Returns the type of thisGeometry.intgetNumGeometries()Returns the number of elements in thisGeometryCollection.Iterator<G>iterator()Creates anIteratorover the elements of thisGeometryCollection.-
Methods inherited from class org.geolatte.geom.Geometry
as, checkCast, equals, forceToCrs, getCoordinateDimension, getCoordinateReferenceSystem, getCrs, getEnvelope, getNumPositions, getPositionClass, getPositionN, getPositions, getSRID, hashCode, isEmpty, nestPositionSequences, toString, writeReplace
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
AbstractGeometryCollection
@SafeVarargs public AbstractGeometryCollection(G... geometries)
Constructs aGeometryCollectionfrom the specifiedGeometrys.- Parameters:
geometries- theGeometrys that are the elements of the constructedGeometryCollection.
-
AbstractGeometryCollection
public AbstractGeometryCollection(CoordinateReferenceSystem<P> crs)
Constructs an emptyGeometryCollection
-
-
Method Detail
-
getNumGeometries
public int getNumGeometries()
Returns the number of elements in thisGeometryCollection.
-
getComponentType
public Class<? extends Geometry> getComponentType()
Description copied from interface:ComplexReturns theClassof which all constituentGeometrys are instances.
-
components
public G[] components()
Returns the components
-
getGeometryN
public G getGeometryN(int num)
Returns theGeometryelement at the specified (zero-based) position in thisGeometryCollection.- Parameters:
num- the position in the collection of the requestedGeometry- Returns:
- the element
Geometryat the position specified by the num parameter.
-
getDimension
public int getDimension()
Description copied from class:GeometryReturns the topological dimension of this instance. In non-homogenous collections, this will return the largest topological dimension of the containedGeometries.- Specified by:
getDimensionin classGeometry<P extends Position>- Returns:
- the topological dimension of this instance
-
getGeometryType
public GeometryType getGeometryType()
Description copied from class:GeometryReturns the type of thisGeometry.- Specified by:
getGeometryTypein classGeometry<P extends Position>- Returns:
- the
GeometryTypeof this instance.
-
iterator
public Iterator<G> iterator()
Creates anIteratorover the elements of thisGeometryCollection.
-
-