27 #include "../../../../core/translator/Translator.h" 28 #include "../../../../dataaccess/datasource/DataSource.h" 29 #include "../../../../dataaccess/datasource/DataSourceManager.h" 30 #include "../../../../maptools/DataSetLayer.h" 31 #include "../../dataset/selector/DataSetSelectorDialog.h" 32 #include "../../Exception.h" 33 #include "../utils/DataSet2Layer.h" 56 std::list<te::map::AbstractLayerPtr> layers;
62 if(datasource.get() ==
nullptr)
66 if(datasource.get() ==
nullptr)
67 throw Exception(
TE_TR(
"Could not retrieve the data source instance!"));
70 if(!datasource->isOpened())
73 std::vector<std::string> datasetNames = datasource->getDataSetNames();
75 if(datasetNames.size() == 1)
78 std::unique_ptr<te::da::DataSetType>
dt = datasource->getDataSetType(datasetNames[0]);
81 layers.push_back(layer);
85 std::unique_ptr<DataSetSelectorDialog> ldialog(
new DataSetSelectorDialog(static_cast<QWidget*>(parent())));
87 ldialog->set(*it,
true);
89 int retval = ldialog->exec();
91 if(retval == QDialog::Rejected)
94 std::list<te::da::DataSetTypePtr> datasets = ldialog->getCheckedDataSets();
95 std::list<std::string> geomProps = ldialog->getCheckedGeomProperties();
97 assert(datasets.size() == geomProps.size());
99 std::transform(datasets.begin(), datasets.end(), geomProps.begin(), std::back_inserter(layers),
DataSet2Layer((*it)->getId()));
boost::shared_ptr< DataSetType > DataSetTypePtr
boost::shared_ptr< DataSource > DataSourcePtr
A simple widget that allows the selection of datasets from a given data source.
Base exception class for plugin module.
#define TE_TR(message)
It marks a string in order to get translated.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
static te::dt::TimeDuration dt(20, 30, 50, 11)
boost::intrusive_ptr< DataSetLayer > DataSetLayerPtr