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