27 #include "../../../common/StringUtils.h" 28 #include "../../../common/progress/ProgressManager.h" 29 #include "../../../dataaccess/utils/Utils.h" 30 #include "../../../geometry/Utils.h" 31 #include "../../../maptools/Utils.h" 32 #include "../../../raster/BandProperty.h" 33 #include "../../../raster/RasterProperty.h" 34 #include "../../../rp/Module.h" 35 #include "../../../rp/PostClassification.h" 36 #include "../../../se/CoverageStyle.h" 37 #include "../../../se/RasterSymbolizer.h" 38 #include "../../../se/Utils.h" 39 #include "../progress/ProgressViewerDialog.h" 42 #include "ui_PostClassificationWidgetForm.h" 45 #include <QMessageBox> 49 m_ui(new
Ui::PostClassificationWidgetForm),
54 m_ui->m_weightLineEdit->setText(
"1");
55 m_ui->m_thresholdLineEdit->setText(
"1");
58 QGridLayout* inputLayout =
new QGridLayout(
m_ui->m_inputWidget);
59 inputLayout->setContentsMargins(0, 0, 0, 0);
64 QGridLayout* outputLayout =
new QGridLayout(
m_ui->m_outputWidget);
65 outputLayout->setContentsMargins(0, 0, 0, 0);
84 std::list<te::map::AbstractLayerPtr> layersRasterList;
86 std::list<te::map::AbstractLayerPtr>::iterator it = layerList.begin();
88 while (it != layerList.end())
90 std::unique_ptr<te::da::DataSetType> dsType = it->get()->getSchema();
92 if (dsType->hasRaster())
97 layersRasterList.push_back(it->get());
103 if(!layersRasterList.empty())
107 m_layer = layersRasterList.begin()->get();
115 QMessageBox::warning(
this, tr(
"Post Classification"), tr(
"Input image is not defined."));
122 QMessageBox::warning(
this, tr(
"Post Classification"), tr(
"Output image is not defined."));
127 std::unique_ptr<te::da::DataSet>
ds =
m_layer->getData();
131 std::unique_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
138 algoInputParams.
m_weight = (
unsigned int)
m_ui->m_weightLineEdit->text().toUtf8().toInt();
139 algoInputParams.
m_threshold = (
unsigned int)
m_ui->m_thresholdLineEdit->text().toUtf8().toInt();
148 QApplication::setOverrideCursor(Qt::WaitCursor);
150 if (algorithmInstance.
initialize(algoInputParams))
152 if (algorithmInstance.
execute(algoOutputParams))
154 algoOutputParams.
reset();
162 QApplication::restoreOverrideCursor();
164 QMessageBox::information(
this, tr(
"Post Classification"), tr(
"Post Classification ended sucessfully."));
168 QApplication::restoreOverrideCursor();
170 QMessageBox::critical(
this, tr(
"Post Classification"), tr(
"Post Classification execution error.") +
178 QApplication::restoreOverrideCursor();
180 QMessageBox::critical(
this, tr(
"Post Classification"), tr(
"Post Classification initialization error.") +
const std::string & getErrorMessage() const
Return the current error message if there is any.
void weightSliderValueChanged(int value)
PostClassification output parameters.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Raster post classification.
void thresholdSliderValueChanged(int value)
TESEEXPORT RasterSymbolizer * GetRasterSymbolizer(Style *s)
Try to get raster symbolizer from a style.
This file has the PostClassificationWidget class.
static te::dt::Date ds(2010, 01, 01)
~PostClassificationWidget()
unsigned int m_weight
The weight value defines the number of times the frequency of the central point has to be considered...
te::qt::widgets::OutputRasterWidget * m_outputWidget
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated resources and reset the parameters instance to its initial state...
void setList(std::list< te::map::AbstractLayerPtr > &layerList)
unsigned int m_threshold
The threshold value is the frequency value above which the central point is modified.
bool initialize(const AlgorithmInputParameters &inputParams) _NOEXCEPT_OP(false)
Initialize the algorithm instance making it ready for execution.
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
PostClassificationWidget(QWidget *parent=0, Qt::WindowFlags f=0)
bool execute(AlgorithmOutputParameters &outputParams) _NOEXCEPT_OP(false)
Executes the algorithm using the supplied parameters.
te::map::AbstractLayerPtr m_layer
te::map::AbstractLayerPtr m_outputLayer
Utility functions for the data access module.
te::qt::widgets::InputLayerWidget * m_inputWidget
std::unique_ptr< Ui::PostClassificationWidgetForm > m_ui
Ui::PostClassificationWidgetForm * getForm() const
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
void addLayer(te::map::AbstractLayerPtr layer)
te::rst::Raster const * m_inRasterPtr
Input raster.
te::se::ColorMap * getColorMap() const
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string.