27 #include "../../../common/progress/ProgressManager.h" 28 #include "../../../color/ColorBar.h" 29 #include "../../../color/ColorScheme.h" 30 #include "../../../color/ColorSchemeCatalog.h" 31 #include "../../../color/ColorSchemeCatalogManager.h" 32 #include "../../../color/ColorSchemeGroup.h" 33 #include "../../../color/RGBAColor.h" 34 #include "../../../dataaccess/dataset/DataSet.h" 35 #include "../../../dataaccess/utils/Utils.h" 36 #include "../../../raster/Grid.h" 37 #include "../../../raster/Raster.h" 38 #include "../../../raster/RasterSummary.h" 39 #include "../../../raster/RasterSummaryManager.h" 40 #include "../../../rp/Classifier.h" 41 #include "../../../rp/Module.h" 42 #include "../../../se/Categorize.h" 43 #include "../../../se/ColorMap.h" 44 #include "../../../se/ParameterValue.h" 45 #include "../../../se/RasterSymbolizer.h" 46 #include "../../../se/Rule.h" 47 #include "../../../se/Utils.h" 48 #include "../../../maptools/Utils.h" 49 #include "../../../maptools/GroupingAlgorithms.h" 50 #include "../help/HelpPushButton.h" 51 #include "../layer/search/LayerSearchWidget.h" 52 #include "../layer/search/LayerSearchWizardPage.h" 53 #include "../progress/ProgressViewerDialog.h" 56 #include "../raster/RasterInfoWidget.h" 64 #include <QMessageBox> 65 #include <QApplication> 66 #include <QActionGroup> 72 this->setWizardStyle(QWizard::ModernStyle);
73 this->setWindowTitle(tr(
"Classifier"));
76 this->setOption(QWizard::HaveHelpButton,
true);
77 this->setOption(QWizard::HelpButtonOnRight,
false);
81 this->setButton(QWizard::HelpButton, helpButton);
85 connect(
this, SIGNAL(currentIdChanged(
int)), SLOT(
onPageChanged(
int)));
99 std::list<te::map::AbstractLayerPtr> list =
m_layerSearchPage->getSearchWidget()->getSelecteds();
101 if(list.empty() ==
false)
168 QMessageBox::warning(
this, tr(
"Classifier"), tr(
"File already exists."));
173 std::list<te::map::AbstractLayerPtr> list =
m_layerSearchPage->getSearchWidget()->getSelecteds();
204 QApplication::setOverrideCursor(Qt::WaitCursor);
206 if(algorithmInstance.
initialize(algoInputParams))
208 if(algorithmInstance.
execute(algoOutputParams))
210 algoOutputParams.
reset();
216 QMessageBox::information(
this, tr(
"Classifier"), tr(
"Classifier ended sucessfully."));
220 QMessageBox::critical(
this, tr(
"Classifier"), tr(
"Classifier execution error.") +
223 QApplication::restoreOverrideCursor();
230 QMessageBox::critical(
this, tr(
"Classifier"), tr(
"Classifier initialization error.") +
233 QApplication::restoreOverrideCursor();
241 if(rs && rs->
getROISet().empty() ==
false)
250 QColor cWhite(Qt::white);
251 std::string colorWhiteStr = cWhite.name().toUtf8().data();
256 std::map<std::string, te::cl::ROI*> roiSetMap = rs->
getROISet();
257 std::map<std::string, te::cl::ROI*>::iterator it = roiSetMap.begin();
259 unsigned int count = 1;
261 while(it != roiSetMap.end())
263 std::string color = it->second->getColor();
264 std::string range = QString::number(count).toUtf8().data();
270 if(count == roiSetMap.size())
272 std::string rangeNext = QString::number(count + 1).toUtf8().data();
294 QApplication::restoreOverrideCursor();
308 const std::complex<double>* cmin = rsMin->at(0).m_minVal;
309 const std::complex<double>* cmax = rsMax->at(0).m_maxVal;
310 double min = cmin->real();
311 double max = cmax->real();
313 std::vector<double> vec;
318 std::vector<te::color::RGBAColor> colorVec;
327 for(std::size_t t = 0; t < csgVec.size(); ++t)
335 for(std::size_t
p = 0;
p < csVec.size(); ++
p)
341 std::vector<te::color::RGBAColor>* colors = cs->
getColors()[0];
343 std::vector<te::color::RGBAColor>::iterator it = colors->begin();
351 while(it != colors->end())
353 if(count != 0 && count != static_cast<int>(colors->size()) - 1)
355 double pos = (1. / (colors->size() - 1)) * count;
370 std::vector<te::se::Rule*> legVec;
376 c->setFallbackValue(
"#000000");
379 QColor cWhite(Qt::white);
380 std::string colorWhiteStr = cWhite.name().toUtf8().data();
385 for(std::size_t i = 0; i < legVec.size(); ++i)
387 std::string rangeStrLower;
388 std::string rangeStrUpper;
392 QColor color(colorVec[i].getRed(), colorVec[i].getGreen(), colorVec[i].getBlue(), colorVec[i].getAlpha());
394 std::string colorStr = color.name().toUtf8().data();
399 if(legVec[i] == legVec.back())
const std::string & getErrorMessage() const
Return the current error message if there is any.
The transformation of continuous values to distinct values (Categorize function). ...
const std::vector< ColorScheme * > & getColorSchemes() const
It returns a reference to the list of color schemes belonging to this group.
const std::vector< ColorSchemeGroup * > & getColorSchemeGroups() const
It returns the list of color scheme groups in the catalog.
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.
const std::string & getName() const
It returns the group name.
TESEEXPORT RasterSymbolizer * GetRasterSymbolizer(Style *s)
Try to get raster symbolizer from a style.
It models the concept of color scheme.
void setLookupValue(ParameterValue *v)
const std::vector< std::vector< RGBAColor > * > & getColors() const
It returns all color lists.
void setCategorize(Categorize *c)
void GroupingByEqualSteps(std::string attrName, iterator begin, iterator end, int nSteps, std::vector< te::se::Rule * > &rules, int precision=0)
It groups the values defined by a range of iterators using the equal steps algorithm.
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.
TEFEEXPORT void GetFilterStepValues(const te::fe::Filter *filter, std::string &valueMin, std::string &valueMax)
static RasterSummaryManager & 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.
boost::ptr_vector< BandSummary > RasterSummary
RasterSummary is just a typedef of a boost::ptr_vector.
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
const std::string & getName() const
It returns the color schema name.
Utility functions for the data access module.
void setRecode(Recode *i)
const std::vector< te::color::RGBAColor > & getSlices(const int &n)
It generates color bar.
TEMAPEXPORT te::rst::Raster * GetRaster(AbstractLayer *layer)
It gets the raster referenced by the given data set layer.
void addColor(const RGBAColor &color, const double &pos)
It adds a color in the color bar.
This class represents a group of color schemes.
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.
A catalog for color schemes.
void setColorMap(ColorMap *c)
It models the concept of color bar.
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 setInterpolate(Interpolate *i)
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)