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
00074 class BufferInputLineSimplifier
00075 {
00076
00077 public:
00078
00091 static std::auto_ptr<geom::CoordinateSequence> simplify(
00092 const geom::CoordinateSequence& inputLine, double distanceTol);
00093
00094 BufferInputLineSimplifier(const geom::CoordinateSequence& input);
00095
00106 std::auto_ptr<geom::CoordinateSequence> simplify(double distanceTol);
00107
00108 private:
00109
00116 bool deleteShallowConcavities();
00117
00126 unsigned int findNextNonDeletedIndex(unsigned int index) const;
00127
00128 std::auto_ptr<geom::CoordinateSequence> collapseLine() const;
00129
00130 bool isDeletable(int i0, int i1, int i2, double distanceTol) const;
00131
00132 bool isShallowConcavity(const geom::Coordinate& p0,
00133 const geom::Coordinate& p1,
00134 const geom::Coordinate& p2,
00135 double distanceTol) const;
00136
00150 bool isShallowSampled(const geom::Coordinate& p0,
00151 const geom::Coordinate& p2,
00152 int i0, int i2, double distanceTol) const;
00153
00154 bool isShallow(const geom::Coordinate& p0,
00155 const geom::Coordinate& p1,
00156 const geom::Coordinate& p2,
00157 double distanceTol) const;
00158
00159 bool isConcave(const geom::Coordinate& p0,
00160 const geom::Coordinate& p1,
00161 const geom::Coordinate& p2) const;
00162
00163 static const int NUM_PTS_TO_CHECK = 10;
00164
00165 static const int INIT = 0;
00166 static const int DELETE = 1;
00167 static const int KEEP = 1;
00168
00169 const geom::CoordinateSequence& inputLine;
00170 double distanceTol;
00171 std::vector<int> isDeleted;
00172
00173 int angleOrientation;
00174
00175
00176 BufferInputLineSimplifier(const BufferInputLineSimplifier& other);
00177 BufferInputLineSimplifier& operator=(const BufferInputLineSimplifier& rhs);
00178 };
00179
00180
00181 }
00182 }
00183 }
00184
00185
00186 #endif // ndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H
00187
00188
00189
00190
00191