GEOS 3.15.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
65 const std::shared_ptr<const CoordinateSequence>& getSharedCoordinates() const;
66
67 const SimpleCurve* getCurveN(std::size_t) const override;
68
73 virtual std::unique_ptr<Point> getEndPoint() const;
74
75 const Envelope* getEnvelopeInternal() const override
76 {
77 return &envelope;
78 }
79
80 std::size_t getNumCurves() const override;
81
82 std::size_t getNumPoints() const override;
83
84 virtual std::unique_ptr<Point> getPointN(std::size_t n) const;
85
90 virtual std::unique_ptr<Point> getStartPoint() const;
91
92 bool hasM() const override;
93
94 bool hasZ() const override;
95
96 bool isClosed() const override;
97
98 virtual bool isCoordinate(CoordinateXY& pt) const;
99
100 virtual bool isCurved() const = 0;
101
102 bool isEmpty() const override;
103
111 void normalize() override;
112
113protected:
114
115 SimpleCurve(const SimpleCurve& other);
116
117 SimpleCurve(const std::shared_ptr<const CoordinateSequence>& newCoords,
118 bool isLinear,
119 const GeometryFactory& factory);
120
121 SimpleCurve(std::unique_ptr<CoordinateSequence>&& newCoords,
122 bool isLinear,
123 const GeometryFactory& factory);
124
125 int compareToSameClass(const Geometry* ls) const override;
126
127 Envelope computeEnvelopeInternal(bool isLinear) const;
128
129 std::shared_ptr<const CoordinateSequence> points;
130 mutable Envelope envelope;
131
132
133private:
134
135 void normalizeClosed();
136};
137
138}
139}
Basic namespace for all GEOS functionalities.
Definition geos.h:38