GEOS: geos::geom::IntersectionMatrix Class Reference

GEOS 3.5.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | List of all members
geos::geom::IntersectionMatrix Class Reference

Implementation of Dimensionally Extended Nine-Intersection Model (DE-9IM) matrix. More...

`#include <IntersectionMatrix.h>`

## Public Member Functions
| IntersectionMatrix ()
| Default constructor. More...
| IntersectionMatrix (const std::string &elements)
| Overriden constructor. More...
| IntersectionMatrix (const IntersectionMatrix &other)
| Copy constructor. More...
bool | matches (const std::string &requiredDimensionSymbols) const
| Returns whether the elements of this IntersectionMatrix satisfies the required dimension symbols. More...
void | add (IntersectionMatrix *other)
| Adds one matrix to another. More...
void | set (int row, int column, int dimensionValue)
| Changes the value of one of this IntersectionMatrixs elements. More...
void | set (const std::string &dimensionSymbols)
| Changes the elements of this IntersectionMatrix to the dimension symbols in dimensionSymbols. More...
void | setAtLeast (int row, int column, int minimumDimensionValue)
| Changes the specified element to minimumDimensionValue if the element is less. More...
void | setAtLeastIfValid (int row, int column, int minimumDimensionValue)
| If row >= 0 and column >= 0, changes the specified element to minimumDimensionValue if the element is less. Does nothing if row <0 or column < 0. More...
void | setAtLeast (std::string minimumDimensionSymbols)
| For each element in this IntersectionMatrix, changes the element to the corresponding minimum dimension symbol if the element is less. More...
void | setAll (int dimensionValue)
| Changes the elements of this IntersectionMatrix to dimensionValue. More...
int | get (int row, int column) const
| Returns the value of one of this IntersectionMatrixs elements. More...
bool | isDisjoint () const
| Returns true if this IntersectionMatrix is FF*FF****. More...
bool | isIntersects () const
| Returns true if isDisjoint returns false. More...
bool | isTouches (int dimensionOfGeometryA, int dimensionOfGeometryB) const
| Returns true if this IntersectionMatrix is FT*******, F**T***** or F***T****. More...
bool | isCrosses (int dimensionOfGeometryA, int dimensionOfGeometryB) const
| Returns true if this IntersectionMatrix is: More...
bool | isWithin () const
| Returns true if this IntersectionMatrix is T*F**F***. More...
bool | isContains () const
| Returns true if this IntersectionMatrix is T*****FF*. More...
bool | isEquals (int dimensionOfGeometryA, int dimensionOfGeometryB) const
| Returns true if this IntersectionMatrix is T*F**FFF*. More...
bool | isOverlaps (int dimensionOfGeometryA, int dimensionOfGeometryB) const
| Returns true if this IntersectionMatrix is: More...
bool | isCovers () const
| Returns true if this IntersectionMatrix is `T*****FF*` or `*T****FF*` or `***T**FF*` or `****T*FF*` More...
bool | isCoveredBy () const
| Returns true if this IntersectionMatrix is `T*F**F***` `*TF**F***` or `**FT*F***` or `**F*TF***` More...
IntersectionMatrix * | transpose ()
| Transposes this IntersectionMatrix. More...
std::string | toString () const
| Returns a nine-character String representation of this IntersectionMatrix. More...

## Static Public Member Functions
static bool | matches (int actualDimensionValue, char requiredDimensionSymbol)
| Tests if given dimension value satisfies the dimension symbol. More...
static bool | matches (const std::string &actualDimensionSymbols, const std::string &requiredDimensionSymbols)
| Returns true if each of the actual dimension symbols satisfies the corresponding required dimension symbol. More...

## Detailed Description

Implementation of Dimensionally Extended Nine-Intersection Model (DE-9IM) matrix.

Dimensionally Extended Nine-Intersection Model (DE-9IM) matrix. This class can used to represent both computed DE-9IM's (like 212FF1FF2) as well as patterns for matching them (like T*T******).

Methods are provided to:

- set and query the elements of the matrix in a convenient fashion
- convert to and from the standard string representation (specified in SFS Section 2.1.13.2).
- test to see if a matrix matches a given pattern string.

For a description of the DE-9IM, see the OpenGIS Simple Features Specification for SQL.

Todo:
  Suggestion: add equal and not-equal operator to this class.

## Constructor & Destructor Documentation

geos::geom::IntersectionMatrix::IntersectionMatrix | ( |  | ) |

Default constructor.

Creates an IntersectionMatrix with Dimension::False dimension values ('F').

geos::geom::IntersectionMatrix::IntersectionMatrix | ( | const std::string & | elements | ) |

Overriden constructor.

Creates an IntersectionMatrix with the given dimension symbols.

Parameters

  elements | - reference to string containing pattern of dimension values for elements.

geos::geom::IntersectionMatrix::IntersectionMatrix | ( | const IntersectionMatrix & | other | ) |

Copy constructor.

Creates an IntersectionMatrix with the same elements as other.

Todo:
  Add assignment operator to make this class fully copyable.

## Member Function Documentation

void geos::geom::IntersectionMatrix::add | ( | IntersectionMatrix * | other | ) |

Adds one matrix to another.

Addition is defined by taking the maximum dimension value of each position in the summand matrices.

Parameters

  other | - the matrix to add.

Todo:
  Why the 'other' matrix is not passed by const-reference?

int geos::geom::IntersectionMatrix::get | ( | int | row,
|  | int | column
| ) |  | const

Returns the value of one of this IntersectionMatrixs elements.

Parameters

  row | - the row of this IntersectionMatrix, indicating the interior, boundary or exterior of the first Geometry.
  column | - the column of this IntersectionMatrix, indicating the interior, boundary or exterior of the second Geometry.

Returns
  the dimension value at the given matrix position.

bool geos::geom::IntersectionMatrix::isContains | ( |  | ) | const

Returns true if this IntersectionMatrix is T*****FF*.

Returns
  true if the first Geometry contains the second.

bool geos::geom::IntersectionMatrix::isCoveredBy | ( |  | ) | const

Returns true if this IntersectionMatrix is `T*F**F***` `*TF**F***` or `**FT*F***` or `**F*TF***`

Returns
  `true` if the first Geometry is covered by the second

bool geos::geom::IntersectionMatrix::isCovers | ( |  | ) | const

Returns true if this IntersectionMatrix is `T*****FF*` or `*T****FF*` or `***T**FF*` or `****T*FF*`

Returns
  `true` if the first Geometry covers the second

bool geos::geom::IntersectionMatrix::isCrosses | ( | int | dimensionOfGeometryA,
|  | int | dimensionOfGeometryB
| ) |  | const

Returns true if this IntersectionMatrix is:

- T*T****** (for a point and a curve, a point and an area or a line and an area)
- 0******** (for two curves)

Parameters

  dimensionOfGeometryA | - he dimension of the first Geometry.
  dimensionOfGeometryB | - the dimension of the second Geometry.

Returns
  true if the two Geometry's related by this IntersectionMatrix cross.

For this function to return true, the Geometrys must be a point and a curve; a point and a surface; two curves; or a curve and a surface.

bool geos::geom::IntersectionMatrix::isDisjoint | ( |  | ) | const

Returns true if this IntersectionMatrix is FF*FF****.

Returns
  true if the two Geometrys related by this IntersectionMatrix are disjoint.

bool geos::geom::IntersectionMatrix::isEquals | ( | int | dimensionOfGeometryA,
|  | int | dimensionOfGeometryB
| ) |  | const

Returns true if this IntersectionMatrix is T*F**FFF*.

Parameters

  dimensionOfGeometryA | - he dimension of the first Geometry.
  dimensionOfGeometryB | - the dimension of the second Geometry.

Returns
  true if the two Geometry's related by this IntersectionMatrix are equal; the Geometrys must have the same dimension for this function to return true

bool geos::geom::IntersectionMatrix::isIntersects | ( |  | ) | const

Returns true if isDisjoint returns false.

Returns
  true if the two Geometrys related by this IntersectionMatrix intersect.

bool geos::geom::IntersectionMatrix::isOverlaps | ( | int | dimensionOfGeometryA,
|  | int | dimensionOfGeometryB
| ) |  | const

Returns true if this IntersectionMatrix is:

- T*T***T** (for two points or two surfaces)
- 1*T***T** (for two curves)

Parameters

  dimensionOfGeometryA | - he dimension of the first Geometry.
  dimensionOfGeometryB | - the dimension of the second Geometry.

Returns
  true if the two Geometry's related by this IntersectionMatrix overlap.

For this function to return true, the Geometrys must be two points, two curves or two surfaces.

bool geos::geom::IntersectionMatrix::isTouches | ( | int | dimensionOfGeometryA,
|  | int | dimensionOfGeometryB
| ) |  | const

Returns true if this IntersectionMatrix is FT*******, F**T***** or F***T****.

Parameters

  dimensionOfGeometryA | - the dimension of the first Geometry.
  dimensionOfGeometryB | - the dimension of the second Geometry.

Returns
  true if the two Geometry's related by this IntersectionMatrix touch, false if both Geometrys are points.

bool geos::geom::IntersectionMatrix::isWithin | ( |  | ) | const

Returns true if this IntersectionMatrix is T*F**F***.

Returns
  true if the first Geometry is within the second.

bool geos::geom::IntersectionMatrix::matches | ( | const std::string & | requiredDimensionSymbols | ) | const

Returns whether the elements of this IntersectionMatrix satisfies the required dimension symbols.

Parameters

  requiredDimensionSymbols | - nine dimension symbols with which to compare the elements of this IntersectionMatrix. Possible values are {T, F, * , 0, 1, 2}.

Returns
  true if this IntersectionMatrix matches the required dimension symbols.

static bool geos::geom::IntersectionMatrix::matches | ( | int | actualDimensionValue,
|  | char | requiredDimensionSymbol
| ) |  |
| static

Tests if given dimension value satisfies the dimension symbol.

Parameters

  actualDimensionValue | - valid dimension value stored in the IntersectionMatrix. Possible values are {TRUE, FALSE, DONTCARE, 0, 1, 2}.
  requiredDimensionSymbol | - a character used in the string representation of an IntersectionMatrix. Possible values are {T, F, * , 0, 1, 2}.

Returns
  true if the dimension symbol encompasses the dimension value.

static bool geos::geom::IntersectionMatrix::matches | ( | const std::string & | actualDimensionSymbols,
|  | const std::string & | requiredDimensionSymbols
| ) |  |
| static

Returns true if each of the actual dimension symbols satisfies the corresponding required dimension symbol.

Parameters

  actualDimensionSymbols | - nine dimension symbols to validate. Possible values are {T, F, * , 0, 1, 2}.
  requiredDimensionSymbols | - nine dimension symbols to validate against. Possible values are {T, F, * , 0, 1, 2}.

Returns
  true if each of the required dimension symbols encompass the corresponding actual dimension symbol.

void geos::geom::IntersectionMatrix::set | ( | int | row,
|  | int | column,
|  | int | dimensionValue
| ) |  |

Changes the value of one of this IntersectionMatrixs elements.

Parameters

  row | - the row of this IntersectionMatrix, indicating the interior, boundary or exterior of the first Geometry.
  column | - the column of this IntersectionMatrix, indicating the interior, boundary or exterior of the second Geometry.
  dimensionValue | - the new value of the element.

void geos::geom::IntersectionMatrix::set | ( | const std::string & | dimensionSymbols | ) |

Changes the elements of this IntersectionMatrix to the dimension symbols in dimensionSymbols.

Parameters

  dimensionSymbols | - nine dimension symbols to which to set this IntersectionMatrix elements. Possible values are {T, F, * , 0, 1, 2}.

void geos::geom::IntersectionMatrix::setAll | ( | int | dimensionValue | ) |

Changes the elements of this IntersectionMatrix to dimensionValue.

Parameters

  dimensionValue | - the dimension value to which to set this IntersectionMatrix elements. Possible values {TRUE, FALSE, DONTCARE, 0, 1, 2}.

void geos::geom::IntersectionMatrix::setAtLeast | ( | int | row,
|  | int | column,
|  | int | minimumDimensionValue
| ) |  |

Changes the specified element to minimumDimensionValue if the element is less.

Parameters

  row | - the row of this IntersectionMatrix, indicating the interior, boundary or exterior of the first Geometry.
  column | - the column of this IntersectionMatrix, indicating the interior, boundary or exterior of the second Geometry.
  minimumDimensionValue | - the dimension value with which to compare the element. The order of dimension values from least to greatest is {DONTCARE, TRUE, FALSE, 0, 1, 2}.

void geos::geom::IntersectionMatrix::setAtLeast | ( | std::string | minimumDimensionSymbols | ) |

For each element in this IntersectionMatrix, changes the element to the corresponding minimum dimension symbol if the element is less.

Parameters

  minimumDimensionSymbols | - nine dimension symbols with which to compare the elements of this IntersectionMatrix. The order of dimension values from least to greatest is {DONTCARE, TRUE, FALSE, 0, 1, 2} .

void geos::geom::IntersectionMatrix::setAtLeastIfValid | ( | int | row,
|  | int | column,
|  | int | minimumDimensionValue
| ) |  |

If row >= 0 and column >= 0, changes the specified element to minimumDimensionValue if the element is less. Does nothing if row <0 or column < 0.

Parameters

  row | - the row of this IntersectionMatrix, indicating the interior, boundary or exterior of the first Geometry.
  column | - the column of this IntersectionMatrix, indicating the interior, boundary or exterior of the second Geometry.
  minimumDimensionValue | - the dimension value with which to compare the element. The order of dimension values from least to greatest is {DONTCARE, TRUE, FALSE, 0, 1, 2}.

std::string geos::geom::IntersectionMatrix::toString | ( |  | ) | const

Returns a nine-character String representation of this IntersectionMatrix.

Returns
  the nine dimension symbols of this IntersectionMatrix in row-major order.

IntersectionMatrix* geos::geom::IntersectionMatrix::transpose | ( |  | ) |

Transposes this IntersectionMatrix.

Returns
  this IntersectionMatrix as a convenience.

Todo:

  It returns 'this' pointer so why not to return const-pointer?

  May be it would be better to return copy of transposed matrix?

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

- IntersectionMatrix.h