GEOS 3.15.1
CircularString.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/CircularArc.h>
18#include <geos/geom/LineString.h>
19#include <geos/geom/SimpleCurve.h>
20
21namespace geos {
22namespace geom {
23
24class GEOS_DLL CircularString : public SimpleCurve {
25
26public:
27 using SimpleCurve::SimpleCurve;
28 using SimpleCurve::apply_rw;
29
30 friend class GeometryFactory;
31
32 ~CircularString() override;
33
34 void apply_rw(const CoordinateFilter* filter) override;
35
36 void apply_rw(CoordinateSequenceFilter& filter) override;
37
38 std::unique_ptr<CircularString> clone() const;
39
40 const std::vector<CircularArc>& getArcs() const;
41
42 std::string getGeometryType() const override;
43
44 GeometryTypeId getGeometryTypeId() const override;
45
46 double getLength() const override;
47
48 bool hasCurvedComponents() const override
49 {
50 return true;
51 }
52
53 bool hasCurvedTypes() const override
54 {
55 return true;
56 }
57
58 bool isCurved() const override {
59 return true;
60 }
61
62 void normalize() override;
63
64 std::unique_ptr<CircularString> reverse() const
65 {
66 return std::unique_ptr<CircularString>(reverseImpl());
67 }
68
69 std::unique_ptr<Curve> getCurved(const algorithm::LineToCurveParams&) const;
70
71protected:
72
76 CircularString(std::unique_ptr<CoordinateSequence>&& pts,
77 const GeometryFactory& newFactory);
78
79 CircularString(const std::shared_ptr<const CoordinateSequence>& pts,
80 const GeometryFactory& newFactory);
81
82 CircularString* cloneImpl() const override
83 {
84 return new CircularString(*this);
85 }
86
87 void geometryChangedAction() override
88 {
89 envelope = computeEnvelopeInternal(false);
90 arcs.clear();
91 }
92
93 CircularString* getCurvedImpl(const algorithm::LineToCurveParams&) const override {
94 return cloneImpl();
95 }
96
97 LineString* getLinearizedImpl(const algorithm::CurveToLineParams&) const override;
98
99 int
100 getSortIndex() const override
101 {
102 return SORTINDEX_CIRCULARSTRING;
103 };
104
105 CircularString* reverseImpl() const override;
106
107 void validateConstruction();
108
109private:
110 void createArcs() const;
111
112 void normalizeClosed();
113
117 mutable std::vector<CircularArc> arcs;
118
119};
120
121
122}
123}
Definition Angle.h:26
GeometryTypeId
Geometry types.
Definition Geometry.h:78
Basic namespace for all GEOS functionalities.
Definition geos.h:38