27 #include "../../../geometry/GeometryProperty.h"
28 #include "../../../qt/widgets/dataset/selector/DataSetSelectorWizardPage.h"
29 #include "../../../qt/widgets/datasource/selector/DataSourceSelectorWidget.h"
30 #include "../../../qt/widgets/datasource/selector/DataSourceSelectorWizardPage.h"
31 #include "../../../qt/widgets/help/HelpPushButton.h"
32 #include "../../../se/Utils.h"
33 #include "../../../st/core/trajectory/TrajectoryDataSetInfo.h"
36 #include "ui_TrajectoryWizardForm.h"
39 #include <boost/uuid/random_generator.hpp>
40 #include <boost/uuid/uuid_io.hpp>
44 static boost::uuids::basic_random_generator<boost::mt19937> gen;
45 boost::uuids::uuid u = gen();
46 std::string
id = boost::uuids::to_string(u);
47 std::string title = dataType->getTitle().empty() ? dataType->getName() : dataType->getTitle();
51 trajectoryLayer->setRendererType(
"ABSTRACT_LAYER_RENDERER");
55 trajectoryLayer->setSRID(gp->
getSRID());
56 trajectoryLayer->setExtent(*mbr);
58 return trajectoryLayer;
63 m_ui(new Ui::TrajectoryWizardForm)
78 m_datasetSelectorPage->setSubTitle(tr(
"Please, select the datasets you want to transfer to another data source"));
84 m_PropWidgetPage->setSubTitle(tr(
"Please, adjust the temporal properties of the new Trajectory Layer"));
88 connect(this->button(QWizard::NextButton), SIGNAL(pressed()),
this, SLOT(
next()));
89 connect(this->button(QWizard::BackButton), SIGNAL(pressed()),
this, SLOT(
back()));
90 connect(this->button(QWizard::FinishButton), SIGNAL(pressed()),
this, SLOT(
finish()));
93 this->setButton(QWizard::HelpButton, helpButton);
103 std::list<te::da::DataSourceInfoPtr> datasources = m_datasourceSelectorPage->getSelectorWidget()->getSelecteds();
105 if(datasources.empty())
108 return datasources.front();
113 return m_trajectoryLayers;
123 if(currentId() == PAGE_DATASOURCE_SELECTION)
125 m_datasetSelectorPage->set(getDataSource(),
true);
127 else if (currentId() == PAGE_DATASET_SELECTION)
129 m_PropWidgetPage->set(m_datasetSelectorPage->getCheckedDataSets());
136 QApplication::setOverrideCursor(Qt::WaitCursor);
138 std::list<te::da::DataSetTypePtr> dataTypes = m_datasetSelectorPage->getCheckedDataSets();
142 std::list<te::st::TrajectoryDataSetInfo*> infos = m_PropWidgetPage->getInfo(dataInfo);
143 std::list<te::st::TrajectoryDataSetInfo*>::const_iterator infosBegin = infos.begin();
144 std::list<te::st::TrajectoryDataSetInfo*>::const_iterator infosEnd = infos.end();
145 std::list<te::da::DataSetTypePtr>::const_iterator typesItBegin = dataTypes.begin();
147 if (infos.size() == 1)
149 m_trajectoryLayers.push_back(
generateLayer(*typesItBegin, *infosBegin, dataInfo));
153 while(infosBegin != infosEnd)
155 m_trajectoryLayers.push_back(
generateLayer(*typesItBegin, *infosBegin, dataInfo));
163 std::cout << std::endl <<
"Failed to create a new layer and insert it into the application: " << e.
what() << std::endl;
164 QWizard::finished(1);
168 std::cout << std::endl <<
"Failed to create a new layer and insert it into the application: unknown exception!" << std::endl;
169 QWizard::finished(1);
172 QApplication::restoreOverrideCursor();
173 QWizard::finished(0);
boost::intrusive_ptr< TrajectoryDataSetLayer > TrajectoryDataSetLayerPtr
TEDATAACCESSEXPORT te::gm::Envelope * GetExtent(const std::string &datasetName, const std::string &propertyName, const std::string &datasourceId)
boost::shared_ptr< DataSetType > DataSetTypePtr
This is the base class for layers.
virtual const char * what() const
It outputs the exception message.
te::st::TrajectoryDataSetLayerPtr generateLayer(te::da::DataSetTypePtr dataType, te::st::TrajectoryDataSetInfo *trajInfo, te::da::DataSourceInfoPtr dataInfo, te::map::AbstractLayer *parent=0)
TESEEXPORT Style * CreateFeatureTypeStyle(const te::gm::GeomType &geomType)
Try creates an appropriate feature type style based on given geometry type.
A wizard used to generate a new Trajectorylayer.
A WizardPage used to configure the general properties of a new spatio-temporal layer.
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.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
A class that contains infos about a DataSet that contains observations of one or more trajectories...
A layer with reference to a dataset that contains trajectories.
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
A wizardPage used to configure the generaç properties of a new trajectory layer.
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr
const std::string & getName() const
It returns the property name.