GEOS 3.14.0dev
SimpleCurve.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2001-2002 Vivid Solutions Inc.
7 * Copyright (C) 2005 2006 Refractions Research Inc.
8 * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
9 * Copyright (C) 2024 ISciences, LLC
10 *
11 * This is free software; you can redistribute and/or modify it under
12 * the terms of the GNU Lesser General Public Licence as published
13 * by the Free Software Foundation.
14 * See the COPYING file for more information.
15 *
16 **********************************************************************/
17
18#pragma once
19
20#include <geos/geom/Curve.h>
21#include <geos/geom/Geometry.h>
22
23namespace geos {
24namespace geom {
25
26class GEOS_DLL SimpleCurve : public Curve {
27public:
28
29 using Curve::apply_ro;
30 using Curve::apply_rw;
31
32 void apply_ro(CoordinateFilter* filter) const override;
33
34 void apply_ro(CoordinateSequenceFilter& filter) const override;
35
36 void apply_rw(CoordinateSequenceFilter& filter) override;
37
38 void apply_rw(const CoordinateFilter* filter) override;
39
40 bool equalsExact(const Geometry* other, double tolerance = 0)
41 const override;
42
43 bool equalsIdentical(const Geometry* other) const override;
44
50 std::unique_ptr<Geometry> getBoundary() const override;
51
52 const CoordinateXY* getCoordinate() const override;
53
55 uint8_t getCoordinateDimension() const override;
56
57 virtual const Coordinate& getCoordinateN(std::size_t n) const;
58
59 std::unique_ptr<CoordinateSequence> getCoordinates() const override;
60
62 const CoordinateSequence* getCoordinatesRO() const;
63
64 const SimpleCurve* getCurveN(std::size_t) const override;
65
70 virtual std::unique_ptr<Point> getEndPoint() const;
71
72 const Envelope* getEnvelopeInternal() const override
73 {
74 return &envelope;
75 }
76
77 std::size_t getNumCurves() const override;
78
79 std::size_t getNumPoints() const override;
80
81 virtual std::unique_ptr<Point> getPointN(std::size_t n) const;
82
87 virtual std::unique_ptr<Point> getStartPoint() const;
88
89 bool hasM() const override;
90
91 bool hasZ() const override;
92
93 bool isClosed() const override;
94
95 virtual bool isCoordinate(CoordinateXY& pt) const;
96
97 virtual bool isCurved() const = 0;
98
99 bool isEmpty() const override;
100
108 void normalize() override;
109
117 std::unique_ptr<CoordinateSequence> releaseCoordinates();
118
119protected:
120
121 SimpleCurve(const SimpleCurve& other);
122
123 SimpleCurve(std::unique_ptr<CoordinateSequence>&& newCoords,
124 bool isLinear,
125 const GeometryFactory& factory);
126
127 int compareToSameClass(const Geometry* ls) const override;
128
129 Envelope computeEnvelopeInternal(bool isLinear) const;
130
131 // TODO: hold value or shared_ptr instead of unique_ptr?
132 std::unique_ptr<CoordinateSequence> points;
133 mutable Envelope envelope;
134
135
136private:
137
138 void normalizeClosed();
139};
140
141}
142}
Basic namespace for all GEOS functionalities.
Definition geos.h:39