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
00026 #ifndef GEOS_SIMPLIFY_TAGGEDLINESTRING_H
00027 #define GEOS_SIMPLIFY_TAGGEDLINESTRING_H
00028
00029 #include <geos/export.h>
00030 #include <vector>
00031 #include <memory>
00032
00033
00034 namespace geos {
00035 namespace geom {
00036 class Coordinate;
00037 class CoordinateSequence;
00038 class Geometry;
00039 class LineString;
00040 class LinearRing;
00041 }
00042 namespace simplify {
00043 class TaggedLineSegment;
00044 }
00045 }
00046
00047 namespace geos {
00048 namespace simplify {
00049
00050
00056 class GEOS_DLL TaggedLineString {
00057
00058 public:
00059
00060 typedef std::vector<geom::Coordinate> CoordVect;
00061
00062 typedef std::auto_ptr<CoordVect> CoordVectPtr;
00063
00064 typedef geom::CoordinateSequence CoordSeq;
00065
00066 typedef std::auto_ptr<geom::CoordinateSequence> CoordSeqPtr;
00067
00068 TaggedLineString(const geom::LineString* nParentLine,
00069 size_t minimumSize=2);
00070
00071 ~TaggedLineString();
00072
00073 size_t getMinimumSize() const;
00074
00075 const geom::LineString* getParent() const;
00076
00077 const CoordSeq* getParentCoordinates() const;
00078
00079 CoordSeqPtr getResultCoordinates() const;
00080
00081 size_t getResultSize() const;
00082
00083 TaggedLineSegment* getSegment(size_t);
00084
00085 const TaggedLineSegment* getSegment(size_t) const;
00086
00087 std::vector<TaggedLineSegment*>& getSegments();
00088
00089 const std::vector<TaggedLineSegment*>& getSegments() const;
00090
00091 void addToResult(std::auto_ptr<TaggedLineSegment> seg);
00092
00093 std::auto_ptr<geom::Geometry> asLineString() const;
00094
00095 std::auto_ptr<geom::Geometry> asLinearRing() const;
00096
00097 private:
00098
00099 const geom::LineString* parentLine;
00100
00101
00102 std::vector<TaggedLineSegment*> segs;
00103
00104
00105 std::vector<TaggedLineSegment*> resultSegs;
00106
00107 size_t minimumSize;
00108
00109 void init();
00110
00111 static CoordVectPtr extractCoordinates(
00112 const std::vector<TaggedLineSegment*>& segs);
00113
00114
00115 TaggedLineString(const TaggedLineString&);
00116 TaggedLineString& operator= (const TaggedLineString&);
00117
00118 };
00119
00120 }
00121 }
00122
00123 #endif // GEOS_SIMPLIFY_TAGGEDLINESTRING_H
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151