src/terralib/gdal/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/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 
45  std::vector<std::pair<std::string, std::string> >& /*params*/) const
46 {
47 }
48 
50 {
51  finalize();
53 }
54 
56 {
57  delete sm_factory;
58  sm_factory = nullptr;
59 }
60 
63 {
64 }
65 
66 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*))
67 {
68  std::unique_ptr<Raster> raster(new Raster);
69 
70  raster->create(g, bands, rinfo, h, deleter);
71 
72  return raster.release();
73 }
74 
76 {
77  return new Raster;
78 }
79 
80 std::map<std::string, std::string> te::gdal::RasterFactory::getCapabilities() const
81 {
82  std::map<std::string, std::string> capabilities;
83 
84  capabilities["supported_formats"] = "tif,jpg,png,hdf";
85 
86  return capabilities;
87 }
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).
This is the concrete factory for GDAL rasters.
This class represents Raster data.
static void initialize()
It initializes the factory: the singleton instance will be registered in the abstract factory DataSou...
This is a class that represents a GDAL Raster.
This is the concrete factory for GDAL rasters.
An abstract class for raster data strucutures.
te::da::DataSourceCapabilities capabilities
URI C++ Library.
Definition: Attributes.h:37
Configuration flags for the GDAL Driver of TerraLib.
void getCreationalParameters(std::vector< std::pair< std::string, std::string > > &params) const
It returns the list of parameters accepted as raster info.
list bands
Definition: compose.py:2
std::map< std::string, std::string > getCapabilities() const
It return a map (string, string) containing all supported formats.
static const std::string sm_driverIdentifier
The GDAL driver identifier.
te::rst::Raster * build()
Concrete factories (derived from this one) must implement this method in order to create objects...
const std::string & getType() const
Returns the type (name) of this factory.
static void finalize()
It finalizes the factory: the singleton instance will be destroyed and will be unregistered from the ...
A rectified grid is the spatial support for raster data.
Definition: raster/Grid.h:68
An static class with global definitions for the TerraLib GDAL driver.
#define TE_GDAL_DRIVER_IDENTIFIER
Utilitary functions to access GDAL and match some of its concepts to TerraLib concepts.