Raster.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/grib/Raster.h
22 
23  \brief A raster class for GRIB format.
24 */
25 
26 #ifndef __TERRALIB_GRIB_INTERNAL_RASTER_H
27 #define __TERRALIB_GRIB_INTERNAL_RASTER_H
28 
29 // TerraLib
30 #include "../raster/Raster.h"
31 #include "Config.h"
32 
33 // STL
34 #include <cstdio>
35 
36 // Grib API
37 #include <grib_api.h>
38 
39 namespace te
40 {
41  namespace grib
42  {
43 // Forward declaration
44  class Band;
45 
46  /*!
47  \class Raster
48 
49  \brief A raster class for GRIB format.
50  */
52  {
53  public:
54 
55  Raster();
56 
57  // Raster(te::rst::Grid* grid, te::common::AccessPolicy p = te::common::RAccess);
58 
59  Raster(const Raster& rhs);
60 
61  ~Raster();
62 
63  void open(const std::map<std::string, std::string>& rinfo, te::common::AccessPolicy p = te::common::RAccess);
64 
65  void open(void* h, const std::map<std::string, std::string>& rinfo, te::common::AccessPolicy p = te::common::RAccess, void (*deleter)(void*) = 0);
66 
67  std::map<std::string, std::string> getInfo() const;
68 
69  std::size_t getNumberOfBands() const;
70 
71  int getBandDataType(std::size_t i) const;
72 
73  const te::rst::Band* getBand(std::size_t i) const;
74 
75  te::rst::Band* getBand(std::size_t i);
76 
77  const te::rst::Band& operator[](std::size_t i) const;
78 
79  te::rst::Band& operator[](std::size_t i);
80 
81  te::dt::AbstractData* clone() const;
82 
83  void close();
84 
85  void setGridSatelliteRep();
86 
87  void setGridLatLngRep();
88 
89  void setGridReducedGGRep();
90 
91  void create(te::rst::Grid *g, const std::vector< te::rst::BandProperty * > bands, const std::map< std::string, std::string > &rinfo, void *h = 0, void(*deleter)(void *) = 0)
92  {
93  // see terralib/memory/Raster.cpp (create)
94  // to be implemented
95  }
96 
97  bool createMultiResolution( const unsigned int levels, const te::rst::InterpolationMethod interpMethod )
98  {
99  return false;
100  };
101 
102  bool removeMultiResolution() { return false; };
103 
104  unsigned int getMultiResLevelsCount() const
105  {
106  return 0;
107  }
108 
109  te::rst::Raster* getMultiResLevel( const unsigned int level ) const
110  {
111  return 0;
112  }
113 
114  protected:
115 
116  std::vector<Band*> m_bands; //!< The list of data bands.
117  FILE* m_file; //!< file
118 
119  static grib_context* sm_context; //!< Grib API context
120  // void (*m_deleter)(void*); //!< A pointer to a deleter function, if the buffer needs to be deleted by this object.
121  };
122 
123  } // end namespace grib
124 } // end namespace te
125 
126 #endif //__TERRALIB_GRIB_INTERNAL_RASTER_H
bool createMultiResolution(const unsigned int levels, const te::rst::InterpolationMethod interpMethod)
Create a sub-sampled multi-resolution pyramid.
Definition: Raster.h:97
std::vector< Band * > m_bands
The list of data bands.
Definition: Raster.h:116
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:92
static grib_context * sm_context
Grib API context.
Definition: Raster.h:119
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:40
An abstract class for raster data strucutures.
Definition: Raster.h:71
URI C++ Library.
unsigned int getMultiResLevelsCount() const
Returns the current number of multi-resolution pyramid levels.
Definition: Raster.h:104
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
Configuration flags for GRIB.
A raster band description.
Definition: Band.h:63
A raster class for GRIB format.
Definition: Raster.h:51
void create(te::rst::Grid *g, const std::vector< te::rst::BandProperty * > bands, const std::map< std::string, std::string > &rinfo, void *h=0, void(*deleter)(void *)=0)
Definition: Raster.h:91
bool removeMultiResolution()
Remove/Destroy a sub-sampled multi-resolution pyramid, if there is one.
Definition: Raster.h:102
#define TEGRIBEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:110
A rectified grid is the spatial support for raster data.
Definition: Grid.h:68
FILE * m_file
file
Definition: Raster.h:117
te::rst::Raster * getMultiResLevel(const unsigned int level) const
Returns the required level of a multi-resolution pyramid or NULL if that level does not exists...
Definition: Raster.h:109