Java Doc for Geometry.java in  » GIS » jts » com » vividsolutions » jts » geom » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » jts » com.vividsolutions.jts.geom 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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 GeometryCollections would be useful, GeometryCollections 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 GeometryCollections 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 Geometrys 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 LineStrings. It means that all intersection points on LineStrings will be present as endpoints of LineStrings 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 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.
version:
   1.7



Field Summary
protected  intSRID
    
protected  Envelopeenvelope
     The bounding box of this Geometry.
final protected  GeometryFactoryfactory
    

Constructor Summary
public  Geometry(GeometryFactory factory)
     Creates a new Geometry via the specified GeometryFactory.

Method Summary
abstract public  voidapply(CoordinateFilter filter)
     Performs an operation with or on this Geometry's coordinates.
abstract public  voidapply(CoordinateSequenceFilter filter)
     Performs an operation on the coordinates in this Geometry's CoordinateSequence s.
abstract public  voidapply(GeometryFilter filter)
     Performs an operation with or on this Geometry and its subelement Geometrys (if any).
abstract public  voidapply(GeometryComponentFilter filter)
     Performs an operation with or on this Geometry and its component Geometry's.
public  Geometrybuffer(double distance)
     Computes a buffer area around this geometry having the given width.
public  Geometrybuffer(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  Geometrybuffer(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  voidcheckNotGeometryCollection(Geometry g)
     Throws an exception if g's class is GeometryCollection .
public  Objectclone()
     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  intcompare(Collection a, Collection b)
     Returns the first non-zero result of compareTo encountered as the two Collections are iterated over.
public  intcompareTo(Object o)
     Returns whether this Geometry is greater than, equal to, or less than another Geometry.
public  intcompareTo(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 Geometrys have the same class, their first elements are compared.
abstract protected  intcompareToSameClass(Object o)
     Returns whether this Geometry is greater than, equal to, or less than another Geometry having the same class.
abstract protected  intcompareToSameClass(Object o, CoordinateSequenceComparator comp)
     Returns whether this Geometry is greater than, equal to, or less than another Geometry of the same class.
abstract protected  EnvelopecomputeEnvelopeInternal()
     Returns the minimum and maximum x and y values in this Geometry , or a null Envelope if this Geometry is empty.
public  booleancontains(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  GeometryconvexHull()
     Computes the smallest convex Polygon that contains all the points in the Geometry.
public  booleancoveredBy(Geometry g)
     Returns true if this geometry is covered by the specified geometry.
public  booleancovers(Geometry g)
     Returns true if this geometry covers the specified geometry.
public  booleancrosses(Geometry g)
     Returns true if this geometry crosses the specified geometry.
public  Geometrydifference(Geometry other)
     Computes a Geometry representing the points making up this Geometry that do not make up other.
public  booleandisjoint(Geometry g)
     Returns true if this geometry is disjoint to the specified geometry.
public  doubledistance(Geometry g)
    
protected  booleanequal(Coordinate a, Coordinate b, double tolerance)
    
public  booleanequals(Geometry g)
     Returns true if this geometry is equal to the specified geometry.
abstract public  booleanequalsExact(Geometry other, double tolerance)
     Returns true if the two Geometrys are exactly equal, up to a specified distance tolerance.
public  booleanequalsExact(Geometry other)
     Returns true if the two Geometrys are exactly equal.
public  voidgeometryChanged()
     Notifies this Geometry that its Coordinates have been changed by an external party (using a CoordinateFilter, for example).
protected  voidgeometryChangedAction()
     Notifies this Geometry that its Coordinates have been changed by an external party.
public  doublegetArea()
     Returns the area of this Geometry.
abstract public  GeometrygetBoundary()
     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  intgetBoundaryDimension()
     Returns the dimension of this Geometrys inherent boundary. the dimension of the boundary of the class implementing thisinterface, whether or not this object is the empty geometry.
public  PointgetCentroid()
     Computes the centroid of this Geometry.
abstract public  CoordinategetCoordinate()
     Returns a vertex of this Geometry.
abstract public  Coordinate[]getCoordinates()
     Returns this Geometry s vertices.
abstract public  intgetDimension()
     Returns the dimension of this Geometry.
public  GeometrygetEnvelope()
     Returns this Geometrys bounding box.
public  EnvelopegetEnvelopeInternal()
     Returns the minimum and maximum x and y values in this Geometry , or a null Envelope if this Geometry is empty.
public  GeometryFactorygetFactory()
     Gets the factory which contains the context in which this geometry was created.
public  GeometrygetGeometryN(int n)
     Returns an element Geometry from a GeometryCollection (or this, if the geometry is not a collection).
abstract public  StringgetGeometryType()
     Returns the name of this object's com.vivid.jts.geom interface.
public  PointgetInteriorPoint()
     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  doublegetLength()
     Returns the length of this Geometry.
public  intgetNumGeometries()
     Returns the number of Geometry s in a GeometryCollection (or 1, if the geometry is not a collection).
abstract public  intgetNumPoints()
     Returns the count of this Geometrys vertices.
public  PrecisionModelgetPrecisionModel()
     Returns the PrecisionModel used by the Geometry.
public  intgetSRID()
     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  ObjectgetUserData()
     Gets the user data object for this geometry, if any.
protected static  booleanhasNonEmptyElements(Geometry[] geometries)
     Returns true if the array contains any non-empty Geometrys.
protected static  booleanhasNullElements(Object[] array)
     Returns true if the array contains any null elements.
public  Geometryintersection(Geometry other)
     Computes a Geometry representing the points shared by this Geometry and other.
public  booleanintersects(Geometry g)
     Returns true if this geometry intersects the specified geometry.
abstract public  booleanisEmpty()
     Returns whether or not the set of points in this Geometry is empty.
protected  booleanisEquivalentClass(Geometry other)
     Returns whether the two Geometrys are equal, from the point of view of the equalsExact method.
public  booleanisRectangle()
    
public  booleanisSimple()
     Tests whether this Geometry is simple.
public  booleanisValid()
     Tests the validity of this Geometry.
public  booleanisWithinDistance(Geometry geom, double distance)
     Tests whether the distance from this Geometry to another is less than or equal to a specified value.
abstract public  voidnormalize()
     Converts this Geometry to normal form (or canonical form ).
public  booleanoverlaps(Geometry g)
     Returns true if this geometry overlaps the specified geometry.
public  booleanrelate(Geometry g, String intersectionPattern)
     Returns true if the elements in the DE-9IM IntersectionMatrix for the two Geometrys match the elements in intersectionPattern.
public  IntersectionMatrixrelate(Geometry g)
     Returns the DE-9IM IntersectionMatrix for the two Geometrys.
public  voidsetSRID(int SRID)
     Sets the ID of the Spatial Reference System used by the Geometry.
public  voidsetUserData(Object userData)
     A simple scheme for applications to add their own custom data to a Geometry.
public  GeometrysymDifference(Geometry other)
     Returns a set combining the points in this Geometry not in other, and the points in other not in this Geometry.
public  StringtoString()
    
public  StringtoText()
     Returns the Well-known Text representation of this Geometry.
public  booleantouches(Geometry g)
     Returns true if this geometry touches the specified geometry.
public  Geometryunion(Geometry other)
     Computes a Geometry representing all the points in this Geometry and other.
public  booleanwithin(Geometry g)
     Returns true if this geometry is within the specified geometry.

Field Detail
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.



factory
final protected GeometryFactory factory(Code)
The GeometryFactory used to create this Geometry




Constructor Detail
Geometry
public Geometry(GeometryFactory factory)(Code)
Creates a new Geometry via the specified GeometryFactory.
Parameters:
  factory -




Method Detail
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 Geometrys (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 GeometryCollectionbut 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 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.
Parameters:
  a - a Collection of Comparables
Parameters:
  b - a Collection of Comparables 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 Geometrys 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 Geometrys 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 Geometrys bounding box; if the Geometryis 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 Points 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 Geometrys 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 Geometrys 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



equal
protected boolean equal(Coordinate a, Coordinate b, double tolerance)(Code)



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 Geometrys are equal



equalsExact
abstract public boolean equalsExact(Geometry other, double tolerance)(Code)
Returns true if the two Geometrys 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 Geometrys are composites and any children are not Geometrys, returns false.
Parameters:
  other - the Geometry with which to compare this Geometry true if this and the other Geometryare of the same class and have equal internal data.



equalsExact
public boolean equalsExact(Geometry other)(Code)
Returns true if the two Geometrys 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 Geometrys are composites and any children are not Geometrys, 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 Geometryare 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 Geometrys 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 Geometrys contained by composite Geometrys 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 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). an empty Point (for empty Geometrys), aPoint (for Points) 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 Geometrys bounding box; if the Geometryis 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 Geometrys most specific com.vividsolutions.jts.geominterface



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 Geometrys vertices. The Geometry s contained by composite Geometrys 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 Geometrys



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 Geometryis 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 Geometrys.
Parameters:
  geometries - an array of Geometrys; no elements may benull true if any of the GeometrysisEmpty 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 arrays 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 Geometrys
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 Geometrys 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 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.
Parameters:
  other - the Geometry with which to compare this Geometryfor equality true if the classes of the two Geometrys 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 Geometrys 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 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.



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 Geometrys overlap.



relate
public boolean relate(Geometry g, String intersectionPattern)(Code)
Returns true if the elements in the DE-9IM IntersectionMatrix for the two Geometrys 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 Geometrys true if the DE-9IM intersectionmatrix for the two Geometrys match intersectionPattern
See Also:   IntersectionMatrix



relate
public IntersectionMatrix relate(Geometry g)(Code)
Returns the DE-9IM IntersectionMatrix for the two Geometrys.
Parameters:
  other - the Geometry with which to compare this Geometry an IntersectionMatrix describing the intersections of the interiors,boundaries and exteriors of the two Geometrys



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 Geometrywith other
throws:
  TopologyException - if a robustness error occurs
throws:
  IllegalArgumentException - if either input is a non-empty GeometryCollection



toString
public String toString()(Code)



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 Geometrys touch;Returns false if both Geometrys 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



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.