All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RasterFactory.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 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/gdal/RasterFactory.cpp
22 
23  \brief This is the concrete factory for GDAL rasters.
24 */
25 
26 // TerraLib
27 #include "../raster/Grid.h"
28 #include "Config.h"
29 #include "Globals.h"
30 #include "Raster.h"
31 #include "RasterFactory.h"
32 #include "Utils.h"
33 
34 // STL
35 #include <memory>
36 
38 
39 const std::string& te::gdal::RasterFactory::getType() const
40 {
42 }
43 
44 void te::gdal::RasterFactory::getCreationalParameters(std::vector< std::pair<std::string, std::string> >& params) const
45 {
46 }
47 
49 {
50  finalize();
51  sm_factory = new RasterFactory;
52 }
53 
55 {
56  delete sm_factory;
57  sm_factory = 0;
58 }
59 
62 {
63 }
64 
65 te::rst::Raster* te::gdal::RasterFactory::create(te::rst::Grid* g, const std::vector<te::rst::BandProperty*> bands, const std::map<std::string, std::string>& rinfo, void* h, void (*deleter)(void*))
66 {
67  std::auto_ptr<Raster> raster(new Raster);
68 
69  raster->create(g, bands, rinfo, h, deleter);
70 
71  return raster.release();
72 }
73 
75 {
76  return new Raster;
77 }
78 
79 std::map<std::string, std::string> te::gdal::RasterFactory::getCapabilities() const
80 {
81  std::map<std::string, std::string> capabilities;
82 
83  capabilities["supported_formats"] = "tif,jpg,png,hdf";
84 
85  return capabilities;
86 }
static const std::string sm_driverIdentifier
The GDAL driver identifier.
Definition: Globals.h:49
static void initialize()
It initializes the factory: the singleton instance will be registered in the abstract factory DataSou...
Configuration flags for the GDAL Driver of TerraLib.
This class represents Raster data.
Definition: Raster.h:59
std::map< std::string, std::string > getCapabilities() const
It return a map (string, string) containing all supported formats.
This is the concrete factory for GDAL rasters.
Definition: RasterFactory.h:44
const std::string & getType() const
Returns the type (name) of this factory.
A rectified grid is the spatial support for raster data.
Definition: Grid.h:55
void getCreationalParameters(std::vector< std::pair< std::string, std::string > > &params) const
It returns the list of parameters accepted as raster info.
This is the concrete factory for GDAL rasters.
An static class with global definitions for the TerraLib GDAL driver.
This is a class that represents a GDAL Raster.
Utilitary functions to access GDAL and match some of its concepts to TerraLib concepts.
#define TE_GDAL_DRIVER_IDENTIFIER
Definition: Config.h:38
An abstract class for raster data strucutures.
Definition: Raster.h:70
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).
static RasterFactory * sm_factory
Definition: RasterFactory.h:73
te::da::DataSourceCapabilities capabilities
te::rst::Raster * build()
Concrete factories (derived from this one) must implement this method in order to create objects...
static void finalize()
It finalizes the factory: the singleton instance will be destroyed and will be unregistered from the ...