GEOS
3.3.9
|
00001 /********************************************************************** 00002 * $Id: IntersectionMatrix.h 3255 2011-03-01 17:56:10Z mloskot $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2006 Refractions Research Inc. 00008 * 00009 * This is free software; you can redistribute and/or modify it under 00010 * the terms of the GNU Lesser General Public Licence as published 00011 * by the Free Software Foundation. 00012 * See the COPYING file for more information. 00013 * 00014 ********************************************************************** 00015 * 00016 * Last port: geom/IntersectionMatrix.java rev. 1.18 00017 * 00018 **********************************************************************/ 00019 00020 #ifndef GEOS_GEOM_INTERSECTIONMATRIX_H 00021 #define GEOS_GEOM_INTERSECTIONMATRIX_H 00022 00023 #include <geos/export.h> 00024 #include <string> 00025 00026 #include <geos/inline.h> 00027 00028 namespace geos { 00029 namespace geom { // geos::geom 00030 00052 class GEOS_DLL IntersectionMatrix { 00053 00054 public: 00055 00062 IntersectionMatrix(); 00063 00072 IntersectionMatrix(const std::string& elements); 00073 00081 IntersectionMatrix(const IntersectionMatrix &other); 00082 00093 bool matches(const std::string& requiredDimensionSymbols) const; 00094 00107 static bool matches(int actualDimensionValue, 00108 char requiredDimensionSymbol); 00109 00122 static bool matches(const std::string& actualDimensionSymbols, 00123 const std::string& requiredDimensionSymbols); 00124 00135 void add(IntersectionMatrix* other); 00136 00147 void set(int row, int column, int dimensionValue); 00148 00157 void set(const std::string& dimensionSymbols); 00158 00171 void setAtLeast(int row, int column, int minimumDimensionValue); 00172 00193 void setAtLeastIfValid(int row, int column, int minimumDimensionValue); 00194 00205 void setAtLeast(std::string minimumDimensionSymbols); 00206 00215 void setAll(int dimensionValue); 00216 00230 int get(int row, int column) const; 00231 00238 bool isDisjoint() const; 00239 00246 bool isIntersects() const; 00247 00260 bool isTouches(int dimensionOfGeometryA, int dimensionOfGeometryB) 00261 const; 00262 00280 bool isCrosses(int dimensionOfGeometryA, int dimensionOfGeometryB) 00281 const; 00282 00288 bool isWithin() const; 00289 00295 bool isContains() const; 00296 00306 bool isEquals(int dimensionOfGeometryA, int dimensionOfGeometryB) 00307 const; 00308 00322 bool isOverlaps(int dimensionOfGeometryA, int dimensionOfGeometryB) 00323 const; 00324 00333 bool isCovers() const; 00334 00335 00344 bool isCoveredBy() const; 00345 00354 IntersectionMatrix* transpose(); 00355 00363 std::string toString() const; 00364 00365 private: 00366 00367 static const int firstDim; // = 3; 00368 00369 static const int secondDim; // = 3; 00370 00371 // Internal buffer for 3x3 matrix. 00372 int matrix[3][3]; 00373 00374 }; // class IntersectionMatrix 00375 00376 GEOS_DLL std::ostream& operator<< (std::ostream&os, const IntersectionMatrix& im); 00377 00378 00379 } // namespace geos::geom 00380 } // namespace geos 00381 00382 //#ifdef GEOS_INLINE 00383 //# include "geos/geom/IntersectionMatrix.inl" 00384 //#endif 00385 00386 #endif // ndef GEOS_GEOM_INTERSECTIONMATRIX_H 00387 00388 /********************************************************************** 00389 * $Log$ 00390 * Revision 1.6 2006/05/17 17:41:10 strk 00391 * Added output operator + test 00392 * 00393 * Revision 1.5 2006/05/17 17:24:17 strk 00394 * Added port info, fixed isCoveredBy() comment. 00395 * 00396 * Revision 1.4 2006/05/17 17:20:10 strk 00397 * added isCovers() and isCoveredBy() public methods to IntersectionMatrix and associated tests. 00398 * 00399 * Revision 1.3 2006/04/09 01:46:13 mloskot 00400 * [SORRY] Added comments for doxygen based on JTS docs. Added row/col dimension consts. Added asserts in functions to check if given row/col is in range. 00401 * 00402 * Revision 1.2 2006/03/24 09:52:41 strk 00403 * USE_INLINE => GEOS_INLINE 00404 * 00405 * Revision 1.1 2006/03/09 16:46:49 strk 00406 * geos::geom namespace definition, first pass at headers split 00407 * 00408 **********************************************************************/