GEOS  3.3.3
IntersectionMatrix.h
1 /**********************************************************************
2  * $Id: IntersectionMatrix.h 3255 2011-03-01 17:56:10Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2006 Refractions Research Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************
15  *
16  * Last port: geom/IntersectionMatrix.java rev. 1.18
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_GEOM_INTERSECTIONMATRIX_H
21 #define GEOS_GEOM_INTERSECTIONMATRIX_H
22 
23 #include <geos/export.h>
24 #include <string>
25 
26 #include <geos/inline.h>
27 
28 namespace geos {
29 namespace geom { // geos::geom
30 
52 class GEOS_DLL IntersectionMatrix {
53 
54 public:
55 
63 
72  IntersectionMatrix(const std::string& elements);
73 
82 
93  bool matches(const std::string& requiredDimensionSymbols) const;
94 
107  static bool matches(int actualDimensionValue,
108  char requiredDimensionSymbol);
109 
122  static bool matches(const std::string& actualDimensionSymbols,
123  const std::string& requiredDimensionSymbols);
124 
135  void add(IntersectionMatrix* other);
136 
147  void set(int row, int column, int dimensionValue);
148 
157  void set(const std::string& dimensionSymbols);
158 
171  void setAtLeast(int row, int column, int minimumDimensionValue);
172 
193  void setAtLeastIfValid(int row, int column, int minimumDimensionValue);
194 
205  void setAtLeast(std::string minimumDimensionSymbols);
206 
215  void setAll(int dimensionValue);
216 
230  int get(int row, int column) const;
231 
238  bool isDisjoint() const;
239 
246  bool isIntersects() const;
247 
260  bool isTouches(int dimensionOfGeometryA, int dimensionOfGeometryB)
261  const;
262 
280  bool isCrosses(int dimensionOfGeometryA, int dimensionOfGeometryB)
281  const;
282 
288  bool isWithin() const;
289 
295  bool isContains() const;
296 
306  bool isEquals(int dimensionOfGeometryA, int dimensionOfGeometryB)
307  const;
308 
322  bool isOverlaps(int dimensionOfGeometryA, int dimensionOfGeometryB)
323  const;
324 
333  bool isCovers() const;
334 
335 
344  bool isCoveredBy() const;
345 
354  IntersectionMatrix* transpose();
355 
363  std::string toString() const;
364 
365 private:
366 
367  static const int firstDim; // = 3;
368 
369  static const int secondDim; // = 3;
370 
371  // Internal buffer for 3x3 matrix.
372  int matrix[3][3];
373 
374 }; // class IntersectionMatrix
375 
376 GEOS_DLL std::ostream& operator<< (std::ostream&os, const IntersectionMatrix& im);
377 
378 
379 } // namespace geos::geom
380 } // namespace geos
381 
382 //#ifdef GEOS_INLINE
383 //# include "geos/geom/IntersectionMatrix.inl"
384 //#endif
385 
386 #endif // ndef GEOS_GEOM_INTERSECTIONMATRIX_H
387 
388 /**********************************************************************
389  * $Log$
390  * Revision 1.6 2006/05/17 17:41:10 strk
391  * Added output operator + test
392  *
393  * Revision 1.5 2006/05/17 17:24:17 strk
394  * Added port info, fixed isCoveredBy() comment.
395  *
396  * Revision 1.4 2006/05/17 17:20:10 strk
397  * added isCovers() and isCoveredBy() public methods to IntersectionMatrix and associated tests.
398  *
399  * Revision 1.3 2006/04/09 01:46:13 mloskot
400  * [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.
401  *
402  * Revision 1.2 2006/03/24 09:52:41 strk
403  * USE_INLINE => GEOS_INLINE
404  *
405  * Revision 1.1 2006/03/09 16:46:49 strk
406  * geos::geom namespace definition, first pass at headers split
407  *
408  **********************************************************************/