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/memory/RasterFactory.cpp
22 
23  \brief This is the concrete factory for In-Memory driver.
24 */
25 
26 // TerraLib
27 #include "../common/StringUtils.h"
28 #include "../common/Translator.h"
29 #include "Exception.h"
30 #include "Raster.h"
31 #include "RasterFactory.h"
32 
33 // STL
34 #include <memory>
35 
37 
39 
41 {
42 }
43 
44 const std::string& te::mem::RasterFactory::getType() const
45 {
46  return sg_rasterFactoryId;
47 }
48 
49 void te::mem::RasterFactory::getCreationalParameters(std::vector< std::pair<std::string, std::string> >& params) const
50 {
51  params.push_back(std::pair<std::string, std::string>("MEM_SRC_RASTER_DRIVER_TYPE", ""));
52  params.push_back(std::pair<std::string, std::string>("MEM_TILED_RASTER", ""));
53  params.push_back(std::pair<std::string, std::string>("MEM_RASTER_TILE_WIDTH", ""));
54  params.push_back(std::pair<std::string, std::string>("MEM_RASTER_TILE_HEIGHT", ""));
55 
56  params.push_back(std::pair<std::string, std::string>("MEM_IS_DATA_BUFFER", ""));
57  params.push_back(std::pair<std::string, std::string>("MEM_BUFFER_NROWS", ""));
58  params.push_back(std::pair<std::string, std::string>("MEM_BUFFER_NCOLS", ""));
59  params.push_back(std::pair<std::string, std::string>("MEM_BUFFER_DATATYPE", ""));
60  params.push_back(std::pair<std::string, std::string>("MEM_BUFFER_NBANDS", ""));
61  params.push_back(std::pair<std::string, std::string>("MEM_BUFFER_SRID", ""));
62  params.push_back(std::pair<std::string, std::string>("MEM_BUFFER_RES_X", ""));
63  params.push_back(std::pair<std::string, std::string>("MEM_BUFFER_RES_Y", ""));
64  params.push_back(std::pair<std::string, std::string>("MEM_BUFFER_MIN_X", ""));
65  params.push_back(std::pair<std::string, std::string>("MEM_BUFFER_MIN_Y", ""));
66  params.push_back(std::pair<std::string, std::string>("MEM_BUFFER_MAX_X", ""));
67  params.push_back(std::pair<std::string, std::string>("MEM_BUFFER_MAX_Y", ""));
68 
69  params.push_back(std::pair<std::string, std::string>("MEM_RASTER_NROWS", ""));
70  params.push_back(std::pair<std::string, std::string>("MEM_RASTER_NCOLS", ""));
71  params.push_back(std::pair<std::string, std::string>("MEM_RASTER_DATATYPE", ""));
72  params.push_back(std::pair<std::string, std::string>("MEM_RASTER_NBANDS", ""));
73  params.push_back(std::pair<std::string, std::string>("MEM_RASTER_SRID", ""));
74  params.push_back(std::pair<std::string, std::string>("MEM_RASTER_RES_X", ""));
75  params.push_back(std::pair<std::string, std::string>("MEM_RASTER_RES_Y", ""));
76  params.push_back(std::pair<std::string, std::string>("MEM_RASTER_MIN_X", ""));
77  params.push_back(std::pair<std::string, std::string>("MEM_RASTER_MIN_Y", ""));
78  params.push_back(std::pair<std::string, std::string>("MEM_RASTER_MAX_X", ""));
79  params.push_back(std::pair<std::string, std::string>("MEM_RASTER_MAX_Y", ""));
80 }
81 
84 {
85 }
86 
88  const std::vector<te::rst::BandProperty*> bands,
89  const std::map<std::string, std::string>& rinfo,
90  void* h,
91  void (*deleter)(void*))
92 {
93  std::auto_ptr<Raster> raster(new Raster);
94 
95  raster->create(g, bands, rinfo, h, deleter);
96 
97  return raster.release();
98 }
99 
101 {
102  return new Raster;
103 }
104 
105 std::map<std::string, std::string> te::mem::RasterFactory::getCapabilities() const
106 {
107  std::map<std::string, std::string> capabilities = std::map<std::string, std::string>();
108 
109  return capabilities;
110 }
te::rst::Raster * build()
Concrete factories (derived from this one) must implement this method in order to create objects...
static std::string sg_rasterFactoryId(TE_MEMORY_DRIVER_IDENTIFIER)
A raster class for memory.
Definition: Raster.h:44
std::map< std::string, std::string > getCapabilities() const
It returns a map containing all supported formats.
An exception class for the TerraLib In-Memory Data Access driver.
An abstract class for raster data strucutures.
Definition: Raster.h:71
te::da::DataSourceCapabilities capabilities
This is the abstract factory for Rasters.
Definition: RasterFactory.h:44
static RasterFactory sm_factory
Definition: RasterFactory.h:66
const std::string & getType() const
Returns the type (name) of this factory.
A raster class for memory.
~RasterFactory()
Destructor.
This is the concrete factory for In-Memory driver.
void getCreationalParameters(std::vector< std::pair< std::string, std::string > > &params) const
It returns the list of parameters accepted as raster info.
A rectified grid is the spatial support for raster data.
Definition: Grid.h:68
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).
#define TE_MEMORY_DRIVER_IDENTIFIER
The In-Memory driver identifier string.
Definition: Config.h:42