Complete Note#1 in the http://wiki.osgeo.org/wiki/GEOS_Provenance_Review to get out...
[geos.git] / include / geos / simplify / TaggedLineString.h
blobfc4846c5fe54039f99d7c4c739ca66ae2e3d86ac
1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2006 Refractions Research Inc.
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
13 **********************************************************************
15 * Last port: simplify/TaggedLineString.java rev. 1.2 (JTS-1.7.1)
17 **********************************************************************
19 * NOTES: This class can be optimized to work with vector<Coordinate*>
20 * rather then with CoordinateSequence. Also, LineSegment should
21 * be replaced with a class not copying Coordinates.
23 **********************************************************************/
25 #ifndef GEOS_SIMPLIFY_TAGGEDLINESTRING_H
26 #define GEOS_SIMPLIFY_TAGGEDLINESTRING_H
28 #include <geos/export.h>
29 #include <vector>
30 #include <memory>
32 #ifdef _MSC_VER
33 #pragma warning(push)
34 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
35 #endif
37 // Forward declarations
38 namespace geos {
39 namespace geom {
40 class Coordinate;
41 class CoordinateSequence;
42 class Geometry;
43 class LineString;
44 class LinearRing;
46 namespace simplify {
47 class TaggedLineSegment;
51 namespace geos {
52 namespace simplify { // geos::simplify
55 /** \brief
57 * Contains and owns a list of TaggedLineSegments
60 class GEOS_DLL TaggedLineString {
62 public:
64 typedef std::vector<geom::Coordinate> CoordVect;
66 typedef std::auto_ptr<CoordVect> CoordVectPtr;
68 typedef geom::CoordinateSequence CoordSeq;
70 typedef std::auto_ptr<geom::CoordinateSequence> CoordSeqPtr;
72 TaggedLineString(const geom::LineString* nParentLine,
73 std::size_t minimumSize=2);
75 ~TaggedLineString();
77 std::size_t getMinimumSize() const;
79 const geom::LineString* getParent() const;
81 const CoordSeq* getParentCoordinates() const;
83 CoordSeqPtr getResultCoordinates() const;
85 std::size_t getResultSize() const;
87 TaggedLineSegment* getSegment(std::size_t i);
89 const TaggedLineSegment* getSegment(std::size_t i) const;
91 std::vector<TaggedLineSegment*>& getSegments();
93 const std::vector<TaggedLineSegment*>& getSegments() const;
95 void addToResult(std::auto_ptr<TaggedLineSegment> seg);
97 std::auto_ptr<geom::Geometry> asLineString() const;
99 std::auto_ptr<geom::Geometry> asLinearRing() const;
101 private:
103 const geom::LineString* parentLine;
105 // TaggedLineSegments owned by this object
106 std::vector<TaggedLineSegment*> segs;
108 // TaggedLineSegments owned by this object
109 std::vector<TaggedLineSegment*> resultSegs;
111 std::size_t minimumSize;
113 void init();
115 static CoordVectPtr extractCoordinates(
116 const std::vector<TaggedLineSegment*>& segs);
118 // Copying is turned off
119 TaggedLineString(const TaggedLineString&);
120 TaggedLineString& operator= (const TaggedLineString&);
124 } // namespace geos::simplify
125 } // namespace geos
127 #ifdef _MSC_VER
128 #pragma warning(pop)
129 #endif
131 #endif // GEOS_SIMPLIFY_TAGGEDLINESTRING_H
133 /**********************************************************************
134 * $Log$
135 * Revision 1.7 2006/06/12 11:29:23 strk
136 * unsigned int => size_t
138 * Revision 1.6 2006/04/13 21:52:34 strk
139 * Many debugging lines and assertions added. Fixed bug in TaggedLineString class.
141 * Revision 1.5 2006/04/13 16:04:10 strk
142 * Made TopologyPreservingSimplifier implementation successfully build
144 * Revision 1.4 2006/04/13 09:21:45 mloskot
145 * Removed definition of copy ctor and assignment operator for TaggedLineString class.
146 * According to following rule: Declaring, but not defining, private copy operations has
147 * the effect of "turning off" copying for the class.
149 * Revision 1.3 2006/04/12 17:19:57 strk
150 * Ported TaggedLineStringSimplifier class, made LineSegment class
151 * polymorphic to fix derivation of TaggedLineSegment
153 * Revision 1.2 2006/04/12 15:20:37 strk
154 * LineSegmentIndex class
156 * Revision 1.1 2006/04/12 14:22:12 strk
157 * Initial implementation of TaggedLineSegment and TaggedLineString classes
159 **********************************************************************/