IntersectionMatrix.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: geom/IntersectionMatrix.java rev. 1.18
*
**********************************************************************/
#pragma once
#include <geos/geom/Location.h>
#include <geos/export.h>
#include <array>
#include <string>
namespace geos {
namespace geom { // geos::geom
class GEOS_DLL IntersectionMatrix {
public:
IntersectionMatrix();
IntersectionMatrix(const std::string& elements);
IntersectionMatrix(const IntersectionMatrix& other);
bool matches(const std::string& requiredDimensionSymbols) const;
static bool matches(int actualDimensionValue,
char requiredDimensionSymbol);
static bool matches(const std::string& actualDimensionSymbols,
const std::string& requiredDimensionSymbols);
void add(IntersectionMatrix* other);
void set(Location row, Location column, int dimensionValue);
void set(const std::string& dimensionSymbols);
void setAtLeast(Location row, Location column, int minimumDimensionValue);
void setAtLeastIfValid(Location row, Location column, int minimumDimensionValue);
void setAtLeast(std::string minimumDimensionSymbols);
void setAll(int dimensionValue);
int get(Location row, Location column) const {
return matrix[static_cast<size_t>(row)][static_cast<size_t>(column)];
}
bool isDisjoint() const;
bool isIntersects() const;
bool isTouches(int dimensionOfGeometryA, int dimensionOfGeometryB)
const;
bool isCrosses(int dimensionOfGeometryA, int dimensionOfGeometryB)
const;
bool isWithin() const;
bool isContains() const;
bool isEquals(int dimensionOfGeometryA, int dimensionOfGeometryB)
const;
bool isOverlaps(int dimensionOfGeometryA, int dimensionOfGeometryB)
const;
bool isCovers() const;
bool isCoveredBy() const;
IntersectionMatrix* transpose();
std::string toString() const;
private:
static const int firstDim; // = 3;
static const int secondDim; // = 3;
// Internal buffer for 3x3 matrix.
std::array<std::array<int, 3>, 3> matrix;
}; // class IntersectionMatrix
GEOS_DLL std::ostream& operator<< (std::ostream& os, const IntersectionMatrix& im);
} // namespace geos::geom
} // namespace geos
geos::geom::IntersectionMatrix
Implementation of Dimensionally Extended Nine-Intersection Model (DE-9IM) matrix.
Definition IntersectionMatrix.h:51
geos::geom::IntersectionMatrix::setAll
void setAll(int dimensionValue)
Changes the elements of this IntersectionMatrix to dimensionValue.
geos::geom::IntersectionMatrix::get
int get(Location row, Location column) const
Returns the value of one of this IntersectionMatrixs elements.
Definition IntersectionMatrix.h:229
geos::geom::IntersectionMatrix::isCovers
bool isCovers() const
Returns true if this IntersectionMatrix is T*****FF* or T****FF or ***T**FF* or ****T*FF*.
geos::geom::IntersectionMatrix::isWithin
bool isWithin() const
Returns true if this IntersectionMatrix is T*F**F***.
geos::geom::IntersectionMatrix::isCoveredBy
bool isCoveredBy() const
Returns true if this IntersectionMatrix is T*F**F*** *TF**F*** or **FT*F*** or **F*TF***.
geos::geom::IntersectionMatrix::isIntersects
bool isIntersects() const
Returns true if isDisjoint returns false.
geos::geom::IntersectionMatrix::isTouches
bool isTouches(int dimensionOfGeometryA, int dimensionOfGeometryB) const
Returns true if this IntersectionMatrix is FT*******, F**T***** or F***T****.
geos::geom::IntersectionMatrix::isEquals
bool isEquals(int dimensionOfGeometryA, int dimensionOfGeometryB) const
Returns true if this IntersectionMatrix is T*F**FFF*.
geos::geom::IntersectionMatrix::transpose
IntersectionMatrix * transpose()
Transposes this IntersectionMatrix.
geos::geom::IntersectionMatrix::set
void set(Location row, Location column, int dimensionValue)
Changes the value of one of this IntersectionMatrixs elements.
geos::geom::IntersectionMatrix::isCrosses
bool isCrosses(int dimensionOfGeometryA, int dimensionOfGeometryB) const
Returns true if this IntersectionMatrix is:
geos::geom::IntersectionMatrix::setAtLeast
void setAtLeast(std::string minimumDimensionSymbols)
For each element in this IntersectionMatrix, changes the element to the corresponding minimum dimensi...
geos::geom::IntersectionMatrix::setAtLeastIfValid
void setAtLeastIfValid(Location row, Location column, int minimumDimensionValue)
If row >= 0 and column >= 0, changes the specified element to minimumDimensionValue if the element is...
geos::geom::IntersectionMatrix::set
void set(const std::string &dimensionSymbols)
Changes the elements of this IntersectionMatrix to the dimension symbols in dimensionSymbols.
geos::geom::IntersectionMatrix::add
void add(IntersectionMatrix *other)
Adds one matrix to another.
geos::geom::IntersectionMatrix::IntersectionMatrix
IntersectionMatrix()
Default constructor.
geos::geom::IntersectionMatrix::isDisjoint
bool isDisjoint() const
Returns true if this IntersectionMatrix is FF*FF****.
geos::geom::IntersectionMatrix::matches
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...
geos::geom::IntersectionMatrix::matches
bool matches(const std::string &requiredDimensionSymbols) const
Returns whether the elements of this IntersectionMatrix satisfies the required dimension symbols.
geos::geom::IntersectionMatrix::IntersectionMatrix
IntersectionMatrix(const IntersectionMatrix &other)
Copy constructor.
geos::geom::IntersectionMatrix::isContains
bool isContains() const
Returns true if this IntersectionMatrix is T*****FF*.
geos::geom::IntersectionMatrix::matches
static bool matches(int actualDimensionValue, char requiredDimensionSymbol)
Tests if given dimension value satisfies the dimension symbol.
geos::geom::IntersectionMatrix::toString
std::string toString() const
Returns a nine-character String representation of this IntersectionMatrix.
geos::geom::IntersectionMatrix::isOverlaps
bool isOverlaps(int dimensionOfGeometryA, int dimensionOfGeometryB) const
Returns true if this IntersectionMatrix is:
geos::geom::IntersectionMatrix::IntersectionMatrix
IntersectionMatrix(const std::string &elements)
Overridden constructor.
geos::geom::IntersectionMatrix::setAtLeast
void setAtLeast(Location row, Location column, int minimumDimensionValue)
Changes the specified element to minimumDimensionValue if the element is less.
geos::geom
Definition Angle.h:26
geos::geom::Location
Location
Constants representing the location of a point relative to a geometry.
Definition Location.h:32
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38