Loading...
Searching...
No Matches
Coverage.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 Coverage.h
22
23 \brief This file contains an abstract class to represent a coverage.
24*/
25
26#ifndef __TERRALIB_ST_INTERNAL_COVERAGE_H
27#define __TERRALIB_ST_INTERNAL_COVERAGE_H
28
29//ST
30#include "../../Config.h"
31#include "../../Enums.h"
32
33//STL
34#include <vector>
35#include <map>
36#include <memory>
37
38// Boost
39#include <boost/shared_ptr.hpp>
40#include <boost/ptr_container/ptr_vector.hpp>
41
42// Forward declarations
43namespace te { namespace dt { class DateTime; class AbstractData; } }
44
45namespace te { namespace gm { class Geometry; class Point; class Polygon;} }
46
47namespace te { namespace rst { class Raster; } }
48
49namespace te
50{
51 namespace st
52 {
53 /*!
54 \class Coverage
55
56 \brief An abstract class to represent a coverage.
57
58 A coverage represents the variation of the values of a property
59 within a spatial extent at a specific time.
60
61 \ingroup st
62 */
64 {
65 public:
66
67 /*!
68 \brief A constructor.
69 */
71
72 /*!
73 \brief It returns a clone of this coverage.
74
75 \return A new coverage.
76
77 \note The caller will take the ownership of the returned pointer.
78 */
79 virtual Coverage* clone() const = 0;
80
81 /*!
82 \brief It returns the coverage type.
83
84 For while, there are two kinds of Coverages: Point Coverage and Raster Coverage.
85
86 \return Returns the coverage type.
87 */
88 virtual CoverageType getType() const = 0;
89
90 /*!
91 \brief It returns the spatial extent of a coverage
92
93 \return Returns the coverage spatial extent.
94
95 \note The caller will NOT take the ownership of the returned geometry.
96 */
97 virtual te::gm::Geometry* getSpatialExtent() const = 0;
98
99 /*!
100 \brief It returns the time associated to the coverage
101
102 \return Returns the time associated to the coverage.
103
104 \note The caller will NOT take the ownership of the returned date and time.
105 */
106 virtual te::dt::DateTime* getTime() const = 0;
107
108 /*!
109 \brief It returns the number of properties associated to the coverage.
110
111 For raster coverage, the number of properties is equal to the number of bands.
112 For point coverage, this means the number of properties associated to each point.
113
114 \return The number of properties associated to the coverage.
115
116 \note The caller will NOT take the ownership of the returned date and time.
117 */
118 virtual unsigned int getNumberOfProperties() const = 0;
119
120 /*!
121 \brief It returns the types of the coverage properties.
122
123 \return The types of the coverage properties.
124
125 \note The caller will take a refence to the internal vector.
126 */
127 virtual const std::vector<int>& getPropertyTypes() const = 0;
128
129 /*!
130 \brief It returns the names of the coverage properties.
131
132 \return The names of the coverage properties.
133
134 \note The caller will take a refence to the internal vector.
135 */
136 virtual const std::vector<std::string>& getPropertyNames() const = 0;
137
138 /*!
139 \brief It returns the values associated to a given location
140
141 This method returns the values of all properties of the coverage.
142
143 \param l The given location
144 \param result The returned values associated to a given location
145
146 \note The caller will take the ownership of the returned value.
147 */
148 virtual void getValue(const te::gm::Point& l, boost::ptr_vector<te::dt::AbstractData>& result) const = 0;
149
150 /*!
151 \brief It returns the value of the p-th property associated to a given location
152
153 \param l The given location
154 \param p The index of the property that will be considered.
155
156 \return Returns the value associated to a given location
157
158 \note The caller will take the ownership of the returned value.
159 */
160 virtual std::unique_ptr<te::dt::AbstractData> getValue(const te::gm::Point& l, unsigned int p=0) const = 0;
161
162 /*!
163 \brief It returns the values of the p-th property associated to the locations inside a given polygon
164
165 \param l The given polygon
166 \param p The desired property
167 \param result The returned values of the p-th property associated to the locations inside a given polygon
168
169 \note The caller will take the ownership of the returned value.
170 */
171 virtual void getValue(const te::gm::Polygon& l, unsigned int p, boost::ptr_vector<te::dt::AbstractData>& result) const = 0;
172
173 /*!
174 \brief It returns values associated to the locations inside a given polygon
175
176 This method returns the values of all properties of the coverage, ordered by locations.
177
178 An example, if the coverage has two properties:
179 The first position of the result vector contains the first property value of first location.
180 The second position of the result vector contains the second property value of the first location.
181 The third position of the result vector contains the first property value of the second location.
182 And so on.
183
184 \param l The given polygon
185 \param result The returned values associated the locations inside a given polygon
186
187 \note The caller will take the ownership of the returned value.
188 */
189 virtual void getValue(const te::gm::Polygon& l, boost::ptr_vector<te::dt::AbstractData>& result) const = 0;
190
191 /*!
192 \brief It returns the values as integers associated to a given location
193
194 This method returns the values of all properties of the coverage.
195
196 \param l The given location
197 \param result The returned values associated to a given location
198 */
199 virtual void getInt(const te::gm::Point& l, std::vector<int>& result) const = 0;
200
201 /*!
202 \brief It returns the value as integer of the p-th property associated to a given location
203
204 \param l The given location
205 \param p The index of the property that will be considered.
206
207 \return Returns the value as an integer associated to a given location
208 */
209 virtual int getInt(const te::gm::Point& l, unsigned int p=0) const = 0;
210
211 /*!
212 \brief It returns the values as integers of the p-th property associated to the locations inside a given polygon
213
214 \param l The given polygon
215 \param p The desired property
216 \param result The returned values of the p-th property associated to the locations inside a given polygon
217 */
218 virtual void getInt(const te::gm::Polygon& l, unsigned int p, std::vector<int>& result) const = 0;
219
220 /*!
221 \brief It returns values as integers associated to the locations inside a given polygon
222
223 This method returns the values of all properties of the coverage, ordered by locations.
224
225 An example, if the coverage has two properties:
226 The first position of the result vector contains the first property value of first location.
227 The second position of the result vector contains the second property value of the first location.
228 The third position of the result vector contains the first property value of the second location.
229 And so on.
230
231 \param l The given polygon
232 \param result The returned values associated the locations inside a given polygon.
233 */
234 virtual void getInt(const te::gm::Polygon& l, std::vector<int>& result) const = 0;
235
236 /*!
237 \brief It returns the values as doubles associated to a given location
238
239 This method returns the values of all properties of the coverage.
240
241 \param l The given location
242 \param result The returned values associated to a given location
243 */
244 virtual void getDouble(const te::gm::Point& l, std::vector<double>& result) const = 0;
245
246 /*!
247 \brief It returns the value as double of the p-th property associated to a given location
248
249 \param l The given location
250 \param p The index of the property that will be considered.
251
252 \return Returns the value as a double associated to a given location
253 */
254 virtual double getDouble(const te::gm::Point& l, unsigned int p=0) const = 0;
255
256 /*!
257 \brief It returns the values as doubles of the p-th property associated to the locations inside a given polygon
258
259 \param l The given polygon
260 \param p The desired property
261 \param result The returned values of the p-th property associated to the locations inside a given polygon
262 */
263 virtual void getDouble(const te::gm::Polygon& l, unsigned int p, std::vector<double>& result) const = 0;
264
265 /*!
266 \brief It returns values as doubles associated to the locations inside a given polygon
267
268 This method returns the values of all properties of the coverage, ordered by locations.
269
270 An example, if the coverage has two properties:
271 The first position of the result vector contains the first property value of first location.
272 The second position of the result vector contains the second property value of the first location.
273 The third position of the result vector contains the first property value of the second location.
274 And so on.
275
276 \param l The given polygon
277 \param result The returned values associated the locations inside a given polygon
278 */
279 virtual void getDouble(const te::gm::Polygon& l, std::vector<double>& result) const = 0;
280
281 /*!
282 \brief It returns a raster associated to the coverage.
283
284 For point coverage, it considers the interpolation function to generate
285 the raster.
286
287 The returned raster will contain all properties, each property will be
288 a band. If the caller wants to consider only one property,
289 it must use the other getRaster method when the caller pass a defined property.
290
291 \return Returns a raster associated to the coverage.
292
293 \note The caller will take the ownership of the returned raster.
294 */
295 virtual std::unique_ptr<te::rst::Raster> getRaster() const = 0;
296
297 /*!
298 \brief It returns a raster associated to the coverage of the i-th property.
299
300 For point coverage, it considers the interpolation function to generate
301 a raster.
302
303 The returned raster will have one band associated to the given property.
304
305 \param p The property that will be considered to generate the raster.
306
307 \return Returns a raster associated to the coverage.
308
309 \note The caller will take the ownership of the returned raster.
310 */
311 virtual std::unique_ptr<te::rst::Raster> getRaster(unsigned int p) const = 0;
312
313 /*! \brief Virtual destructor. */
314 virtual ~Coverage();
315 };
316
317 //Typedef
318 typedef boost::shared_ptr<te::st::Coverage> CoverageShrPtr;
319
320 } // end namespace st
321} // end namespace te
322
323#endif // __TERRALIB_ST_INTERNAL_COVERAGE_H
324
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
A point with x and y coordinate values.
Definition: Point.h:51
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:51
An abstract class to represent a coverage.
Definition: Coverage.h:64
virtual int getInt(const te::gm::Point &l, unsigned int p=0) const =0
It returns the value as integer of the p-th property associated to a given location.
virtual void getDouble(const te::gm::Polygon &l, std::vector< double > &result) const =0
It returns values as doubles associated to the locations inside a given polygon.
virtual std::unique_ptr< te::rst::Raster > getRaster() const =0
It returns a raster associated to the coverage.
virtual CoverageType getType() const =0
It returns the coverage type.
virtual void getValue(const te::gm::Polygon &l, unsigned int p, boost::ptr_vector< te::dt::AbstractData > &result) const =0
It returns the values of the p-th property associated to the locations inside a given polygon.
virtual te::gm::Geometry * getSpatialExtent() const =0
It returns the spatial extent of a coverage.
virtual void getInt(const te::gm::Polygon &l, unsigned int p, std::vector< int > &result) const =0
It returns the values as integers of the p-th property associated to the locations inside a given pol...
virtual te::dt::DateTime * getTime() const =0
It returns the time associated to the coverage.
virtual unsigned int getNumberOfProperties() const =0
It returns the number of properties associated to the coverage.
virtual std::unique_ptr< te::rst::Raster > getRaster(unsigned int p) const =0
It returns a raster associated to the coverage of the i-th property.
virtual const std::vector< std::string > & getPropertyNames() const =0
It returns the names of the coverage properties.
virtual double getDouble(const te::gm::Point &l, unsigned int p=0) const =0
It returns the value as double of the p-th property associated to a given location.
virtual void getInt(const te::gm::Point &l, std::vector< int > &result) const =0
It returns the values as integers associated to a given location.
virtual ~Coverage()
Virtual destructor.
virtual std::unique_ptr< te::dt::AbstractData > getValue(const te::gm::Point &l, unsigned int p=0) const =0
It returns the value of the p-th property associated to a given location.
Coverage()
A constructor.
virtual void getDouble(const te::gm::Point &l, std::vector< double > &result) const =0
It returns the values as doubles associated to a given location.
virtual void getInt(const te::gm::Polygon &l, std::vector< int > &result) const =0
It returns values as integers associated to the locations inside a given polygon.
virtual void getValue(const te::gm::Point &l, boost::ptr_vector< te::dt::AbstractData > &result) const =0
It returns the values associated to a given location.
virtual void getDouble(const te::gm::Polygon &l, unsigned int p, std::vector< double > &result) const =0
It returns the values as doubles of the p-th property associated to the locations inside a given poly...
virtual const std::vector< int > & getPropertyTypes() const =0
It returns the types of the coverage properties.
virtual Coverage * clone() const =0
It returns a clone of this coverage.
virtual void getValue(const te::gm::Polygon &l, boost::ptr_vector< te::dt::AbstractData > &result) const =0
It returns values associated to the locations inside a given polygon.
boost::shared_ptr< te::st::Coverage > CoverageShrPtr
Definition: Coverage.h:318
CoverageType
An enum for the types of coverage.
Definition: Enums.h:44
TerraLib.
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88