GEOS  3.9.1dev
IntersectionMatrix.h
Go to the documentation of this file.
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/geom/Location.h>
23 
24 #include <geos/export.h>
25 #include <array>
26 #include <string>
27 
28 #include <geos/inline.h>
29 
30 namespace geos {
31 namespace geom { // geos::geom
32 
55 
56 public:
57 
65 
74  IntersectionMatrix(const std::string& elements);
75 
84 
95  bool matches(const std::string& requiredDimensionSymbols) const;
96 
109  static bool matches(int actualDimensionValue,
110  char requiredDimensionSymbol);
111 
124  static bool matches(const std::string& actualDimensionSymbols,
125  const std::string& requiredDimensionSymbols);
126 
137  void add(IntersectionMatrix* other);
138 
149  void set(Location row, Location column, int dimensionValue);
150 
159  void set(const std::string& dimensionSymbols);
160 
173  void setAtLeast(Location row, Location column, int minimumDimensionValue);
174 
195  void setAtLeastIfValid(Location row, Location column, int minimumDimensionValue);
196 
207  void setAtLeast(std::string minimumDimensionSymbols);
208 
217  void setAll(int dimensionValue);
218 
232  int get(geom::Location row, geom::Location column) const {
233  return matrix[static_cast<size_t>(row)][static_cast<size_t>(column)];
234  }
235 
242  bool isDisjoint() const;
243 
250  bool isIntersects() const;
251 
264  bool isTouches(int dimensionOfGeometryA, int dimensionOfGeometryB)
265  const;
266 
284  bool isCrosses(int dimensionOfGeometryA, int dimensionOfGeometryB)
285  const;
286 
292  bool isWithin() const;
293 
299  bool isContains() const;
300 
310  bool isEquals(int dimensionOfGeometryA, int dimensionOfGeometryB)
311  const;
312 
326  bool isOverlaps(int dimensionOfGeometryA, int dimensionOfGeometryB)
327  const;
328 
337  bool isCovers() const;
338 
339 
348  bool isCoveredBy() const;
349 
358  IntersectionMatrix* transpose();
359 
367  std::string toString() const;
368 
369 private:
370 
371  static const int firstDim; // = 3;
372 
373  static const int secondDim; // = 3;
374 
375  // Internal buffer for 3x3 matrix.
376  std::array<std::array<int, 3>, 3> matrix;
377 
378 }; // class IntersectionMatrix
379 
380 GEOS_DLL std::ostream& operator<< (std::ostream& os, const IntersectionMatrix& im);
381 
382 
383 } // namespace geos::geom
384 } // namespace geos
385 
386 #endif // ndef GEOS_GEOM_INTERSECTIONMATRIX_H
#define GEOS_DLL
Definition: export.h:28
Implementation of Dimensionally Extended Nine-Intersection Model (DE-9IM) matrix. ...
std::ostream & operator<<(std::ostream &os, const Coordinate &c)
Output function.
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:34
Basic namespace for all GEOS functionalities.
std::array< std::array< int, 3 >, 3 > matrix