GEOS 3.6.2
IntersectionMatrix.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************
14 *
15 * Last port: geom/IntersectionMatrix.java rev. 1.18
16 *
17 **********************************************************************/
18
19#ifndef GEOS_GEOM_INTERSECTIONMATRIX_H
20#define GEOS_GEOM_INTERSECTIONMATRIX_H
21
22#include <geos/export.h>
23#include <string>
24
25#include <geos/inline.h>
26
27namespace geos {
28namespace geom { // geos::geom
29
51class GEOS_DLL IntersectionMatrix {
52
53public:
54
62
71 IntersectionMatrix(const std::string& elements);
72
81
92 bool matches(const std::string& requiredDimensionSymbols) const;
93
106 static bool matches(int actualDimensionValue,
107 char requiredDimensionSymbol);
108
121 static bool matches(const std::string& actualDimensionSymbols,
122 const std::string& requiredDimensionSymbols);
123
135
146 void set(int row, int column, int dimensionValue);
147
156 void set(const std::string& dimensionSymbols);
157
170 void setAtLeast(int row, int column, int minimumDimensionValue);
171
192 void setAtLeastIfValid(int row, int column, int minimumDimensionValue);
193
204 void setAtLeast(std::string minimumDimensionSymbols);
205
214 void setAll(int dimensionValue);
215
229 int get(int row, int column) const;
230
237 bool isDisjoint() const;
238
245 bool isIntersects() const;
246
259 bool isTouches(int dimensionOfGeometryA, int dimensionOfGeometryB)
260 const;
261
279 bool isCrosses(int dimensionOfGeometryA, int dimensionOfGeometryB)
280 const;
281
287 bool isWithin() const;
288
294 bool isContains() const;
295
305 bool isEquals(int dimensionOfGeometryA, int dimensionOfGeometryB)
306 const;
307
321 bool isOverlaps(int dimensionOfGeometryA, int dimensionOfGeometryB)
322 const;
323
332 bool isCovers() const;
333
334
343 bool isCoveredBy() const;
344
354
362 std::string toString() const;
363
364private:
365
366 static const int firstDim; // = 3;
367
368 static const int secondDim; // = 3;
369
370 // Internal buffer for 3x3 matrix.
371 int matrix[3][3];
372
373}; // class IntersectionMatrix
374
375GEOS_DLL std::ostream& operator<< (std::ostream&os, const IntersectionMatrix& im);
376
377
378} // namespace geos::geom
379} // namespace geos
380
381#endif // ndef GEOS_GEOM_INTERSECTIONMATRIX_H
Implementation of Dimensionally Extended Nine-Intersection Model (DE-9IM) matrix.
Definition IntersectionMatrix.h:51
void setAll(int dimensionValue)
Changes the elements of this IntersectionMatrix to dimensionValue.
bool isCovers() const
Returns true if this IntersectionMatrix is T*****FF* or T****FF or ***T**FF* or ****T*FF*.
int get(int row, int column) const
Returns the value of one of this IntersectionMatrixs elements.
bool isWithin() const
Returns true if this IntersectionMatrix is T*F**F***.
bool isCoveredBy() const
Returns true if this IntersectionMatrix is T*F**F*** *TF**F*** or **FT*F*** or **F*TF***.
bool isIntersects() const
Returns true if isDisjoint returns false.
bool isTouches(int dimensionOfGeometryA, int dimensionOfGeometryB) const
Returns true if this IntersectionMatrix is FT*******, F**T***** or F***T****.
void setAtLeast(int row, int column, int minimumDimensionValue)
Changes the specified element to minimumDimensionValue if the element is less.
bool isEquals(int dimensionOfGeometryA, int dimensionOfGeometryB) const
Returns true if this IntersectionMatrix is T*F**FFF*.
void set(int row, int column, int dimensionValue)
Changes the value of one of this IntersectionMatrixs elements.
IntersectionMatrix * transpose()
Transposes this IntersectionMatrix.
bool isCrosses(int dimensionOfGeometryA, int dimensionOfGeometryB) const
Returns true if this IntersectionMatrix is:
void setAtLeast(std::string minimumDimensionSymbols)
For each element in this IntersectionMatrix, changes the element to the corresponding minimum dimensi...
void setAtLeastIfValid(int row, int column, int minimumDimensionValue)
If row >= 0 and column >= 0, changes the specified element to minimumDimensionValue if the element is...
void set(const std::string &dimensionSymbols)
Changes the elements of this IntersectionMatrix to the dimension symbols in dimensionSymbols.
void add(IntersectionMatrix *other)
Adds one matrix to another.
IntersectionMatrix()
Default constructor.
bool isDisjoint() const
Returns true if this IntersectionMatrix is FF*FF****.
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 s...
bool matches(const std::string &requiredDimensionSymbols) const
Returns whether the elements of this IntersectionMatrix satisfies the required dimension symbols.
IntersectionMatrix(const IntersectionMatrix &other)
Copy constructor.
bool isContains() const
Returns true if this IntersectionMatrix is T*****FF*.
static bool matches(int actualDimensionValue, char requiredDimensionSymbol)
Tests if given dimension value satisfies the dimension symbol.
std::string toString() const
Returns a nine-character String representation of this IntersectionMatrix.
bool isOverlaps(int dimensionOfGeometryA, int dimensionOfGeometryB) const
Returns true if this IntersectionMatrix is:
IntersectionMatrix(const std::string &elements)
Overriden constructor.
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
GEOS_DLL std::ostream & operator<<(std::ostream &os, const Coordinate &c)
Output function.
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25