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 te::st::PointCoverageIterator::PointCoverageIterator(const PointCoverageObservationSet::const_iterator& it) :
37  m_it(it)
38 {
39 }
40 
43 {
44  if(this == &rhs)
45  return *this;
46 
47  m_it = rhs.m_it;
48  return *this;
49 }
50 
52 {
53  return m_it == rhs.m_it;
54 }
55 
57 {
58  return m_it != rhs.m_it;
59 }
60 
62 {
63  ++m_it;
64  return *this;
65 }
66 
68 {
69  te::st::PointCoverageIterator result = *this;
70  ++m_it;
71  return result;
72 }
73 
75 {
76  --m_it;
77  return *this;
78 }
79 
81 {
82  te::st::PointCoverageIterator result = *this;
83  --m_it;
84  return result;
85 }
86 
88 {
89  return *m_it;
90 }
91 
93 {
94  return m_it->get()->first;
95 }
96 
98 {
99  PointCoverageItem* aux = m_it->get();
100  return &aux->second.operator[](i);
101 }
102 
104 {
105  PointCoverageItem* aux = m_it->get();
106  return &aux->second.operator[](0);
107 }
108 
110 {
111  PointCoverageItem* aux = m_it->get();
112  return atof(aux->second.operator[](i).toString().c_str());
113 }
114 
116 {
117  PointCoverageItem* aux = m_it->get();
118  return atof(aux->second.operator[](0).toString().c_str());
119 }
120 
122 {
123  PointCoverageItem* aux = m_it->get();
124  return atoi(aux->second.operator[](i).toString().c_str());
125 }
126 
128 {
129  PointCoverageItem* aux = m_it->get();
130  return atoi(aux->second.operator[](0).toString().c_str());
131 }
132 
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.