00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_OP_DISTANCE_DISTANCEOP_H
00017 #define GEOS_OP_DISTANCE_DISTANCEOP_H
00018
00019 #include <geos/algorithm/PointLocator.h>
00020
00021 #include <vector>
00022
00023
00024 namespace geos {
00025 namespace geom {
00026 class Coordinate;
00027 class Polygon;
00028 class LineString;
00029 class Point;
00030 class Geometry;
00031 class CoordinateSequence;
00032 }
00033 namespace operation {
00034 namespace distance {
00035 class GeometryLocation;
00036 }
00037 }
00038 }
00039
00040
00041 namespace geos {
00042 namespace operation {
00043 namespace distance {
00044
00060 class DistanceOp {
00061 public:
00068 static double distance(const geom::Geometry *g0, const geom::Geometry *g1);
00069
00078 static geom::CoordinateSequence* closestPoints(geom::Geometry *g0, geom::Geometry *g1);
00079
00084 DistanceOp(const geom::Geometry *g0, const geom::Geometry *g1);
00085
00086 ~DistanceOp();
00087
00093 double distance();
00094
00102 geom::CoordinateSequence* closestPoints();
00103
00114 std::vector<GeometryLocation*>* closestLocations();
00115
00116 private:
00117
00118 algorithm::PointLocator ptLocator;
00119 std::vector<geom::Geometry const*> geom;
00120 std::vector<geom::Coordinate *> newCoords;
00121 std::vector<GeometryLocation*> *minDistanceLocation;
00122 double minDistance;
00123 void updateMinDistance(double dist);
00124 void updateMinDistance(std::vector<GeometryLocation*> *locGeom, bool flip);
00125 void computeMinDistance();
00126 void computeContainmentDistance();
00127
00128 void computeInside(std::vector<GeometryLocation*> *locs,
00129 const std::vector<const geom::Polygon*>& polys,
00130 std::vector<GeometryLocation*> *locPtPoly);
00131
00132 void computeInside(GeometryLocation *ptLoc,
00133 const geom::Polygon *poly,
00134 std::vector<GeometryLocation*> *locPtPoly);
00135
00136 void computeLineDistance();
00137
00138 void computeMinDistanceLines(
00139 const std::vector<const geom::LineString*>& lines0,
00140 const std::vector<const geom::LineString*>& lines1,
00141 std::vector<GeometryLocation*>& locGeom);
00142
00143 void computeMinDistancePoints(
00144 const std::vector<const geom::Point*>& points0,
00145 const std::vector<const geom::Point*>& points1,
00146 std::vector<GeometryLocation*>& locGeom);
00147
00148 void computeMinDistanceLinesPoints(
00149 const std::vector<const geom::LineString*>& lines0,
00150 const std::vector<const geom::Point*>& points1,
00151 std::vector<GeometryLocation*>& locGeom);
00152
00153 void computeMinDistance(const geom::LineString *line0,
00154 const geom::LineString *line1,
00155 std::vector<GeometryLocation*>& locGeom);
00156
00157 void computeMinDistance(const geom::LineString *line,
00158 const geom::Point *pt,
00159 std::vector<GeometryLocation*>& locGeom);
00160 };
00161
00162
00163 }
00164 }
00165 }
00166
00167 #endif // GEOS_OP_DISTANCE_DISTANCEOP_H
00168
00169
00170
00171
00172
00173
00174
00175