20 #ifndef GEOS_OP_DISTANCE_DISTANCEOP_H
21 #define GEOS_OP_DISTANCE_DISTANCEOP_H
23 #include <geos/export.h>
25 #include <geos/algorithm/PointLocator.h>
26 #include <geos/operation/distance/GeometryLocation.h>
27 #include <geos/geom/CoordinateSequence.h>
35 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
72 class GEOS_DLL DistanceOp {
84 static double distance(
const geom::Geometry& g0,
85 const geom::Geometry& g1);
88 static double distance(
const geom::Geometry* g0,
89 const geom::Geometry* g1);
101 static bool isWithinDistance(
const geom::Geometry& g0,
102 const geom::Geometry& g1,
117 static std::unique_ptr<geom::CoordinateSequence> nearestPoints(
118 const geom::Geometry* g0,
119 const geom::Geometry* g1);
122 DistanceOp(
const geom::Geometry* g0,
const geom::Geometry* g1);
132 DistanceOp(
const geom::Geometry& g0,
const geom::Geometry& g1);
144 DistanceOp(
const geom::Geometry& g0,
const geom::Geometry& g1,
145 double terminateDistance);
147 ~DistanceOp() =
default;
164 std::unique_ptr<geom::CoordinateSequence> nearestPoints();
169 std::array<geom::Geometry const*, 2> geom;
170 double terminateDistance;
173 algorithm::PointLocator ptLocator;
174 std::array<std::unique_ptr<GeometryLocation>, 2> minDistanceLocation;
176 bool computed =
false;
178 void updateMinDistance(std::array<std::unique_ptr<GeometryLocation>, 2> & locGeom,
bool flip);
180 void computeMinDistance();
182 void computeContainmentDistance();
184 void computeInside(std::vector<std::unique_ptr<GeometryLocation>> & locs,
185 const std::vector<const geom::Polygon*>& polys,
186 std::array<std::unique_ptr<GeometryLocation>, 2> & locPtPoly);
188 void computeInside(std::unique_ptr<GeometryLocation> & ptLoc,
189 const geom::Polygon* poly,
190 std::array<std::unique_ptr<GeometryLocation>, 2> & locPtPoly);
196 void computeFacetDistance();
198 void computeMinDistanceLines(
199 const std::vector<const geom::LineString*>& lines0,
200 const std::vector<const geom::LineString*>& lines1,
201 std::array<std::unique_ptr<GeometryLocation>, 2> & locGeom);
203 void computeMinDistancePoints(
204 const std::vector<const geom::Point*>& points0,
205 const std::vector<const geom::Point*>& points1,
206 std::array<std::unique_ptr<GeometryLocation>, 2> & locGeom);
208 void computeMinDistanceLinesPoints(
209 const std::vector<const geom::LineString*>& lines0,
210 const std::vector<const geom::Point*>& points1,
211 std::array<std::unique_ptr<GeometryLocation>, 2> & locGeom);
213 void computeMinDistance(
const geom::LineString* line0,
214 const geom::LineString* line1,
215 std::array<std::unique_ptr<GeometryLocation>, 2> & locGeom);
217 void computeMinDistance(
const geom::LineString* line,
218 const geom::Point* pt,
219 std::array<std::unique_ptr<GeometryLocation>, 2> & locGeom);
231 #endif // GEOS_OP_DISTANCE_DISTANCEOP_H