GEOS 3.2.2
|
00001 /********************************************************************** 00002 * $Id: TaggedLineString.h 2785 2009-12-03 19:55:11Z mloskot $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2006 Refractions Research Inc. 00008 * 00009 * This is free software; you can redistribute and/or modify it under 00010 * the terms of the GNU Lesser General Licence as published 00011 * by the Free Software Foundation. 00012 * See the COPYING file for more information. 00013 * 00014 ********************************************************************** 00015 * 00016 * Last port: simplify/TaggedLineString.java rev. 1.2 (JTS-1.7.1) 00017 * 00018 ********************************************************************** 00019 * 00020 * NOTES: This class can be optimized to work with vector<Coordinate*> 00021 * rather then with CoordinateSequence. Also, LineSegment should 00022 * be replaced with a class not copying Coordinates. 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 #include <cstddef> 00033 00034 // Forward declarations 00035 namespace geos { 00036 namespace geom { 00037 class Coordinate; 00038 class CoordinateSequence; 00039 class Geometry; 00040 class LineString; 00041 class LinearRing; 00042 } 00043 namespace simplify { 00044 class TaggedLineSegment; 00045 } 00046 } 00047 00048 namespace geos { 00049 namespace simplify { // geos::simplify 00050 00051 using namespace std; 00052 00058 class GEOS_DLL TaggedLineString { 00059 00060 public: 00061 00062 typedef std::vector<geom::Coordinate> CoordVect; 00063 00064 typedef std::auto_ptr<CoordVect> CoordVectPtr; 00065 00066 typedef geom::CoordinateSequence CoordSeq; 00067 00068 typedef std::auto_ptr<geom::CoordinateSequence> CoordSeqPtr; 00069 00070 TaggedLineString(const geom::LineString* nParentLine, 00071 size_t minimumSize=2); 00072 00073 ~TaggedLineString(); 00074 00075 size_t getMinimumSize() const; 00076 00077 const geom::LineString* getParent() const; 00078 00079 const CoordSeq* getParentCoordinates() const; 00080 00081 CoordSeqPtr getResultCoordinates() const; 00082 00083 size_t getResultSize() const; 00084 00085 TaggedLineSegment* getSegment(size_t); 00086 00087 const TaggedLineSegment* getSegment(size_t) const; 00088 00089 std::vector<TaggedLineSegment*>& getSegments(); 00090 00091 const std::vector<TaggedLineSegment*>& getSegments() const; 00092 00093 void addToResult(std::auto_ptr<TaggedLineSegment> seg); 00094 00095 std::auto_ptr<geom::Geometry> asLineString() const; 00096 00097 std::auto_ptr<geom::Geometry> asLinearRing() const; 00098 00099 private: 00100 00101 const geom::LineString* parentLine; 00102 00103 // TaggedLineSegments owned by this object 00104 std::vector<TaggedLineSegment*> segs; 00105 00106 // TaggedLineSegments owned by this object 00107 std::vector<TaggedLineSegment*> resultSegs; 00108 00109 size_t minimumSize; 00110 00111 void init(); 00112 00113 static CoordVectPtr extractCoordinates( 00114 const std::vector<TaggedLineSegment*>& segs); 00115 00116 // Copying is turned off 00117 TaggedLineString(const TaggedLineString&); 00118 TaggedLineString& operator= (const TaggedLineString&); 00119 00120 }; 00121 00122 } // namespace geos::simplify 00123 } // namespace geos 00124 00125 #endif // GEOS_SIMPLIFY_TAGGEDLINESTRING_H 00126 00127 /********************************************************************** 00128 * $Log$ 00129 * Revision 1.7 2006/06/12 11:29:23 strk 00130 * unsigned int => size_t 00131 * 00132 * Revision 1.6 2006/04/13 21:52:34 strk 00133 * Many debugging lines and assertions added. Fixed bug in TaggedLineString class. 00134 * 00135 * Revision 1.5 2006/04/13 16:04:10 strk 00136 * Made TopologyPreservingSimplifier implementation successfully build 00137 * 00138 * Revision 1.4 2006/04/13 09:21:45 mloskot 00139 * Removed definition of copy ctor and assignment operator for TaggedLineString class. 00140 * According to following rule: Declaring, but not defining, private copy operations has 00141 * the effect of "turning off" copying for the class. 00142 * 00143 * Revision 1.3 2006/04/12 17:19:57 strk 00144 * Ported TaggedLineStringSimplifier class, made LineSegment class 00145 * polymorphic to fix derivation of TaggedLineSegment 00146 * 00147 * Revision 1.2 2006/04/12 15:20:37 strk 00148 * LineSegmentIndex class 00149 * 00150 * Revision 1.1 2006/04/12 14:22:12 strk 00151 * Initial implementation of TaggedLineSegment and TaggedLineString classes 00152 * 00153 **********************************************************************/