All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Raster.h
Go to the documentation of this file.
1 /* Copyright (C) 2011-2011 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  protected:
98 
99  std::vector<Band*> m_bands; //!< The list of data bands.
100  FILE* m_file; //!< file
101 
102  static grib_context* sm_context; //!< Grib API context
103  // void (*m_deleter)(void*); //!< A pointer to a deleter function, if the buffer needs to be deleted by this object.
104  };
105 
106  } // end namespace grib
107 } // end namespace te
108 
109 #endif //__TERRALIB_GRIB_INTERNAL_RASTER_H
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
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:40
FILE * m_file
file
Definition: Raster.h:100
A rectified grid is the spatial support for raster data.
Definition: Grid.h:55
A raster band description.
Definition: Band.h:63
#define TEGRIBEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:110
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
Configuration flags for GRIB.
std::vector< Band * > m_bands
The list of data bands.
Definition: Raster.h:99
An abstract class for raster data strucutures.
Definition: Raster.h:70
static grib_context * sm_context
Grib API context.
Definition: Raster.h:102