GEOS: DistanceOp.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# DistanceOp.h

    00001 /**********************************************************************
    00002  * $Id: DistanceOp.h 1831 2006-09-07 09:01:08Z 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 #ifndef GEOS_OP_DISTANCE_DISTANCEOP_H
    00017 #define GEOS_OP_DISTANCE_DISTANCEOP_H
    00018
    00019 #include <geos/algorithm/PointLocator.h> // for composition
    00020
    00021 #include <vector>
    00022
    00023 // Forward declarations
    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 { // geos::operation
    00043 namespace distance { // geos::operation::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 } // namespace geos::operation::distance
    00164 } // namespace geos::operation
    00165 } // namespace geos
    00166
    00167 #endif // GEOS_OP_DISTANCE_DISTANCEOP_H
    00168
    00169 /**********************************************************************
    00170  * $Log$
    00171  * Revision 1.1  2006/03/21 17:55:01  strk
    00172  * opDistance.h header split
    00173  *
    00174  **********************************************************************/
    00175