00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef GEOS_SIMPLIFY_TAGGEDLINESTRINGSIMPLIFIER_H
00026 #define GEOS_SIMPLIFY_TAGGEDLINESTRINGSIMPLIFIER_H
00027
00028 #include <geos/export.h>
00029 #include <vector>
00030 #include <memory>
00031
00032
00033 namespace geos {
00034 namespace algorithm {
00035 class LineIntersector;
00036 }
00037 namespace geom {
00038 class CoordinateSequence;
00039 class LineSegment;
00040 }
00041 namespace simplify {
00042 class TaggedLineSegment;
00043 class TaggedLineString;
00044 class LineSegmentIndex;
00045 }
00046 }
00047
00048 namespace geos {
00049 namespace simplify {
00050
00051
00058 class GEOS_DLL TaggedLineStringSimplifier {
00059
00060 public:
00061
00062 TaggedLineStringSimplifier(LineSegmentIndex* inputIndex,
00063 LineSegmentIndex* outputIndex);
00064
00073 void setDistanceTolerance(double d);
00074
00075 void simplify(TaggedLineString* line);
00076
00077
00078 private:
00079
00080
00081 LineSegmentIndex* inputIndex;
00082
00083
00084 LineSegmentIndex* outputIndex;
00085
00086 std::auto_ptr<algorithm::LineIntersector> li;
00087
00089 TaggedLineString* line;
00090
00091 const geom::CoordinateSequence* linePts;
00092
00093 double distanceTolerance;
00094
00095 void simplifySection(size_t i, size_t j,
00096 size_t depth);
00097
00098 static size_t findFurthestPoint(
00099 const geom::CoordinateSequence* pts,
00100 size_t i, size_t j,
00101 double& maxDistance);
00102
00103 bool hasBadIntersection(const TaggedLineString* parentLine,
00104 const std::vector<size_t>& sectionIndex,
00105 const geom::LineSegment& candidateSeg);
00106
00107 bool hasBadInputIntersection(const TaggedLineString* parentLine,
00108 const std::vector<size_t>& sectionIndex,
00109 const geom::LineSegment& candidateSeg);
00110
00111 bool hasBadOutputIntersection(const geom::LineSegment& candidateSeg);
00112
00113 bool hasInteriorIntersection(const geom::LineSegment& seg0,
00114 const geom::LineSegment& seg1) const;
00115
00116 std::auto_ptr<TaggedLineSegment> flatten(
00117 size_t start, size_t end);
00118
00127 static bool isInLineSection(
00128 const TaggedLineString* parentLine,
00129 const std::vector<size_t>& sectionIndex,
00130 const TaggedLineSegment* seg);
00131
00140 void remove(const TaggedLineString* line,
00141 size_t start,
00142 size_t end);
00143
00144 };
00145
00146 inline void
00147 TaggedLineStringSimplifier::setDistanceTolerance(double d)
00148 {
00149 distanceTolerance = d;
00150 }
00151
00152 }
00153 }
00154
00155 #endif // GEOS_SIMPLIFY_TAGGEDLINESTRINGSIMPLIFIER_H
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169