Loading...
Searching...
No Matches
PointCoverageIterator.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file PointCoverageIterator.h
22
23 \brief This file contains an iterator that is able to traverse all observations
24 of a point coverage.
25*/
26
27#ifndef __TERRALIB_ST_INTERNAL_POINTCOVERAGEITERATOR_H
28#define __TERRALIB_ST_INTERNAL_POINTCOVERAGEITERATOR_H
29
30// ST
31#include "../../Config.h"
33
34// STL
35#include <map>
36
37// Boost
38#include <boost/shared_ptr.hpp>
39
40// Forward declarations
41namespace te { namespace dt { class DateTime; } }
42namespace te { namespace gm { class Point; } }
43
44namespace te
45{
46 namespace st
47 {
48 /*!
49 \class PointCoverageIterator
50
51 \brief A class to traverse the observations of a PointCoverage.
52
53 This class provides a mechanism to traverse the point coverage
54 observations sequentially.
55
56 An example of use:
57
58 PointCoverageIterator it = cv.begin();
59 while(it!=cv.end())
60 {
61 Point& l = it.getLocation();
62 double v = it.getDouble(i); //or getValue() or getInt or...
63 ++it;
64 }
65
66 \sa PointCoverage
67 */
69 {
70 public:
71
72 /*! \brief Empty constructor. */
74
75 /*!
76 \brief Constructor.
77
78 \param it A iterator that points to the point coverage observations
79 */
80 PointCoverageIterator(const PointCoverageObservationSet::const_iterator& it);
81
82 /*! \brief Assignment operator. */
84
85 /*! \brief Operator == */
87
88 /*! \brief Operator != */
90
91 /*!
92 \brief Prefix operator ++
93
94 After using this operator, the internal cursor points
95 to the next point coverage observation.
96
97 The semantics of prefix is this: Increment the value and then fetch it.
98 */
100
101 /*!
102 \brief Postfix operator ++
103
104 After using this operator, the internal cursor points
105 to the next point coverage observation.
106
107 The semantics of postfix is: Fetch the value and then increment the original.
108 */
110
111 /*!
112 \brief Prefix operator --
113
114 After using this operator, the internal cursor points
115 to the preceding point coverage observation.
116
117 The semantics of prefix is this: Increment the value and then fetch it.
118 */
120
121 /*!
122 \brief Postfix operator --
123
124 After using this operator, the internal cursor points
125 to the preceding point coverage observation.
126
127 The semantics of postfix is: Fetch the value and then increment the original.
128 */
130
131 /*!
132 \brief Prefix operator *
133
134 It returns the item (a shared pointer to a pair of a point and a vector of values)
135 pointed by the internal cursor.
136 */
138
139 /*!
140 \brief It returns the location pointed by the internal cursor.
141
142 \return A reference to the location pointed by the internal cursor.
143 */
145
146 /*!
147 \brief It returns the i-th attribute value pointed by the internal cursor.
148
149 \param i The index of the property to be returned.
150
151 \return A pointer to the attribute value pointed by the internal cursor.
152
153 \note The caller will NOT take the ownership of the returned pointer.
154 */
156
157 /*!
158 \brief It returns the first attribute value pointed by the internal cursor.
159
160 \return A pointer to the first attribute value pointed by the internal cursor.
161
162 \note The caller will NOT take the ownership of the returned pointer.
163 */
165
166 /*!
167 \brief It returns the i-th attribute value as a double pointed by the internal cursor.
168
169 \param i The index of the property to be returned.
170
171 \return The attribute value as a double pointed by the internal cursor.
172 */
173 double getDouble(int i) const;
174
175 /*!
176 \brief It returns the first attribute value as a double pointed by the internal cursor.
177
178 \return The attribute value as a double pointed by the internal cursor.
179 */
180 double getDouble() const;
181
182 /*!
183 \brief It returns the i-th attribute value as an integer pointed by the internal cursor.
184
185 \param i The index of the property to be returned.
186
187 \return The attribute value as an integer pointed by the internal cursor.
188 */
189 int getInt(int i) const;
190
191 /*!
192 \brief It returns the first attribute value as an integer pointed by the internal cursor.
193
194 \return The first attribute value as an integer pointed by the internal cursor.
195 */
196 int getInt() const;
197
198 /*! \brief Virtual destructor. */
200
201 private:
202
203 PointCoverageObservationSet::const_iterator m_it; //!< The internal cursor
204 };
205 } // end namespace st
206} // end namespace te
207
208#endif // __TERRALIB_ST_INTERNAL_POINTCOVERAGEITERATOR_H
209
210
This file contains a class to represent an observation of a PointCoverage.
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:56
A point with x and y coordinate values.
Definition: Point.h:51
A class to traverse the observations of a PointCoverage.
double getDouble() const
It returns the first attribute value as a double pointed by the internal cursor.
PointCoverageIterator(const PointCoverageObservationSet::const_iterator &it)
Constructor.
double getDouble(int i) const
It returns the i-th attribute value as a double pointed by the internal cursor.
bool operator==(const PointCoverageIterator &rhs)
Operator ==.
te::gm::Point & getLocation() const
It returns the location pointed by the internal cursor.
const PointCoverageIterator & operator=(const PointCoverageIterator &rhs)
Assignment operator.
te::dt::AbstractData * getValue(int i) const
It returns the i-th attribute value pointed by the internal cursor.
PointCoverageObservationSet::const_iterator m_it
The internal cursor.
PointCoverageIterator & operator++()
Prefix operator ++.
te::dt::AbstractData * getValue() const
It returns the first attribute value pointed by the internal cursor.
PointCoverageIterator()
Empty constructor.
int getInt() const
It returns the first attribute value as an integer pointed by the internal cursor.
PointCoverageObservation operator*() const
Prefix operator *.
PointCoverageIterator operator--(int aux)
Postfix operator –.
int getInt(int i) const
It returns the i-th attribute value as an integer pointed by the internal cursor.
virtual ~PointCoverageIterator()
Virtual destructor.
PointCoverageIterator operator++(int aux)
Postfix operator ++.
bool operator!=(const PointCoverageIterator &rhs)
Operator !=.
PointCoverageIterator & operator--()
Prefix operator –.
boost::shared_ptr< PointCoverageItem > PointCoverageObservation
TerraLib.
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88