00001 /********************************************************************** 00002 * $Id: BasicPreparedGeometry.h 2419 2009-04-29 08:22:16Z strk $ 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 * Last port: geom/prep/BasicPreparedGeometry.java rev. 1.5 (JTS-1.10) 00018 * 00019 **********************************************************************/ 00020 00021 #ifndef GEOS_GEOM_PREP_BASICPREPAREDGEOMETRY_H 00022 #define GEOS_GEOM_PREP_BASICPREPAREDGEOMETRY_H 00023 00024 #include <geos/geom/prep/PreparedGeometry.h> // for inheritance 00025 //#include <geos/algorithm/PointLocator.h> 00026 //#include <geos/geom/util/ComponentCoordinateExtracter.h> 00027 #include <geos/geom/Coordinate.h> 00028 //#include <geos/geom/Location.h> 00029 00030 #include <vector> 00031 #include <string> 00032 00033 namespace geos { 00034 namespace geom { 00035 class Geometry; 00036 class Coordinate; 00037 } 00038 } 00039 00040 00041 namespace geos { 00042 namespace geom { // geos::geom 00043 namespace prep { // geos::geom::prep 00044 00045 // * \class BasicPreparedGeometry 00046 00060 class BasicPreparedGeometry: public PreparedGeometry 00061 { 00062 private: 00063 const geom::Geometry * baseGeom; 00064 Coordinate::ConstVect representativePts; 00065 00066 protected: 00070 void setGeometry( const geom::Geometry * geom ); 00071 00079 bool envelopesIntersect(const geom::Geometry* g) const; 00080 00089 bool envelopeCovers(const geom::Geometry* g) const; 00090 00091 public: 00092 BasicPreparedGeometry( const Geometry * geom); 00093 00094 ~BasicPreparedGeometry( ); 00095 00096 const geom::Geometry & getGeometry() const 00097 { 00098 return *baseGeom; 00099 } 00100 00108 const Coordinate::ConstVect * getRepresentativePoints() const 00109 { 00110 return &representativePts; 00111 } 00112 00122 bool isAnyTargetComponentInTest(const geom::Geometry * testGeom) const; 00123 00127 bool contains(const geom::Geometry * g) const; 00128 00132 bool containsProperly(const geom::Geometry * g) const; 00133 00137 bool coveredBy(const geom::Geometry * g) const; 00138 00142 bool covers(const geom::Geometry * g) const; 00143 00147 bool crosses(const geom::Geometry * g) const; 00148 00153 bool disjoint(const geom::Geometry * g) const; 00154 00158 bool intersects(const geom::Geometry * g) const; 00159 00163 bool overlaps(const geom::Geometry * g) const; 00164 00168 bool touches(const geom::Geometry * g) const; 00169 00173 bool within(const geom::Geometry * g) const; 00174 00175 std::string toString(); 00176 00177 }; 00178 00179 } // namespace geos::geom::prep 00180 } // namespace geos::geom 00181 } // namespace geos 00182 00183 #endif // GEOS_GEOM_PREP_BASICPREPAREDGEOMETRY_H 00184 /********************************************************************** 00185 * $Log$ 00186 **********************************************************************/ 00187