GEOS 3.3.8

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

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