27 #include "../common/Translator.h"
28 #include "../dataaccess/dataset/DataSetType.h"
29 #include "../dataaccess/datasource/DataSourceManager.h"
30 #include "../dataaccess/datasource/DataSourceTransactor.h"
31 #include "../dataaccess/utils/Utils.h"
32 #include "../geometry/Envelope.h"
33 #include "../maptools/AbstractLayer.h"
34 #include "../raster/Grid.h"
35 #include "../raster/RasterProperty.h"
36 #include "../se/Utils.h"
37 #include "../srs/Config.h"
42 #include <boost/uuid/random_generator.hpp>
43 #include <boost/uuid/uuid_io.hpp>
46 : m_datasourceId(datasourceId)
52 static boost::uuids::basic_random_generator<boost::mt19937> gen;
54 if(dataset.get() == 0)
55 throw Exception(
TE_TR(
"Can not convert a NULL dataset to a WMS layer!"));
57 boost::uuids::uuid u = gen();
58 std::string
id = boost::uuids::to_string(u);
60 std::string title = dataset->getTitle().empty() ? dataset->getName() : dataset->getTitle();
63 layer->setDataSetName(dataset->getName());
64 layer->setDataSourceId(m_datasourceId);
67 if(dataset->size() == 0)
73 assert(dataset->hasRaster());
76 layer->setSRID(grid->getSRID());
77 layer->setExtent(*(grid->getExtent()));
TEDATAACCESSEXPORT te::rst::RasterProperty * GetFirstRasterProperty(const DataSetType *dt)
boost::intrusive_ptr< WMSLayer > WMSLayerPtr
TEDATAACCESSEXPORT void LoadProperties(te::da::DataSetType *dataset, const std::string &datasourceId)
boost::shared_ptr< DataSetType > DataSetTypePtr
boost::shared_ptr< DataSource > DataSourcePtr
TESEEXPORT Style * CreateCoverageStyle(const std::vector< te::rst::BandProperty * > &properties)
Try creates an appropriate coverage style based on given band properties.
#define TE_TR(message)
It marks a string in order to get translated.
A functor that converts a dataset from WMS server to a TerraLib WMSLayer.
A layer with reference to a WMS Layer.
An exception class for the TerraLib WMS module.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
WMS2Layer(const std::string &datasourceId)
WMSLayerPtr operator()(const te::da::DataSetTypePtr &dataset) const
A rectified grid is the spatial support for raster data.