GEOS 3.9.1
CoordinateArraySequence.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
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#ifndef GEOS_GEOM_COORDINATEARRAYSEQUENCE_H
16#define GEOS_GEOM_COORDINATEARRAYSEQUENCE_H
17
18#include <geos/export.h>
19#include <vector>
20
21#include <geos/geom/CoordinateSequence.h>
22
23#include <geos/inline.h>
24
25// Forward declarations
26namespace geos {
27namespace geom {
28class Coordinate;
29}
30}
31
32
33namespace geos {
34namespace geom { // geos.geom
35
38public:
39
41
43
44 std::unique_ptr<CoordinateSequence> clone() const override;
45
46 const Coordinate& getAt(std::size_t pos) const override;
47
49 void getAt(std::size_t i, Coordinate& c) const override;
50
51 size_t getSize() const override;
52
53 // See dox in CoordinateSequence.h
54 void toVector(std::vector<Coordinate>&) const override;
55
58
60 CoordinateArraySequence(std::vector<Coordinate> && coords,
61 std::size_t dimension = 0);
62
64 CoordinateArraySequence(std::vector<Coordinate>* coords,
65 std::size_t dimension = 0);
66
68 CoordinateArraySequence(std::size_t n, std::size_t dimension = 0);
69
70 ~CoordinateArraySequence() override = default;
71
72 bool
73 isEmpty() const override
74 {
75 return empty();
76 }
77
78 bool
79 empty() const
80 {
81 return vect.empty();
82 }
83
85 void
87 {
88 vect.clear();
89 }
90
92 void add(const Coordinate& c);
93
100 void add(const Coordinate& c, bool allowRepeated);
101
113 void add(std::size_t i, const Coordinate& coord, bool allowRepeated);
114
115 void add(const CoordinateSequence* cl, bool allowRepeated, bool direction);
116
117 void setAt(const Coordinate& c, std::size_t pos) override;
118
119 void setPoints(const std::vector<Coordinate>& v) override;
120
121 void setOrdinate(std::size_t index, std::size_t ordinateIndex,
122 double value) override;
123
124 void expandEnvelope(Envelope& env) const override;
125
126 std::size_t getDimension() const override;
127
128 void apply_rw(const CoordinateFilter* filter) override;
129
130 void apply_ro(CoordinateFilter* filter) const override;
131
132private:
133 std::vector<Coordinate> vect;
134 mutable std::size_t dimension;
135};
136
139
140} // namespace geos.geom
141} // namespace geos
142
143#endif // ndef GEOS_GEOM_COORDINATEARRAYSEQUENCE_H
The default implementation of CoordinateSequence.
Definition: CoordinateArraySequence.h:37
std::unique_ptr< CoordinateSequence > clone() const override
Returns a deep copy of this collection.
void toVector(std::vector< Coordinate > &) const override
const Coordinate & getAt(std::size_t pos) const override
Returns a read-only reference to Coordinate at position i.
void expandEnvelope(Envelope &env) const override
void clear()
Reset this CoordinateArraySequence to the empty state.
Definition: CoordinateArraySequence.h:86
CoordinateArraySequence(std::vector< Coordinate > *coords, std::size_t dimension=0)
Construct sequence taking ownership of given Coordinate vector.
size_t getSize() const override
Returns the number of Coordinates (actual or otherwise, as this implementation may not store its data...
CoordinateArraySequence(std::size_t n, std::size_t dimension=0)
Construct sequence allocating space for n coordinates.
void setAt(const Coordinate &c, std::size_t pos) override
Copy Coordinate c to position pos.
CoordinateArraySequence()
Construct an empty sequence.
void add(std::size_t i, const Coordinate &coord, bool allowRepeated)
Inserts the specified coordinate at the specified position in this list.
void setPoints(const std::vector< Coordinate > &v) override
Substitute Coordinate list with a copy of the given vector.
void getAt(std::size_t i, Coordinate &c) const override
Copy Coordinate at position i to Coordinate c.
std::size_t getDimension() const override
void setOrdinate(std::size_t index, std::size_t ordinateIndex, double value) override
void add(const Coordinate &c)
Add a Coordinate to the list.
void add(const Coordinate &c, bool allowRepeated)
Add a coordinate.
CoordinateArraySequence(std::vector< Coordinate > &&coords, std::size_t dimension=0)
Construct sequence moving from given Coordinate vector.
bool isEmpty() const override
Returns true it list contains no coordinates.
Definition: CoordinateArraySequence.h:73
Geometry classes support the concept of applying a coordinate filter to every coordinate in the Geome...
Definition: CoordinateFilter.h:43
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
CoordinateArraySequence DefaultCoordinateSequence
This is for backward API compatibility.
Definition: CoordinateArraySequence.h:138
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26