27 #include "../common/StringUtils.h"
28 #include "../common/Translator.h"
37 #include <boost/lexical_cast.hpp>
54 params.push_back(std::pair<std::string, std::string>(
"MAXMEMPERCENTUSED",
"40"));
55 params.push_back(std::pair<std::string, std::string>(
"MAXNUMBEROFRAMBLOCKS",
"1"));
64 const std::vector<te::rst::BandProperty*> bands,
65 const std::map<std::string, std::string>& rinfo,
67 void (*deleter)(
void*))
69 std::auto_ptr<te::rst::Raster> rasterPtr;
71 if( rinfo.find(
"MAXNUMBEROFRAMBLOCKS" ) != rinfo.end() )
73 unsigned int maxNumberOfRAMBlocks = boost::lexical_cast<
unsigned int >( rinfo.find(
"MAXNUMBEROFRAMBLOCKS" )->second );
76 else if( rinfo.find(
"MAXMEMPERCENTUSED" ) != rinfo.end() )
78 unsigned int maxMemPercentUsed = boost::lexical_cast<
unsigned int>( rinfo.find(
"MAXMEMPERCENTUSED" )->second );
79 if( maxMemPercentUsed > 100 )
81 throw Exception(
TE_TR(
"Invalid parameter: MAXMEMPERCENTUSED") );
84 rasterPtr.reset(
new ExpansibleRaster( (
unsigned char)maxMemPercentUsed, g, bands ) );
91 return rasterPtr.release();
101 return std::map<std::string, std::string>();
112 delete sm_factoryPointer;
113 sm_factoryPointer = 0;
A raster (stored in memory and eventually swapped to disk) where it is possible to dynamically add li...
ExpansibleRasterFactory()
static void initialize()
It initializes the factory: the singleton instance will be registered in the abstract factory DataSou...
#define TE_TR(message)
It marks a string in order to get translated.
An exception class for the TerraLib In-Memory Data Access driver.
te::rst::Raster * build()
Concrete factories (derived from this one) must implement this method in order to create objects...
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).
An abstract class for raster data strucutures.
This is the abstract factory for Rasters.
~ExpansibleRasterFactory()
static std::string sg_expansibleRasterFactoryId("EXPANSIBLE")
void getCreationalParameters(std::vector< std::pair< std::string, std::string > > ¶ms) const
It returns the list of parameters accepted as raster info.
A raster (stored in memory and eventually swapped to disk) where it is possible to dynamically add li...
This is the concrete factory for expansible raster.
const std::string & getType() const
Returns the type (name) of this factory.
A rectified grid is the spatial support for raster data.
static ExpansibleRasterFactory * sm_factoryPointer
std::map< std::string, std::string > getCapabilities() const
It returns a map containing all supported formats.
static void finalize()
It finalizes the factory: the singleton instance will be destroyed and will be unregistered from the ...