com.vividsolutions.jts.geom.prep
Interface PreparedGeometry

All Known Implementing Classes:
BasicPreparedGeometry

public interface PreparedGeometry

An interface for classes which prepare Geometrys in order to optimize the performance of repeated calls to specific geometric operations.

A given implementation may provide optimized implementations for only some of the specified methods, and delegate the remaining methods to the original Geometry operations. An implementation may also only optimize certain situations, and delegate others. See the implementing classes for documentation about which methods and situations they optimize.

Author:
Martin Davis

Method Summary
 boolean contains(Geometry geom)
          Tests whether the base Geometry contains a given geometry.
 boolean containsProperly(Geometry geom)
          Tests whether the base Geometry contains a given geometry.
 boolean coveredBy(Geometry geom)
          Tests whether the base Geometry is covered by a given geometry.
 boolean covers(Geometry geom)
          Tests whether the base Geometry covers a given geometry.
 boolean crosses(Geometry geom)
          Tests whether the base Geometry crosses a given geometry.
 boolean disjoint(Geometry geom)
          Tests whether the base Geometry is disjoint from a given geometry.
 Geometry getGeometry()
          Gets the original Geometry which has been prepared.
 boolean intersects(Geometry geom)
          Tests whether the base Geometry intersects a given geometry.
 boolean overlaps(Geometry geom)
          Tests whether the base Geometry overlaps a given geometry.
 boolean touches(Geometry geom)
          Tests whether the base Geometry touches a given geometry.
 boolean within(Geometry geom)
          Tests whether the base Geometry is within a given geometry.
 

Method Detail

getGeometry

public Geometry getGeometry()
Gets the original Geometry which has been prepared.

Returns:
the base geometry

contains

public boolean contains(Geometry geom)
Tests whether the base Geometry contains a given geometry.

Parameters:
geom - the Geometry to test
Returns:
true if this Geometry contains the given Geometry
See Also:
Geometry.contains(Geometry)

containsProperly

public boolean containsProperly(Geometry geom)
Tests whether the base Geometry contains a given geometry.

The containsProperly predicate has the following equivalent definitions:

The advantage to using this predicate is that it can be computed efficiently, with no need to compute topology at individual points.

An example use case for this predicate is computing the intersections of a set of geometries with a large polygonal geometry. Since intersection is a fairly slow operation, it can be more efficient to use containsProperly to filter out test geometries which lie wholly inside the area. In these cases the intersection known a priori to be simply the original test geometry.

Parameters:
geom - the Geometry to test
Returns:
true if this Geometry properly contains the given Geometry

coveredBy

public boolean coveredBy(Geometry geom)
Tests whether the base Geometry is covered by a given geometry.

Parameters:
geom - the Geometry to test
Returns:
true if this Geometry is covered by the given Geometry
See Also:
Geometry.coveredBy(Geometry)

covers

public boolean covers(Geometry geom)
Tests whether the base Geometry covers a given geometry.

Parameters:
geom - the Geometry to test
Returns:
true if this Geometry covers the given Geometry
See Also:
Geometry.covers(Geometry)

crosses

public boolean crosses(Geometry geom)
Tests whether the base Geometry crosses a given geometry.

Parameters:
geom - the Geometry to test
Returns:
true if this Geometry crosses the given Geometry
See Also:
Geometry.crosses(Geometry)

disjoint

public boolean disjoint(Geometry geom)
Tests whether the base Geometry is disjoint from a given geometry. This method supports GeometryCollections as input

Parameters:
geom - the Geometry to test
Returns:
true if this Geometry is disjoint from the given Geometry
See Also:
Geometry.disjoint(Geometry)

intersects

public boolean intersects(Geometry geom)
Tests whether the base Geometry intersects a given geometry. This method supports GeometryCollections as input

Parameters:
geom - the Geometry to test
Returns:
true if this Geometry intersects the given Geometry
See Also:
Geometry.intersects(Geometry)

overlaps

public boolean overlaps(Geometry geom)
Tests whether the base Geometry overlaps a given geometry.

Parameters:
geom - the Geometry to test
Returns:
true if this Geometry overlaps the given Geometry
See Also:
Geometry.overlaps(Geometry)

touches

public boolean touches(Geometry geom)
Tests whether the base Geometry touches a given geometry.

Parameters:
geom - the Geometry to test
Returns:
true if this Geometry touches the given Geometry
See Also:
Geometry.touches(Geometry)

within

public boolean within(Geometry geom)
Tests whether the base Geometry is within a given geometry.

Parameters:
geom - the Geometry to test
Returns:
true if this Geometry is within the given Geometry
See Also:
Geometry.within(Geometry)