27 #include "../../../common/Exception.h" 28 #include "../../../core/translator/Translator.h" 29 #include "../../../rp/Segmenter.h" 30 #include "../../../maptools/Utils.h" 32 #include "ui_SegmenterAdvancedOptionsWizardPageForm.h" 35 #include <boost/algorithm/string.hpp> 36 #include <boost/filesystem.hpp> 37 #include <boost/lexical_cast.hpp> 38 #include <boost/uuid/random_generator.hpp> 39 #include <boost/uuid/uuid_io.hpp> 43 m_ui(new
Ui::SegmenterAdvancedOptionsWizardPageForm)
49 this->setTitle(tr(
"Segmenter Advanced Options"));
50 this->setSubTitle(tr(
"Used to set the segmenter advanced options."));
61 m_ui->m_maximumThreadsNumberLineEdit->setText(threadNumber);
64 m_ui->m_maximumBlockSizeLineEdit->setText(maxBlockSize);
80 std::string outputdataset =
m_name.append(
".shp");
82 boost::filesystem::path uri(
m_path.append(
"/"+outputdataset));
84 std::size_t idx = outputdataset.find(
".");
85 if(idx != std::string::npos)
86 outputdataset = outputdataset.substr(0,idx);
88 const std::string connInfo(
"file://" + uri.string());
91 boost::uuids::basic_random_generator<boost::mt19937> gen;
92 boost::uuids::uuid u = gen();
93 std::string
id = boost::uuids::to_string(u);
96 ds->setConnInfo(connInfo);
97 ds->setTitle(uri.stem().string());
98 ds->setAccessDriver(
"OGR");
100 ds->setDescription(uri.string());
108 unsigned int band = 0;
109 unsigned int maxGeom = 0;
112 std::vector<te::gm::Geometry*> geomVec;
113 std::vector< double > geomsValues;
118 QApplication::setOverrideCursor(Qt::WaitCursor);
123 raster->
vectorize(geomVec, band, maxGeom, &geomsValues);
125 catch(
const std::exception& e)
129 QApplication::restoreOverrideCursor();
137 QApplication::restoreOverrideCursor();
147 std::unique_ptr<te::mem::DataSet> dsMem =
createDataSet(dsType.get(), geomVec, geomsValues);
162 catch(
const std::exception& e)
166 QApplication::restoreOverrideCursor();
174 QApplication::restoreOverrideCursor();
179 QApplication::restoreOverrideCursor();
208 dsType->add(idProperty);
211 dsType->add(valueProperty);
215 dsType->add(geomProperty);
218 std::string pkName =
"pk_id";
219 pkName+=
"_" + dataSetName;
230 for(std::size_t t = 0; t < geoms.size(); ++t)
255 std::map<std::string, std::string> options;
257 ds->createDataSet(dsType, options);
259 ds->add(dataSetName, dataSet, options);
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager.
virtual void vectorize(std::vector< te::gm::Geometry * > &g, std::size_t b, unsigned int mp=0, std::vector< double > *const polygonsValues=0)
Vectorizes a given raster band, using GDALPolygonize function.
void add(te::dt::Property *p)
It adds a property to the list of properties of the primary key.
void setGeometry(std::size_t i, te::gm::Geometry *value)
It sets the value of the i-th property.
void setDouble(std::size_t i, double value)
It sets the value of the i-th property.
boost::shared_ptr< DataSetType > DataSetTypePtr
An atomic property like an integer or double.
boost::shared_ptr< DataSource > DataSourcePtr
A class that models the description of a dataset.
static te::dt::Date ds(2010, 01, 01)
void setOutputLayerName(const std::string &name)
#define TE_TR(message)
It marks a string in order to get translated.
This file defines a class for a Segmenter Advanced Options Wizard page.
void applyVectorization()
void setInt32(std::size_t i, boost::int32_t value)
It sets the value of the i-th property.
std::unique_ptr< Ui::SegmenterAdvancedOptionsWizardPageForm > m_ui
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
void setOutputLayerPath(const std::string &path)
Ui::SegmenterAdvancedOptionsWizardPageForm * getForm() const
std::unique_ptr< te::da::DataSetType > createDataSetType(std::string dataSetName, int srid)
static DataSourceInfoManager & getInstance()
It returns a reference to the singleton instance.
An abstract class for raster data strucutures.
te::map::AbstractLayerPtr getOutputLayer()
static te::dt::TimeDuration dt(20, 30, 50, 11)
~SegmenterAdvancedOptionsWizardPage()
te::map::AbstractLayerPtr m_outputLayer
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
SegmenterAdvancedOptionsWizardPage(QWidget *parent=0)
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection.
te::map::AbstractLayerPtr m_layer
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
TEMAPEXPORT te::rst::Raster * GetRaster(AbstractLayer *layer)
It gets the raster referenced by the given data set layer.
int getSRID() const
Returns the raster spatial reference system identifier.
It describes a primary key (pk) constraint.
void saveDataSet(te::mem::DataSet *dataSet, te::da::DataSetType *dsType, te::da::DataSourcePtr ds, std::string dataSetName)
std::unique_ptr< te::mem::DataSet > createDataSet(te::da::DataSetType *dsType, std::vector< te::gm::Geometry * > &geoms, std::vector< double > &geomsValues)
A class that represents a data source component.
void set(te::map::AbstractLayerPtr layer)
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr