geos::geom::prep::PreparedGeometry Class Referenceabstract

An interface for classes which prepare `Geometry`s in order to optimize the performance of repeated calls to specific geometric operations. More...

`#include <PreparedGeometry.h>`

Inheritance diagram for geos::geom::prep::PreparedGeometry:

## Public Member Functions

virtual const geom::Geometry & | getGeometry () const =0
| Gets the original `Geometry` which has been prepared.
virtual bool | contains (const geom::Geometry *geom) const =0
| Tests whether the base `Geometry` contains a given geometry.
virtual bool | containsProperly (const geom::Geometry *geom) const =0
| Tests whether the base `Geometry` properly contains a given geometry.
virtual bool | coveredBy (const geom::Geometry *geom) const =0
| Tests whether the base `Geometry` is covered by a given geometry.
virtual bool | covers (const geom::Geometry *geom) const =0
| Tests whether the base `Geometry` covers a given geometry.
virtual bool | crosses (const geom::Geometry *geom) const =0
| Tests whether the base `Geometry` crosses a given geometry.
virtual bool | disjoint (const geom::Geometry *geom) const =0
| Tests whether the base `Geometry` is disjoint from a given geometry.
virtual bool | intersects (const geom::Geometry *geom) const =0
| Tests whether the base `Geometry` intersects a given geometry.
virtual bool | overlaps (const geom::Geometry *geom) const =0
| Tests whether the base `Geometry` overlaps a given geometry.
virtual bool | touches (const geom::Geometry *geom) const =0
| Tests whether the base `Geometry` touches a given geometry.
virtual bool | within (const geom::Geometry *geom) const =0
| Tests whether the base `Geometry` is within a given geometry.
virtual std::unique_ptr< geom::CoordinateSequence > | nearestPoints (const geom::Geometry *geom) const =0
| Compute the nearest locations on the base `Geometry` and the given geometry.
virtual double | distance (const geom::Geometry *geom) const =0
| Compute the minimum distance between the base `Geometry` and the given geometry.
virtual bool | isWithinDistance (const geom::Geometry *geom, double dist) const =0
| Tests whether the base `Geometry` is within a given distance from the given geometry.
virtual std::unique_ptr< IntersectionMatrix > | relate (const geom::Geometry *geom) const =0
| Compares the prepared geometry to the given geometry and returns the DE9IM intersection matrix as a string.
virtual bool | relate (const geom::Geometry *geom, const std::string &pat) const =0
| Compares the prepared geometry to the given geometry and the provided DE9IM pattern, and returns true if the pattern is consistent with the relationship between the prepared and provided geometries.

## Detailed Description

An interface for classes which prepare `Geometry`s 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.

## Member Function Documentation

## contains()

virtual bool geos::geom::prep::PreparedGeometry::contains | ( | const geom::Geometry * | geom | ) | const

pure virtual

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)

Implemented in geos::geom::prep::BasicPreparedGeometry, and geos::geom::prep::PreparedPolygon.

## containsProperly()

virtual bool geos::geom::prep::PreparedGeometry::containsProperly | ( | const geom::Geometry * | geom | ) | const

pure virtual

Tests whether the base `Geometry` properly contains a given geometry.

The `containsProperly` predicate has the following equivalent definitions:

- Every point of the other geometry is a point of this geometry's interior.
- The DE-9IM Intersection Matrix for the two geometries matches `[T**FF*FF*]`

In other words, if the test geometry has any interaction with the boundary of the target geometry the result of containsProperly is false. This is different semantics to the `Geometry::contains` predicate, in which test geometries can intersect the target's boundary and still be contained.

The advantage of using this predicate is that it can be computed efficiently, since it avoids the need to compute the full topological relationship of the input boundaries in cases where they intersect.

An example use case 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 is known a priori to be exactly the original test geometry.

Parameters

  geom | the Geometry to test

Returns
  true if this Geometry properly contains the given Geometry

See also
  Geometry::contains

Implemented in geos::geom::prep::BasicPreparedGeometry, and geos::geom::prep::PreparedPolygon.

## coveredBy()

virtual bool geos::geom::prep::PreparedGeometry::coveredBy | ( | const geom::Geometry * | geom | ) | const

pure virtual

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)

Implemented in geos::geom::prep::BasicPreparedGeometry.

## covers()

virtual bool geos::geom::prep::PreparedGeometry::covers | ( | const geom::Geometry * | geom | ) | const

pure virtual

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)

Implemented in geos::geom::prep::BasicPreparedGeometry, and geos::geom::prep::PreparedPolygon.

## crosses()

virtual bool geos::geom::prep::PreparedGeometry::crosses | ( | const geom::Geometry * | geom | ) | const

pure virtual

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)

Implemented in geos::geom::prep::BasicPreparedGeometry.

## disjoint()

virtual bool geos::geom::prep::PreparedGeometry::disjoint | ( | const geom::Geometry * | geom | ) | const

pure virtual

Tests whether the base `Geometry` is disjoint from a given geometry.

Parameters

  geom | the Geometry to test

Returns
  true if this Geometry is disjoint from the given Geometry

See also
  Geometry#disjoint(Geometry)

Implemented in geos::geom::prep::BasicPreparedGeometry.

## distance()

virtual double geos::geom::prep::PreparedGeometry::distance | ( | const geom::Geometry * | geom | ) | const

pure virtual

Compute the minimum distance between the base `Geometry` and the given geometry.

Parameters

  geom | the Geometry to compute the distance to

Returns
  the minimum distance between the two geometries

Implemented in geos::geom::prep::BasicPreparedGeometry, geos::geom::prep::PreparedLineString, and geos::geom::prep::PreparedPolygon.

## getGeometry()

virtual const geom::Geometry & geos::geom::prep::PreparedGeometry::getGeometry | ( |  | ) | const

pure virtual

Gets the original `Geometry` which has been prepared.

Returns
  the base geometry

Implemented in geos::geom::prep::BasicPreparedGeometry.

## intersects()

virtual bool geos::geom::prep::PreparedGeometry::intersects | ( | const geom::Geometry * | geom | ) | const

pure virtual

Tests whether the base `Geometry` intersects a given geometry.

Parameters

  geom | the Geometry to test

Returns
  true if this Geometry intersects the given Geometry

See also
  Geometry#intersects(Geometry)

Implemented in geos::geom::prep::BasicPreparedGeometry, geos::geom::prep::PreparedLineString, geos::geom::prep::PreparedPoint, and geos::geom::prep::PreparedPolygon.

## isWithinDistance()

virtual bool geos::geom::prep::PreparedGeometry::isWithinDistance | ( | const geom::Geometry * | geom,
|  | double | dist ) const

pure virtual

Tests whether the base `Geometry` is within a given distance from the given geometry.

Parameters

  geom | the Geometry to test the distance to
  dist | the distance value to compare

Returns
  true if this Geometry is within the given distance from the given Geometry.

Implemented in geos::geom::prep::BasicPreparedGeometry, geos::geom::prep::PreparedLineString, and geos::geom::prep::PreparedPolygon.

## nearestPoints()

virtual std::unique_ptr< geom::CoordinateSequence > geos::geom::prep::PreparedGeometry::nearestPoints | ( | const geom::Geometry * | geom | ) | const

pure virtual

Compute the nearest locations on the base `Geometry` and the given geometry.

Parameters

  geom | the Geometry to compute the nearest point to

Returns
  true the nearest points

Implemented in geos::geom::prep::BasicPreparedGeometry, and geos::geom::prep::PreparedLineString.

## overlaps()

virtual bool geos::geom::prep::PreparedGeometry::overlaps | ( | const geom::Geometry * | geom | ) | const

pure virtual

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)

Implemented in geos::geom::prep::BasicPreparedGeometry.

## relate() [1/2]

virtual std::unique_ptr< IntersectionMatrix > geos::geom::prep::PreparedGeometry::relate | ( | const geom::Geometry * | geom | ) | const

pure virtual

Compares the prepared geometry to the given geometry and returns the DE9IM intersection matrix as a string.

Parameters

  geom | the Geometry to test the

Returns
  the DE9IM matrix

Implemented in geos::geom::prep::BasicPreparedGeometry.

## relate() [2/2]

virtual bool geos::geom::prep::PreparedGeometry::relate | ( | const geom::Geometry * | geom,
|  | const std::string & | pat ) const

pure virtual

Compares the prepared geometry to the given geometry and the provided DE9IM pattern, and returns true if the pattern is consistent with the relationship between the prepared and provided geometries.

Parameters

  geom | the Geometry to test the distance to
  pat | the DE9IM pattern

Returns
  true if the patterns are consistent

Implemented in geos::geom::prep::BasicPreparedGeometry.

## touches()

virtual bool geos::geom::prep::PreparedGeometry::touches | ( | const geom::Geometry * | geom | ) | const

pure virtual

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)

Implemented in geos::geom::prep::BasicPreparedGeometry.

## within()

virtual bool geos::geom::prep::PreparedGeometry::within | ( | const geom::Geometry * | geom | ) | const

pure virtual

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)

Implemented in geos::geom::prep::BasicPreparedGeometry.

The documentation for this class was generated from the following file:

- PreparedGeometry.h