GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2006 Refractions Research Inc. 00007 * 00008 * This is free software; you can redistribute and/or modify it under 00009 * the terms of the GNU Lesser General Licence as published 00010 * by the Free Software Foundation. 00011 * See the COPYING file for more information. 00012 * 00013 ********************************************************************** 00014 * 00015 * Last port: simplify/TaggedLineString.java rev. 1.2 (JTS-1.7.1) 00016 * 00017 ********************************************************************** 00018 * 00019 * NOTES: This class can be optimized to work with vector<Coordinate*> 00020 * rather then with CoordinateSequence. Also, LineSegment should 00021 * be replaced with a class not copying Coordinates. 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 // Forward declarations 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 { // geos::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 // TaggedLineSegments owned by this object 00106 std::vector<TaggedLineSegment*> segs; 00107 00108 // TaggedLineSegments owned by this object 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 // Copying is turned off 00119 TaggedLineString(const TaggedLineString&); 00120 TaggedLineString& operator= (const TaggedLineString&); 00121 00122 }; 00123 00124 } // namespace geos::simplify 00125 } // namespace geos 00126 00127 #ifdef _MSC_VER 00128 #pragma warning(pop) 00129 #endif 00130 00131 #endif // GEOS_SIMPLIFY_TAGGEDLINESTRING_H