GEOS 3.11.1
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#pragma once
26
27#include <geos/export.h>
28#include <vector>
29#include <memory>
30
31#ifdef _MSC_VER
32#pragma warning(push)
33#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
34#endif
35
36// Forward declarations
37namespace geos {
38namespace geom {
39class Coordinate;
40class CoordinateSequence;
41class Geometry;
42class LineString;
43class LinearRing;
44}
45namespace simplify {
46class TaggedLineSegment;
47}
48}
49
50namespace geos {
51namespace simplify { // geos::simplify
52
53
57class GEOS_DLL TaggedLineString {
58
59public:
60
61 typedef std::vector<geom::Coordinate> CoordVect;
62
63 typedef std::unique_ptr<CoordVect> CoordVectPtr;
64
66
67 typedef std::unique_ptr<geom::CoordinateSequence> CoordSeqPtr;
68
69 TaggedLineString(const geom::LineString* nParentLine,
70 std::size_t minimumSize = 2);
71
73
74 std::size_t getMinimumSize() const;
75
76 const geom::LineString* getParent() const;
77
78 const CoordSeq* getParentCoordinates() const;
79
80 CoordSeqPtr getResultCoordinates() const;
81
82 std::size_t getResultSize() const;
83
84 TaggedLineSegment* getSegment(std::size_t i);
85
86 const TaggedLineSegment* getSegment(std::size_t i) const;
87
88 std::vector<TaggedLineSegment*>& getSegments();
89
90 const std::vector<TaggedLineSegment*>& getSegments() const;
91
92 void addToResult(std::unique_ptr<TaggedLineSegment> seg);
93
94 std::unique_ptr<geom::Geometry> asLineString() const;
95
96 std::unique_ptr<geom::Geometry> asLinearRing() const;
97
98private:
99
100 const geom::LineString* parentLine;
101
102 // TaggedLineSegments owned by this object
103 std::vector<TaggedLineSegment*> segs;
104
105 // TaggedLineSegments owned by this object
106 std::vector<TaggedLineSegment*> resultSegs;
107
108 std::size_t minimumSize;
109
110 void init();
111
112 static CoordVectPtr extractCoordinates(
113 const std::vector<TaggedLineSegment*>& segs);
114
115 // Copying is turned off
117 TaggedLineString& operator= (const TaggedLineString&);
118
119};
120
121} // namespace geos::simplify
122} // namespace geos
123
124#ifdef _MSC_VER
125#pragma warning(pop)
126#endif
127
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:44
Definition: LineString.h:66
A geom::LineSegment which is tagged with its location in a geom::Geometry.
Definition: TaggedLineSegment.h:53
Contains and owns a list of TaggedLineSegments.
Definition: TaggedLineString.h:57
Basic namespace for all GEOS functionalities.
Definition: geos.h:39