GEOS  3.6.2
BasicPreparedGeometry.h
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  *
00016  * Last port: geom/prep/BasicPreparedGeometry.java rev. 1.5 (JTS-1.10)
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef GEOS_GEOM_PREP_BASICPREPAREDGEOMETRY_H
00021 #define GEOS_GEOM_PREP_BASICPREPAREDGEOMETRY_H
00022 
00023 #include <geos/geom/prep/PreparedGeometry.h> // for inheritance
00024 //#include <geos/algorithm/PointLocator.h> 
00025 //#include <geos/geom/util/ComponentCoordinateExtracter.h> 
00026 #include <geos/geom/Coordinate.h> 
00027 //#include <geos/geom/Location.h>
00028 
00029 #include <vector>
00030 #include <string>
00031 
00032 namespace geos {
00033         namespace geom {
00034                 class Geometry;
00035                 class Coordinate;
00036         }
00037 }
00038 
00039 
00040 namespace geos {
00041 namespace geom { // geos::geom
00042 namespace prep { // geos::geom::prep
00043 
00044 // * \class BasicPreparedGeometry
00045 
00059 class BasicPreparedGeometry: public PreparedGeometry 
00060 {
00061 private:
00062         const geom::Geometry * baseGeom;
00063         Coordinate::ConstVect representativePts;
00064 
00065 protected:
00069         void setGeometry( const geom::Geometry * geom );
00070         
00078         bool envelopesIntersect(const geom::Geometry* g) const;
00079 
00088         bool envelopeCovers(const geom::Geometry* g) const;
00089 
00090 public:
00091         BasicPreparedGeometry( const Geometry * geom);
00092 
00093         ~BasicPreparedGeometry( );
00094 
00095         const geom::Geometry & getGeometry() const
00096         {
00097                 return *baseGeom;
00098         }
00099 
00107         const Coordinate::ConstVect * getRepresentativePoints()  const
00108         {
00109                 return &representativePts;
00110         }
00111 
00121         bool isAnyTargetComponentInTest(const geom::Geometry * testGeom) const;
00122 
00126         bool contains(const geom::Geometry * g) const;
00127 
00131         bool containsProperly(const geom::Geometry * g) const;
00132 
00136         bool coveredBy(const geom::Geometry * g) const;
00137 
00141         bool covers(const geom::Geometry * g) const;
00142 
00146         bool crosses(const geom::Geometry * g) const;
00147 
00152         bool disjoint(const geom::Geometry * g) const;
00153 
00157         bool intersects(const geom::Geometry * g) const;
00158 
00162         bool overlaps(const geom::Geometry * g) const;
00163 
00167         bool touches(const geom::Geometry * g) const;
00168 
00172         bool within(const geom::Geometry * g) const;
00173 
00174         std::string toString();
00175 
00176 };
00177 
00178 } // namespace geos::geom::prep
00179 } // namespace geos::geom
00180 } // namespace geos
00181 
00182 #endif // GEOS_GEOM_PREP_BASICPREPAREDGEOMETRY_H