00001 /********************************************************************** 00002 * $Id: BasicPreparedGeometry.h 2159 2008-08-18 16:27:02Z 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 00017 #ifndef GEOS_GEOM_PREP_BASICPREPAREDGEOMETRY_H 00018 #define GEOS_GEOM_PREP_BASICPREPAREDGEOMETRY_H 00019 00020 #include <geos/geom/prep/PreparedGeometry.h> // for inheritance 00021 //#include <geos/algorithm/PointLocator.h> 00022 //#include <geos/geom/util/ComponentCoordinateExtracter.h> 00023 #include <geos/geom/Coordinate.h> 00024 //#include <geos/geom/Location.h> 00025 00026 #include <vector> 00027 #include <string> 00028 00029 namespace geos { 00030 namespace geom { 00031 class Geometry; 00032 class Coordinate; 00033 } 00034 } 00035 00036 00037 namespace geos { 00038 namespace geom { // geos::geom 00039 namespace prep { // geos::geom::prep 00040 00041 // * \class BasicPreparedGeometry 00042 00056 class BasicPreparedGeometry: public PreparedGeometry 00057 { 00058 private: 00059 const geom::Geometry * baseGeom; 00060 Coordinate::ConstVect representativePts; 00061 00062 protected: 00066 void setGeometry( const geom::Geometry * geom ); 00067 00075 bool envelopesIntersect(const geom::Geometry* g) const; 00076 00085 bool envelopeCovers(const geom::Geometry* g) const; 00086 00087 public: 00088 BasicPreparedGeometry( const Geometry * geom); 00089 00090 ~BasicPreparedGeometry( ); 00091 00092 const geom::Geometry & getGeometry() const 00093 { 00094 return *baseGeom; 00095 } 00096 00104 const Coordinate::ConstVect * getRepresentativePoints() const 00105 { 00106 return &representativePts; 00107 } 00108 00118 bool isAnyTargetComponentInTest(const geom::Geometry * testGeom) const; 00119 00123 bool contains(const geom::Geometry * g) const; 00124 00128 bool containsProperly(const geom::Geometry * g) const; 00129 00133 bool coveredBy(const geom::Geometry * g) const; 00134 00138 bool covers(const geom::Geometry * g) const; 00139 00143 bool crosses(const geom::Geometry * g) const; 00144 00145 bool disjoint(const geom::Geometry * g) const; 00146 00150 bool intersects(const geom::Geometry * g) const; 00151 00155 bool overlaps(const geom::Geometry * g) const; 00156 00160 bool touches(const geom::Geometry * g) const; 00161 00165 bool within(const geom::Geometry * g) const; 00166 00167 std::string toString(); 00168 00169 }; 00170 00171 } // namespace geos::geom::prep 00172 } // namespace geos::geom 00173 } // namespace geos 00174 00175 #endif // GEOS_GEOM_PREP_BASICPREPAREDGEOMETRY_H 00176 /********************************************************************** 00177 * $Log$ 00178 **********************************************************************/ 00179