|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vividsolutions.jts.geom.Geometry
The base class for all geometric objects.
GeometryCollections would be useful,
GeometryCollections are not supported as arguments to binary
predicates (other than convexHull) or the relate
method.
Point, LineString, or
Polygon will be returned if the result contains a single
element; otherwise, a MultiPoint, MultiLineString,
or MultiPolygon will be returned. If the result is
heterogeneous a GeometryCollection will be returned.
Because it is not clear at this time what semantics for set-theoretic
methods involving GeometryCollections would be useful,
GeometryCollections
are not supported as arguments to the set-theoretic methods.
Geometry.
The SFS does not specify an unambiguous representation of a given point set
returned from a spatial analysis method. One goal of JTS is to make this
specification precise and unambiguous. JTS will use a canonical form for
Geometrys returned from spatial analysis methods. The canonical
form is a Geometry which is simple and noded:
isSimple.
LineStrings. It
means that all intersection points on LineStrings will be
present as endpoints of LineStrings in the result.
Geometry
s. These new points arise from intersections between line segments in the
edges of the input Geometrys. In the general case it is not
possible to represent constructed points exactly. This is due to the fact
that the coordinates of an intersection point may contain twice as many bits
of precision as the coordinates of the input line segments. In order to
represent these constructed points explicitly, JTS must truncate them to fit
the PrecisionModel. Unfortunately, truncating coordinates moves them slightly. Line segments which would not be coincident in the exact result may become coincident in the truncated representation. This in turn leads to "topology collapses" -- situations where a computed element has a lower dimension than it would in the exact result.
When JTS detects topology collapses during the computation of spatial analysis methods, it will throw an exception. If possible the exception will report the location of the collapse.
#equals(Object) and #hashCode are not overridden, so that when two topologically equal Geometries are added to HashMaps and HashSets, they remain distinct. This behaviour is desired in many cases.
| Field Summary | |
protected Envelope |
envelope
The bounding box of this Geometry. |
protected GeometryFactory |
factory
The GeometryFactory used to create this Geometry |
protected int |
SRID
The ID of the Spatial Reference System used by this Geometry |
| Constructor Summary | |
Geometry(GeometryFactory factory)
Creates a new Geometry via the specified GeometryFactory. |
|
| Method Summary | |
abstract void |
apply(CoordinateFilter filter)
Performs an operation with or on this Geometry's
coordinates. |
abstract void |
apply(CoordinateSequenceFilter filter)
Performs an operation on the coordinates in this Geometry's
CoordinateSequences. |
abstract void |
apply(GeometryComponentFilter filter)
Performs an operation with or on this Geometry and its component Geometry's. |
abstract void |
apply(GeometryFilter filter)
Performs an operation with or on this Geometry and its
subelement Geometrys (if any). |
Geometry |
buffer(double distance)
Computes a buffer area around this geometry having the given width. |
Geometry |
buffer(double distance,
int quadrantSegments)
Computes a buffer area around this geometry having the given width and with a specified accuracy of approximation for circular arcs. |
Geometry |
buffer(double distance,
int quadrantSegments,
int endCapStyle)
Computes a buffer area around this geometry having the given width and with a specified accuracy of approximation for circular arcs, and using a specified end cap style. |
protected void |
checkNotGeometryCollection(Geometry g)
Throws an exception if g's class is GeometryCollection
. |
java.lang.Object |
clone()
Creates and returns a full copy of this Geometry object
(including all coordinates contained by it). |
protected int |
compare(java.util.Collection a,
java.util.Collection b)
Returns the first non-zero result of compareTo encountered as
the two Collections are iterated over. |
int |
compareTo(java.lang.Object o)
Returns whether this Geometry is greater than, equal to,
or less than another Geometry. |
int |
compareTo(java.lang.Object o,
CoordinateSequenceComparator comp)
Returns whether this Geometry is greater than, equal to,
or less than another Geometry,
using the given CoordinateSequenceComparator. |
protected abstract int |
compareToSameClass(java.lang.Object o)
Returns whether this Geometry is greater than, equal to,
or less than another Geometry having the same class. |
protected abstract int |
compareToSameClass(java.lang.Object o,
CoordinateSequenceComparator comp)
Returns whether this Geometry is greater than, equal to,
or less than another Geometry of the same class. |
protected abstract Envelope |
computeEnvelopeInternal()
Returns the minimum and maximum x and y values in this Geometry
, or a null Envelope if this Geometry is empty. |
boolean |
contains(Geometry g)
Tests whether this geometry contains the specified geometry. |
Geometry |
convexHull()
Computes the smallest convex Polygon that contains all the
points in the Geometry. |
boolean |
coveredBy(Geometry g)
Tests whether this geometry is covered by the specified geometry. |
boolean |
covers(Geometry g)
Tests whether this geometry covers the specified geometry. |
boolean |
crosses(Geometry g)
Tests whether this geometry crosses the specified geometry. |
Geometry |
difference(Geometry other)
Computes a Geometry representing the points making up this
Geometry that do not make up other. |
boolean |
disjoint(Geometry g)
Tests whether this geometry is disjoint from the specified geometry. |
double |
distance(Geometry g)
Returns the minimum distance between this Geometry
and the Geometry g |
protected boolean |
equal(Coordinate a,
Coordinate b,
double tolerance)
|
boolean |
equals(Geometry g)
Tests whether this geometry is equal to the specified geometry. |
boolean |
equalsExact(Geometry other)
Returns true if the two Geometrys are exactly equal. |
abstract boolean |
equalsExact(Geometry other,
double tolerance)
Returns true if the two Geometrys are exactly equal,
up to a specified distance tolerance. |
void |
geometryChanged()
Notifies this geometry that its coordinates have been changed by an external party (for example, via a CoordinateFilter). |
protected void |
geometryChangedAction()
Notifies this Geometry that its Coordinates have been changed by an external party. |
double |
getArea()
Returns the area of this Geometry. |
abstract Geometry |
getBoundary()
Returns the boundary, or an empty geometry of appropriate dimension if this Geometry is empty. |
abstract int |
getBoundaryDimension()
Returns the dimension of this Geometrys inherent boundary. |
Point |
getCentroid()
Computes the centroid of this Geometry. |
abstract Coordinate |
getCoordinate()
Returns a vertex of this Geometry
(usually, but not necessarily, the first one). |
abstract Coordinate[] |
getCoordinates()
Returns an array containing the values of all the vertices for this geometry. |
abstract int |
getDimension()
Returns the dimension of this geometry. |
Geometry |
getEnvelope()
Returns this Geometrys bounding box. |
Envelope |
getEnvelopeInternal()
Returns the minimum and maximum x and y values in this Geometry
, or a null Envelope if this Geometry is empty. |
GeometryFactory |
getFactory()
Gets the factory which contains the context in which this geometry was created. |
Geometry |
getGeometryN(int n)
Returns an element Geometry from a GeometryCollection
(or this, if the geometry is not a collection). |
abstract java.lang.String |
getGeometryType()
Returns the name of this object's com.vivid.jts.geom
interface. |
Point |
getInteriorPoint()
Computes an interior point of this Geometry. |
double |
getLength()
Returns the length of this Geometry. |
int |
getNumGeometries()
Returns the number of Geometrys in a GeometryCollection
(or 1, if the geometry is not a collection). |
abstract int |
getNumPoints()
Returns the count of this Geometrys vertices. |
PrecisionModel |
getPrecisionModel()
Returns the PrecisionModel used by the Geometry. |
int |
getSRID()
Returns the ID of the Spatial Reference System used by the Geometry. |
java.lang.Object |
getUserData()
Gets the user data object for this geometry, if any. |
protected static boolean |
hasNonEmptyElements(Geometry[] geometries)
Returns true if the array contains any non-empty Geometrys. |
protected static boolean |
hasNullElements(java.lang.Object[] array)
Returns true if the array contains any null elements. |
Geometry |
intersection(Geometry other)
Computes a Geometry representing the points shared by this
Geometry and other. |
boolean |
intersects(Geometry g)
Tests whether this geometry intersects the specified geometry. |
abstract boolean |
isEmpty()
Returns whether or not the set of points in this Geometry is
empty. |
protected boolean |
isEquivalentClass(Geometry other)
Returns whether the two Geometrys are equal, from the point
of view of the equalsExact method. |
protected boolean |
isGeometryCollection(Geometry g)
|
boolean |
isRectangle()
|
boolean |
isSimple()
Tests whether this Geometry is simple. |
boolean |
isValid()
Tests the validity of this Geometry. |
boolean |
isWithinDistance(Geometry geom,
double distance)
Tests whether the distance from this Geometry
to another is less than or equal to a specified value. |
abstract void |
normalize()
Converts this Geometry to normal form (or
canonical form ). |
boolean |
overlaps(Geometry g)
Tests whether this geometry overlaps the specified geometry. |
IntersectionMatrix |
relate(Geometry g)
Returns the DE-9IM IntersectionMatrix for the two Geometrys. |
boolean |
relate(Geometry g,
java.lang.String intersectionPattern)
Tests whether the elements in the DE-9IM IntersectionMatrix for the two Geometrys match the elements in intersectionPattern. |
abstract Geometry |
reverse()
Computes a new geometry which has all component coordinate sequences in reverse order (opposite orientation) to this one. |
void |
setSRID(int SRID)
Sets the ID of the Spatial Reference System used by the Geometry. |
void |
setUserData(java.lang.Object userData)
A simple scheme for applications to add their own custom data to a Geometry. |
Geometry |
symDifference(Geometry other)
Returns a set combining the points in this Geometry not in
other, and the points in other not in this
Geometry. |
java.lang.String |
toString()
|
java.lang.String |
toText()
Returns the Well-known Text representation of this Geometry. |
boolean |
touches(Geometry g)
Tests whether this geometry touches the specified geometry. |
Geometry |
union()
Computes the union of all the elements of this geometry. |
Geometry |
union(Geometry other)
Computes a Geometry representing all the points in this Geometry
and other. |
boolean |
within(Geometry g)
Tests whether this geometry is within the specified geometry. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected Envelope envelope
Geometry.
protected final GeometryFactory factory
GeometryFactory used to create this Geometry
protected int SRID
Geometry
| Constructor Detail |
public Geometry(GeometryFactory factory)
factory - | Method Detail |
public abstract java.lang.String getGeometryType()
com.vivid.jts.geom
interface.
Geometrys most specific com.vividsolutions.jts.geom
interfaceprotected static boolean hasNonEmptyElements(Geometry[] geometries)
Geometrys.
geometries - an array of Geometrys; no elements may be
null
true if any of the Geometrys
isEmpty methods return falseprotected static boolean hasNullElements(java.lang.Object[] array)
null elements.
array - an array to validate
true if any of arrays elements are
nullpublic int getSRID()
Geometry.
JTS supports Spatial Reference System information in the simple way
defined in the SFS. A Spatial Reference System ID (SRID) is present in
each Geometry object. Geometry provides basic
accessor operations for this field, but no others. The SRID is represented
as an integer.
Geometry
is defined.public void setSRID(int SRID)
Geometry.
NOTE: This method should only be used for exceptional circumstances or
for backwards compatibility. Normally the SRID should be set on the
GeometryFactory used to create the geometry.
SRIDs set using this method will not be propagated to
geometries returned by constructive methods.
GeometryFactorypublic GeometryFactory getFactory()
public java.lang.Object getUserData()
null if none setpublic int getNumGeometries()
Geometrys in a GeometryCollection
(or 1, if the geometry is not a collection).
public Geometry getGeometryN(int n)
Geometry from a GeometryCollection
(or this, if the geometry is not a collection).
n - the index of the geometry element
public void setUserData(java.lang.Object userData)
Note that user data objects are not present in geometries created by construction methods.
userData - an object, the semantics for which are defined by the
application using this Geometrypublic PrecisionModel getPrecisionModel()
PrecisionModel used by the Geometry.
Geometry and all other Geometryspublic abstract Coordinate getCoordinate()
Geometry
(usually, but not necessarily, the first one).
The returned coordinate should not be assumed
to be an actual Coordinate object used in
the internal representation.
Coordinate which is a vertex of this Geometry.public abstract Coordinate[] getCoordinates()
In general, the array cannot be assumed to be the actual internal
storage for the vertices. Thus modifying the array
may not modify the geometry itself.
Use the CoordinateSequence.setOrdinate(int, int, double) method
(possibly on the components) to modify the underlying data.
If the coordinates are modified,
geometryChanged() must be called afterwards.
GeometrygeometryChanged,
CoordinateSequence.setOrdinate(int, int, double)public abstract int getNumPoints()
Geometrys vertices. The Geometry
s contained by composite Geometrys must be
Geometry's; that is, they must implement getNumPoints
Geometrypublic boolean isSimple()
Geometry is simple.
In general, the SFS specification of simplicity
follows the rule:
Geometry subclass as follows:
isSimple trivially returns true.
Geometrys are always simple
true if this Geometry has any points of
self-tangency, self-intersection or other anomalous pointsisValid()public boolean isValid()
Geometry.
Subclasses provide their own definition of "valid".
true if this Geometry is validIsValidOppublic abstract boolean isEmpty()
Geometry is
empty.
true if this Geometry equals the empty
geometrypublic double distance(Geometry g)
Geometry
and the Geometry g
g - the Geometry from which to compute the distance
java.lang.IllegalArgumentException - if g is null
public boolean isWithinDistance(Geometry geom,
double distance)
Geometry
to another is less than or equal to a specified value.
geom - the Geometry to check the distance todistance - the distance value to compare
true if the geometries are less than distance apart.public boolean isRectangle()
public double getArea()
Geometry.
Areal Geometries have a non-zero area.
They override this function to compute the area.
Others return 0.0
public double getLength()
Geometry.
Linear geometries return their length.
Areal geometries return their perimeter.
They override this function to compute the area.
Others return 0.0
public Point getCentroid()
Geometry.
The centroid
is equal to the centroid of the set of component Geometries of highest
dimension (since the lower-dimension geometries contribute zero
"weight" to the centroid)
Point which is the centroid of this Geometrypublic Point getInteriorPoint()
Geometry.
An interior point is guaranteed to lie in the interior of the Geometry,
if it possible to calculate such a point exactly. Otherwise,
the point may lie on the boundary of the geometry.
Point which is in the interior of this Geometrypublic abstract int getDimension()
Note that this is a different concept to the dimension of
the vertex Coordinates.
The geometry dimension can never be greater than the coordinate dimension.
For example, a 0-dimensional geometry (e.g. a Point)
may have a coordinate dimension of 3 (X,Y,Z).
public abstract Geometry getBoundary()
Geometry is empty.
(In the case of zero-dimensional geometries, '
an empty GeometryCollection is returned.)
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."
Geometrypublic abstract int getBoundaryDimension()
Geometrys inherent boundary.
Dimension.FALSE if the boundary is the empty geometry.public Geometry getEnvelope()
Geometrys bounding box. If this Geometry
is the empty geometry, returns an empty Point. If the Geometry
is a point, returns a non-empty Point. Otherwise, returns a
Polygon whose points are (minx, miny), (maxx, miny), (maxx,
maxy), (minx, maxy), (minx, miny).
Point (for empty Geometrys), a
Point (for Points) or a Polygon
(in all other cases)public Envelope getEnvelopeInternal()
Geometry
, or a null Envelope if this Geometry is empty.
Geometrys bounding box; if the Geometry
is empty, Envelope#isNull will return truepublic void geometryChanged()
CoordinateFilter).
When this method is called the geometry will flush
and/or update any derived information it has cached (such as its Envelope ).
protected void geometryChangedAction()
apply(GeometryComponentFilter)public boolean disjoint(Geometry g)
The disjoint predicate has the following equivalent definitions:
[FF*FF****]
! g.intersects(this)
(disjoint is the inverse of intersects)
g - the Geometry with which to compare this Geometry
true if the two Geometrys are
disjointintersects(com.vividsolutions.jts.geom.Geometry)public boolean touches(Geometry g)
The touches predicate has the following equivalent definitions:
[FT*******] or [F**T*****] or [F***T****]
false
g - the Geometry with which to compare this Geometry
true if the two Geometrys touch;
Returns false if both Geometrys are pointspublic boolean intersects(Geometry g)
The intersects predicate has the following equivalent definitions:
[T********]
or [*T*******]
or [***T*****]
or [****T****]
! g.disjoint(this)
(intersects is the inverse of disjoint)
g - the Geometry with which to compare this Geometry
true if the two Geometrys intersectdisjoint(com.vividsolutions.jts.geom.Geometry)public boolean crosses(Geometry g)
The crosses predicate has the following equivalent definitions:
[T*T******] (for P/L, P/A, and L/A situations)
[T*****T**] (for L/P, A/P, and A/L situations)
[0********] (for L/L situations)
false.
The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations. JTS extends the definition to apply to L/P, A/P and A/L situations as well, in order to make the relation symmetric.
g - the Geometry with which to compare this Geometry
true if the two Geometrys cross.public boolean within(Geometry g)
The within predicate has the following equivalent definitions:
[T*F**F***]
g.contains(this)
(within is the converse of contains)
A.within(B) = false
g - the Geometry with which to compare this Geometry
true if this Geometry is within
othercontains(com.vividsolutions.jts.geom.Geometry)public boolean contains(Geometry g)
The contains predicate has the following equivalent definitions:
[T*****FF*]
g.within(this)
(contains is the converse of within)
B.contains(A) = false
g - the Geometry with which to compare this Geometry
true if this Geometry contains gwithin(com.vividsolutions.jts.geom.Geometry)public boolean overlaps(Geometry g)
The overlaps predicate has the following equivalent definitions:
[T*T***T**] (for two points or two surfaces)
or [1*T***T**] (for two curves)
false.
g - the Geometry with which to compare this Geometry
true if the two Geometrys overlap.public boolean covers(Geometry g)
The covers predicate has the following equivalent definitions:
[T*****FF*]
or [*T****FF*]
or [***T**FF*]
or [****T*FF*]
g.coveredBy(this)
(covers is the converse of coveredBy)
This predicate is similar to contains(com.vividsolutions.jts.geom.Geometry),
but is more inclusive (i.e. returns true for more cases).
In particular, unlike contains it does not distinguish between
points in the boundary and in the interior of geometries.
For most situations, covers should be used in preference to contains.
As an added benefit, covers is more amenable to optimization,
and hence should be more performant.
g - the Geometry with which to compare this Geometry
true if this Geometry covers gcontains(com.vividsolutions.jts.geom.Geometry),
coveredBy(com.vividsolutions.jts.geom.Geometry)public boolean coveredBy(Geometry g)
The coveredBy predicate has the following equivalent definitions:
[T*F**F***]
or [*TF**F***]
or [**FT*F***]
or [**F*TF***]
g.covers(this)
(coveredBy is the converse of covers)
This predicate is similar to within(com.vividsolutions.jts.geom.Geometry),
but is more inclusive (i.e. returns true for more cases).
g - the Geometry with which to compare this Geometry
true if this Geometry is covered by gwithin(com.vividsolutions.jts.geom.Geometry),
covers(com.vividsolutions.jts.geom.Geometry)
public boolean relate(Geometry g,
java.lang.String intersectionPattern)
IntersectionMatrix for the two Geometrys match the elements in intersectionPattern.
The pattern is a 9-character string, with symbols drawn from the following set:
intersectionPattern - the pattern against which to check the
intersection matrix for the two Geometrys
true if the DE-9IM intersection
matrix for the two Geometrys match intersectionPatternIntersectionMatrixpublic IntersectionMatrix relate(Geometry g)
IntersectionMatrix for the two Geometrys.
IntersectionMatrix describing the intersections of the interiors,
boundaries and exteriors of the two Geometryspublic boolean equals(Geometry g)
The equals predicate has the following equivalent definitions:
true if the two Geometrys are equalpublic java.lang.String toString()
public java.lang.String toText()
Geometry.
For a definition of the Well-known Text format, see the OpenGIS Simple
Features Specification.
Geometrypublic Geometry buffer(double distance)
abs(distance).
Mathematically-exact buffer area boundaries can contain circular arcs. To represent these arcs using linear geometry they must be approximated with line segments. The buffer geometry is constructed using 8 segments per quadrant to approximate the circular arcs. The end cap style is CAP_ROUND.
The buffer operation always returns a polygonal result. The negative or
zero-distance buffer of lines and points is always an empty Polygon.
This is also the result for the buffers of degenerate (zero-area) polygons.
distance - the width of the buffer (may be positive, negative or 0)
TopologyException - if a robustness error occursbuffer(double, int),
buffer(double, int, int)
public Geometry buffer(double distance,
int quadrantSegments)
Mathematically-exact buffer area boundaries can contain circular arcs.
To represent these arcs
using linear geometry they must be approximated with line segments. The
quadrantSegments argument allows controlling the accuracy of
the approximation by specifying the number of line segments used to
represent a quadrant of a circle
The buffer operation always returns a polygonal result. The negative or
zero-distance buffer of lines and points is always an empty Polygon.
This is also the result for the buffers of degenerate (zero-area) polygons.
distance - the width of the buffer (may be positive, negative or 0)quadrantSegments - the number of line segments used to represent a quadrant of a
circle
TopologyException - if a robustness error occursbuffer(double),
buffer(double, int, int)
public Geometry buffer(double distance,
int quadrantSegments,
int endCapStyle)
Mathematically-exact buffer area boundaries can contain circular arcs.
To represent these arcs using linear geometry they must be approximated with line segments.
The quadrantSegments argument allows controlling the
accuracy of the approximation
by specifying the number of line segments used to represent a quadrant of a circle
The end cap style specifies the buffer geometry that will be created at the ends of linestrings. The styles provided are:
The buffer operation always returns a polygonal result. The negative or
zero-distance buffer of lines and points is always an empty Polygon.
This is also the result for the buffers of degenerate (zero-area) polygons.
distance - the width of the buffer (may be positive, negative or 0)quadrantSegments - the number of line segments used to represent a quadrant of a circleendCapStyle - the end cap style to use
TopologyException - if a robustness error occursbuffer(double),
buffer(double, int),
BufferOppublic Geometry convexHull()
Polygon that contains all the
points in the Geometry. This obviously applies only to Geometry
s which contain 3 or more points; the results for degenerate cases are
specified as follows:
Number of Points in argument Geometry |
Geometry class of result |
|---|---|
| 0 | empty GeometryCollection |
| 1 | Point |
| 2 | LineString |
| 3 or more | Polygon |
Geometry'
s pointspublic abstract Geometry reverse()
public Geometry intersection(Geometry other)
Geometry representing the points shared by this
Geometry and other.
GeometryCollections support intersection with
homogeneous collection types, with the semantics that
the result is a GeometryCollection of the
intersection of each element of the target with the argument.
other - the Geometry with which to compute the intersection
Geometrys
TopologyException - if a robustness error occurs
java.lang.IllegalArgumentException - if the argument is a non-empty GeometryCollectionpublic Geometry union(Geometry other)
Geometry representing all the points in this Geometry
and other.
other - the Geometry with which to compute the union
Geometry and
the points of other
TopologyException - if a robustness error occurs
java.lang.IllegalArgumentException - if either input is a non-empty GeometryCollectionpublic Geometry difference(Geometry other)
Geometry representing the points making up this
Geometry that do not make up other. This method
returns the closure of the resultant Geometry.
other - the Geometry with which to compute the
difference
Geometry with
other
TopologyException - if a robustness error occurs
java.lang.IllegalArgumentException - if either input is a non-empty GeometryCollectionpublic Geometry symDifference(Geometry other)
Geometry not in
other, and the points in other not in this
Geometry. This method returns the closure of the resultant
Geometry.
other - the Geometry with which to compute the symmetric
difference
Geometry
with other
TopologyException - if a robustness error occurs
java.lang.IllegalArgumentException - if either input is a non-empty GeometryCollectionpublic Geometry union()
GeometryCollections are fully supported.
The result obeys the following contract:
LineStrings has the effect of fully noding
and dissolving the linework.
Polygons will always
return a Polygonal geometry (unlike {link #union(Geometry)},
which may return geometrys of lower dimension if a topology collapse occurred.
UnaryUnionOp
public abstract boolean equalsExact(Geometry other,
double tolerance)
Geometrys are exactly equal,
up to a specified distance tolerance.
Two Geometries are exactly equal within a distance tolerance
if and only if:
Geometrys are
composites and any children are not Geometrys, returns
false.
other - the Geometry with which to compare this Geometry
true if this and the other Geometry
are of the same class and have equal internal data.public boolean equalsExact(Geometry other)
Geometrys are exactly equal.
Two Geometries are exactly equal iff:
Geometrys are
composites and any children are not Geometrys, returns
false.
This provides a stricter test of equality than
equals.
other - the Geometry with which to compare this Geometry
true if this and the other Geometry
are of the same class and have equal internal data.public abstract void apply(CoordinateFilter filter)
Geometry's
coordinates.
If this method modifies any coordinate values,
geometryChanged() must be called to update the geometry state.
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 Coordinate objects at all).
filter - the filter to apply to this Geometry's
coordinatespublic abstract void apply(CoordinateSequenceFilter filter)
Geometry's
CoordinateSequences.
If the filter reports that a coordinate value has been changed,
geometryChanged() will be called automatically.
filter - the filter to applypublic abstract void apply(GeometryFilter filter)
Geometry and its
subelement Geometrys (if any).
Only GeometryCollections and subclasses
have subelement Geometry's.
filter - the filter to apply to this Geometry (and
its children, if it is a GeometryCollection).public abstract void apply(GeometryComponentFilter filter)
filter - the filter to apply to this Geometry.public java.lang.Object clone()
Geometry object
(including all coordinates contained by it).
Subclasses are responsible for overriding this method and copying
their internal data. Overrides should call this method first.
public abstract void normalize()
Geometry to normal form (or
canonical form ). Normal form is a unique representation for Geometry
s. It can be used to test whether two Geometrys 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.
public int compareTo(java.lang.Object o)
Geometry is greater than, equal to,
or less than another Geometry. If their classes are different, they are compared using the following ordering:
Geometrys have the same class, their first
elements are compared. If those are the same, the second elements are
compared, etc.
compareTo in interface java.lang.Comparableo - a Geometry with which to compare this Geometry
o, as
defined in "Normal Form For Geometry" in the JTS Technical
Specifications
public int compareTo(java.lang.Object o,
CoordinateSequenceComparator comp)
Geometry is greater than, equal to,
or less than another Geometry,
using the given CoordinateSequenceComparator.
If their classes are different, they are compared using the following ordering:
Geometrys have the same class, their first
elements are compared. If those are the same, the second elements are
compared, etc.
o - a Geometry with which to compare this Geometrycomp - a CoordinateSequenceComparator
o, as
defined in "Normal Form For Geometry" in the JTS Technical
Specificationsprotected boolean isEquivalentClass(Geometry other)
Geometrys are equal, from the point
of view of the equalsExact method. Called by equalsExact
. In general, two Geometry classes are considered to be
"equivalent" only if they are the same class. An exception is LineString
, which is considered to be equivalent to its subclasses.
other - the Geometry with which to compare this Geometry
for equality
true if the classes of the two Geometry
s are considered to be equal by the equalsExact method.protected void checkNotGeometryCollection(Geometry g)
g's class is GeometryCollection
. (Its subclasses do not trigger an exception).
g - the Geometry to check
java.lang.IllegalArgumentException - if g is a GeometryCollection
but not one of its subclassesprotected boolean isGeometryCollection(Geometry g)
protected abstract Envelope computeEnvelopeInternal()
Geometry
, or a null Envelope if this Geometry is empty.
Unlike getEnvelopeInternal, this method calculates the Envelope
each time it is called; getEnvelopeInternal caches the result
of this method.
Geometrys bounding box; if the Geometry
is empty, Envelope#isNull will return trueprotected abstract int compareToSameClass(java.lang.Object o)
Geometry is greater than, equal to,
or less than another Geometry having the same class.
o - a Geometry having the same class as this Geometry
o, as
defined in "Normal Form For Geometry" in the JTS Technical
Specifications
protected abstract int compareToSameClass(java.lang.Object o,
CoordinateSequenceComparator comp)
Geometry is greater than, equal to,
or less than another Geometry of the same class.
using the given CoordinateSequenceComparator.
o - a Geometry having the same class as this Geometrycomp - a CoordinateSequenceComparator
o, as
defined in "Normal Form For Geometry" in the JTS Technical
Specifications
protected int compare(java.util.Collection a,
java.util.Collection b)
compareTo encountered as
the two Collections are iterated over. If, by the time one of
the iterations is complete, no non-zero result has been encountered,
returns 0 if the other iteration is also complete. If b
completes before a, a positive number is returned; if a
before b, a negative number.
a - a Collection of Comparablesb - a Collection of Comparables
compareTo result, if any;
otherwise, zero
protected boolean equal(Coordinate a,
Coordinate b,
double tolerance)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||