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