00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
00021 #define GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
00022
00023 #include <geos/geom/CoordinateSequence.h>
00024 #include <geos/algorithm/CGAlgorithms.h>
00025
00026 #include <memory>
00027 #include <vector>
00028
00029
00030
00031 namespace geos {
00032 namespace geom {
00033 class CoordinateSequence;
00034
00035 }
00036 }
00037
00038 namespace geos {
00039 namespace operation {
00040 namespace buffer {
00041
00072 class BufferInputLineSimplifier
00073 {
00074
00075 public:
00076
00089 static std::auto_ptr<geom::CoordinateSequence> simplify(
00090 const geom::CoordinateSequence& inputLine, double distanceTol);
00091
00092 BufferInputLineSimplifier(const geom::CoordinateSequence& input);
00093
00104 std::auto_ptr<geom::CoordinateSequence> simplify(double distanceTol);
00105
00106 private:
00107
00114 bool deleteShallowConcavities();
00115
00124 unsigned int findNextNonDeletedIndex(unsigned int index) const;
00125
00126 std::auto_ptr<geom::CoordinateSequence> collapseLine() const;
00127
00128 bool isDeletable(int i0, int i1, int i2, double distanceTol) const;
00129
00130 bool isShallowConcavity(const geom::Coordinate& p0,
00131 const geom::Coordinate& p1,
00132 const geom::Coordinate& p2,
00133 double distanceTol) const;
00134
00148 bool isShallowSampled(const geom::Coordinate& p0,
00149 const geom::Coordinate& p2,
00150 int i0, int i2, double distanceTol) const;
00151
00152 bool isShallow(const geom::Coordinate& p0,
00153 const geom::Coordinate& p1,
00154 const geom::Coordinate& p2,
00155 double distanceTol) const;
00156
00157 bool isConcave(const geom::Coordinate& p0,
00158 const geom::Coordinate& p1,
00159 const geom::Coordinate& p2) const;
00160
00161 static const int NUM_PTS_TO_CHECK = 10;
00162
00163 static const int INIT = 0;
00164 static const int DELETE = 1;
00165 static const int KEEP = 1;
00166
00167 const geom::CoordinateSequence& inputLine;
00168 double distanceTol;
00169 std::vector<int> isDeleted;
00170
00171 int angleOrientation;
00172
00173
00174 BufferInputLineSimplifier(const BufferInputLineSimplifier& other);
00175 BufferInputLineSimplifier& operator=(const BufferInputLineSimplifier& rhs);
00176 };
00177
00178
00179 }
00180 }
00181 }
00182
00183
00184 #endif // ndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
00185
00186
00187
00188
00189