GEOS  3.3.3
CoordinateArraySequence.h
1 /**********************************************************************
2  * $Id: CoordinateArraySequence.h 3255 2011-03-01 17:56:10Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2006 Refractions Research Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************/
15 
16 #ifndef GEOS_GEOM_COORDINATEARRAYSEQUENCE_H
17 #define GEOS_GEOM_COORDINATEARRAYSEQUENCE_H
18 
19 #include <geos/export.h>
20 #include <vector>
21 
22 #include <geos/geom/CoordinateSequence.h>
23 
24 #include <geos/inline.h>
25 
26 // Forward declarations
27 namespace geos {
28  namespace geom {
29  class Coordinate;
30  }
31 }
32 
33 
34 namespace geos {
35 namespace geom { // geos.geom
36 
39 public:
40 
42 
43  CoordinateSequence *clone() const;
44 
45  //const Coordinate& getCoordinate(int pos) const;
46  const Coordinate& getAt(std::size_t pos) const;
47 
49  virtual void getAt(std::size_t i, Coordinate& c) const;
50 
51  //int size() const;
52  size_t getSize() const;
53 
54  // @deprecated
55  const std::vector<Coordinate>* toVector() const;
56 
57  // See dox in CoordinateSequence.h
58  void toVector(std::vector<Coordinate>&) const;
59 
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 
71 
72  bool isEmpty() const { return empty(); }
73 
74  bool empty() const { return vect->empty(); }
75 
77  void clear() { vect->clear(); }
78 
79  void add(const Coordinate& c);
80 
81  virtual void add(const Coordinate& c, bool allowRepeated);
82 
94  virtual void add(std::size_t i, const Coordinate& coord, bool allowRepeated);
95 
96  void setAt(const Coordinate& c, std::size_t pos);
97 
98  void deleteAt(std::size_t pos);
99 
100  std::string toString() const;
101 
102  void setPoints(const std::vector<Coordinate> &v);
103 
104  double getOrdinate(std::size_t index,
105  size_t ordinateIndex) const;
106 
107  void setOrdinate(std::size_t index, std::size_t ordinateIndex,
108  double value);
109 
110  void expandEnvelope(Envelope &env) const;
111 
112  std::size_t getDimension() const;
113 
114  void apply_rw(const CoordinateFilter *filter);
115 
116  void apply_ro(CoordinateFilter *filter) const;
117 
118  virtual CoordinateSequence& removeRepeatedPoints();
119 
120 private:
121  std::vector<Coordinate> *vect;
122  mutable std::size_t dimension;
123 };
124 
127 
128 } // namespace geos.geom
129 } // namespace geos
130 
131 //#ifdef GEOS_INLINE
132 //# include "geos/geom/CoordinateArraySequence.inl"
133 //#endif
134 
135 #endif // ndef GEOS_GEOM_COORDINATEARRAYSEQUENCE_H
136 
137 /**********************************************************************
138  * $Log$
139  * Revision 1.4 2006/06/12 10:10:39 strk
140  * Fixed getGeometryN() to take size_t rather then int, changed unsigned int parameters to size_t.
141  *
142  * Revision 1.3 2006/05/03 08:58:34 strk
143  * added new non-static CoordinateSequence::removeRepeatedPoints() mutator.
144  *
145  * Revision 1.2 2006/03/24 09:52:41 strk
146  * USE_INLINE => GEOS_INLINE
147  *
148  * Revision 1.1 2006/03/09 16:46:49 strk
149  * geos::geom namespace definition, first pass at headers split
150  *
151  **********************************************************************/