All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PointCoverageIterator.cpp
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.cpp
22 
23  \brief This file contains an iterator that is able to traverse all observations
24  of a point coverage.
25 */
26 
27 // TerraLib
28 #include "../../../geometry/Point.h"
29 #include "../../../datatype/AbstractData.h"
30 
31 //ST
32 #include "PointCoverageIterator.h"
33 
35 {
36 }
37 
38 te::st::PointCoverageIterator::PointCoverageIterator(const PointCoverageObservationSet::const_iterator& it) :
39  m_it(it)
40 {
41 }
42 
45 {
46  if(this == &rhs)
47  return *this;
48 
49  m_it = rhs.m_it;
50  return *this;
51 }
52 
54 {
55  return m_it == rhs.m_it;
56 }
57 
59 {
60  return m_it != rhs.m_it;
61 }
62 
64 {
65  ++m_it;
66  return *this;
67 }
68 
70 {
71  te::st::PointCoverageIterator result = *this;
72  ++m_it;
73  return result;
74 }
75 
77 {
78  --m_it;
79  return *this;
80 }
81 
83 {
84  te::st::PointCoverageIterator result = *this;
85  --m_it;
86  return result;
87 }
88 
90 {
91  return *m_it;
92 }
93 
95 {
96  return m_it->get()->first;
97 }
98 
100 {
101  PointCoverageItem* aux = m_it->get();
102  return &aux->second.operator[](i);
103 }
104 
106 {
107  PointCoverageItem* aux = m_it->get();
108  return &aux->second.operator[](0);
109 }
110 
112 {
113  PointCoverageItem* aux = m_it->get();
114  return atof(aux->second.operator[](i).toString().c_str());
115 }
116 
118 {
119  PointCoverageItem* aux = m_it->get();
120  return atof(aux->second.operator[](0).toString().c_str());
121 }
122 
124 {
125  PointCoverageItem* aux = m_it->get();
126  return atoi(aux->second.operator[](i).toString().c_str());
127 }
128 
130 {
131  PointCoverageItem* aux = m_it->get();
132  return atoi(aux->second.operator[](0).toString().c_str());
133 }
134 
136 {
137 }
138 
139 
140 
141 
142 
143 
144 
145 
PointCoverageObservation operator*() const
Prefix operator *.
virtual ~PointCoverageIterator()
Virtual destructor.
std::pair< te::gm::Point, boost::ptr_vector< te::dt::AbstractData > > PointCoverageItem
PointCoverageIterator & operator--()
Prefix operator –.
double getDouble() const
It returns the first attribute value as a double pointed by the internal cursor.
A class to traverse the observations of a PointCoverage.
boost::shared_ptr< PointCoverageItem > PointCoverageObservation
te::dt::AbstractData * getValue() const
It returns the first attribute value pointed by the internal cursor.
A point with x and y coordinate values.
Definition: Point.h:50
bool operator!=(const PointCoverageIterator &rhs)
Operator !=.
PointCoverageObservationSet::const_iterator m_it
The internal cursor.
const PointCoverageIterator & operator=(const PointCoverageIterator &rhs)
Assignment operator.
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
This file contains an iterator that is able to traverse all observations of a point coverage...
bool operator==(const PointCoverageIterator &rhs)
Operator ==.
PointCoverageIterator & operator++()
Prefix operator ++.
te::gm::Point & getLocation() const
It returns the location 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.