RasterCoverage.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 RasterCoverage.h
22 
23  \brief This file contains a concrete class to represent a raster coverage.
24 */
25 
26 #ifndef __TERRALIB_ST_INTERNAL_RASTERCOVERAGE_H
27 #define __TERRALIB_ST_INTERNAL_RASTERCOVERAGE_H
28 
29 //TerraLib
30 #include "../../../raster/Raster.h"
31 #include "../../../datatype/DateTime.h"
32 
33 //ST
34 #include "../../Config.h"
35 #include "Coverage.h"
36 
37 //STL
38 #include <vector>
39 
40 
41 namespace te
42 {
43  namespace st
44  {
45  /*!
46  \class RasterCoverage
47 
48  \brief A concrete class to represent a raster coverage.
49 
50  A raster coverage is a coverage composed of an observation
51  that is represented by a raster.
52 
53  \ingroup st
54 
55  \sa Coverage Raster Property
56  */
58  {
59  public:
60 
61  /*!
62  \brief A constructor.
63 
64  It constructs an empty raster coverage.
65  */
67 
68  /*!
69  \brief A constructor.
70 
71  It constructs a raster coverage.
72 
73  \param r A raster
74  \param t The spatial extent
75 
76  \note It will take the ownership of the given pointers.
77  \note The grid associated to the given raster must be valid (method Raster::getGrid()).
78  */
80 
81  /*!
82  \brief It sets the raster and its associated datetime
83 
84  \param r The given raster.
85  \param t The time associated to the given raster.
86 
87  \note It will take the ownwership of the given pointers.
88  \note The grid associated to the given raster must be valid (method Raster::getGrid()).
89  */
91 
92  /*!
93  \brief It returns the raster.
94 
95  \return the raster
96 
97  \note The caller will NOT take the ownership of the returned raster.
98  */
100 
101  /*!
102  \brief It returns the time.
103 
104  \return the time
105 
106  \note The caller will NOT take the ownership of the returned time.
107  */
109 
110 
111  /*! \name Coverage inherited methods */
112  //@{
113  Coverage* clone() const;
114 
116 
118 
120 
121  unsigned int getNumberOfProperties() const;
122 
123  const std::vector<int>& getPropertyTypes() const;
124 
125  const std::vector<std::string>& getPropertyNames() const;
126 
127  void getValue(const te::gm::Point& l, boost::ptr_vector<te::dt::AbstractData>& result) const;
128 
129  std::unique_ptr<te::dt::AbstractData> getValue(const te::gm::Point& l, unsigned int p=0) const;
130 
131  void getValue(const te::gm::Polygon& l, unsigned int p, boost::ptr_vector<te::dt::AbstractData>& result) const;
132 
133  void getValue(const te::gm::Polygon& l, boost::ptr_vector<te::dt::AbstractData>& result) const;
134 
135  void getInt(const te::gm::Point& l, std::vector<int>& result) const;
136 
137  int getInt(const te::gm::Point& l, unsigned int p=0) const;
138 
139  void getInt(const te::gm::Polygon& l, unsigned int p, std::vector<int>& result) const;
140 
141  void getInt(const te::gm::Polygon& l, std::vector<int>& result) const;
142 
143  void getDouble(const te::gm::Point& l, std::vector<double>& result) const;
144 
145  double getDouble(const te::gm::Point& l, unsigned int p=0) const;
146 
147  void getDouble(const te::gm::Polygon& l, unsigned int p, std::vector<double>& result) const;
148 
149  void getDouble(const te::gm::Polygon& l, std::vector<double>& result) const;
150 
151  std::unique_ptr<te::rst::Raster> getRaster() const;
152 
153  std::unique_ptr<te::rst::Raster> getRaster(unsigned int p) const;
154  //@}
155 
156  /*! \brief Virtual destructor. */
157  virtual ~RasterCoverage();
158 
159  protected:
160 
163  std::unique_ptr<te::gm::Geometry> m_sextent;
164  std::vector<int> m_ptypes; //! The types of the raster coverage properties
165  std::vector<std::string> m_pnames; //! The names of the raster coverage properties
166  };
167  } // end namespace st
168 } // end namespace te
169 
170 #endif // __TERRALIB_ST_INTERNAL_RASTERCOVERAGE_H
171 
te::st::RasterCoverage::getTime
te::dt::DateTime * getTime() const
It returns the time associated to the coverage.
te::st::RasterCoverage::getDouble
double getDouble(const te::gm::Point &l, unsigned int p=0) const
It returns the value as double of the p-th property associated to a given location.
te::st::RasterCoverage::getInt
void getInt(const te::gm::Polygon &l, unsigned int p, std::vector< int > &result) const
It returns the values as integers of the p-th property associated to the locations inside a given pol...
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::st::RasterCoverage::m_ptypes
std::vector< int > m_ptypes
Definition: RasterCoverage.h:164
te::st::RasterCoverage::clone
Coverage * clone() const
It returns a clone of this coverage.
te::rst::Raster
An abstract class for raster data strucutures.
Definition: Raster.h:72
te::st::RasterCoverage::getSpatialExtent
te::gm::Geometry * getSpatialExtent() const
It returns the spatial extent of a coverage.
te::dt::DateTime
Definition: DateTime.h:56
te::st::RasterCoverage::m_time
te::dt::DateTimeShrPtr m_time
Definition: RasterCoverage.h:162
te::st::RasterCoverage::getRaster
std::unique_ptr< te::rst::Raster > getRaster(unsigned int p) const
It returns a raster associated to the coverage of the i-th property.
te::gm::Polygon
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:51
te::st::RasterCoverage::getDouble
void getDouble(const te::gm::Polygon &l, std::vector< double > &result) const
It returns values as doubles associated to the locations inside a given polygon.
te::st::RasterCoverage
A concrete class to represent a raster coverage.
Definition: RasterCoverage.h:58
te::dt::DateTimeShrPtr
boost::shared_ptr< DateTime > DateTimeShrPtr
Definition: DateTime.h:126
te::st::RasterCoverage::getNumberOfProperties
unsigned int getNumberOfProperties() const
It returns the number of properties associated to the coverage.
te::st::RasterCoverage::RasterCoverage
RasterCoverage()
A constructor.
te::st::RasterCoverage::getValue
void getValue(const te::gm::Point &l, boost::ptr_vector< te::dt::AbstractData > &result) const
It returns the values associated to a given location.
te::st::RasterCoverage::~RasterCoverage
virtual ~RasterCoverage()
Virtual destructor.
te::st::RasterCoverage::m_pnames
std::vector< std::string > m_pnames
The types of the raster coverage properties.
Definition: RasterCoverage.h:165
te::st::RasterCoverage::getPropertyTypes
const std::vector< int > & getPropertyTypes() const
It returns the types of the coverage properties.
te::st::RasterCoverage::m_sextent
std::unique_ptr< te::gm::Geometry > m_sextent
Definition: RasterCoverage.h:163
te::st::RasterCoverage::getType
CoverageType getType() const
It returns the coverage type.
te::st::RasterCoverage::getValue
void getValue(const te::gm::Polygon &l, unsigned int p, boost::ptr_vector< te::dt::AbstractData > &result) const
It returns the values of the p-th property associated to the locations inside a given polygon.
te::st::RasterCoverage::m_raster
te::rst::RasterPtr m_raster
Definition: RasterCoverage.h:161
Coverage.h
This file contains an abstract class to represent a coverage.
te::st::RasterCoverage::getDouble
void getDouble(const te::gm::Polygon &l, unsigned int p, std::vector< double > &result) const
It returns the values as doubles of the p-th property associated to the locations inside a given poly...
te::st::RasterCoverage::set
void set(te::rst::Raster *r, te::dt::DateTime *t)
It sets the raster and its associated datetime.
te::st::RasterCoverage::getPropertyNames
const std::vector< std::string > & getPropertyNames() const
It returns the names of the coverage properties.
te::rst::RasterPtr
boost::shared_ptr< Raster > RasterPtr
Definition: Raster.h:703
TESTEXPORT
#define TESTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88
te::st::CoverageType
CoverageType
An enum for the types of coverage.
Definition: Enums.h:44
te::st::RasterCoverage::getValue
void getValue(const te::gm::Polygon &l, boost::ptr_vector< te::dt::AbstractData > &result) const
It returns values associated to the locations inside a given polygon.
te::st::RasterCoverage::getRaster
te::rst::Raster * getRaster()
It returns the raster.
te::st::RasterCoverage::getInt
void getInt(const te::gm::Point &l, std::vector< int > &result) const
It returns the values as integers associated to a given location.
te::st::Coverage
An abstract class to represent a coverage.
Definition: Coverage.h:64
te::st::RasterCoverage::getInt
void getInt(const te::gm::Polygon &l, std::vector< int > &result) const
It returns values as integers associated to the locations inside a given polygon.
te::st::RasterCoverage::RasterCoverage
RasterCoverage(te::rst::Raster *r, te::dt::DateTime *t)
A constructor.
te::st::RasterCoverage::getDouble
void getDouble(const te::gm::Point &l, std::vector< double > &result) const
It returns the values as doubles associated to a given location.
te::st::RasterCoverage::getRaster
std::unique_ptr< te::rst::Raster > getRaster() const
It returns a raster associated to the coverage.
te::st::RasterCoverage::getInt
int getInt(const te::gm::Point &l, unsigned int p=0) const
It returns the value as integer of the p-th property associated to a given location.
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::st::RasterCoverage::getTime
te::dt::DateTime * getTime()
It returns the time.
te::st::RasterCoverage::getValue
std::unique_ptr< te::dt::AbstractData > getValue(const te::gm::Point &l, unsigned int p=0) const
It returns the value of the p-th property associated to a given location.
te::gm::Point
A point with x and y coordinate values.
Definition: Point.h:51