All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 grid The grid definition. Do not pass a null pointer.
66  \param bands Information about raster bands (This RasterProperty instance will acquire the ownership of all band properties objects).
67  \param rinfo Detailed information about the raster data.
68  \param isRequired Tells if the the property is required (mandatory) or not.
69  \param id The property identifier.
70  \param parent A reference to the parent Property of the new object if it has one.
71 
72  \warning The identifier value (id) may be used by data source implementations.
73  So, don't rely on its value!
74  */
75  RasterProperty(const std::string& name,
76  bool isRequired = false,
77  unsigned int id = 0,
78  te::dt::Property* parent = 0);
79 
80  /*!
81  \brief It constructs a new raster property.
82 
83  \param grid The grid definition. Do not pass a null pointer.
84  \param bands Information about raster bands (This RasterProperty instance will acquire the ownership of all band properties objects).
85  \param rinfo Detailed information about the raster data.
86  \param isRequired Tells if the the property is required (mandatory) or not.
87  \param id The property identifier.
88  \param parent A reference to the parent Property of the new object if it has one.
89 
90  \warning The identifier value (id) may be used by data source implementations.
91  So, don't rely on its value!
92  */
93  RasterProperty(Grid* grid,
94  const std::vector<BandProperty*>& bands,
95  const std::map<std::string, std::string>& rinfo,
96  bool isRequired = false,
97  unsigned int id = 0,
98  te::dt::Property* parent = 0);
99  /*!
100  \brief Copy constructor.
101 
102  \param rhs The right-hand-side copy that would be used to copy from.
103  */
104  RasterProperty(const RasterProperty& rhs);
105 
106  /*! \brief Destructor. */
107  virtual ~RasterProperty();
108 
109  /*!
110  \brief Assignment operator.
111 
112  \param rhs The right-hand-side copy used to copy from.
113 
114  \return A reference to this object.
115  */
116  RasterProperty& operator=(const RasterProperty& rhs);
117 
118  /*!
119  \brief Sets the definition of the raster grid support.
120 
121  \param grid The grid definition. Do not pass a null pointer.
122 
123  \note The class will take the ownership of the pointer.
124  */
125  void set(te::rst::Grid* grid);
126 
127  /*! \brief Returns the definition of the raster grid support. */
128  te::rst::Grid* getGrid();
129 
130  /*! \brief Returns the definition of the raster grid support. */
131  const te::rst::Grid* getGrid() const;
132 
133  /*!
134  \brief It adds a new band information to the property.
135 
136  \param b A pointer to the band definition.
137 
138  \note The class will take the ownership of the pointer.
139  */
140  void add(te::rst::BandProperty* b);
141 
142  /*!
143  \brief It sets the i-th band to the new information provided.
144 
145  \param i The band index.
146  \param b The i-th band information to be assigned to the property.
147 
148  \note The method will clear any previous band associated to the i-th position.
149 
150  \note The class will take the ownership of the pointer.
151 
152  \warning The i-th position must be a valid index.
153  */
154  void set(std::size_t i, te::rst::BandProperty* b);
155 
156  /*! \brief Returns a reference to the list of bands definitions. */
157  std::vector<te::rst::BandProperty*>& getBandProperties();
158 
159  /*! \brief Returns a reference to the list of bands definitions. */
160  const std::vector<te::rst::BandProperty*>& getBandProperties() const;
161 
162  /*!
163  \brief Sets the detailed information about the raster data.
164 
165  \param rinfo Detailed information about the raster data.
166  */
167  void setInfo(const std::map<std::string, std::string>& rinfo);
168 
169  /*! \brief Returns the detailed information about the raster data. */
170  const std::map<std::string, std::string>& getInfo() const;
171 
172  /*!
173  \brief It returns a clone of the object.
174 
175  The new property will NOT have associations to other elements.
176 
177  \return A clone of the object.
178  */
179  te::dt::Property* clone() const;
180 
181  ///*!
182  // \brief Sets the Raster Property name
183 
184  // \param name The name.
185 
186  // \warning This method will update the 'm_rinfo["URI"]' property.
187  //*/
188  //void setName(const std::string& name);
189 
190  protected:
191 
192  Grid* m_grid; //!< The spatial support for raster data.
193  std::vector<BandProperty*> m_bands; //!< A vector of bands description.
194  std::map<std::string, std::string> m_rinfo; //!< Additional raster information.
195  };
196 
197  } // end namespace rst
198 } // end namespace te
199 
200 #endif // __TERRALIB_RASTER_INTERNAL_RASTERPROPERTY_H
201 
#define TERASTEREXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:65
An atomic property like an integer or double.
std::map< std::string, std::string > m_rinfo
Additional raster information.
A raster band description.
Definition: BandProperty.h:61
It models a property definition.
Definition: Property.h:59
Raster property.
std::vector< BandProperty * > m_bands
A vector of bands description.
Configuration flags for the Raster module of TerraLib.
A rectified grid is the spatial support for raster data.
Definition: Grid.h:68
Grid * m_grid
Sets the Raster Property name.