27 #include "../../../geometry/Envelope.h"
28 #include "../../../geometry/GeometryProperty.h"
29 #include "../../../qt/widgets/dataset/selector/DataSetSelectorWizardPage.h"
30 #include "../../../qt/widgets/datasource/selector/DataSourceSelectorWidget.h"
31 #include "../../../qt/widgets/datasource/selector/DataSourceSelectorWizardPage.h"
32 #include "../../../qt/widgets/help/HelpPushButton.h"
33 #include "../../../se/Utils.h"
34 #include "../../../st/core/observation/ObservationDataSetInfo.h"
37 #include "ui_ObservationWizardForm.h"
40 #include <boost/uuid/random_generator.hpp>
41 #include <boost/uuid/uuid_io.hpp>
45 static boost::uuids::basic_random_generator<boost::mt19937> gen;
46 boost::uuids::uuid u = gen();
47 std::string
id = boost::uuids::to_string(u);
48 std::string title = dataType->getTitle().empty() ? dataType->getName() : dataType->getTitle();
52 observationLayer->setRendererType(
"ABSTRACT_LAYER_RENDERER");
56 observationLayer->setSRID(gp->
getSRID());
57 observationLayer->setExtent(*mbr);
59 return observationLayer;
64 m_ui(new Ui::ObservationWizardForm)
79 m_datasetSelectorPage->setSubTitle(tr(
"Please, select the datasets you want to transfer to another data source"));
85 m_PropWidgetPage->setSubTitle(tr(
"Please, adjust the temporal properties of the new Observation Layer"));
89 connect(this->button(QWizard::NextButton), SIGNAL(pressed()),
this, SLOT(
next()));
90 connect(this->button(QWizard::BackButton), SIGNAL(pressed()),
this, SLOT(
back()));
91 connect(this->button(QWizard::FinishButton), SIGNAL(pressed()),
this, SLOT(
finish()));
94 this->setButton(QWizard::HelpButton, helpButton);
104 std::list<te::da::DataSourceInfoPtr> datasources = m_datasourceSelectorPage->getSelectorWidget()->getSelecteds();
106 if(datasources.empty())
109 return datasources.front();
114 return m_observationLayers;
124 if(currentId() == PAGE_DATASOURCE_SELECTION)
126 m_datasetSelectorPage->set(getDataSource(),
true);
128 else if (currentId() == PAGE_DATASET_SELECTION)
130 m_PropWidgetPage->set(m_datasetSelectorPage->getCheckedDataSets());
137 QApplication::setOverrideCursor(Qt::WaitCursor);
139 std::list<te::da::DataSetTypePtr> dataTypes = m_datasetSelectorPage->getCheckedDataSets();
143 std::list<te::st::ObservationDataSetInfo*> infos = m_PropWidgetPage->getInfo(dataInfo);
144 std::list<te::st::ObservationDataSetInfo*>::const_iterator infosBegin = infos.begin();
145 std::list<te::st::ObservationDataSetInfo*>::const_iterator infosEnd = infos.end();
146 std::list<te::da::DataSetTypePtr>::const_iterator typesItBegin = dataTypes.begin();
148 if (infos.size() == 1)
150 m_observationLayers.push_back(
generateLayer(*typesItBegin, *infosBegin, dataInfo));
154 static boost::uuids::basic_random_generator<boost::mt19937> gen;
155 boost::uuids::uuid u = gen();
156 std::string
id = boost::uuids::to_string(u);
158 while(infosBegin != infosEnd)
160 m_observationLayers.push_back(
generateLayer(*typesItBegin, *infosBegin, dataInfo));
168 std::cout << std::endl <<
"Failed to create a new layer and insert it into the application: " << e.
what() << std::endl;
169 QWizard::finished(1);
173 std::cout << std::endl <<
"Failed to create a new layer and insert it into the application: unknown exception!" << std::endl;
174 QWizard::finished(1);
177 QApplication::restoreOverrideCursor();
178 QWizard::finished(0);
TEDATAACCESSEXPORT te::gm::Envelope * GetExtent(const std::string &datasetName, const std::string &propertyName, const std::string &datasourceId)
boost::shared_ptr< DataSetType > DataSetTypePtr
A layer with reference to a dataset that contains observations.
This is the base class for layers.
A class that contains infos about a DataSet that contains observations.
boost::intrusive_ptr< ObservationDataSetLayer > ObservationDataSetLayerPtr
virtual const char * what() const
It outputs the exception message.
TESEEXPORT Style * CreateFeatureTypeStyle(const te::gm::GeomType &geomType)
Try creates an appropriate feature type style based on given geometry type.
int getSRID() const
It returns the spatial reference system identifier associated to this property.
GeomType getGeometryType() const
It returns the geometry subtype allowed for the property.
A WizardPage used to configure the general properties of a new spatio-temporal layer.
te::st::ObservationDataSetLayerPtr generateLayer(te::da::DataSetTypePtr dataType, te::st::ObservationDataSetInfo *obsInfo, te::da::DataSourceInfoPtr dataInfo, te::map::AbstractLayer *parent=0)
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
A wizardPage used to configure the general properties of a new trajectory layer.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
A wizard used to generate a new Observationlayer.
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr
const std::string & getName() const
It returns the property name.