GEOS  3.7.2
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
26 namespace geos {
27  namespace geom {
28  class Coordinate;
29  }
30 }
31 
32 
33 namespace geos {
34 namespace geom { // geos.geom
35 
38 public:
39 
41 
43 
44  CoordinateSequence *clone() const override;
45 
46  //const Coordinate& getCoordinate(int pos) const;
47  const Coordinate& getAt(std::size_t pos) const override;
48 
50  void getAt(std::size_t i, Coordinate& c) const override;
51 
52  //int size() const;
53  size_t getSize() const override;
54 
55  // @deprecated
56  const std::vector<Coordinate>* toVector() const override;
57 
58  // See dox in CoordinateSequence.h
59  void toVector(std::vector<Coordinate>&) const override;
60 
63 
65  CoordinateArraySequence(std::vector<Coordinate> *coords,
66  std::size_t dimension = 0);
67 
69  CoordinateArraySequence(std::size_t n, std::size_t dimension = 0);
70 
71  ~CoordinateArraySequence() override;
72 
73  bool isEmpty() const override { return empty(); }
74 
75  bool empty() const { return vect->empty(); }
76 
78  void clear() { vect->clear(); }
79 
80  void add(const Coordinate& c) override;
81 
82  void add(const Coordinate& c, bool allowRepeated) override;
83 
95  void add(std::size_t i, const Coordinate& coord, bool allowRepeated) override;
96 
97  void setAt(const Coordinate& c, std::size_t pos) override;
98 
99  void deleteAt(std::size_t pos) override;
100 
101  std::string toString() const override;
102 
103  void setPoints(const std::vector<Coordinate> &v) override;
104 
105  double getOrdinate(std::size_t index,
106  size_t ordinateIndex) const override;
107 
108  void setOrdinate(std::size_t index, std::size_t ordinateIndex,
109  double value) override;
110 
111  void expandEnvelope(Envelope &env) const override;
112 
113  std::size_t getDimension() const override;
114 
115  void apply_rw(const CoordinateFilter *filter) override;
116 
117  void apply_ro(CoordinateFilter *filter) const override;
118 
120 
121 private:
122  std::vector<Coordinate> *vect;
123  mutable std::size_t dimension;
124 };
125 
128 
129 } // namespace geos.geom
130 } // namespace geos
131 
132 #endif // ndef GEOS_GEOM_COORDINATEARRAYSEQUENCE_H
geos::geom::CoordinateArraySequence::add
void add(const Coordinate &c) override
Add a Coordinate to the list.
geos::geom::CoordinateArraySequence::getAt
void getAt(std::size_t i, Coordinate &c) const override
Copy Coordinate at position i to Coordinate c.
geos::geom::CoordinateArraySequence::add
void add(std::size_t i, const Coordinate &coord, bool allowRepeated) override
Inserts the specified coordinate at the specified position in this list.
geos::geom::CoordinateArraySequence::isEmpty
bool isEmpty() const override
Returns true it list contains no coordinates.
Definition: CoordinateArraySequence.h:73
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::geom::CoordinateArraySequence::removeRepeatedPoints
CoordinateSequence & removeRepeatedPoints() override
Remove consecutive equal Coordinates from the sequence.
geos::geom::CoordinateArraySequence::setAt
void setAt(const Coordinate &c, std::size_t pos) override
Get a reference to Coordinate at position pos.
geos::geom::CoordinateArraySequence::getAt
const Coordinate & getAt(std::size_t pos) const override
Returns a read-only reference to Coordinate at position i.
geos::geom::CoordinateArraySequence::toString
std::string toString() const override
Get a string rapresentation of CoordinateSequence.
geos::geom::CoordinateArraySequence::CoordinateArraySequence
CoordinateArraySequence(std::size_t n, std::size_t dimension=0)
Construct sequence allocating space for n coordinates.
geos::geom::CoordinateArraySequence::setOrdinate
void setOrdinate(std::size_t index, std::size_t ordinateIndex, double value) override
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
geos::geom::DefaultCoordinateSequence
CoordinateArraySequence DefaultCoordinateSequence
This is for backward API compatibility.
Definition: CoordinateArraySequence.h:127
geos::geom::CoordinateArraySequence::CoordinateArraySequence
CoordinateArraySequence(std::vector< Coordinate > *coords, std::size_t dimension=0)
Construct sequence taking ownership of given Coordinate vector.
geos::geom::CoordinateArraySequence::deleteAt
void deleteAt(std::size_t pos) override
Delete Coordinate at position pos (list will shrink).
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59
geos::geom::CoordinateArraySequence::getSize
size_t getSize() const override
Returns the number of Coordinates (actual or otherwise, as this implementation may not store its data...
geos::geom::CoordinateArraySequence::clone
CoordinateSequence * clone() const override
Returns a deep copy of this collection.
geos::geom::CoordinateArraySequence::toVector
void toVector(std::vector< Coordinate > &) const override
Pushes all Coordinates of this sequence onto the provided vector.
geos::geom::CoordinateArraySequence::setPoints
void setPoints(const std::vector< Coordinate > &v) override
Substitute Coordinate list with a copy of the given vector.
geos::geom::CoordinateArraySequence::toVector
const std::vector< Coordinate > * toVector() const override
Returns a read-only vector with the Coordinates in this collection.
geos::geom::CoordinateArraySequence::CoordinateArraySequence
CoordinateArraySequence()
Construct an empty sequence.
geos::geom::Envelope
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:59
geos::geom::CoordinateArraySequence::expandEnvelope
void expandEnvelope(Envelope &env) const override
geos::geom::CoordinateFilter
Definition: CoordinateFilter.h:43
geos::geom::CoordinateArraySequence::getDimension
std::size_t getDimension() const override
geos::geom::CoordinateArraySequence::add
void add(const Coordinate &c, bool allowRepeated) override
Add a coordinate.
geos::geom::CoordinateArraySequence
The default implementation of CoordinateSequence.
Definition: CoordinateArraySequence.h:37
geos::geom::CoordinateArraySequence::clear
void clear()
Reset this CoordinateArraySequence to the empty state.
Definition: CoordinateArraySequence.h:78