27 #include "../../../../common/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"
53 m_datasources = datasources;
58 std::list<te::map::AbstractLayerPtr> layers;
60 for(std::list<te::da::DataSourceInfoPtr>::iterator it = m_datasources.begin(); it != m_datasources.end(); ++it)
64 if(datasource.get() == 0)
68 if(datasource.get() == 0)
69 throw Exception(
TE_TR(
"Could not retrieve the data source instance!"));
72 if(!datasource->isOpened())
75 std::vector<std::string> datasetNames = datasource->getDataSetNames();
77 if(datasetNames.size() == 1)
80 std::auto_ptr<te::da::DataSetType> dt = datasource->getDataSetType(datasetNames[0]);
83 layers.push_back(layer);
87 std::auto_ptr<DataSetSelectorDialog> ldialog(
new DataSetSelectorDialog(static_cast<QWidget*>(parent())));
89 ldialog->set(*it,
true);
91 int retval = ldialog->exec();
93 if(retval == QDialog::Rejected)
96 std::list<te::da::DataSetTypePtr> datasets = ldialog->getCheckedDataSets();
97 std::list<std::string> geomProps = ldialog->getCheckedGeomProperties();
99 assert(datasets.size() == geomProps.size());
101 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.
#define TE_TR(message)
It marks a string in order to get translated.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
boost::intrusive_ptr< DataSetLayer > DataSetLayerPtr