/src/geos/include/geos/noding/ArcString.h
Line | Count | Source |
1 | | /********************************************************************** |
2 | | * |
3 | | * GEOS - Geometry Engine Open Source |
4 | | * http://geos.osgeo.org |
5 | | * |
6 | | * Copyright (C) 2025 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/export.h> |
18 | | #include <geos/geom/CircularArc.h> |
19 | | #include <geos/noding/PathString.h> |
20 | | |
21 | | #include <vector> |
22 | | |
23 | | namespace geos::noding { |
24 | | |
25 | | /** \brief |
26 | | * An interface for classes which represent a sequence of contiguous |
27 | | * circular arcs, analogous to the SegmentString for contiguous line |
28 | | * segments. |
29 | | */ |
30 | | class GEOS_DLL ArcString : public PathString { |
31 | | public: |
32 | 0 | explicit ArcString(std::vector<geom::CircularArc> arcs) : m_arcs(std::move(arcs)) { |
33 | 0 | } |
34 | | |
35 | | ArcString(std::vector<geom::CircularArc> arcs, const std::shared_ptr<const geom::CoordinateSequence>& seq, void* context) |
36 | 0 | : m_arcs(std::move(arcs)), |
37 | 0 | m_seq(seq), |
38 | 0 | m_context(context) |
39 | 0 | {} |
40 | | |
41 | 0 | std::size_t getSize() const override { |
42 | 0 | return m_arcs.size(); |
43 | 0 | } |
44 | | |
45 | 0 | double getLength() const override { |
46 | 0 | double tot = 0; |
47 | 0 | for (const auto &arc: m_arcs) { |
48 | 0 | tot += arc.getLength(); |
49 | 0 | } |
50 | 0 | return tot; |
51 | 0 | } |
52 | | |
53 | 0 | const geom::CircularArc &getArc(std::size_t i) const { |
54 | 0 | return m_arcs[i]; |
55 | 0 | } |
56 | | |
57 | 0 | auto begin() const { |
58 | 0 | return m_arcs.begin(); |
59 | 0 | } |
60 | | |
61 | 0 | auto end() const { |
62 | 0 | return m_arcs.end(); |
63 | 0 | } |
64 | | |
65 | | const std::shared_ptr<const geom::CoordinateSequence>& getCoordinates() const override; |
66 | | |
67 | | protected: |
68 | | std::vector<geom::CircularArc> m_arcs; |
69 | | std::shared_ptr<const geom::CoordinateSequence> m_seq; |
70 | | void* m_context; |
71 | | }; |
72 | | |
73 | | } |