RasterProperty.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 terralib/raster/RasterProperty.h
22 
23  \brief Raster property.
24 */
25 
26 #ifndef __TERRALIB_RASTER_INTERNAL_RASTERPROPERTY_H
27 #define __TERRALIB_RASTER_INTERNAL_RASTERPROPERTY_H
28 
29 // TerraLib
30 #include "../datatype/SimpleProperty.h"
31 #include "Config.h"
32 
33 // STL
34 #include <map>
35 #include <vector>
36 
37 namespace te
38 {
39  namespace rst
40  {
41 // Forward declaration
42  class BandProperty;
43  class Grid;
44 
45  /*!
46  \brief Raster property.
47 
48  A raster property is used to describe a raster data. It inherits
49  from SimpleProperty, so it can be used through the dataaccess API.
50 
51  It contains a pointer to its grid
52  support and a list of bands description.
53 
54  \ingroup rst
55 
56  \sa te::dt::SimpleProperty
57  */
59  {
60  public:
61 
62  /*!
63  \brief It constructs a new raster property.
64 
65  \param bands Information about raster bands (This RasterProperty instance will acquire the ownership of all band properties objects).
66  \param rinfo Detailed information about the raster data.
67  \param isRequired Tells if the the property is required (mandatory) or not.
68  \param id The property identifier.
69  \param parent A reference to the parent Property of the new object if it has one.
70 
71  \warning The identifier value (id) may be used by data source implementations.
72  So, don't rely on its value!
73  */
74  RasterProperty(const std::string& name,
75  bool isRequired = false,
76  unsigned int id = 0,
77  te::dt::Property* parent = 0);
78 
79  /*!
80  \brief It constructs a new raster property.
81 
82  \param grid The grid definition (Do not pass a null pointer, this RasterProperty instance will take the grid's ownership).
83  \param bands Information about raster bands (This RasterProperty instance will acquire the ownership of all band properties objects).
84  \param rinfo Detailed information about the raster data.
85  \param isRequired Tells if the the property is required (mandatory) or not.
86  \param id The property identifier.
87  \param parent A reference to the parent Property of the new object if it has one.
88 
89  \warning The identifier value (id) may be used by data source implementations.
90  So, don't rely on its value!
91  */
93  const std::vector<BandProperty*>& bands,
94  const std::map<std::string, std::string>& rinfo,
95  bool isRequired = false,
96  unsigned int id = 0,
97  te::dt::Property* parent = 0);
98  /*!
99  \brief Copy constructor.
100 
101  \param rhs The right-hand-side copy that would be used to copy from.
102  */
104 
105  /*! \brief Destructor. */
106  virtual ~RasterProperty();
107 
108  /*!
109  \brief Assignment operator.
110 
111  \param rhs The right-hand-side copy used to copy from.
112 
113  \return A reference to this object.
114  */
116 
117  /*!
118  \brief Sets the definition of the raster grid support.
119 
120  \param grid The grid definition. Do not pass a null pointer.
121 
122  \note The class will take the ownership of the pointer.
123  */
124  void set(te::rst::Grid* grid);
125 
126  /*! \brief Returns the definition of the raster grid support. */
128 
129  /*! \brief Returns the definition of the raster grid support. */
130  const te::rst::Grid* getGrid() const;
131 
132  /*!
133  \brief It adds a new band information to the property.
134 
135  \param b A pointer to the band definition.
136 
137  \note The class will take the ownership of the pointer.
138  */
140 
141  /*!
142  \brief It sets the i-th band to the new information provided.
143 
144  \param i The band index.
145  \param b The i-th band information to be assigned to the property.
146 
147  \note The method will clear any previous band associated to the i-th position.
148 
149  \note The class will take the ownership of the pointer.
150 
151  \warning The i-th position must be a valid index.
152  */
153  void set(std::size_t i, te::rst::BandProperty* b);
154 
155  /*! \brief Returns a reference to the list of bands definitions. */
156  std::vector<te::rst::BandProperty*>& getBandProperties();
157 
158  /*! \brief Returns a reference to the list of bands definitions. */
159  const std::vector<te::rst::BandProperty*>& getBandProperties() const;
160 
161  /*!
162  \brief Sets the detailed information about the raster data.
163 
164  \param rinfo Detailed information about the raster data.
165  */
166  void setInfo(const std::map<std::string, std::string>& rinfo);
167 
168  /*! \brief Returns the detailed information about the raster data. */
169  const std::map<std::string, std::string>& getInfo() const;
170 
171  /*!
172  \brief It returns a clone of the object.
173 
174  The new property will NOT have associations to other elements.
175 
176  \return A clone of the object.
177  */
179 
180  ///*!
181  // \brief Sets the Raster Property name
182 
183  // \param name The name.
184 
185  // \warning This method will update the 'm_rinfo["URI"]' property.
186  //*/
187  //void setName(const std::string& name);
188 
189  protected:
190 
191  Grid* m_grid; //!< The spatial support for raster data.
192  std::vector<BandProperty*> m_bands; //!< A vector of bands description.
193  std::map<std::string, std::string> m_rinfo; //!< Additional raster information.
194  };
195 
196  } // end namespace rst
197 } // end namespace te
198 
199 #endif // __TERRALIB_RASTER_INTERNAL_RASTERPROPERTY_H
200 
te::rst::RasterProperty::~RasterProperty
virtual ~RasterProperty()
Destructor.
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::rst::RasterProperty::getGrid
const te::rst::Grid * getGrid() const
Returns the definition of the raster grid support.
te::rst::RasterProperty::setInfo
void setInfo(const std::map< std::string, std::string > &rinfo)
Sets the detailed information about the raster data.
te::rst::RasterProperty::RasterProperty
RasterProperty(Grid *grid, const std::vector< BandProperty * > &bands, const std::map< std::string, std::string > &rinfo, bool isRequired=false, unsigned int id=0, te::dt::Property *parent=0)
It constructs a new raster property.
te::rst::Grid
A rectified grid is the spatial support for raster data.
Definition: Grid.h:69
te::rst::RasterProperty
Raster property.
Definition: RasterProperty.h:59
TERASTEREXPORT
#define TERASTEREXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
te::rst::RasterProperty::operator=
RasterProperty & operator=(const RasterProperty &rhs)
Assignment operator.
te::rst::RasterProperty::getInfo
const std::map< std::string, std::string > & getInfo() const
Returns the detailed information about the raster data.
te::rst::RasterProperty::set
void set(std::size_t i, te::rst::BandProperty *b)
It sets the i-th band to the new information provided.
te::rst::RasterProperty::clone
te::dt::Property * clone() const
It returns a clone of the object.
te::rst::RasterProperty::set
void set(te::rst::Grid *grid)
Sets the definition of the raster grid support.
te::rst::RasterProperty::getBandProperties
const std::vector< te::rst::BandProperty * > & getBandProperties() const
Returns a reference to the list of bands definitions.
te::dt::SimpleProperty
An atomic property like an integer or double.
Definition: SimpleProperty.h:48
te::rst::RasterProperty::getGrid
te::rst::Grid * getGrid()
Returns the definition of the raster grid support.
te::rst::RasterProperty::RasterProperty
RasterProperty(const std::string &name, bool isRequired=false, unsigned int id=0, te::dt::Property *parent=0)
It constructs a new raster property.
te::rst::BandProperty
A raster band description.
Definition: BandProperty.h:62
te::rst::RasterProperty::getBandProperties
std::vector< te::rst::BandProperty * > & getBandProperties()
Returns a reference to the list of bands definitions.
te::dt::Property
It models a property definition.
Definition: Property.h:60
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::sa::Grid
@ Grid
Definition: Enums.h:106
te::rst::RasterProperty::add
void add(te::rst::BandProperty *b)
It adds a new band information to the property.
te::rst::RasterProperty::RasterProperty
RasterProperty(const RasterProperty &rhs)
Copy constructor.