# IntersectionMatrix.h

    00001 /**********************************************************************
    00002  * $Id: IntersectionMatrix.h 1820 2006-09-06 16:54:23Z 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 <string>
    00024
    00025 #include <geos/inline.h>
    00026
    00027 namespace geos {
    00028 namespace geom { // geos::geom
    00029
    00051 class 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 std::ostream& operator<< (std::ostream&os, const IntersectionMatrix& im);
    00376
    00377
    00378 } // namespace geos::geom
    00379 } // namespace geos
    00380
    00381 //#ifdef GEOS_INLINE
    00382 //# include "geos/geom/IntersectionMatrix.inl"
    00383 //#endif
    00384
    00385 #endif // ndef GEOS_GEOM_INTERSECTIONMATRIX_H
    00386
    00387 /**********************************************************************
    00388  * $Log$
    00389  * Revision 1.6  2006/05/17 17:41:10  strk
    00390  * Added output operator + test
    00391  *
    00392  * Revision 1.5  2006/05/17 17:24:17  strk
    00393  * Added port info, fixed isCoveredBy() comment.
    00394  *
    00395  * Revision 1.4  2006/05/17 17:20:10  strk
    00396  * added isCovers() and isCoveredBy() public methods to IntersectionMatrix and associated tests.
    00397  *
    00398  * Revision 1.3  2006/04/09 01:46:13  mloskot
    00399  * [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.
    00400  *
    00401  * Revision 1.2  2006/03/24 09:52:41  strk
    00402  * USE_INLINE => GEOS_INLINE
    00403  *
    00404  * Revision 1.1  2006/03/09 16:46:49  strk
    00405  * geos::geom namespace definition, first pass at headers split
    00406  *
    00407  **********************************************************************/