GEOS 3.6.2
TaggedLineString.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
7 *
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.
12 *
13 **********************************************************************
14 *
15 * Last port: simplify/TaggedLineString.java rev. 1.2 (JTS-1.7.1)
16 *
17 **********************************************************************
18 *
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.
22 *
23 **********************************************************************/
24
25#ifndef GEOS_SIMPLIFY_TAGGEDLINESTRING_H
26#define GEOS_SIMPLIFY_TAGGEDLINESTRING_H
27
28#include <geos/export.h>
29#include <vector>
30#include <memory>
31
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
36
37// Forward declarations
38namespace geos {
39 namespace geom {
40 class Coordinate;
42 class Geometry;
43 class LineString;
44 class LinearRing;
45 }
46 namespace simplify {
48 }
49}
50
51namespace geos {
52namespace simplify { // geos::simplify
53
54
60class GEOS_DLL TaggedLineString {
61
62public:
63
64 typedef std::vector<geom::Coordinate> CoordVect;
65
66 typedef std::auto_ptr<CoordVect> CoordVectPtr;
67
68 typedef geom::CoordinateSequence CoordSeq;
69
70 typedef std::auto_ptr<geom::CoordinateSequence> CoordSeqPtr;
71
72 TaggedLineString(const geom::LineString* nParentLine,
73 std::size_t minimumSize=2);
74
75 ~TaggedLineString();
76
77 std::size_t getMinimumSize() const;
78
79 const geom::LineString* getParent() const;
80
81 const CoordSeq* getParentCoordinates() const;
82
83 CoordSeqPtr getResultCoordinates() const;
84
85 std::size_t getResultSize() const;
86
87 TaggedLineSegment* getSegment(std::size_t i);
88
89 const TaggedLineSegment* getSegment(std::size_t i) const;
90
91 std::vector<TaggedLineSegment*>& getSegments();
92
93 const std::vector<TaggedLineSegment*>& getSegments() const;
94
95 void addToResult(std::auto_ptr<TaggedLineSegment> seg);
96
97 std::auto_ptr<geom::Geometry> asLineString() const;
98
99 std::auto_ptr<geom::Geometry> asLinearRing() const;
100
101private:
102
103 const geom::LineString* parentLine;
104
105 // TaggedLineSegments owned by this object
106 std::vector<TaggedLineSegment*> segs;
107
108 // TaggedLineSegments owned by this object
109 std::vector<TaggedLineSegment*> resultSegs;
110
111 std::size_t minimumSize;
112
113 void init();
114
115 static CoordVectPtr extractCoordinates(
116 const std::vector<TaggedLineSegment*>& segs);
117
118 // Copying is turned off
119 TaggedLineString(const TaggedLineString&);
120 TaggedLineString& operator= (const TaggedLineString&);
121
122};
123
124} // namespace geos::simplify
125} // namespace geos
126
127#ifdef _MSC_VER
128#pragma warning(pop)
129#endif
130
131#endif // GEOS_SIMPLIFY_TAGGEDLINESTRING_H
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:59
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:167
Definition LineString.h:70
Models an OGC SFS LinearRing.
Definition LinearRing.h:57
A geom::LineSegment which is tagged with its location in a geom::Geometry.
Definition TaggedLineSegment.h:55
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25