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 "../../../maptools/Utils.h" 32 #include "../../../rp/IHSFusion.h" 33 #include "../../../rp/Module.h" 34 #include "../../../rp/PCAFusion.h" 35 #include "../../../rp/WisperFusion.h" 36 #include "../help/HelpPushButton.h" 37 #include "../layer/search/LayerSearchWidget.h" 38 #include "../layer/search/LayerSearchWizardPage.h" 39 #include "../progress/ProgressViewerDialog.h" 42 #include "../raster/RasterInfoWidget.h" 50 #include <QMessageBox> 51 #include <QApplication> 58 this->setWizardStyle(QWizard::ModernStyle);
59 this->setWindowTitle(tr(
"Fusion"));
62 this->setOption(QWizard::HaveHelpButton,
true);
63 this->setOption(QWizard::HelpButtonOnRight,
false);
67 this->setButton(QWizard::HelpButton, helpButton);
71 connect(
this, SIGNAL(currentIdChanged(
int)), SLOT(
onPageChanged(
int)));
84 if(list.empty() ==
false)
97 if(list.empty() ==
false)
145 m_layerLowerSearchPage->setSubTitle(tr(
"Allows selection of layers using filters for selection. Select the layer with a LOWER raster resolution."));
147 m_layerHigherSearchPage->setSubTitle(tr(
"Allows selection of layers using filters for selection. Select the layer with a HIGHER raster resolution."));
155 QMessageBox::warning(
this, tr(
"Fusion"), tr(
"File already exists."));
174 std::list<te::map::AbstractLayerPtr> listLower =
m_layerLowerSearchPage->getSearchWidget()->getSelecteds();
188 adjustRasters(inputRstLower, inputRstHigher, rasterLower, rasterHigher);
204 QApplication::setOverrideCursor(Qt::WaitCursor);
208 if(algorithmInstance.
initialize(algoInputParams))
210 if(algorithmInstance.
execute(algoOutputParams))
212 algoOutputParams.
reset();
218 QMessageBox::information(
this, tr(
"Fusion"), tr(
"Fusion ended sucessfully"));
222 QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion execution error.") +
225 QApplication::restoreOverrideCursor();
235 QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion initialization error.") +
238 QApplication::restoreOverrideCursor();
246 catch(
const std::exception& e)
248 QMessageBox::warning(
this, tr(
"Fusion"), e.what());
250 QApplication::restoreOverrideCursor();
259 QMessageBox::warning(
this, tr(
"Fusion"), tr(
"An exception has occurred!"));
261 QApplication::restoreOverrideCursor();
269 QApplication::restoreOverrideCursor();
282 std::list<te::map::AbstractLayerPtr> listLower =
m_layerLowerSearchPage->getSearchWidget()->getSelecteds();
296 adjustRasters(inputRstLower, inputRstHigher, rasterLower, rasterHigher);
313 QApplication::setOverrideCursor(Qt::WaitCursor);
317 if(algorithmInstance.
initialize(algoInputParams))
319 if(algorithmInstance.
execute(algoOutputParams))
321 algoOutputParams.
reset();
327 QMessageBox::information(
this, tr(
"Fusion"), tr(
"Fusion ended sucessfully"));
331 QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion execution error.") +
334 QApplication::restoreOverrideCursor();
344 QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion initialization error.") +
347 QApplication::restoreOverrideCursor();
355 catch(
const std::exception& e)
357 QMessageBox::warning(
this, tr(
"Fusion"), e.what());
359 QApplication::restoreOverrideCursor();
368 QMessageBox::warning(
this, tr(
"Fusion"), tr(
"An exception has occurred!"));
370 QApplication::restoreOverrideCursor();
378 QApplication::restoreOverrideCursor();
391 std::list<te::map::AbstractLayerPtr> listLower =
m_layerLowerSearchPage->getSearchWidget()->getSelecteds();
405 adjustRasters(inputRstLower, inputRstHigher, rasterLower, rasterHigher);
421 QApplication::setOverrideCursor(Qt::WaitCursor);
425 if(algorithmInstance.
initialize(algoInputParams))
427 if(algorithmInstance.
execute(algoOutputParams))
429 algoOutputParams.
reset();
435 QMessageBox::information(
this, tr(
"Fusion"), tr(
"Fusion ended sucessfully"));
439 QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion execution error.") +
442 QApplication::restoreOverrideCursor();
452 QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion initialization error.") +
455 QApplication::restoreOverrideCursor();
463 catch(
const std::exception& e)
465 QMessageBox::warning(
this, tr(
"Fusion"), e.what());
467 QApplication::restoreOverrideCursor();
476 QMessageBox::warning(
this, tr(
"Fusion"), tr(
"An exception has occurred!"));
478 QApplication::restoreOverrideCursor();
486 QApplication::restoreOverrideCursor();
503 rOutLower = rInLower;
504 rOutHigher = rInHigher;
514 if(boxLower.
equals(boxHigher))
516 rOutLower = rInLower;
517 rOutHigher = rInHigher;
535 std::map<std::string, std::string> rLowerInfo;
536 rLowerInfo[
"FORCE_MEM_DRIVER"] =
"TRUE";
542 rOutLower = rInLower->
trim(&interBox, rLowerInfo);
545 std::map<std::string, std::string> rHigherInfo;
546 rHigherInfo[
"FORCE_MEM_DRIVER"] =
"TRUE";
559 rOutHigher = rInHigher->
trim(&interBox, rHigherInfo);
const std::string & getErrorMessage() const
Return the current error message if there is any.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
te::gm::Envelope * getExtent()
Returns the geographic extension of the raster data.
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Fusion of a low-resolution multi-band image with a high resolution image using the WiSpeR method...
Fusion of a low-resolution multi-band image with a high resolution image using the IHS method...
bool intersects(const Envelope &rhs) const
It returns true if the envelopes "spatially intersects".
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
IHSFusion output parameters.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
virtual Raster * trim(const te::gm::Envelope *env, const std::map< std::string, std::string > &rinfo) const
Subsetting operation for trimming (cropping) the raster.
const double & getUpperRightX() const
It returns a constant refernce to the x coordinate of the upper right corner.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
PCAFusion output parameters.
const double & getUpperRightY() const
It returns a constant refernce to the x coordinate of the upper right corner.
Fusion of a low-resolution multi-band image with a high resolution image using the PCA (Principal com...
WisperFusion output parameters.
This file defines a class for a Raster Info Wizard page.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
This file defines a class for a Fusion Wizard page.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
An Envelope defines a 2D rectangular region.
An abstract class for raster data strucutures.
This class is GUI used to define the raster info parameters for raster factory.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
This class is GUI used to define the fusion parameters for the RP fusion operation.
Utility functions for the data access module.
A Qt dialog that allows users to run a fusion operation defined by RP module.
bool equals(const Envelope &rhs) const
It returns true if the envelopes are "spatially equal".
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
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.
virtual Raster * transform(int srid, const std::map< std::string, std::string > &rinfo, int m=1) const
Reprojects this raster to a distinct SRS. This method reprojects this raster to a distinct SRS...
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Envelope intersection(const Envelope &rhs) const
It returns an envelope that represents the point set intersection with another envelope.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.