27 #include "../../../dataaccess/dataset/DataSet.h"
28 #include "../../../dataaccess/dataset/DataSetAdapter.h"
29 #include "../../../dataaccess/dataset/DataSetType.h"
30 #include "../../../dataaccess/dataset/DataSetTypeConverter.h"
31 #include "../../../dataaccess/datasource/DataSource.h"
32 #include "../../../dataaccess/datasource/DataSourceInfo.h"
33 #include "../../../dataaccess/datasource/DataSourceManager.h"
34 #include "../../../dataaccess/datasource/DataSourceTransactor.h"
35 #include "../../../dataaccess/utils/Utils.h"
36 #include "../../../geometry/GeometryProperty.h"
37 #include "../../../qt/widgets/dataset/selector/DataSetSelectorWizardPage.h"
38 #include "../../../qt/widgets/datasource/selector/DataSourceSelectorWidget.h"
39 #include "../../../qt/widgets/datasource/selector/DataSourceSelectorWizardPage.h"
40 #include "../../../qt/widgets/help/HelpPushButton.h"
41 #include "../../../qt/widgets/utils/ScopedCursor.h"
46 #include "ui_DataExchangerWizardForm.h"
47 #include "ui_DataExchangeSummaryWizardPageForm.h"
48 #include "ui_DataSetOptionsWizardPageForm.h"
49 #include "ui_DataSourceSelectorWidgetForm.h"
59 #include <QAbstractButton>
60 #include <QMessageBox>
61 #include <QVBoxLayout>
65 m_ui(new Ui::DataExchangerWizardForm)
85 m_datasetSelectorPage->setSubTitle(tr(
"Please, select the datasets you want to transfer to another data source"));
110 connect(this->button(QWizard::NextButton), SIGNAL(pressed()),
this, SLOT(
next()));
111 connect(this->button(QWizard::BackButton), SIGNAL(pressed()),
this, SLOT(
back()));
112 connect(this->button(QWizard::CommitButton), SIGNAL(pressed()),
this, SLOT(
commit()));
117 this->setButton(QWizard::HelpButton, helpButton);
128 return QWizard::nextId();
133 std::list<te::da::DataSourceInfoPtr> datasources = m_datasourceSelectorPage->getSelectorWidget()->getSelecteds();
135 if(datasources.empty())
138 return datasources.front();
143 std::list<te::da::DataSourceInfoPtr> datasources = m_targetSelectorPage->getSelectorWidget()->getSelecteds();
145 if(datasources.empty())
148 return datasources.front();
153 this->setOption(QWizard::HaveCustomButton1,
false);
155 if(currentId() == PAGE_SUMMARY)
157 this->setButtonText(QWizard::CustomButton1, tr(
"Apply"));
158 this->setOption(QWizard::HaveCustomButton1,
true);
160 connect(this->button(QWizard::CustomButton1), SIGNAL(clicked()), m_datasetOptionsPage.get(), SLOT(applyChanges()));
168 this->setOption(QWizard::HaveCustomButton1,
false);
170 if(currentId() == PAGE_DATASOURCE_SELECTION)
172 m_datasetSelectorPage->set(getDataSource(),
true);
174 else if(currentId() == PAGE_TARGET_DATASOURCE)
176 std::list<te::da::DataSetTypePtr> datasets = m_datasetSelectorPage->getCheckedDataSets();
177 m_datasetOptionsPage->set(datasets, getDataSource(), getTargetDataSource());
179 this->setButtonText(QWizard::CustomButton1, tr(
"Apply"));
180 this->setOption(QWizard::HaveCustomButton1,
true);
182 connect(this->button(QWizard::CustomButton1), SIGNAL(clicked()), m_datasetOptionsPage.get(), SLOT(applyChanges()));
200 if(idatasource.get() == 0)
211 if(odatasource.get() == 0)
215 std::list<DataExchangeStatus> result;
217 std::map<te::da::DataSetTypePtr, te::da::DataSetTypeConverter*> odatasets = m_datasetOptionsPage->getDatasets();
219 std::map<te::da::DataSetTypePtr, te::da::DataSetTypeConverter*>::iterator it = odatasets.begin();
221 while(it != odatasets.end())
227 std::auto_ptr<te::da::DataSourceTransactor> t(0);
231 std::map<std::string,std::string> nopt;
235 std::auto_ptr<te::da::DataSet> dataset(idatasource->getDataSet(idset->getName()));
237 t = odatasource->getTransactor();
242 t->createDataSet(odset, nopt);
246 dsAdapter->setSRID(geomProp->
getSRID());
248 if(dataset->moveBeforeFirst())
249 t->add(odset->
getName(), dsAdapter.get(), ods->getConnInfo());
258 result.push_back(status);
262 catch(
const std::exception& e)
269 result.push_back(status);
280 result.push_back(status);
288 m_summaryPage->set(result);
boost::shared_ptr< DataSetType > DataSetTypePtr
boost::shared_ptr< DataSource > DataSourcePtr
A class that models the description of a dataset.
int getSRID() const
It returns the spatial reference system identifier associated to this property.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
TEDATAACCESSEXPORT DataSetAdapter * CreateAdapter(DataSet *ds, DataSetTypeConverter *converter, bool isOwner=false)
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr
const std::string & getName() const
It returns the property name.