GEOS
3.4.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2006 Refractions Research Inc. 00007 * 00008 * This is free software; you can redistribute and/or modify it under 00009 * the terms of the GNU Lesser General Public Licence as published 00010 * by the Free Software Foundation. 00011 * See the COPYING file for more information. 00012 * 00013 ********************************************************************** 00014 * 00015 * Last port: geom/IntersectionMatrix.java rev. 1.18 00016 * 00017 **********************************************************************/ 00018 00019 #ifndef GEOS_GEOM_INTERSECTIONMATRIX_H 00020 #define GEOS_GEOM_INTERSECTIONMATRIX_H 00021 00022 #include <geos/export.h> 00023 #include <string> 00024 00025 #include <geos/inline.h> 00026 00027 namespace geos { 00028 namespace geom { // geos::geom 00029 00051 class GEOS_DLL IntersectionMatrix { 00052 00053 public: 00054 00061 IntersectionMatrix(); 00062 00071 IntersectionMatrix(const std::string& elements); 00072 00080 IntersectionMatrix(const IntersectionMatrix &other); 00081 00092 bool matches(const std::string& requiredDimensionSymbols) const; 00093 00106 static bool matches(int actualDimensionValue, 00107 char requiredDimensionSymbol); 00108 00121 static bool matches(const std::string& actualDimensionSymbols, 00122 const std::string& requiredDimensionSymbols); 00123 00134 void add(IntersectionMatrix* other); 00135 00146 void set(int row, int column, int dimensionValue); 00147 00156 void set(const std::string& dimensionSymbols); 00157 00170 void setAtLeast(int row, int column, int minimumDimensionValue); 00171 00192 void setAtLeastIfValid(int row, int column, int minimumDimensionValue); 00193 00204 void setAtLeast(std::string minimumDimensionSymbols); 00205 00214 void setAll(int dimensionValue); 00215 00229 int get(int row, int column) const; 00230 00237 bool isDisjoint() const; 00238 00245 bool isIntersects() const; 00246 00259 bool isTouches(int dimensionOfGeometryA, int dimensionOfGeometryB) 00260 const; 00261 00279 bool isCrosses(int dimensionOfGeometryA, int dimensionOfGeometryB) 00280 const; 00281 00287 bool isWithin() const; 00288 00294 bool isContains() const; 00295 00305 bool isEquals(int dimensionOfGeometryA, int dimensionOfGeometryB) 00306 const; 00307 00321 bool isOverlaps(int dimensionOfGeometryA, int dimensionOfGeometryB) 00322 const; 00323 00332 bool isCovers() const; 00333 00334 00343 bool isCoveredBy() const; 00344 00353 IntersectionMatrix* transpose(); 00354 00362 std::string toString() const; 00363 00364 private: 00365 00366 static const int firstDim; // = 3; 00367 00368 static const int secondDim; // = 3; 00369 00370 // Internal buffer for 3x3 matrix. 00371 int matrix[3][3]; 00372 00373 }; // class IntersectionMatrix 00374 00375 GEOS_DLL std::ostream& operator<< (std::ostream&os, const IntersectionMatrix& im); 00376 00377 00378 } // namespace geos::geom 00379 } // namespace geos 00380 00381 #endif // ndef GEOS_GEOM_INTERSECTIONMATRIX_H