GEOS 3.14.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 const Envelope* getEnvelopeInternal() const override
60 {
61 return &envelope;
62 }
63
64 std::string getGeometryType() const override;
65
66 GeometryTypeId getGeometryTypeId() const override;
67
68 double getLength() const override;
69
71 std::size_t getNumCurves() const override;
72
73 std::size_t getNumPoints() const override;
74
75 bool hasCurvedComponents() const override;
76
77 bool hasM() const override;
78
79 bool hasZ() const override;
80
81 bool isClosed() const override;
82
83 bool isEmpty() const override;
84
85 void normalize() override;
86
87 std::unique_ptr<CompoundCurve> reverse() const;
88
89 void validateConstruction() const;
90
91protected:
94 CompoundCurve(std::vector<std::unique_ptr<SimpleCurve>>&&,
95 const GeometryFactory&);
96
97 CompoundCurve(const CompoundCurve&);
98
99 CompoundCurve& operator=(const CompoundCurve&);
100
101 CompoundCurve* cloneImpl() const override;
102
103 Envelope computeEnvelopeInternal() const;
104
105 void geometryChangedAction() override
106 {
107 envelope = computeEnvelopeInternal();
108 }
109
110 int getSortIndex() const override
111 {
112 return SORTINDEX_COMPOUNDCURVE;
113 }
114
115 CompoundCurve* reverseImpl() const override;
116
117private:
118 std::vector<std::unique_ptr<SimpleCurve>> curves;
119 Envelope envelope;
120};
121
122}
123}
GeometryTypeId
Geometry types.
Definition Geometry.h:74
Basic namespace for all GEOS functionalities.
Definition geos.h:39