GEOS 3.15.0beta3
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 hasCurvedTypes() const override
49 {
50 return true;
51 }
52
53 bool isCurved() const override {
54 return true;
55 }
56
57 void normalize() override;
58
59 std::unique_ptr<CircularString> reverse() const
60 {
61 return std::unique_ptr<CircularString>(reverseImpl());
62 }
63
64 std::unique_ptr<Curve> getCurved(const algorithm::LineToCurveParams&) const;
65
66protected:
67
71 CircularString(std::unique_ptr<CoordinateSequence>&& pts,
72 const GeometryFactory& newFactory);
73
74 CircularString(const std::shared_ptr<const CoordinateSequence>& pts,
75 const GeometryFactory& newFactory);
76
77 CircularString* cloneImpl() const override
78 {
79 return new CircularString(*this);
80 }
81
82 void geometryChangedAction() override
83 {
84 envelope = computeEnvelopeInternal(false);
85 }
86
87 CircularString* getCurvedImpl(const algorithm::LineToCurveParams&) const override {
88 return cloneImpl();
89 }
90
91 LineString* getLinearizedImpl(const algorithm::CurveToLineParams&) const override;
92
93 int
94 getSortIndex() const override
95 {
96 return SORTINDEX_CIRCULARSTRING;
97 };
98
99 CircularString* reverseImpl() const override;
100
101 void validateConstruction();
102
103private:
104 void createArcs() const;
105
106 void normalizeClosed();
107
108 mutable std::vector<CircularArc> arcs;
109
110};
111
112
113}
114}
GeometryTypeId
Geometry types.
Definition Geometry.h:78
Basic namespace for all GEOS functionalities.
Definition geos.h:38