GEOS 3.15.0dev
CurveBuilder.h
1/**********************************************************************
2*
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2026 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 Foundations.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************/
14
15#pragma once
16
17#include <geos/export.h>
18
19#include <memory>
20#include <vector>
21
22namespace geos::geom {
23class CoordinateSequence;
24class Curve;
25class GeometryFactory;
26class SimpleCurve;
27}
28
29namespace geos::geom::util {
30
33class GEOS_DLL CurveBuilder {
34public:
35 CurveBuilder(const GeometryFactory& gfact, bool hasZ, bool hasM);
36
37 // Add all coordinates in the provided geometry
38 void add(const Curve& geom);
39
40 // Add all coordinates in the provided sequence
41 void add(const CoordinateSequence& seq, bool isCurved);
42
43 // Close the ring, if necessary, using a linear segment
44 void closeRing();
45
46 // Get the result geometry
47 std::unique_ptr<Curve> getGeometry();
48
49 // Get a reference to the CoordinateSequence to which
50 // coordinates are currently being added.
51 CoordinateSequence& getSeq(bool isCurved);
52
53private:
54 void finishCurve();
55 void finishLine();
56
57 std::vector<std::unique_ptr<SimpleCurve>> m_curves;
58 std::unique_ptr<CoordinateSequence> m_pts{nullptr};
59 const GeometryFactory& m_gfact;
60 const bool m_hasZ;
61 const bool m_hasM;
62 bool m_isCurved{false};
63};
64
65}
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:71
Definition CurveBuilder.h:33
Provides classes that parse and modify Geometry objects.
Definition ComponentCoordinateExtracter.h:28
Definition Angle.h:26