GEOS  3.8.0dev
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  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::size_t n, std::size_t dimension = 0);
65 
66  ~CoordinateArraySequence() override;
67 
68  bool
69  isEmpty() const override
70  {
71  return empty();
72  }
73 
74  bool
75  empty() const
76  {
77  return vect.empty();
78  }
79 
81  void
83  {
84  vect.clear();
85  }
86 
88  void add(const Coordinate& c);
89 
96  void add(const Coordinate& c, bool allowRepeated);
97 
109  void add(std::size_t i, const Coordinate& coord, bool allowRepeated);
110 
111  void add(const CoordinateSequence* cl, bool allowRepeated, bool direction);
112 
113  void setAt(const Coordinate& c, std::size_t pos) override;
114 
115  void setPoints(const std::vector<Coordinate>& v) override;
116 
117  double getOrdinate(std::size_t index,
118  size_t ordinateIndex) const override;
119 
120  void setOrdinate(std::size_t index, std::size_t ordinateIndex,
121  double value) override;
122 
123  void expandEnvelope(Envelope& env) const override;
124 
125  std::size_t getDimension() const override;
126 
127  void apply_rw(const CoordinateFilter* filter) override;
128 
129  void apply_ro(CoordinateFilter* filter) const override;
130 
131 private:
132  std::vector<Coordinate> vect;
133  mutable std::size_t dimension;
134 };
135 
138 
139 } // namespace geos.geom
140 } // namespace geos
141 
142 #endif // ndef GEOS_GEOM_COORDINATEARRAYSEQUENCE_H
CoordinateArraySequence DefaultCoordinateSequence
This is for backward API compatibility.
Definition: CoordinateArraySequence.h:137
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
The default implementation of CoordinateSequence.
Definition: CoordinateArraySequence.h:37
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
bool isEmpty() const override
Returns true it list contains no coordinates.
Definition: CoordinateArraySequence.h:69
Geometry classes support the concept of applying a coordinate filter to every coordinate in the Geome...
Definition: CoordinateFilter.h:43
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58
void clear()
Reset this CoordinateArraySequence to the empty state.
Definition: CoordinateArraySequence.h:82