GEOS 3.15.0beta1
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
29 friend class GeometryFactory;
30
31 ~CircularString() override;
32
33 std::unique_ptr<CircularString> clone() const;
34
35 const std::vector<CircularArc>& getArcs() const;
36
37 std::string getGeometryType() const override;
38
39 GeometryTypeId getGeometryTypeId() const override;
40
41 double getLength() const override;
42
43 bool hasCurvedComponents() const override
44 {
45 return true;
46 }
47
48 bool isCurved() const override {
49 return true;
50 }
51
52 void normalize() override;
53
54 std::unique_ptr<CircularString> reverse() const
55 {
56 return std::unique_ptr<CircularString>(reverseImpl());
57 }
58
59 std::unique_ptr<Curve> getCurved(const algorithm::LineToCurveParams&) const;
60
61protected:
62
66 CircularString(std::unique_ptr<CoordinateSequence>&& pts,
67 const GeometryFactory& newFactory);
68
69 CircularString(const std::shared_ptr<const CoordinateSequence>& pts,
70 const GeometryFactory& newFactory);
71
72 CircularString* cloneImpl() const override
73 {
74 return new CircularString(*this);
75 }
76
77 void geometryChangedAction() override
78 {
79 envelope = computeEnvelopeInternal(false);
80 }
81
82 CircularString* getCurvedImpl(const algorithm::LineToCurveParams&) const override {
83 return cloneImpl();
84 }
85
86 LineString* getLinearizedImpl(const algorithm::CurveToLineParams&) const override;
87
88 int
89 getSortIndex() const override
90 {
91 return SORTINDEX_CIRCULARSTRING;
92 };
93
94 CircularString* reverseImpl() const override;
95
96 void validateConstruction();
97
98private:
99 void createArcs() const;
100
101 void normalizeClosed();
102
103 mutable std::vector<CircularArc> arcs;
104
105};
106
107
108}
109}
Definition Angle.h:26
GeometryTypeId
Geometry types.
Definition Geometry.h:78
Basic namespace for all GEOS functionalities.
Definition geos.h:38