| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectcom.vividsolutions.jts.geom.Geometrypublic abstract class Geometryextends java.lang.Objectimplements Cloneable, Comparable, SerializableGeometryCollections 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 int |
|
protected Envelope |
|
Constructor Summary | |
| |
Method Summary | |
abstract void |
|
abstract void |
|
abstract void |
|
Geometry |
|
Geometry |
|
Geometry |
|
protected void |
|
Object |
|
protected int |
|
int |
|
int |
|
protected abstract int |
|
protected abstract int |
|
protected abstract Envelope |
|
boolean | |
Geometry |
|
boolean | |
boolean | |
boolean | |
Geometry |
|
boolean | |
double | |
protected boolean |
|
boolean | |
boolean |
|
abstract boolean |
|
void |
|
protected void |
|
double |
|
abstract Geometry |
|
abstract int |
|
Point |
|
abstract Coordinate |
|
abstract Coordinate[] |
|
abstract int |
|
Geometry |
|
Envelope |
|
GeometryFactory |
|
Geometry |
|
abstract String |
|
Point |
|
double |
|
int |
|
abstract int |
|
PrecisionModel |
|
int |
|
Object |
|
protected static boolean |
|
protected static boolean |
|
Geometry |
|
boolean |
|
abstract boolean |
|
protected boolean |
|
boolean | |
abstract boolean | |
boolean |
|
boolean |
|
abstract void |
|
boolean | |
IntersectionMatrix |
|
boolean |
|
void |
|
void |
|
Geometry |
|
String |
|
String |
|
boolean | |
Geometry | |
boolean | |
public abstract 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 abstract 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 abstract void apply(GeometryFilter filter)
Performs an operation with or on thisGeometryand its subelementGeometrys (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).
public Geometry buffer(double distance)
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 radiusabs(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)
- Returns:
- an area geometry representing the buffer region
- See Also:
buffer(double,int),buffer(double,int,int)
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. Buffer area boundaries can contain circular arcs. To represent these arcs using linear geometry they must be approximated with line segments. ThequadrantSegmentsargument 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)quadrantSegments- the number of line segments used to represent a quadrant of a circle
- Returns:
- an area geometry representing the buffer region
- See Also:
buffer(double),buffer(double,int,int)
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. ThequadrantSegmentsargument 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)quadrantSegments- the number of line segments used to represent a quadrant of a circleendCapStyle- the end cap style to use
- Returns:
- an area geometry representing the buffer region
- See Also:
buffer(double),buffer(double,int),BufferOp
protected void checkNotGeometryCollection(Geometry g)
Throws an exception ifg's class isGeometryCollection. (Its subclasses do not trigger an exception).
- Parameters:
g- theGeometryto check
public Object clone()
protected int compare(Collection a,
Collection b)Returns the first non-zero result ofcompareToencountered as the twoCollections 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. Ifbcompletes beforea, a positive number is returned; if a before b, a negative number.
- Parameters:
a- aCollectionofComparablesb- aCollectionofComparables
- Returns:
- the first non-zero
compareToresult, if any; otherwise, zero
public int compareTo(Object o)
Returns whether thisGeometryis greater than, equal to, or less than anotherGeometry. If their classes are different, they are compared using the following ordering:If the two
- Point (lowest)
- MultiPoint
- LineString
- LinearRing
- MultiLineString
- Polygon
- MultiPolygon
- GeometryCollection (highest)
Geometrys have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.
- Parameters:
o- aGeometrywith which to compare 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
public int compareTo(Object o,
CoordinateSequenceComparator comp)Returns whether thisGeometryis greater than, equal to, or less than anotherGeometry, using the givenCoordinateSequenceComparator. If their classes are different, they are compared using the following ordering:If the two
- Point (lowest)
- MultiPoint
- LineString
- LinearRing
- MultiLineString
- Polygon
- MultiPolygon
- GeometryCollection (highest)
Geometrys have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.
- Parameters:
o- aGeometrywith which to compare thisGeometrycomp- 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 abstract int compareToSameClass(Object o)
Returns whether thisGeometryis greater than, equal to, or less than anotherGeometryhaving the same class.
- Parameters:
o- aGeometryhaving 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 abstract int compareToSameClass(Object o,
CoordinateSequenceComparator comp)Returns whether thisGeometryis greater than, equal to, or less than anotherGeometryof the same class. using the givenCoordinateSequenceComparator.
- Parameters:
o- aGeometryhaving the same class as thisGeometrycomp- 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 abstract Envelope computeEnvelopeInternal()
Returns the minimum and maximum x and y values in thisGeometry, or a nullEnvelopeif thisGeometryis empty. UnlikegetEnvelopeInternal, this method calculates theEnvelopeeach time it is called;getEnvelopeInternalcaches the result of this method.
- Returns:
- this
Geometrys bounding box; if theGeometryis empty,Envelope#isNullwill returntrue
public boolean contains(Geometry g)
Returnstrueif this geometry contains the specified geometry. Thecontainspredicate has the following equivalent definitions: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,
- 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)(containsis the inverse ofwithin)P.contains(G) = false
- Parameters:
g- theGeometrywith which to compare thisGeometry
- Returns:
trueif thisGeometrycontainsg
- See Also:
within(Geometry)
public Geometry convexHull()
Computes the smallest convexPolygonthat contains all the points in theGeometry. This obviously applies only toGeometrys which contain 3 or more points; the results for degenerate cases are specified as follows:
Number of Points in argumentGeometryGeometryclass of result0 empty GeometryCollection1 Point2 LineString3 or more Polygon
- Returns:
- the minimum-area convex polygon containing this
Geometry' s points
public boolean coveredBy(Geometry g)
Returnstrueif this geometry is covered by the specified geometry. ThecoveredBypredicate has the following equivalent definitions:Note the difference between
- 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)(coveredByis the inverse ofcovers)coveredByandwithin-coveredByis a more inclusive relation
- Parameters:
g- theGeometrywith which to compare thisGeometry
- Returns:
trueif thisGeometryis covered byg
- See Also:
within(Geometry),covers(Geometry)
public boolean covers(Geometry g)
Returnstrueif this geometry covers the specified geometry. Thecoverspredicate has the following equivalent definitions:Note the difference between
- 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)(coversis the inverse ofcoverdBy)coversandcontains-coversis a more inclusive relation. In particular, unlikecontainsit does not distinguish between points in the boundary and in the interior of geometries. For most situations,coversshould be used in preference tocontains. As an added benefit,coversis more amenable to optimization, and hence should be more performant.
- Parameters:
g- theGeometrywith which to compare thisGeometry
- Returns:
trueif thisGeometrycoversg
- See Also:
contains(Geometry),coveredBy(Geometry)
public boolean crosses(Geometry g)
Returnstrueif this geometry crosses the specified geometry. Thecrossespredicate has the following equivalent definitions:For any other combination of dimensions this predicate returns
- 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)
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- theGeometrywith which to compare thisGeometry
- Returns:
trueif the twoGeometrys cross.
public Geometry difference(Geometry other)
Computes aGeometryrepresenting the points making up thisGeometrythat do not make upother. This method returns the closure of the resultantGeometry.
- Parameters:
other- theGeometrywith which to compute the difference
- Returns:
- the point set difference of this
Geometrywithother
public boolean disjoint(Geometry g)
Returnstrueif this geometry is disjoint to the specified geometry. Thedisjointpredicate 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)(disjointis the inverse ofintersects)
- Parameters:
g- theGeometrywith which to compare thisGeometry
- Returns:
trueif the twoGeometrys are disjoint
- See Also:
intersects(Geometry)
public double distance(Geometry g)
Returns the minimum distance between thisGeometryand theGeometryg
- Parameters:
g- theGeometryfrom which to compute the distance
public boolean equals(Geometry g)
Returnstrueif this geometry is equal to the specified geometry. Theequalspredicate 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:
- Returns:
trueif the twoGeometrys are equal
public boolean equalsExact(Geometry other)
Returns true if the twoGeometrys are exactly equal. Two Geometries are exactly equal iff:If this and the other
- they have the same class
- they have the same values of Coordinates in their internal Coordinate lists, in exactly the same order.
Geometrys are composites and any children are notGeometrys, returns false. This provides a stricter test of equality thanequals.
- Parameters:
other- theGeometrywith which to compare thisGeometry
- Returns:
trueif this and the otherGeometryare of the same class and have equal internal data.
public abstract boolean equalsExact(Geometry other, double tolerance)
Returns true if the twoGeometrys 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.
Geometrys are composites and any children are notGeometrys, returnsfalse.
- Parameters:
other- theGeometrywith which to compare thisGeometry
- Returns:
trueif this and the otherGeometryare of the same class and have equal internal data.
public void geometryChanged()
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 itsEnvelope).
protected void geometryChangedAction()
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:
apply(GeometryComponentFilter)
public double getArea()
Returns the area of thisGeometry. Areal Geometries have a non-zero area. They override this function to compute the area. Others return 0.0
- Returns:
- the area of the Geometry
public abstract Geometry getBoundary()
Returns the boundary, or the empty geometry if thisGeometryis 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."
- Returns:
- the closure of the combinatorial boundary of this
Geometry
public abstract int getBoundaryDimension()
Returns the dimension of thisGeometrys inherent boundary.
- Returns:
- the dimension of the boundary of the class implementing this interface, whether or not this object is the empty geometry. Returns
Dimension.FALSEif the boundary is the empty geometry.
public Point getCentroid()
Computes the centroid of thisGeometry. 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)
- Returns:
- a
Pointwhich is the centroid of this Geometry
public abstract Coordinate getCoordinate()
Returns a vertex of thisGeometry.
- Returns:
- a
Coordinatewhich is a vertex of thisGeometry. Returnsnullif this Geometry is empty
public abstract Coordinate[] getCoordinates()
Returns thisGeometrys vertices. If you modify the coordinates in this array, be sure to call #geometryChanged afterwards. TheGeometrys contained by compositeGeometrys must be Geometry's; that is, they must implementgetCoordinates.
- Returns:
- the vertices of this
Geometry
public abstract int getDimension()
Returns the dimension of thisGeometry.
- Returns:
- the dimension of the class implementing this interface, whether or not this object is the empty geometry
public Geometry getEnvelope()
Returns thisGeometrys bounding box. If thisGeometryis the empty geometry, returns an emptyPoint. If theGeometryis a point, returns a non-emptyPoint. Otherwise, returns aPolygonwhose points are (minx, miny), (maxx, miny), (maxx, maxy), (minx, maxy), (minx, miny).
- Returns:
- an empty
Point(for emptyGeometrys), aPoint(forPoints) or aPolygon(in all other cases)
public Envelope getEnvelopeInternal()
Returns the minimum and maximum x and y values in thisGeometry, or a nullEnvelopeif thisGeometryis empty.
- Returns:
- this
Geometrys bounding box; if theGeometryis empty,Envelope#isNullwill returntrue
public GeometryFactory getFactory()
Gets the factory which contains the context in which this geometry was created.
- Returns:
- the factory for this geometry
public Geometry getGeometryN(int n)
Returns an elementGeometryfrom aGeometryCollection(orthis, if the geometry is not a collection).
- Parameters:
n- the index of the geometry element
- Returns:
- the n'th geometry contained in this geometry
public abstract String getGeometryType()
Returns the name of this object'scom.vivid.jts.geominterface.
- Returns:
- the name of this
Geometrys most specificcom.vividsolutions.jts.geominterface
public Point getInteriorPoint()
Computes an interior point of thisGeometry. 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.
- Returns:
- a
Pointwhich is in the interior of this Geometry
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 ofGeometrys in aGeometryCollection(or 1, if the geometry is not a collection).
- Returns:
- the number of geometries contained in this geometry
public abstract int getNumPoints()
Returns the count of thisGeometrys vertices. TheGeometrys contained by compositeGeometrys must be Geometry's; that is, they must implementgetNumPoints
- Returns:
- the number of vertices in this
Geometry
public PrecisionModel getPrecisionModel()
Returns thePrecisionModelused by theGeometry.
- Returns:
- the specification of the grid of allowable points, for this
Geometryand all otherGeometrys
public int getSRID()
Returns the ID of the Spatial Reference System used by theGeometry. JTS supports Spatial Reference System information in the simple way defined in the SFS. A Spatial Reference System ID (SRID) is present in eachGeometryobject.Geometryprovides basic accessor operations for this field, but no others. The SRID is represented as an integer.
- Returns:
- the ID of the coordinate space in which the
Geometryis defined.
public Object getUserData()
Gets the user data object for this geometry, if any.
- Returns:
- the user data object, or
nullif none set
protected static boolean hasNonEmptyElements(Geometry[] geometries)
Returns true if the array contains any non-emptyGeometrys.
- Parameters:
geometries- an array ofGeometrys; no elements may benull
- Returns:
trueif any of theGeometrysisEmptymethods returnfalse
protected static boolean hasNullElements(Object[] array)
Returns true if the array contains anynullelements.
- Parameters:
array- an array to validate
- Returns:
trueif any ofarrays elements arenull
public Geometry intersection(Geometry other)
Computes aGeometryrepresenting the points shared by thisGeometryandother.
- Parameters:
other- theGeometrywith which to compute the intersection
- Returns:
- the points common to the two
Geometrys
public boolean intersects(Geometry g)
Returnstrueif this geometry intersects the specified geometry. Theintersectspredicate has the following equivalent definitions:
- The two geometries have at least one point in common
- !
g.disjoint(this)(intersectsis the inverse ofdisjoint)
- Parameters:
g- theGeometrywith which to compare thisGeometry
- Returns:
trueif the twoGeometrys intersect
- See Also:
disjoint(Geometry)
public abstract boolean isEmpty()
Returns whether or not the set of points in thisGeometryis empty.
- Returns:
trueif thisGeometryequals the empty geometry
protected boolean isEquivalentClass(Geometry other)
Returns whether the twoGeometrys are equal, from the point of view of theequalsExactmethod. Called byequalsExact. In general, twoGeometryclasses are considered to be "equivalent" only if they are the same class. An exception isLineString, which is considered to be equivalent to its subclasses.
- Parameters:
other- theGeometrywith which to compare thisGeometryfor equality
- Returns:
trueif the classes of the twoGeometrys are considered to be equal by theequalsExactmethod.
public boolean isRectangle()
public abstract boolean isSimple()
Tests whether thisGeometryis 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.
Geometrysubclass as follows:
- Valid polygonal geometries are simple by definition, so
isSimpletrivially 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
Geometrys are always simple
- Returns:
trueif thisGeometryhas any points of self-tangency, self-intersection or other anomalous points
- See Also:
isValid()
public boolean isValid()
Tests the validity of thisGeometry. Subclasses provide their own definition of "valid".
- Returns:
trueif thisGeometryis valid
- See Also:
IsValidOp
public boolean isWithinDistance(Geometry geom, double distance)
Tests whether the distance from thisGeometryto another is less than or equal to a specified value.
- Parameters:
geom- the Geometry to check the distance todistance- the distance value to compare
- Returns:
trueif the geometries are less thandistanceapart.
public abstract void normalize()
Converts thisGeometryto normal form (or canonical form ). Normal form is a unique representation forGeometrys. It can be used to test whether twoGeometrys 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 boolean overlaps(Geometry g)
Returnstrueif this geometry overlaps the specified geometry. Theoverlapspredicate has the following equivalent definitions:If the geometries are of different dimension this predicate returns
- 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) or1*T***T**(for two curves)false.
- Parameters:
g- theGeometrywith which to compare thisGeometry
- Returns:
trueif the twoGeometrys overlap.
public IntersectionMatrix relate(Geometry g)
Returns the DE-9IMIntersectionMatrixfor the twoGeometrys.
- Parameters:
- Returns:
- an
IntersectionMatrixdescribing the intersections of the interiors, boundaries and exteriors of the twoGeometrys
public boolean relate(Geometry g, String intersectionPattern)
Returnstrueif the elements in the DE-9IMIntersectionMatrixfor the twoGeometrys match the elements inintersectionPattern. The pattern is a 9-character string, with symbols drawn from the following set:For more information on the DE-9IM, see the OpenGIS Simple Features Specification.
- 0 (dimension 0)
- 1 (dimension 1)
- 2 (dimension 2)
- T ( matches 0, 1 or 2)
- F ( matches FALSE)
- * ( matches any value)
- Parameters:
intersectionPattern- the pattern against which to check the intersection matrix for the twoGeometrys
- Returns:
trueif the DE-9IM intersection matrix for the twoGeometrys matchintersectionPattern
- See Also:
IntersectionMatrix
public void setSRID(int SRID)
Sets the ID of the Spatial Reference System used by theGeometry.
public void setUserData(Object userData)
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 the application using this Geometry
public Geometry symDifference(Geometry other)
Returns a set combining the points in thisGeometrynot inother, and the points inothernot in thisGeometry. This method returns the closure of the resultantGeometry.
- Parameters:
other- theGeometrywith which to compute the symmetric difference
- Returns:
- the point set symmetric difference of this
Geometrywithother
public String toString()
public String toText()
Returns the Well-known Text representation of thisGeometry. For a definition of the Well-known Text format, see the OpenGIS Simple Features Specification.
- Returns:
- the Well-known Text representation of this
Geometry
public boolean touches(Geometry g)
Returnstrueif this geometry touches the specified geometry. Thetouchespredicate has the following equivalent definitions:If both geometries have dimension 0, this predicate returns
- 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****
false
- Parameters:
g- theGeometrywith which to compare thisGeometry
- Returns:
trueif the twoGeometrys touch; Returnsfalseif bothGeometrys are points
public Geometry union(Geometry other)
Computes aGeometryrepresenting all the points in thisGeometryandother.
- Parameters:
other- theGeometrywith which to compute the union
- Returns:
- a set combining the points of this
Geometryand the points ofother
public boolean within(Geometry g)
Returnstrueif this geometry is within the specified geometry. Thewithinpredicate has the following equivalent definitions: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,
- 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)(withinis the inverse ofcontains)G.within(P) = false
- Parameters:
g- theGeometrywith which to compare thisGeometry
- Returns:
trueif thisGeometryis withinother
- See Also:
contains(Geometry)