21 #include "../../../dataaccess/datasource/DataSourceInfoManager.h"
22 #include "../../../dataaccess/utils/Utils.h"
23 #include "../../widgets/layer/utils/DataSet2Layer.h"
24 #include "../help/HelpPushButton.h"
25 #include "../layer/search/LayerSearchWidget.h"
26 #include "../layer/search/LayerSearchWizardPage.h"
31 #include <boost/algorithm/string.hpp>
32 #include <boost/filesystem.hpp>
33 #include <boost/lexical_cast.hpp>
34 #include <boost/uuid/random_generator.hpp>
35 #include <boost/uuid/uuid_io.hpp>
40 this->setWizardStyle(QWizard::ModernStyle);
41 this->setWindowTitle(tr(
"Vectorization"));
43 this->setOption(QWizard::HaveHelpButton,
true);
44 this->setOption(QWizard::HelpButtonOnRight,
false);
48 this->setButton(QWizard::HelpButton, helpButton);
61 if(currentPage() == m_layerSearchPage.get())
63 std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
65 if(list.empty() ==
false)
69 m_vectorPage->setLayer(l);
72 return m_layerSearchPage->isComplete();
74 else if(currentPage() == m_vectorPage.get())
84 m_layerSearchPage->getSearchWidget()->setList(layerList);
85 m_layerSearchPage->getSearchWidget()->filterOnlyByRaster();
96 addPage(m_layerSearchPage.get());
99 addPage(m_vectorPage.get());
107 std::string outputdataset = m_vectorPage->getLayerName();
109 bool toFile = m_vectorPage->outputDataSourceToFile();
113 boost::filesystem::path uri(m_vectorPage->getRepositoryName());
115 std::size_t idx = outputdataset.find(
".");
116 if(idx != std::string::npos)
117 outputdataset = outputdataset.substr(0,idx);
119 std::map<std::string, std::string> dsinfo;
120 dsinfo[
"URI"] = uri.string();
123 boost::uuids::basic_random_generator<boost::mt19937> gen;
124 boost::uuids::uuid u = gen();
125 std::string
id = boost::uuids::to_string(u);
128 ds->setConnInfo(dsinfo);
129 ds->setTitle(uri.stem().string());
130 ds->setAccessDriver(
"OGR");
132 ds->setDescription(uri.string());
140 outDSInfo = m_vectorPage->getDataSourceInfo();
144 std::auto_ptr<te::rst::Raster> raster = m_vectorPage->getRaster();
145 unsigned int band = m_vectorPage->getBand();
146 unsigned int maxGeom = 0;
147 m_vectorPage->hasMaxGeom(maxGeom);
150 std::vector<te::gm::Geometry*> geomVec;
153 raster->vectorize(geomVec, band, maxGeom);
162 m_outputLayer = converter(dt);
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager.
boost::shared_ptr< DataSetType > DataSetTypePtr
boost::shared_ptr< DataSource > DataSourcePtr
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance.
A class that represents a data source component.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr