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_TAGGEDLINESTRING_H
00026 #define GEOS_SIMPLIFY_TAGGEDLINESTRING_H
00027
00028 #include <geos/export.h>
00029 #include <vector>
00030 #include <memory>
00031
00032 #ifdef _MSC_VER
00033 #pragma warning(push)
00034 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00035 #endif
00036
00037
00038 namespace geos {
00039 namespace geom {
00040 class Coordinate;
00041 class CoordinateSequence;
00042 class Geometry;
00043 class LineString;
00044 class LinearRing;
00045 }
00046 namespace simplify {
00047 class TaggedLineSegment;
00048 }
00049 }
00050
00051 namespace geos {
00052 namespace simplify {
00053
00054
00060 class GEOS_DLL TaggedLineString {
00061
00062 public:
00063
00064 typedef std::vector<geom::Coordinate> CoordVect;
00065
00066 typedef std::auto_ptr<CoordVect> CoordVectPtr;
00067
00068 typedef geom::CoordinateSequence CoordSeq;
00069
00070 typedef std::auto_ptr<geom::CoordinateSequence> CoordSeqPtr;
00071
00072 TaggedLineString(const geom::LineString* nParentLine,
00073 std::size_t minimumSize=2);
00074
00075 ~TaggedLineString();
00076
00077 std::size_t getMinimumSize() const;
00078
00079 const geom::LineString* getParent() const;
00080
00081 const CoordSeq* getParentCoordinates() const;
00082
00083 CoordSeqPtr getResultCoordinates() const;
00084
00085 std::size_t getResultSize() const;
00086
00087 TaggedLineSegment* getSegment(std::size_t i);
00088
00089 const TaggedLineSegment* getSegment(std::size_t i) const;
00090
00091 std::vector<TaggedLineSegment*>& getSegments();
00092
00093 const std::vector<TaggedLineSegment*>& getSegments() const;
00094
00095 void addToResult(std::auto_ptr<TaggedLineSegment> seg);
00096
00097 std::auto_ptr<geom::Geometry> asLineString() const;
00098
00099 std::auto_ptr<geom::Geometry> asLinearRing() const;
00100
00101 private:
00102
00103 const geom::LineString* parentLine;
00104
00105
00106 std::vector<TaggedLineSegment*> segs;
00107
00108
00109 std::vector<TaggedLineSegment*> resultSegs;
00110
00111 std::size_t minimumSize;
00112
00113 void init();
00114
00115 static CoordVectPtr extractCoordinates(
00116 const std::vector<TaggedLineSegment*>& segs);
00117
00118
00119 TaggedLineString(const TaggedLineString&);
00120 TaggedLineString& operator= (const TaggedLineString&);
00121
00122 };
00123
00124 }
00125 }
00126
00127 #ifdef _MSC_VER
00128 #pragma warning(pop)
00129 #endif
00130
00131 #endif // GEOS_SIMPLIFY_TAGGEDLINESTRING_H