27 #include "../../../../core/logger/Logger.h" 28 #include "../../../../core/translator/Translator.h" 29 #include "../../../../dataaccess/dataset/DataSetType.h" 30 #include "../../../../dataaccess/datasource/DataSourceManager.h" 31 #include "../../../../dataaccess/utils/Utils.h" 32 #include "../../../../maptools/AbstractLayer.h" 33 #include "../../../../srs/SpatialReferenceSystemManager.h" 34 #include "../../../widgets/layer/utils/DataSet2Layer.h" 35 #include "../../../af/ApplicationController.h" 36 #include "../../../af/events/LayerEvents.h" 40 #include <QApplication> 43 #include <QMessageBox> 49 #include <boost/uuid/random_generator.hpp> 50 #include <boost/uuid/uuid_io.hpp> 51 #include <boost/filesystem.hpp> 55 std::list<te::da::DataSetTypePtr> res;
59 std::vector<std::string> dsets = ds->getDataSetNames();
61 std::vector<std::string>::iterator it;
63 for (it = dsets.begin(); it != dsets.end(); ++it)
81 catch (std::exception& e)
83 #ifdef TERRALIB_LOGGER_ENABLED 84 std::string str =
"GDAL Plug-in - GetLayer";
87 #endif // TERRALIB_LOGGER_ENABLED 89 QMessageBox::warning(
nullptr,
TE_TR(
"GDAL functions"),
TE_TR(
"There were issues while reading the layer from the requested GDAL data source."));
97 std::list<te::map::AbstractLayerPtr> res;
104 catch (std::exception& e)
106 #ifdef TERRALIB_LOGGER_ENABLED 107 std::string str =
"GDAL Plug-in - GetLayers";
110 #endif // TERRALIB_LOGGER_ENABLED 112 QMessageBox::warning(
nullptr,
TE_TR(
"GDAL functions"),
TE_TR(
"There were issues while reading some layer(s) from the requested GDAL data source."));
118 for (QStringList::iterator it = fileNames.begin(); it != fileNames.end(); ++it)
122 ds->setAccessDriver(
"GDAL");
124 std::string fpath = it->toUtf8().data();
125 ds->setConnInfo(
"file://" + fpath);
127 ds->setDescription(
"A single raster file");
129 boost::uuids::basic_random_generator<boost::mt19937> gen;
130 boost::uuids::uuid u = gen();
131 std::string
id = boost::uuids::to_string(u);
135 boost::filesystem::path mpath(it->toUtf8().data());
137 std::string fileBaseName = mpath.stem().string();
139 ds->setTitle(fileBaseName);
std::list< te::da::DataSetTypePtr > GetDataSetsInfo(const te::da::DataSourceInfoPtr &info)
void CreateLayers(QStringList fileNames, std::list< te::map::AbstractLayerPtr > &layers)
boost::shared_ptr< DataSetType > DataSetTypePtr
boost::shared_ptr< DataSource > DataSourcePtr
This event signals that a list of layers have been created.
static te::dt::Date ds(2010, 01, 01)
#define TE_TR(message)
It marks a string in order to get translated.
void GetLayers(const te::da::DataSourceInfoPtr &info, std::list< te::map::AbstractLayerPtr > &layers)
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
te::map::AbstractLayerPtr GetLayer(const te::da::DataSourceInfoPtr &info, std::string fileName)
std::list< te::map::AbstractLayerPtr > GetLayers(const QModelIndexList &lst)
Utility functions for the data access module.
std::list< te::da::DataSetTypePtr > GetDataSetsInfo(const te::da::DataSourceInfoPtr &info)
#define TE_LOG_DEBUG(message)
Use this tag in order to log a message to the TerraLib default logger with the DEBUG level...
A class that represents a data source component.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr