GEOS  3.8.0dev
BasicPreparedGeometry.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2006 Refractions Research Inc.
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  *
14  **********************************************************************
15  *
16  * Last port: geom/prep/BasicPreparedGeometry.java rev. 1.5 (JTS-1.10)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_GEOM_PREP_BASICPREPAREDGEOMETRY_H
21 #define GEOS_GEOM_PREP_BASICPREPAREDGEOMETRY_H
22 
23 #include <geos/geom/prep/PreparedGeometry.h> // for inheritance
24 //#include <geos/algorithm/PointLocator.h>
25 //#include <geos/geom/util/ComponentCoordinateExtracter.h>
26 #include <geos/geom/Coordinate.h>
27 //#include <geos/geom/Location.h>
28 
29 #include <vector>
30 #include <string>
31 
32 namespace geos {
33 namespace geom {
34 class Geometry;
35 class Coordinate;
36 }
37 }
38 
39 
40 namespace geos {
41 namespace geom { // geos::geom
42 namespace prep { // geos::geom::prep
43 
44 // * \class BasicPreparedGeometry
45 
60 private:
61  const geom::Geometry* baseGeom;
62  Coordinate::ConstVect representativePts;
63 
64 protected:
68  void setGeometry(const geom::Geometry* geom);
69 
77  bool envelopesIntersect(const geom::Geometry* g) const;
78 
87  bool envelopeCovers(const geom::Geometry* g) const;
88 
89 public:
90  BasicPreparedGeometry(const Geometry* geom);
91 
92  ~BasicPreparedGeometry() override;
93 
94  const geom::Geometry&
95  getGeometry() const override
96  {
97  return *baseGeom;
98  }
99 
107  const Coordinate::ConstVect*
109  {
110  return &representativePts;
111  }
112 
122  bool isAnyTargetComponentInTest(const geom::Geometry* testGeom) const;
123 
127  bool contains(const geom::Geometry* g) const override;
128 
132  bool containsProperly(const geom::Geometry* g) const override;
133 
137  bool coveredBy(const geom::Geometry* g) const override;
138 
142  bool covers(const geom::Geometry* g) const override;
143 
147  bool crosses(const geom::Geometry* g) const override;
148 
153  bool disjoint(const geom::Geometry* g) const override;
154 
158  bool intersects(const geom::Geometry* g) const override;
159 
163  bool overlaps(const geom::Geometry* g) const override;
164 
168  bool touches(const geom::Geometry* g) const override;
169 
173  bool within(const geom::Geometry* g) const override;
174 
175  std::string toString();
176 
177 };
178 
179 } // namespace geos::geom::prep
180 } // namespace geos::geom
181 } // namespace geos
182 
183 #endif // GEOS_GEOM_PREP_BASICPREPAREDGEOMETRY_H
bool touches(const geom::Geometry *g) const override
bool intersects(const geom::Geometry *g) const override
bool contains(const geom::Geometry *g) const override
bool disjoint(const geom::Geometry *g) const override
bool overlaps(const geom::Geometry *g) const override
bool crosses(const geom::Geometry *g) const override
bool coveredBy(const geom::Geometry *g) const override
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:187
const Coordinate::ConstVect * getRepresentativePoints() const
Definition: BasicPreparedGeometry.h:108
const geom::Geometry & getGeometry() const override
Definition: BasicPreparedGeometry.h:95
std::vector< const Coordinate * > ConstVect
A vector of const Coordinate pointers.
Definition: Coordinate.h:71
An interface for classes which prepare Geometrys in order to optimize the performance of repeated cal...
Definition: PreparedGeometry.h:53
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
A base class for PreparedGeometry subclasses.
Definition: BasicPreparedGeometry.h:59
bool covers(const geom::Geometry *g) const override
bool containsProperly(const geom::Geometry *g) const override
bool within(const geom::Geometry *g) const override
bool envelopeCovers(const geom::Geometry *g) const
bool isAnyTargetComponentInTest(const geom::Geometry *testGeom) const
void setGeometry(const geom::Geometry *geom)
bool envelopesIntersect(const geom::Geometry *g) const