All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RasterFactory.cpp
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/RasterFactory.cpp
22 
23  \brief This is the concrete factory for GRIB.
24 */
25 
26 // TerraLib
27 #include "../common/StringUtils.h"
28 #include "../common/Translator.h"
29 #include "Exception.h"
30 #include "RasterFactory.h"
31 #include "Raster.h"
32 
33 // STL
34 #include <memory>
35 
37 
39 {
40 }
41 
42 const std::string& te::grib::RasterFactory::getType() const
43 {
44  throw Exception(TR_GRIB("Not implemented yet!"));
45 }
46 
47 void te::grib::RasterFactory::getCreationalParameters(std::vector< std::pair<std::string, std::string> >& params) const
48 {
49  // see terralib/memory/RasterFactory.cpp (getCreationalParameters)
50  throw Exception(TR_GRIB("Not implemented yet!"));
51 }
52 
54 {
55  finalize();
56  sm_factory = new RasterFactory;
57 }
58 
60 {
61  delete sm_factory;
62  sm_factory = 0;
63 }
64 
67 {
68 }
69 
71  const std::vector<te::rst::BandProperty*> bands,
72  const std::map<std::string, std::string>& rinfo,
73  void* h, void (*deleter)(void*))
74 {
75  std::auto_ptr<Raster> raster(new Raster);
76 
77  raster->create(g, bands, rinfo, h, deleter);
78 
79  return raster.release();
80 }
81 
83 {
84  return new Raster;
85 }
86 
87 std::map<std::string, std::string> te::grib::RasterFactory::getCapabilities() const
88 {
89  std::map<std::string, std::string> capabilities;
90 
91  capabilities["supported_formats"] = "grib";
92 
93  return capabilities;
94 }
void getCreationalParameters(std::vector< std::pair< std::string, std::string > > &params) const
It returns the list of parameters accepted as raster info.
#define GRIB_DRIVER_IDENTIFIER
The MyDriver driver identifier string.
Definition: Config.h:41
const std::string & getType() const
Returns the type (name) of this factory.
An exception class for GRIB.
static void initialize()
It initializes the factory: the singleton instance will be registered in the abstract factory DataSou...
A raster class for GRIB format.
te::rst::Raster * build()
Concrete factories (derived from this one) must implement this method in order to create objects...
This is the concrete factory for GRIB.
An abstract class for raster data strucutures.
Definition: Raster.h:71
te::rst::Raster * 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)
This method must be implemented by subclasses (raster drivers).
te::da::DataSourceCapabilities capabilities
std::map< std::string, std::string > getCapabilities() const
It return a map (string, string) containing all supported formats.
This is the abstract factory for Rasters.
Definition: RasterFactory.h:44
static void finalize()
It finalizes the factory: the singleton instance will be destroyed and will be unregistered from the ...
static RasterFactory * sm_factory
Definition: RasterFactory.h:73
A raster class for GRIB format.
Definition: Raster.h:51
~RasterFactory()
Destructor.
A rectified grid is the spatial support for raster data.
Definition: Grid.h:68
#define TR_GRIB(message)
It marks a string in order to get translated. This is a special mark used in the DataAccess module of...
Definition: Config.h:69