GEOS 3.15.0dev
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/SimpleCurve.h>
18#include <geos/util.h>
19#include <vector>
20
21namespace geos {
22namespace geom {
23
24class GEOS_DLL CompoundCurve : public Curve {
25 friend class GeometryFactory;
26
27public:
28 using Curve::apply_ro;
29 using Curve::apply_rw;
30
31 void apply_ro(CoordinateFilter* filter) const override;
32
33 void apply_ro(CoordinateSequenceFilter& filter) const override;
34
35 void apply_rw(CoordinateSequenceFilter& filter) override;
36
37 void apply_rw(const CoordinateFilter* filter) override;
38
39 int compareToSameClass(const Geometry* geom) const override;
40
41 std::unique_ptr<CompoundCurve> clone() const;
42
43 bool equalsExact(const Geometry* other, double tolerance = 0)
44 const override;
45
46 bool equalsIdentical(const Geometry* other) const override;
47
48 std::unique_ptr<Geometry> getBoundary() const override;
49
50 const CoordinateXY* getCoordinate() const override;
51
52 uint8_t getCoordinateDimension() const override;
53
54 std::unique_ptr<CoordinateSequence> getCoordinates() const override;
55
57 const SimpleCurve* getCurveN(std::size_t) const override;
58
59 std::unique_ptr<Point> getEndPoint() const override;
60
61 const Envelope* getEnvelopeInternal() const override
62 {
63 return &envelope;
64 }
65
66 std::string getGeometryType() const override;
67
68 GeometryTypeId getGeometryTypeId() const override;
69
70 double getLength() const override;
71
73 std::size_t getNumCurves() const override;
74
75 std::size_t getNumPoints() const override;
76
77 std::unique_ptr<Point> getPointN(std::size_t n) const override;
78
79 std::unique_ptr<Point> getStartPoint() const override;
80
81 bool hasCurvedComponents() const override;
82
83 bool hasM() const override;
84
85 bool hasZ() const override;
86
87 bool isClosed() const override;
88
89 bool isEmpty() const override;
90
91 void normalize() override;
92
93 std::unique_ptr<CompoundCurve> reverse() const;
94
95 void validateConstruction() const;
96
97protected:
100 CompoundCurve(std::vector<std::unique_ptr<SimpleCurve>>&&,
101 const GeometryFactory&);
102
103 CompoundCurve(const CompoundCurve&);
104
105 CompoundCurve& operator=(const CompoundCurve&);
106
107 CompoundCurve* cloneImpl() const override;
108
109 Envelope computeEnvelopeInternal() const;
110
111 void geometryChangedAction() override
112 {
113 envelope = computeEnvelopeInternal();
114 }
115
116 int getSortIndex() const override
117 {
118 return SORTINDEX_COMPOUNDCURVE;
119 }
120
121 CompoundCurve* reverseImpl() const override;
122
123private:
124 void normalizeClosed();
125
126 void reverseInPlace();
127
128 std::vector<std::unique_ptr<SimpleCurve>> curves;
129 Envelope envelope;
130};
131
132}
133}
GeometryTypeId
Geometry types.
Definition Geometry.h:73
Basic namespace for all GEOS functionalities.
Definition geos.h:38