23 #include "../../../common/progress/ProgressManager.h" 24 #include "../../../dataaccess/datasource/DataSourceManager.h" 25 #include "../../../dataaccess/utils/Utils.h" 26 #include "../../../rp/Functions.h" 27 #include "../../../maptools/Utils.h" 28 #include "../../../se/Categorize.h" 29 #include "../../../se/ColorMap.h" 30 #include "../../../se/ParameterValue.h" 31 #include "../../../se/RasterSymbolizer.h" 32 #include "../../../se/SelectedChannel.h" 33 #include "../../../se/Utils.h" 34 #include "../help/HelpPushButton.h" 35 #include "../layer/search/LayerSearchWidget.h" 36 #include "../layer/search/LayerSearchWizardPage.h" 37 #include "../progress/ProgressViewerDialog.h" 38 #include "../utils/ScopedCursor.h" 41 #include "../raster/RasterInfoWidget.h" 45 #include <QApplication> 46 #include <QMessageBox> 51 this->setWizardStyle(QWizard::ModernStyle);
52 this->setWindowTitle(tr(
"Raster Slicing"));
54 this->setOption(QWizard::HaveHelpButton,
true);
55 this->setOption(QWizard::HelpButtonOnRight,
false);
59 this->setButton(QWizard::HelpButton, helpButton);
63 connect(
this, SIGNAL(currentIdChanged(
int)), SLOT(
onPageChanged(
int)));
78 std::list<te::map::AbstractLayerPtr> list =
m_layerSearchPage->getSearchWidget()->getSelecteds();
80 if(list.empty() ==
false)
84 if( layerPtr.get() != nullptr )
157 QMessageBox::warning(
this, tr(
"Raster Slicing"), tr(
"File already exists."));
162 std::list<te::map::AbstractLayerPtr> list =
m_layerSearchPage->getSearchWidget()->getSelecteds();
165 std::unique_ptr<te::rst::Raster> inputRst;
167 unsigned int inputRasterBand = 0;
168 bool eqHistogram =
false;
169 m_wizardPage->getParameters( inputRasterBand, eqHistogram );
175 QApplication::setOverrideCursor(Qt::WaitCursor);
176 std::unique_ptr< te::rst::Raster > outRasterPtr;
184 std::map<std::string, std::string> rinfo = tempRaster->getInfo();
185 rinfo[
"FORCE_MEM_DRIVER"] =
"TRUE";
187 inputRst.reset(tempRaster->trim(&
m_wizardPage->getExtent(), rinfo));
198 std::map<double, double> slice_limits;
199 for (
size_t i = 0; i < values.size(); ++i)
202 size_t pos = limits.find(
" ");
203 double min = std::stod(limits.substr(0, pos));
204 double max = std::stod(limits.substr(pos));
205 slice_limits.insert(std::pair< double, double >(min, max));
210 std::vector< te::rst::BandProperty::ColorEntry > palette;
212 for(
size_t i = 0; i < colors.size(); ++i)
223 palette.push_back(color);
227 static_cast<int>(palette.size()), eqHistogram,
m_rasterInfoPage->getWidget()->getInfo(),
228 m_rasterInfoPage->getWidget()->getType(),
true, &palette, outRasterPtr, slice_limits) )
230 outRasterPtr.reset();
236 QApplication::restoreOverrideCursor();
237 QMessageBox::information(
this, tr(
"Raster slicing"), tr(
"Raster slicing ended sucessfully"));
241 QApplication::restoreOverrideCursor();
243 QMessageBox::critical(
this, tr(
"Raster slicing"), tr(
"Raster slicing execution error.") +
int getRed() const
It returns the red component color value (a value from 0 to 255).
bool RasterSlicing(const te::rst::Raster &inputRaster, const unsigned int inputRasterBand, const bool createPaletteRaster, const unsigned int slicesNumber, const bool eqHistogram, const std::map< std::string, std::string > &rasterInfo, const std::string &rasterType, const bool enableProgress, std::vector< te::rst::BandProperty::ColorEntry > const *const palettePtr, std::unique_ptr< te::rst::Raster > &outRasterPtr, std::map< double, double > limits)
Generate all wavelet planes from the given input raster.
int getBlue() const
It returns the blue component color value (a value from 0 to 255).
int getGreen() const
It returns the green component color value (a value from 0 to 255).
short c4
alpha or blackband.
static const std::string getLastLogStr()
Returns the last log string generated by this module.
This file defines a class for a Raster Info Wizard page.
const std::vector< ParameterValue * > & getThresholds() const
An Envelope defines a 2D rectangular region.
This class is GUI used to define the raster info parameters for raster factory.
int getAlpha() const
It returns the alpha component color value (a value from 0 to 255).
Utility functions for the data access module.
TEMAPEXPORT te::rst::Raster * GetRaster(AbstractLayer *layer)
It gets the raster referenced by the given data set layer.
short c1
gray, red, cyan or hue.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
short c3
blue, yellow, or saturation.
Categorize * getCategorize() const
An structure to represent a color tuple.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
TESEEXPORT std::string GetString(const te::se::ParameterValue *param)
It gets the parameter value as a string.
A ColorMap defines either the colors of a pallette-type raster source or the mapping of numeric pixel...
short c2
green, magenta, or lightness.
const std::vector< ParameterValue * > & getThresholdValues() const