GEOS  3.13.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 #pragma once
21 
22 #include <geos/geom/prep/PreparedGeometry.h> // for inheritance
23 //#include <geos/algorithm/PointLocator.h>
24 //#include <geos/geom/util/ComponentCoordinateExtracter.h>
25 #include <geos/geom/Coordinate.h>
26 //#include <geos/geom/Location.h>
27 
28 #include <vector>
29 #include <string>
30 
31 namespace geos {
32 namespace geom {
33 class Geometry;
34 class Coordinate;
35 }
36 }
37 
38 
39 namespace geos {
40 namespace geom { // geos::geom
41 namespace prep { // geos::geom::prep
42 
43 // * \class BasicPreparedGeometry
44 
59 private:
60  const geom::Geometry* baseGeom;
61  std::vector<const CoordinateXY*> representativePts;
62 
63 protected:
67  void setGeometry(const geom::Geometry* geom);
68 
76  bool envelopesIntersect(const geom::Geometry* g) const;
77 
86  bool envelopeCovers(const geom::Geometry* g) const;
87 
88 public:
89  BasicPreparedGeometry(const Geometry* geom);
90 
91  ~BasicPreparedGeometry() override = default;
92 
93  const geom::Geometry&
94  getGeometry() const override
95  {
96  return *baseGeom;
97  }
98 
106  const std::vector<const CoordinateXY*>*
108  {
109  return &representativePts;
110  }
111 
120  bool isAnyTargetComponentInTest(const geom::Geometry* testGeom) const;
121 
125  bool contains(const geom::Geometry* g) const override;
126 
130  bool containsProperly(const geom::Geometry* g) const override;
131 
135  bool coveredBy(const geom::Geometry* g) const override;
136 
140  bool covers(const geom::Geometry* g) const override;
141 
145  bool crosses(const geom::Geometry* g) const override;
146 
151  bool disjoint(const geom::Geometry* g) const override;
152 
156  bool intersects(const geom::Geometry* g) const override;
157 
161  bool overlaps(const geom::Geometry* g) const override;
162 
166  bool touches(const geom::Geometry* g) const override;
167 
171  bool within(const geom::Geometry* g) const override;
172 
176  std::unique_ptr<geom::CoordinateSequence> nearestPoints(const geom::Geometry* g) const override;
177 
181  double distance(const geom::Geometry* g) const override;
182 
186  bool isWithinDistance(const geom::Geometry* geom, double dist) const override;
187 
188  std::string toString();
189 
190 };
191 
192 } // namespace geos::geom::prep
193 } // namespace geos::geom
194 } // namespace geos
195 
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:186
A base class for PreparedGeometry subclasses.
Definition: BasicPreparedGeometry.h:58
const geom::Geometry & getGeometry() const override
Gets the original Geometry which has been prepared.
Definition: BasicPreparedGeometry.h:94
bool covers(const geom::Geometry *g) const override
bool envelopeCovers(const geom::Geometry *g) const
const std::vector< const CoordinateXY * > * getRepresentativePoints() const
Definition: BasicPreparedGeometry.h:107
bool coveredBy(const geom::Geometry *g) const override
bool isWithinDistance(const geom::Geometry *geom, double dist) const override
bool intersects(const geom::Geometry *g) const override
bool contains(const geom::Geometry *g) const override
double distance(const geom::Geometry *g) const override
bool isAnyTargetComponentInTest(const geom::Geometry *testGeom) const
std::unique_ptr< geom::CoordinateSequence > nearestPoints(const geom::Geometry *g) const override
bool envelopesIntersect(const geom::Geometry *g) const
bool touches(const geom::Geometry *g) const override
bool crosses(const geom::Geometry *g) const override
bool overlaps(const geom::Geometry *g) const override
void setGeometry(const geom::Geometry *geom)
bool within(const geom::Geometry *g) const override
bool disjoint(const geom::Geometry *g) const override
bool containsProperly(const geom::Geometry *g) const override
An interface for classes which prepare Geometrys in order to optimize the performance of repeated cal...
Definition: PreparedGeometry.h:56
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25