27 #include "../../../common/progress/ProgressManager.h"
28 #include "../../../dataaccess/dataset/DataSet.h"
29 #include "../../../dataaccess/utils/Utils.h"
30 #include "../../../raster/Raster.h"
31 #include "../../../rp/Classifier.h"
32 #include "../../../rp/Module.h"
33 #include "../../../se/Categorize.h"
34 #include "../../../se/ColorMap.h"
35 #include "../../../se/ParameterValue.h"
36 #include "../../../se/RasterSymbolizer.h"
37 #include "../../../se/Utils.h"
38 #include "../help/HelpPushButton.h"
39 #include "../layer/search/LayerSearchWidget.h"
40 #include "../layer/search/LayerSearchWizardPage.h"
41 #include "../progress/ProgressViewerDialog.h"
52 #include <QMessageBox>
53 #include <QApplication>
60 this->setWizardStyle(QWizard::ModernStyle);
61 this->setWindowTitle(tr(
"Classifier"));
64 this->setOption(QWizard::HaveHelpButton,
true);
65 this->setOption(QWizard::HelpButtonOnRight,
false);
69 this->setButton(QWizard::HelpButton, helpButton);
83 if(currentPage() == m_layerSearchPage.get())
85 std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
87 if(list.empty() ==
false)
91 m_classifierPage->set(l);
94 return m_layerSearchPage->isComplete();
96 else if(currentPage() == m_classifierPage.get())
98 return m_classifierPage->isComplete();
100 else if(currentPage() == m_rasterInfoPage.get())
110 m_layerSearchPage->getSearchWidget()->setList(layerList);
111 m_layerSearchPage->getSearchWidget()->filterOnlyByRaster();
113 m_classifierPage->setList(layerList);
118 return m_outputLayer;
127 addPage(m_layerSearchPage.get());
128 addPage(m_classifierPage.get());
129 addPage(m_rasterInfoPage.get());
132 m_layerSearchPage->getSearchWidget()->enableMultiSelection(
false);
138 std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
140 std::auto_ptr<te::da::DataSet> ds = l->getData();
144 std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
153 algoOutputParams.
m_rInfo = m_rasterInfoPage->getWidget()->getInfo();
154 algoOutputParams.
m_rType = m_rasterInfoPage->getWidget()->getType();
160 QApplication::setOverrideCursor(Qt::WaitCursor);
162 if(algorithmInstance.
initialize(algoInputParams))
164 if(algorithmInstance.
execute(algoOutputParams))
166 algoOutputParams.
reset();
170 m_rasterInfoPage->getWidget()->getInfo());
172 QMessageBox::information(
this, tr(
"Classifier"), tr(
"Classifier ended sucessfully"));
176 QMessageBox::critical(
this, tr(
"Classifier"), tr(
"Classifier execution error.") +
181 QApplication::restoreOverrideCursor();
188 QMessageBox::critical(
this, tr(
"Classifier"), tr(
"Classifier initialization error.") +
193 QApplication::restoreOverrideCursor();
201 if(rs && rs->
getROISet().empty() ==
false)
210 QColor cWhite(Qt::white);
211 std::string colorWhiteStr = cWhite.name().toLatin1().data();
216 std::map<std::string, te::cl::ROI*> roiSetMap = rs->
getROISet();
217 std::map<std::string, te::cl::ROI*>::iterator it = roiSetMap.begin();
221 while(it != roiSetMap.end())
223 std::string color = it->second->getColor();
224 std::string range = QString::number(count).toStdString();
230 if(count == roiSetMap.size())
232 std::string rangeNext = QString::number(count + 1).toStdString();
252 QApplication::restoreOverrideCursor();
Utility functions for the data access module.
The transformation of continuous values to distinct values (Categorize function). ...
A Qt dialog that allows users to run a classifier operation defined by RP module. ...
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
TESEEXPORT RasterSymbolizer * GetRasterSymbolizer(Style *s)
Try to get raster symbolizer from a style.
void setLookupValue(ParameterValue *v)
void setCategorize(Categorize *c)
Classifier output parameters.
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
A ROISet is a set of ROI's.
This file defines a class for a Raster Info Wizard page.
static const std::string & getLastLogStr()
Returns the last log string generated by this module.
void removeViewer(int viewerId)
Dettach a progress viewer.
static ProgressManager & getInstance()
It returns a reference to the singleton instance.
This file defines a class for a Classifier Wizard page.
This class is GUI used to define the raster info parameters for raster factory.
This class is GUI used to define the classifier parameters for the RP constast operation.
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
int addViewer(AbstractProgressViewer *apv)
Attach a progress viewer.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
void setColorMap(ColorMap *c)
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void setThresholdsBelongTo(ThresholdsBelongToType t)
void addThreshold(ParameterValue *v)
A ColorMap defines either the colors of a pallette-type raster source or the mapping of numeric pixel...
void addValue(ParameterValue *v)
std::map< std::string, te::cl::ROI * > & getROISet()
Get the roi set map.
void setFallbackValue(const std::string &v)