| java.lang.Object com.vividsolutions.jts.geom.Geometry
All known Subclasses: com.vividsolutions.jts.geom.Point, com.vividsolutions.jts.geom.Polygon, com.vividsolutions.jts.geom.GeometryCollection, com.vividsolutions.jts.geom.LineString,
Geometry | abstract public class Geometry implements Cloneable,Comparable,Serializable(Code) | | The base class for all geometric objects.
Binary Predicates
Because it is not clear at this time
what semantics for spatial
analysis methods involving GeometryCollection s would be useful,
GeometryCollection s are not supported as arguments to binary
predicates (other than convexHull ) or the relate
method.
Set-Theoretic Methods
The spatial analysis methods will
return the most specific class possible to represent the result. If the
result is homogeneous, a 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 GeometryCollection s would be useful,
GeometryCollections
are not supported as arguments to the set-theoretic methods.
Representation of Computed Geometries
The SFS states that the result
of a set-theoretic method is the "point-set" result of the usual
set-theoretic definition of the operation (SFS 3.2.21.1). However, there are
sometimes many ways of representing a point set as a 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
Geometry s returned from spatial analysis methods. The canonical
form is a Geometry which is simple and noded:
- Simple means that the Geometry returned will be simple according to
the JTS definition of
isSimple .
- Noded applies only to overlays involving
LineString s. It
means that all intersection points on LineString s will be
present as endpoints of LineString s in the result.
This definition implies that non-simple geometries which are arguments to
spatial analysis methods must be subjected to a line-dissolve process to
ensure that the results are simple.
Constructed Points And The Precision Model
The results computed by the set-theoretic methods may
contain constructed points which are not present in the input Geometry
s. These new points arise from intersections between line segments in the
edges of the input Geometry s. 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.
version: 1.7 |
Constructor Summary | |
public | Geometry(GeometryFactory factory) Creates a new Geometry via the specified GeometryFactory. |
Method Summary | |
abstract public void | apply(CoordinateFilter filter) Performs an operation with or on this Geometry 's
coordinates. | abstract public void | apply(CoordinateSequenceFilter filter) Performs an operation on the coordinates in this Geometry 's
CoordinateSequence s. | abstract public void | apply(GeometryFilter filter) Performs an operation with or on this Geometry and its
subelement Geometry s (if any). | abstract public void | apply(GeometryComponentFilter filter) Performs an operation with or on this Geometry and its
component Geometry's. | public Geometry | buffer(double distance) Computes a buffer area around this geometry having the given
width. | public 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. | public 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.
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. | protected void | checkNotGeometryCollection(Geometry g) Throws an exception if g 's class is GeometryCollection
. | public Object | clone() Creates and returns a full copy of this
Geometry object
(including all coordinates contained by it).
Subclasses are responsible for overriding this method and copying
their internal data. | protected int | compare(Collection a, Collection b) Returns the first non-zero result of compareTo encountered as
the two Collection s are iterated over. | public int | compareTo(Object o) Returns whether this Geometry is greater than, equal to,
or less than another Geometry . | public int | compareTo(Object o, CoordinateSequenceComparator comp) Returns whether this 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:
- Point (lowest)
- MultiPoint
- LineString
- LinearRing
- MultiLineString
- Polygon
- MultiPolygon
- GeometryCollection (highest)
If the two Geometry s have the same class, their first
elements are compared. | abstract protected int | compareToSameClass(Object o) Returns whether this Geometry is greater than, equal to,
or less than another Geometry having the same class. | abstract protected int | compareToSameClass(Object o, CoordinateSequenceComparator comp) Returns whether this Geometry is greater than, equal to,
or less than another Geometry of the same class. | abstract protected Envelope | computeEnvelopeInternal() Returns the minimum and maximum x and y values in this Geometry
, or a null Envelope if this Geometry is empty. | public boolean | contains(Geometry g) Returns true if this geometry contains the
specified geometry.
The contains predicate has the following equivalent definitions:
- Every point of the other geometry is a point of this geometry,
and the interiors of the two geometries have at least one point in common.
- The DE-9IM Intersection Matrix for the two geometries is
T*****FF*
g.within(this)
(contains is the inverse of within )
An implication of the definition is that "Polygons do not
contain their boundary". | public Geometry | convexHull() Computes the smallest convex Polygon that contains all the
points in the Geometry . | public boolean | coveredBy(Geometry g) Returns true if this geometry is covered by the
specified geometry. | public boolean | covers(Geometry g) Returns true if this geometry covers the
specified geometry. | public boolean | crosses(Geometry g) Returns true if this geometry crosses the
specified geometry. | public Geometry | difference(Geometry other) Computes a Geometry representing the points making up this
Geometry that do not make up other . | public boolean | disjoint(Geometry g) Returns true if this geometry is disjoint to the specified geometry. | public double | distance(Geometry g) | protected boolean | equal(Coordinate a, Coordinate b, double tolerance) | public boolean | equals(Geometry g) Returns true if this geometry is equal to the
specified geometry. | abstract public boolean | equalsExact(Geometry other, double tolerance) Returns true if the two Geometry s are exactly equal,
up to a specified distance tolerance. | public boolean | equalsExact(Geometry other) Returns true if the two Geometry s are exactly equal. | public void | geometryChanged() Notifies this Geometry that its Coordinates have been changed by an external
party (using a CoordinateFilter, for example). | protected void | geometryChangedAction() Notifies this Geometry that its Coordinates have been changed by an external
party. | public double | getArea() Returns the area of this Geometry . | abstract public Geometry | getBoundary() Returns the boundary, or an empty geometry of appropriate dimension
if this 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. | abstract public int | getBoundaryDimension() Returns the dimension of this Geometry s inherent boundary.
the dimension of the boundary of the class implementing thisinterface, whether or not this object is the empty geometry. | public Point | getCentroid() Computes the centroid of this Geometry . | abstract public Coordinate | getCoordinate() Returns a vertex of this Geometry . | abstract public Coordinate[] | getCoordinates() Returns this Geometry s vertices. | abstract public int | getDimension() Returns the dimension of this Geometry . | public Geometry | getEnvelope() Returns this Geometry s bounding box. | public Envelope | getEnvelopeInternal() Returns the minimum and maximum x and y values in this Geometry
, or a null Envelope if this Geometry is empty. | public GeometryFactory | getFactory() Gets the factory which contains the context in which this geometry was created. | public Geometry | getGeometryN(int n) Returns an element
Geometry from a
GeometryCollection (or this , if the geometry is not a collection). | abstract public String | getGeometryType() Returns the name of this object's com.vivid.jts.geom
interface. | public Point | getInteriorPoint() Computes an interior point of this Geometry .
An interior point is guaranteed to lie in the interior of the Geometry,
if it possible to calculate such a point exactly. | public double | getLength() Returns the length of this Geometry . | public int | getNumGeometries() Returns the number of
Geometry s in a
GeometryCollection (or 1, if the geometry is not a collection). | abstract public int | getNumPoints() Returns the count of this Geometry s vertices. | public PrecisionModel | getPrecisionModel() Returns the PrecisionModel used by the Geometry . | public int | getSRID() Returns the ID of the Spatial Reference System used by the Geometry .
JTS supports Spatial Reference System information in the simple way
defined in the SFS. | public 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 Geometry s. | protected static boolean | hasNullElements(Object[] array) Returns true if the array contains any null elements. | public Geometry | intersection(Geometry other) Computes a Geometry representing the points shared by this
Geometry and other . | public boolean | intersects(Geometry g) Returns true if this geometry intersects the specified geometry. | abstract public boolean | isEmpty() Returns whether or not the set of points in this Geometry is
empty. | protected boolean | isEquivalentClass(Geometry other) Returns whether the two Geometry s are equal, from the point
of view of the equalsExact method. | public boolean | isRectangle() | public boolean | isSimple() Tests whether this
Geometry is simple. | public boolean | isValid() Tests the validity of this Geometry . | public 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 public void | normalize() Converts this Geometry to normal form (or
canonical form ). | public boolean | overlaps(Geometry g) Returns true if this geometry overlaps the
specified geometry. | public boolean | relate(Geometry g, String intersectionPattern) Returns true if the elements in the DE-9IM
IntersectionMatrix for the two Geometry s match the elements in intersectionPattern . | public IntersectionMatrix | relate(Geometry g) Returns the DE-9IM
IntersectionMatrix for the two Geometry s. | public void | setSRID(int SRID) Sets the ID of the Spatial Reference System used by the Geometry . | public void | setUserData(Object userData) A simple scheme for applications to add their own custom data to a Geometry. | public 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 . | public String | toString() | public String | toText() Returns the Well-known Text representation of this Geometry . | public boolean | touches(Geometry g) Returns true if this geometry touches the
specified geometry. | public Geometry | union(Geometry other) Computes a Geometry representing all the points in this Geometry
and other . | public boolean | within(Geometry g) Returns true if this geometry is within the
specified geometry. |
SRID | protected int SRID(Code) | | The ID of the Spatial Reference System used by this Geometry
|
envelope | protected Envelope envelope(Code) | | The bounding box of this Geometry .
|
Geometry | public Geometry(GeometryFactory factory)(Code) | | Creates a new Geometry via the specified GeometryFactory.
Parameters: factory - |
apply | abstract public void apply(CoordinateFilter filter)(Code) | | Performs an operation with or on this 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 Coordinates at all).
Parameters: filter - the filter to apply to this Geometry 'scoordinates |
apply | abstract public void apply(CoordinateSequenceFilter filter)(Code) | | Performs an operation on the coordinates in this Geometry 's
CoordinateSequence s.
If this method modifies any coordinate values,
#geometryChanged() must be called to update the geometry state.
Parameters: filter - the filter to apply |
apply | abstract public void apply(GeometryFilter filter)(Code) | | Performs an operation with or on this Geometry and its
subelement Geometry s (if any).
Only GeometryCollections and subclasses
have subelement Geometry's.
Parameters: filter - the filter to apply to this Geometry (andits children, if it is a GeometryCollection ). |
apply | abstract public void apply(GeometryComponentFilter filter)(Code) | | 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 this Geometry . |
buffer | public Geometry buffer(double distance)(Code) | | Computes a buffer area around this geometry having the given
width.
The buffer of a Geometry is the Minkowski sum or difference
of the geometry with a disc of radius abs(distance) .
The buffer is constructed using 8 segments per quadrant to represent curves.
The end cap style is CAP_ROUND.
Parameters: distance - the width of the buffer (may be positive, negative or 0) an area geometry representing the buffer region throws: TopologyException - if a robustness error occurs See Also: Geometry.buffer(double,int) See Also: Geometry.buffer(double,int,int) |
buffer | public Geometry buffer(double distance, int quadrantSegments)(Code) | | Computes a buffer area around this geometry having the given
width and with a specified accuracy of approximation for circular arcs.
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
Parameters: distance - the width of the buffer (may be positive, negative or 0) Parameters: quadrantSegments - the number of line segments used to represent a quadrant of a circle an area geometry representing the buffer region throws: TopologyException - if a robustness error occurs See Also: Geometry.buffer(double) See Also: Geometry.buffer(double,int,int) |
buffer | public Geometry buffer(double distance, int quadrantSegments, int endCapStyle)(Code) | | 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.
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:
- BufferOp.CAP_ROUND - (default) a semi-circle
- BufferOp.CAP_BUTT - a straight line perpendicular to the end segment
- BufferOp.CAP_SQUARE - a half-square
Parameters: distance - the width of the buffer (may be positive, negative or 0) Parameters: quadrantSegments - the number of line segments used to represent a quadrant of a circle Parameters: endCapStyle - the end cap style to use an area geometry representing the buffer region throws: TopologyException - if a robustness error occurs See Also: Geometry.buffer(double) See Also: Geometry.buffer(double,int) See Also: BufferOp |
checkNotGeometryCollection | protected void checkNotGeometryCollection(Geometry g)(Code) | | Throws an exception if g 's class is GeometryCollection
. (Its subclasses do not trigger an exception).
Parameters: g - the Geometry to check throws: IllegalArgumentException - if g is a GeometryCollection but not one of its subclasses |
clone | public Object clone()(Code) | | Creates and returns a full copy of this
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.
a clone of this instance |
compare | protected int compare(Collection a, Collection b)(Code) | | Returns the first non-zero result of compareTo encountered as
the two Collection s 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.
Parameters: a - a Collection of Comparable s Parameters: b - a Collection of Comparable s the first non-zero compareTo result, if any;otherwise, zero |
compareTo | public int compareTo(Object o)(Code) | | Returns whether this Geometry is greater than, equal to,
or less than another Geometry .
If their classes are different, they are compared using the following
ordering:
- Point (lowest)
- MultiPoint
- LineString
- LinearRing
- MultiLineString
- Polygon
- MultiPolygon
- GeometryCollection (highest)
If the two Geometry s have the same class, their first
elements are compared. If those are the same, the second elements are
compared, etc.
Parameters: o - a Geometry with which to compare this Geometry a positive number, 0, or a negative number, depending on whetherthis object is greater than, equal to, or less than o , asdefined in "Normal Form For Geometry" in the JTS TechnicalSpecifications |
compareTo | public int compareTo(Object o, CoordinateSequenceComparator comp)(Code) | | Returns whether this 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:
- Point (lowest)
- MultiPoint
- LineString
- LinearRing
- MultiLineString
- Polygon
- MultiPolygon
- GeometryCollection (highest)
If the two Geometry s have the same class, their first
elements are compared. If those are the same, the second elements are
compared, etc.
Parameters: o - a Geometry with which to compare this Geometry Parameters: comp - a CoordinateSequenceComparator a positive number, 0, or a negative number, depending on whetherthis object is greater than, equal to, or less than o , asdefined in "Normal Form For Geometry" in the JTS TechnicalSpecifications |
compareToSameClass | abstract protected int compareToSameClass(Object o)(Code) | | Returns whether this Geometry is greater than, equal to,
or less than another Geometry having the same class.
Parameters: o - a Geometry having the same class as this Geometry a positive number, 0, or a negative number, depending on whetherthis object is greater than, equal to, or less than o , asdefined in "Normal Form For Geometry" in the JTS TechnicalSpecifications |
compareToSameClass | abstract protected int compareToSameClass(Object o, CoordinateSequenceComparator comp)(Code) | | Returns whether this Geometry is greater than, equal to,
or less than another Geometry of the same class.
using the given
CoordinateSequenceComparator .
Parameters: o - a Geometry having the same class as this Geometry Parameters: comp - a CoordinateSequenceComparator a positive number, 0, or a negative number, depending on whetherthis object is greater than, equal to, or less than o , asdefined in "Normal Form For Geometry" in the JTS TechnicalSpecifications |
computeEnvelopeInternal | abstract protected Envelope computeEnvelopeInternal()(Code) | | Returns the minimum and maximum x and y values in this 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.
this Geometry s bounding box; if the Geometry is empty, Envelope#isNull will return true |
contains | public boolean contains(Geometry g)(Code) | | Returns true if this geometry contains the
specified geometry.
The contains predicate has the following equivalent definitions:
- Every point of the other geometry is a point of this geometry,
and the interiors of the two geometries have at least one point in common.
- The DE-9IM Intersection Matrix for the two geometries is
T*****FF*
g.within(this)
(contains is the inverse of within )
An implication of the definition is that "Polygons do not
contain their boundary". In other words, if a geometry G is a subset of
the points in the boundary of a polygon P, P.contains(G) = false
Parameters: g - the Geometry with which to compare this Geometry true if this Geometry contains g See Also: Geometry.within |
convexHull | public Geometry convexHull()(Code) | | Computes the smallest convex 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 Point s in argument Geometry |
Geometry class of result |
0 |
empty GeometryCollection |
1 |
Point |
2 |
LineString |
3 or more |
Polygon |
the minimum-area convex polygon containing this Geometry 's points |
coveredBy | public boolean coveredBy(Geometry g)(Code) | | Returns true if this geometry is covered by the
specified geometry.
The coveredBy predicate has the following equivalent definitions:
- Every point of this geometry is a point of the other geometry.
- The DE-9IM Intersection Matrix for the two geometries is
T*F**F***
or *TF**F***
or **FT*F***
or **F*TF***
g.covers(this)
(coveredBy is the inverse of covers )
Note the difference between coveredBy and within
- coveredBy is a more inclusive relation.
Parameters: g - the Geometry with which to compare this Geometry true if this Geometry is covered by g See Also: Geometry.within See Also: Geometry.covers |
covers | public boolean covers(Geometry g)(Code) | | Returns true if this geometry covers the
specified geometry.
The covers predicate has the following equivalent definitions:
- Every point of the other geometry is a point of this geometry.
- The DE-9IM Intersection Matrix for the two geometries is
T*****FF*
or *T****FF*
or ***T**FF*
or ****T*FF*
g.coveredBy(this)
(covers is the inverse of coverdBy )
Note the difference between covers and contains
- covers is a more inclusive relation.
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.
Parameters: g - the Geometry with which to compare this Geometry true if this Geometry covers g See Also: Geometry.contains See Also: Geometry.coveredBy |
crosses | public boolean crosses(Geometry g)(Code) | | Returns true if this geometry crosses the
specified geometry.
The crosses predicate has the following equivalent definitions:
- The geometries have some but not all interior points in common.
- The DE-9IM Intersection Matrix for the two geometries is
- T*T****** (for P/L, P/A, and L/A situations)
- T*****T** (for L/P, L/A, and A/L situations)
- 0******** (for L/L situations)
For any other combination of dimensions this predicate returns 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.
This makes the relation symmetric.
Parameters: g - the Geometry with which to compare this Geometry true if the two Geometry s cross. |
difference | public Geometry difference(Geometry other)(Code) | | Computes a Geometry representing the points making up this
Geometry that do not make up other . This method
returns the closure of the resultant Geometry .
Parameters: other - the Geometry with which to compute thedifference the point set difference of this Geometry withother throws: TopologyException - if a robustness error occurs throws: IllegalArgumentException - if either input is a non-empty GeometryCollection |
disjoint | public boolean disjoint(Geometry g)(Code) | | Returns true if this geometry is disjoint to the specified geometry.
The disjoint predicate has the following equivalent definitions:
- The two geometries have no point in common
- The DE-9IM Intersection Matrix for the two geometries is FF*FF****
- !
g.intersects(this)
(disjoint is the inverse of intersects )
Parameters: g - the Geometry with which to compare this Geometry true if the two Geometry s aredisjoint See Also: Geometry.intersects |
distance | public double distance(Geometry g)(Code) | | Returns the minimum distance between this Geometry
and the Geometry g
Parameters: g - the Geometry from which to compute the distance |
equals | public boolean equals(Geometry g)(Code) | | Returns true if this geometry is equal to the
specified geometry.
The equals predicate has the following equivalent definitions:
- The two geometries have at least one point in common,
and no point of either geometry lies in the exterior of the other geometry.
- The DE-9IM Intersection Matrix for the two geometries is T*F**FFF*
Parameters: other - the Geometry with which to compare this Geometry true if the two Geometry s are equal |
equalsExact | abstract public boolean equalsExact(Geometry other, double tolerance)(Code) | | Returns true if the two Geometry s are exactly equal,
up to a specified distance tolerance.
Two Geometries are exactly equal within a distance tolerance
if and only if:
- they have the same class
- they have the same values for their vertices,
within the given tolerance distance, in exactly the same order.
If this and the other Geometry s are
composites and any children are not Geometry s, returns
false .
Parameters: 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. |
equalsExact | public boolean equalsExact(Geometry other)(Code) | | Returns true if the two Geometry s are exactly equal.
Two Geometries are exactly equal iff:
- they have the same class
- they have the same values of Coordinates in their internal
Coordinate lists, in exactly the same order.
If this and the other Geometry s are
composites and any children are not Geometry s, returns
false.
This provides a stricter test of equality than
equals .
Parameters: 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. |
geometryChanged | public void geometryChanged()(Code) | | Notifies this Geometry that its Coordinates have been changed by an external
party (using a CoordinateFilter, for example). The Geometry will flush
and/or update any information it has cached (such as its
Envelope ).
|
geometryChangedAction | protected void geometryChangedAction()(Code) | | Notifies this Geometry that its Coordinates have been changed by an external
party. When #geometryChanged is called, this method will be called for
this Geometry and its component Geometries.
See Also: Geometry.apply(GeometryComponentFilter) |
getArea | public double getArea()(Code) | | Returns the area of this Geometry .
Areal Geometries have a non-zero area.
They override this function to compute the area.
Others return 0.0
the area of the Geometry |
getBoundary | abstract public Geometry getBoundary()(Code) | | Returns the boundary, or an empty geometry of appropriate dimension
if this 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."
the closure of the combinatorial boundary of this Geometry |
getBoundaryDimension | abstract public int getBoundaryDimension()(Code) | | Returns the dimension of this Geometry s inherent boundary.
the dimension of the boundary of the class implementing thisinterface, whether or not this object is the empty geometry. ReturnsDimension.FALSE if the boundary is the empty geometry. |
getCentroid | public Point getCentroid()(Code) | | Computes the centroid of this 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)
a Point which is the centroid of this Geometry |
getCoordinate | abstract public Coordinate getCoordinate()(Code) | | Returns a vertex of this Geometry .
a Coordinate which is a vertex of this Geometry .Returns null if this Geometry is empty |
getCoordinates | abstract public Coordinate[] getCoordinates()(Code) | | Returns this Geometry s vertices. If you modify the coordinates
in this array, be sure to call #geometryChanged afterwards.
The Geometry s contained by composite Geometry s
must be Geometry's; that is, they must implement getCoordinates .
the vertices of this Geometry |
getDimension | abstract public int getDimension()(Code) | | Returns the dimension of this Geometry .
the dimension of the class implementing this interface, whetheror not this object is the empty geometry |
getEnvelope | public Geometry getEnvelope()(Code) | | Returns this Geometry s 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).
an empty Point (for empty Geometry s), aPoint (for Point s) or a Polygon (in all other cases) |
getEnvelopeInternal | public Envelope getEnvelopeInternal()(Code) | | Returns the minimum and maximum x and y values in this Geometry
, or a null Envelope if this Geometry is empty.
this Geometry s bounding box; if the Geometry is empty, Envelope#isNull will return true |
getFactory | public GeometryFactory getFactory()(Code) | | Gets the factory which contains the context in which this geometry was created.
the factory for this geometry |
getGeometryN | public Geometry getGeometryN(int n)(Code) | | Returns an element
Geometry from a
GeometryCollection (or this , if the geometry is not a collection).
Parameters: n - the index of the geometry element the n'th geometry contained in this geometry |
getGeometryType | abstract public String getGeometryType()(Code) | | Returns the name of this object's com.vivid.jts.geom
interface.
the name of this Geometry s most specific com.vividsolutions.jts.geom interface |
getInteriorPoint | public Point getInteriorPoint()(Code) | | Computes an interior point of this 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.
a Point which is in the interior of this Geometry |
getLength | public double getLength()(Code) | | Returns the length of this Geometry .
Linear geometries return their length.
Areal geometries return their perimeter.
They override this function to compute the area.
Others return 0.0
the length of the Geometry |
getNumGeometries | public int getNumGeometries()(Code) | | Returns the number of
Geometry s in a
GeometryCollection (or 1, if the geometry is not a collection).
the number of geometries contained in this geometry |
getNumPoints | abstract public int getNumPoints()(Code) | | Returns the count of this Geometry s vertices. The Geometry
s contained by composite Geometry s must be
Geometry's; that is, they must implement getNumPoints
the number of vertices in this Geometry |
getPrecisionModel | public PrecisionModel getPrecisionModel()(Code) | | Returns the PrecisionModel used by the Geometry .
the specification of the grid of allowable points, for thisGeometry and all other Geometry s |
getSRID | public int getSRID()(Code) | | Returns the ID of the Spatial Reference System used by the 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.
the ID of the coordinate space in which the Geometry is defined. |
getUserData | public Object getUserData()(Code) | | Gets the user data object for this geometry, if any.
the user data object, or null if none set |
hasNonEmptyElements | protected static boolean hasNonEmptyElements(Geometry[] geometries)(Code) | | Returns true if the array contains any non-empty Geometry s.
Parameters: geometries - an array of Geometry s; no elements may benull true if any of the Geometry sisEmpty methods return false |
hasNullElements | protected static boolean hasNullElements(Object[] array)(Code) | | Returns true if the array contains any null elements.
Parameters: array - an array to validate true if any of array s elements arenull |
intersection | public Geometry intersection(Geometry other)(Code) | | Computes a Geometry representing the points shared by this
Geometry and other .
Parameters: other - the Geometry with which to compute theintersection the points common to the two Geometry s throws: TopologyException - if a robustness error occurs throws: IllegalArgumentException - if either input is a non-empty GeometryCollection |
intersects | public boolean intersects(Geometry g)(Code) | | Returns true if this geometry intersects the specified geometry.
The intersects predicate has the following equivalent definitions:
- The two geometries have at least one point in common
- !
g.disjoint(this)
(intersects is the inverse of disjoint )
Parameters: g - the Geometry with which to compare this Geometry true if the two Geometry s intersect See Also: Geometry.disjoint |
isEmpty | abstract public boolean isEmpty()(Code) | | Returns whether or not the set of points in this Geometry is
empty.
true if this Geometry equals the emptygeometry |
isEquivalentClass | protected boolean isEquivalentClass(Geometry other)(Code) | | Returns whether the two Geometry s 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.
Parameters: 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. |
isRectangle | public boolean isRectangle()(Code) | | |
isSimple | public boolean isSimple()(Code) | | Tests whether this
Geometry is simple.
In general, the SFS specification of simplicity
follows the rule:
- A Geometry is simple iff the only self-intersections are at
boundary points.
Simplicity is defined for each
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
true if this Geometry has any points ofself-tangency, self-intersection or other anomalous points See Also: Geometry.isValid |
isValid | public boolean isValid()(Code) | | Tests the validity of this Geometry .
Subclasses provide their own definition of "valid".
true if this Geometry is valid See Also: IsValidOp |
isWithinDistance | public boolean isWithinDistance(Geometry geom, double distance)(Code) | | Tests whether the distance from this Geometry
to another is less than or equal to a specified value.
Parameters: geom - the Geometry to check the distance to Parameters: distance - the distance value to compare true if the geometries are less than distance apart. |
normalize | abstract public void normalize()(Code) | | Converts this Geometry to normal form (or
canonical form ). Normal form is a unique representation for Geometry
s. It can be used to test whether two Geometry 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.
|
overlaps | public boolean overlaps(Geometry g)(Code) | | Returns true if this geometry overlaps the
specified geometry.
The overlaps predicate has the following equivalent definitions:
- The geometries have some but not all points in common,
they have the same dimension,
and the intersection of the interiors of the two geometries has
the same dimension as the geometries themselves.
- The DE-9IM Intersection Matrix for the two geometries is
T*T***T** (for two points or two surfaces)
or 1*T***T** (for two curves)
If the geometries are of different dimension this predicate returns false .
Parameters: g - the Geometry with which to compare this Geometry true if the two Geometry s overlap. |
relate | public boolean relate(Geometry g, String intersectionPattern)(Code) | | Returns true if the elements in the DE-9IM
IntersectionMatrix for the two Geometry s match the elements in intersectionPattern .
The pattern is a 9-character string, with symbols drawn from the following set:
- 0 (dimension 0)
- 1 (dimension 1)
- 2 (dimension 2)
- T ( matches 0, 1 or 2)
- F ( matches FALSE)
- * ( matches any value)
For more information on the DE-9IM, see the OpenGIS Simple Features
Specification.
Parameters: other - the Geometry with which to comparethis Geometry Parameters: intersectionPattern - the pattern against which to check theintersection matrix for the two Geometry s true if the DE-9IM intersectionmatrix for the two Geometry s match intersectionPattern See Also: IntersectionMatrix |
setSRID | public void setSRID(int SRID)(Code) | | Sets the ID of the Spatial Reference System used by the Geometry .
|
setUserData | public void setUserData(Object userData)(Code) | | A simple scheme for applications to add their own custom data to a Geometry.
An example use might be to add an object representing a Coordinate Reference System.
Note that user data objects are not present in geometries created by
construction methods.
Parameters: userData - an object, the semantics for which are defined by theapplication using this Geometry |
symDifference | public Geometry symDifference(Geometry other)(Code) | | Returns a set combining the points in this Geometry not in
other , and the points in other not in this
Geometry . This method returns the closure of the resultant
Geometry .
Parameters: other - the Geometry with which to compute the symmetricdifference the point set symmetric difference of this Geometry with other throws: TopologyException - if a robustness error occurs throws: IllegalArgumentException - if either input is a non-empty GeometryCollection |
toText | public String toText()(Code) | | Returns the Well-known Text representation of this Geometry .
For a definition of the Well-known Text format, see the OpenGIS Simple
Features Specification.
the Well-known Text representation of this Geometry |
touches | public boolean touches(Geometry g)(Code) | | Returns true if this geometry touches the
specified geometry.
The touches predicate has the following equivalent definitions:
- The geometries have at least one point in common, but their interiors do not intersect.
- The DE-9IM Intersection Matrix for the two geometries is
FT*******, F**T***** or F***T****
If both geometries have dimension 0, this predicate returns false
Parameters: g - the Geometry with which to compare this Geometry true if the two Geometry s touch;Returns false if both Geometry s are points |
union | public Geometry union(Geometry other)(Code) | | Computes a Geometry representing all the points in this Geometry
and other .
Parameters: other - the Geometry with which to compute the union a set combining the points of this Geometry andthe points of other throws: TopologyException - if a robustness error occurs throws: IllegalArgumentException - if either input is a non-empty GeometryCollection |
within | public boolean within(Geometry g)(Code) | | Returns true if this geometry is within the
specified geometry.
The within predicate has the following equivalent definitions:
- Every point of this geometry is a point of the other geometry,
and the interiors of the two geometries have at least one point in common.
- The DE-9IM Intersection Matrix for the two geometries is T*F**F***
g.contains(this)
(within is the inverse of contains )
An implication of the definition is that
"The boundary of a Polygon is not within the Polygon".
In other words, if a geometry G is a subset of
the points in the boundary of a polygon P, G.within(P) = false
Parameters: g - the Geometry with which to compare this Geometry true if this Geometry is withinother See Also: Geometry.contains |
|
|