Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
com.vividsolutions.jts.geom.Geometry
com.vividsolutions.jts.geom.GeometryCollection
public class GeometryCollection
extends Geometry
GeometryCollection
.
Field Summary | |
protected Geometry[] |
|
Constructor Summary | |
| |
|
Method Summary | |
void |
|
void |
|
void |
|
Object |
|
protected int |
|
protected int |
|
protected Envelope |
|
boolean |
|
double |
|
Geometry |
|
int |
|
Coordinate |
|
Coordinate[] |
|
int |
|
Geometry |
|
String |
|
double |
|
int |
|
int |
|
boolean |
|
boolean | |
void |
|
Methods inherited from class com.vividsolutions.jts.geom.Geometry | |
apply , apply , apply , buffer , buffer , buffer , checkNotGeometryCollection , clone , compare , compareTo , compareTo , compareToSameClass , compareToSameClass , computeEnvelopeInternal , contains , convexHull , coveredBy , covers , crosses , difference , disjoint , distance , equal , equals , equalsExact , equalsExact , geometryChanged , geometryChangedAction , getArea , getBoundary , getBoundaryDimension , getCentroid , getCoordinate , getCoordinates , getDimension , getEnvelope , getEnvelopeInternal , getFactory , getGeometryN , getGeometryType , getInteriorPoint , getLength , getNumGeometries , getNumPoints , getPrecisionModel , getSRID , getUserData , hasNonEmptyElements , hasNullElements , intersection , intersects , isEmpty , isEquivalentClass , isRectangle , isSimple , isValid , isWithinDistance , normalize , overlaps , relate , relate , setSRID , setUserData , symDifference , toString , toText , touches , union , within |
public GeometryCollection(Geometry[] geometries, GeometryFactory factory)
- Parameters:
geometries
- theGeometry
s for thisGeometryCollection
, ornull
or an empty array to create the empty geometry. Elements may be emptyGeometry
s, but notnull
s.
public GeometryCollection(Geometry[] geometries, PrecisionModel precisionModel, int SRID)
Deprecated. Use GeometryFactory instead
public void apply(CoordinateFilter filter)
Performs an operation with or on thisGeometry
's coordinates. If you are using this method to modify the geometry, be sure to call #geometryChanged() afterwards. Note that you cannot use this method to modify this Geometry if its underlying CoordinateSequence's #get method returns a copy of the Coordinate, rather than the actual Coordinate stored (if it even stores Coordinates at all).
- Parameters:
filter
- the filter to apply to thisGeometry
's coordinates
public void apply(GeometryComponentFilter filter)
Performs an operation with or on this Geometry and its component Geometry's. Only GeometryCollections and Polygons have component Geometry's; for Polygons they are the LinearRings of the shell and holes.
- Parameters:
filter
- the filter to apply to thisGeometry
.
public void apply(GeometryFilter filter)
Performs an operation with or on thisGeometry
and its subelementGeometry
s (if any). Only GeometryCollections and subclasses have subelement Geometry's.
- Parameters:
filter
- the filter to apply to thisGeometry
(and its children, if it is aGeometryCollection
).
protected int compareToSameClass(Object o)
Returns whether thisGeometry
is greater than, equal to, or less than anotherGeometry
having the same class.
- Overrides:
- compareToSameClass in interface Geometry
- Parameters:
o
- aGeometry
having the same class as thisGeometry
- Returns:
- a positive number, 0, or a negative number, depending on whether this object is greater than, equal to, or less than
o
, as defined in "Normal Form For Geometry" in the JTS Technical Specifications
protected int compareToSameClass(Object o, CoordinateSequenceComparator comp)
Returns whether thisGeometry
is greater than, equal to, or less than anotherGeometry
of the same class. using the givenCoordinateSequenceComparator
.
- Overrides:
- compareToSameClass in interface Geometry
- Parameters:
o
- aGeometry
having the same class as thisGeometry
comp
- aCoordinateSequenceComparator
- Returns:
- a positive number, 0, or a negative number, depending on whether this object is greater than, equal to, or less than
o
, as defined in "Normal Form For Geometry" in the JTS Technical Specifications
protected Envelope computeEnvelopeInternal()
Returns the minimum and maximum x and y values in thisGeometry
, or a nullEnvelope
if thisGeometry
is empty. UnlikegetEnvelopeInternal
, this method calculates theEnvelope
each time it is called;getEnvelopeInternal
caches the result of this method.
- Overrides:
- computeEnvelopeInternal in interface Geometry
- Returns:
- this
Geometry
s bounding box; if theGeometry
is empty,Envelope#isNull
will returntrue
public boolean equalsExact(Geometry other, double tolerance)
Returns true if the twoGeometry
s are exactly equal, up to a specified distance tolerance. Two Geometries are exactly equal within a distance tolerance if and only if:If this and the other
- they have the same class
- they have the same values for their vertices, within the given tolerance distance, in exactly the same order.
Geometry
s are composites and any children are notGeometry
s, returnsfalse
.
- Overrides:
- equalsExact in interface Geometry
- Parameters:
other
- theGeometry
with which to compare thisGeometry
- Returns:
true
if this and the otherGeometry
are of the same class and have equal internal data.
public double getArea()
Returns the area of thisGeometryCollection
- Returns:
- the area of the polygon
public Geometry getBoundary()
Returns the boundary, or the empty geometry if thisGeometry
is empty. For a discussion of this function, see the OpenGIS Simple Features Specification. As stated in SFS Section 2.1.13.1, "the boundary of a Geometry is a set of Geometries of the next lower dimension."
- Overrides:
- getBoundary in interface Geometry
- Returns:
- the closure of the combinatorial boundary of this
Geometry
public int getBoundaryDimension()
Returns the dimension of thisGeometry
s inherent boundary.
- Overrides:
- getBoundaryDimension in interface Geometry
- Returns:
- the dimension of the boundary of the class implementing this interface, whether or not this object is the empty geometry. Returns
Dimension.FALSE
if the boundary is the empty geometry.
public Coordinate getCoordinate()
Returns a vertex of thisGeometry
.
- Overrides:
- getCoordinate in interface Geometry
- Returns:
- a
Coordinate
which is a vertex of thisGeometry
. Returnsnull
if this Geometry is empty
public Coordinate[] getCoordinates()
Collects all coordinates of all subgeometries into an Array. Note that while changes to the coordinate objects themselves may modify the Geometries in place, the returned Array as such is only a temporary container which is not synchronized back.
- Overrides:
- getCoordinates in interface Geometry
- Returns:
- the collected coordinates
public int getDimension()
Returns the dimension of thisGeometry
.
- Overrides:
- getDimension in interface Geometry
- Returns:
- the dimension of the class implementing this interface, whether or not this object is the empty geometry
public Geometry getGeometryN(int n)
Returns an elementGeometry
from aGeometryCollection
(orthis
, if the geometry is not a collection).
- Overrides:
- getGeometryN in interface Geometry
- Parameters:
n
- the index of the geometry element
- Returns:
- the n'th geometry contained in this geometry
public String getGeometryType()
Returns the name of this object'scom.vivid.jts.geom
interface.
- Overrides:
- getGeometryType in interface Geometry
- Returns:
- the name of this
Geometry
s most specificcom.vividsolutions.jts.geom
interface
public double getLength()
Returns the length of thisGeometry
. Linear geometries return their length. Areal geometries return their perimeter. They override this function to compute the area. Others return 0.0
- Returns:
- the length of the Geometry
public int getNumGeometries()
Returns the number ofGeometry
s in aGeometryCollection
(or 1, if the geometry is not a collection).
- Overrides:
- getNumGeometries in interface Geometry
- Returns:
- the number of geometries contained in this geometry
public int getNumPoints()
Returns the count of thisGeometry
s vertices. TheGeometry
s contained by compositeGeometry
s must be Geometry's; that is, they must implementgetNumPoints
- Overrides:
- getNumPoints in interface Geometry
- Returns:
- the number of vertices in this
Geometry
public boolean isEmpty()
Returns whether or not the set of points in thisGeometry
is empty.
- Returns:
true
if thisGeometry
equals the empty geometry
public boolean isSimple()
Tests whether thisGeometry
is simple. In general, the SFS specification of simplicity follows the rule:Simplicity is defined for each
- A Geometry is simple iff the only self-intersections are at boundary points.
Geometry
subclass as follows:
- Valid polygonal geometries are simple by definition, so
isSimple
trivially returns true.- Linear geometries are simple iff they do not self-intersect at points other than boundary points.
- Zero-dimensional geometries (points) are simple iff they have no repeated points.
- Empty
Geometry
s are always simple
- Returns:
true
if thisGeometry
has any points of self-tangency, self-intersection or other anomalous points
- See Also:
Geometry.isValid()
public void normalize()
Converts thisGeometry
to normal form (or canonical form ). Normal form is a unique representation forGeometry
s. It can be used to test whether twoGeometry
s are equal in a way that is independent of the ordering of the coordinates within them. Normal form equality is a stronger condition than topological equality, but weaker than pointwise equality. The definitions for normal form use the standard lexicographical ordering for coordinates. "Sorted in order of coordinates" means the obvious extension of this ordering to sequences of coordinates.