geos::operation::relateng::RelateNG Class Reference

`#include <RelateNG.h>`

## Public Member Functions

std::unique_ptr< IntersectionMatrix > | evaluate (const Geometry *b)
bool | evaluate (const Geometry *b, const std::string &imPattern)
bool | evaluate (const Geometry *b, TopologyPredicate &predicate)
bool | intersects (const Geometry *a)
bool | crosses (const Geometry *a)
bool | disjoint (const Geometry *a)
bool | touches (const Geometry *a)
bool | within (const Geometry *a)
bool | contains (const Geometry *a)
bool | overlaps (const Geometry *a)
bool | covers (const Geometry *a)
bool | coveredBy (const Geometry *a)
bool | equalsTopo (const Geometry *a)
bool | relate (const Geometry *a, const std::string &pat)
std::unique_ptr< IntersectionMatrix > | relate (const Geometry *a)

## Static Public Member Functions

static bool | relate (const Geometry *a, const Geometry *b, TopologyPredicate &pred)
static bool | relate (const Geometry *a, const Geometry *b, TopologyPredicate &pred, const BoundaryNodeRule &bnRule)
static bool | relate (const Geometry *a, const Geometry *b, const std::string &imPattern)
static std::unique_ptr< IntersectionMatrix > | relate (const Geometry *a, const Geometry *b)
static std::unique_ptr< IntersectionMatrix > | relate (const Geometry *a, const Geometry *b, const BoundaryNodeRule &bnRule)
static std::unique_ptr< RelateNG > | prepare (const Geometry *a)
static std::unique_ptr< RelateNG > | prepare (const Geometry *a, const BoundaryNodeRule &bnRule)
static bool | intersects (const Geometry *a, const Geometry *b)
static bool | crosses (const Geometry *a, const Geometry *b)
static bool | disjoint (const Geometry *a, const Geometry *b)
static bool | touches (const Geometry *a, const Geometry *b)
static bool | within (const Geometry *a, const Geometry *b)
static bool | contains (const Geometry *a, const Geometry *b)
static bool | overlaps (const Geometry *a, const Geometry *b)
static bool | covers (const Geometry *a, const Geometry *b)
static bool | coveredBy (const Geometry *a, const Geometry *b)
static bool | equalsTopo (const Geometry *a, const Geometry *b)

## Detailed Description

Computes the value of topological predicates between two geometries based on the Dimensionally-Extended 9-Intersection Model https://en.wikipedia.org/wiki/DE-9IM (DE-9IM). Standard and custom topological predicates are provided by RelatePredicate.

The RelateNG algorithm has the following capabilities:

- Efficient short-circuited evaluation of topological predicates (including matching custom DE-9IM matrix patterns)
- Optimized repeated evaluation of predicates against a single geometry via cached spatial indexes (AKA "prepared mode")
- Robust computation (only point-local topology is required, so invalid geometry topology does not cause failures)
- GeometryCollection inputs containing mixed types and overlapping polygons are supported, using union semantics.
- Zero-length LineStrings are treated as being topologically identical to Points.
- Support for BoundaryNodeRule.

See IntersectionMatrixPattern for a description of DE-9IM patterns.

If not specified, the standard BoundaryNodeRule::MOD2_BOUNDARY_RULE is used.

RelateNG operates in 2D only; it ignores any Z ordinates.

This implementation replaces RelateOp and PreparedGeometry.

FUTURE WORK

- Support for a distance tolerance to provide "approximate" predicate evaluation

Author
  Martin Davis

See also
  RelateOp
  PreparedGeometry

## Member Function Documentation

## evaluate() [1/3]

std::unique_ptr< IntersectionMatrix > geos::operation::relateng::RelateNG::evaluate | ( | const Geometry * | b | ) |

Computes the DE-9IM matrix for the topological relationship to a geometry.

Parameters

  b | the B geometry to test against

Returns
  the DE-9IM matrix

## evaluate() [2/3]

bool geos::operation::relateng::RelateNG::evaluate | ( | const Geometry * | b,
|  | const std::string & | imPattern )

Tests whether the topological relationship to a geometry matches a DE-9IM matrix pattern.

Parameters

  b | the B geometry to test against
  imPattern | the DE-9IM pattern to match

Returns
  true if the geometries' topological relationship matches the DE-9IM pattern

See also
  IntersectionMatrixPattern

## evaluate() [3/3]

bool geos::operation::relateng::RelateNG::evaluate | ( | const Geometry * | b,
|  | TopologyPredicate & | predicate )

Tests whether the topological relationship to a geometry satisfies a topology predicate.

Parameters

  b | the B geometry to test against
  predicate | the topological predicate

Returns
  true if the predicate is satisfied

References relate().

## prepare() [1/2]

std::unique_ptr< RelateNG > geos::operation::relateng::RelateNG::prepare | ( | const Geometry * | a | ) |

static

Creates a prepared RelateNG instance to optimize the evaluation of relationships against a single geometry.

Parameters

  a | the A input geometry

Returns
  a prepared instance

## prepare() [2/2]

std::unique_ptr< RelateNG > geos::operation::relateng::RelateNG::prepare | ( | const Geometry * | a,
|  | const BoundaryNodeRule & | bnRule )

static

Creates a prepared RelateNG instance to optimize the computation of predicates against a single geometry, using a given BoundaryNodeRule.

Parameters

  a | the A input geometry
  bnRule | the required BoundaryNodeRule

Returns
  a prepared instance

## relate() [1/5]

std::unique_ptr< IntersectionMatrix > geos::operation::relateng::RelateNG::relate | ( | const Geometry * | a,
|  | const Geometry * | b )

static

Computes the DE-9IM matrix for the topological relationship between two geometries.

Parameters

  a | the A input geometry
  b | the B input geometry

Returns
  the DE-9IM matrix for the topological relationship

## relate() [2/5]

std::unique_ptr< IntersectionMatrix > geos::operation::relateng::RelateNG::relate | ( | const Geometry * | a,
|  | const Geometry * | b,
|  | const BoundaryNodeRule & | bnRule )

static

Computes the DE-9IM matrix for the topological relationship between two geometries.

Parameters

  a | the A input geometry
  b | the B input geometry
  bnRule | the Boundary Node Rule to use

Returns
  the DE-9IM matrix for the relationship

## relate() [3/5]

bool geos::operation::relateng::RelateNG::relate | ( | const Geometry * | a,
|  | const Geometry * | b,
|  | const std::string & | imPattern )

static

Tests whether the topological relationship to a geometry matches a DE-9IM matrix pattern.

Parameters

  a | the A input geometry
  b | the B input geometry
  imPattern | the DE-9IM pattern to match

Returns
  true if the geometries relationship matches the DE-9IM pattern

See also
  IntersectionMatrixPattern

## relate() [4/5]

bool geos::operation::relateng::RelateNG::relate | ( | const Geometry * | a,
|  | const Geometry * | b,
|  | TopologyPredicate & | pred )

static

Tests whether the topological relationship between two geometries satisfies a topological predicate.

Parameters

  a | the A input geometry
  b | the B input geometry
  pred | the topological predicate

Returns
  true if the topological relationship is satisfied

Referenced by evaluate().

## relate() [5/5]

bool geos::operation::relateng::RelateNG::relate | ( | const Geometry * | a,
|  | const Geometry * | b,
|  | TopologyPredicate & | pred,
|  | const BoundaryNodeRule & | bnRule )

static

Tests whether the topological relationship between two geometries satisfies a topological predicate, using a given BoundaryNodeRule.

Parameters

  a | the A input geometry
  b | the B input geometry
  pred | the topological predicate
  bnRule | the Boundary Node Rule to use

Returns
  true if the topological relationship is satisfied

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

- RelateNG.h