GEOS 3.15.0beta1
CompoundCurve.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2024 ISciences, LLC
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************/
14
15#pragma once
16
17#include <geos/geom/LineString.h>
18#include <geos/geom/SimpleCurve.h>
19#include <geos/util.h>
20#include <vector>
21
22namespace geos {
23namespace geom {
24
25class GEOS_DLL CompoundCurve : public Curve {
26 friend class GeometryFactory;
27
28public:
29 using Curve::apply_ro;
30 using Curve::apply_rw;
31
32 void apply_ro(CoordinateFilter* filter) const override;
33
34 void apply_ro(CoordinateSequenceFilter& filter) const override;
35
36 void apply_rw(CoordinateSequenceFilter& filter) override;
37
38 void apply_rw(const CoordinateFilter* filter) override;
39
40 int compareToSameClass(const Geometry* geom) const override;
41
42 std::unique_ptr<CompoundCurve> clone() const;
43
44 bool equalsExact(const Geometry* other, double tolerance = 0)
45 const override;
46
47 bool equalsIdentical(const Geometry* other) const override;
48
49 std::unique_ptr<Geometry> getBoundary() const override;
50
51 const CoordinateXY* getCoordinate() const override;
52
53 uint8_t getCoordinateDimension() const override;
54
55 std::unique_ptr<CoordinateSequence> getCoordinates() const override;
56
58 const SimpleCurve* getCurveN(std::size_t) const override;
59
60 const CoordinateXY& getEndCoordinate() const override;
61
62 std::unique_ptr<Point> getEndPoint() const override;
63
64 const Envelope* getEnvelopeInternal() const override
65 {
66 return &envelope;
67 }
68
69 std::string getGeometryType() const override;
70
71 GeometryTypeId getGeometryTypeId() const override;
72
73 double getLength() const override;
74
76 std::size_t getNumCurves() const override;
77
78 std::size_t getNumPoints() const override;
79
80 std::unique_ptr<Point> getPointN(std::size_t n) const override;
81
82 const CoordinateXY& getStartCoordinate() const override;
83
84 std::unique_ptr<Point> getStartPoint() const override;
85
86 bool hasCurvedComponents() const override;
87
88 bool hasM() const override;
89
90 bool hasZ() const override;
91
92 bool isClosed() const override;
93
94 bool isEmpty() const override;
95
96 void normalize() override;
97
98 std::unique_ptr<CompoundCurve> reverse() const;
99
100 void validateConstruction() const;
101
102protected:
105 CompoundCurve(std::vector<std::unique_ptr<SimpleCurve>>&&,
106 const GeometryFactory&);
107
108 CompoundCurve(const CompoundCurve&);
109
110 CompoundCurve& operator=(const CompoundCurve&);
111
112 CompoundCurve* cloneImpl() const override;
113
114 Envelope computeEnvelopeInternal() const;
115
116 void geometryChangedAction() override
117 {
118 envelope = computeEnvelopeInternal();
119 }
120
121 LineString* getLinearizedImpl(const algorithm::CurveToLineParams&) const override;
122
123 CompoundCurve* getCurvedImpl(const algorithm::LineToCurveParams&) const override { return cloneImpl(); }
124
125 int getSortIndex() const override
126 {
127 return SORTINDEX_COMPOUNDCURVE;
128 }
129
130 CompoundCurve* reverseImpl() const override;
131
132private:
133 void normalizeClosed();
134
135 void reverseInPlace();
136
137 std::vector<std::unique_ptr<SimpleCurve>> curves;
138 Envelope envelope;
139};
140
141}
142}
Definition Angle.h:26
GeometryTypeId
Geometry types.
Definition Geometry.h:78
Basic namespace for all GEOS functionalities.
Definition geos.h:38