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/IHSFusion.h"
32 #include "../../../rp/Module.h"
33 #include "../../../rp/PCAFusion.h"
34 #include "../../../rp/WisperFusion.h"
35 #include "../help/HelpPushButton.h"
36 #include "../layer/search/LayerSearchWidget.h"
37 #include "../layer/search/LayerSearchWizardPage.h"
38 #include "../progress/ProgressViewerDialog.h"
49 #include <QMessageBox>
50 #include <QApplication>
57 this->setWizardStyle(QWizard::ModernStyle);
58 this->setWindowTitle(tr(
"Fusion"));
61 this->setOption(QWizard::HaveHelpButton,
true);
62 this->setOption(QWizard::HelpButtonOnRight,
false);
66 this->setButton(QWizard::HelpButton, helpButton);
80 if(currentPage() == m_layerLowerSearchPage.get())
82 std::list<te::map::AbstractLayerPtr> list = m_layerLowerSearchPage->getSearchWidget()->getSelecteds();
84 if(list.empty() ==
false)
88 m_fusionPage->setLower(l);
91 return m_layerLowerSearchPage->isComplete();
93 else if(currentPage() == m_layerHigherSearchPage.get())
95 std::list<te::map::AbstractLayerPtr> list = m_layerHigherSearchPage->getSearchWidget()->getSelecteds();
97 if(list.empty() ==
false)
101 m_fusionPage->setHigher(l);
104 return m_layerHigherSearchPage->isComplete();
106 else if(currentPage() == m_fusionPage.get())
108 return m_fusionPage->isComplete();
110 else if(currentPage() == m_rasterInfoPage.get())
120 m_layerLowerSearchPage->getSearchWidget()->setList(layerList);
121 m_layerLowerSearchPage->getSearchWidget()->filterOnlyByRaster();
123 m_layerHigherSearchPage->getSearchWidget()->setList(layerList);
124 m_layerHigherSearchPage->getSearchWidget()->filterOnlyByRaster();
129 return m_outputLayer;
139 addPage(m_layerLowerSearchPage.get());
140 addPage(m_layerHigherSearchPage.get());
141 addPage(m_fusionPage.get());
142 addPage(m_rasterInfoPage.get());
145 m_layerLowerSearchPage->setSubTitle(tr(
"Allows selection of layers using filters for selection. Select the layer with a LOWER raster resolution."));
146 m_layerLowerSearchPage->getSearchWidget()->enableMultiSelection(
false);
147 m_layerHigherSearchPage->setSubTitle(tr(
"Allows selection of layers using filters for selection. Select the layer with a HIGHER raster resolution."));
148 m_layerHigherSearchPage->getSearchWidget()->enableMultiSelection(
false);
153 if(m_fusionPage->isIHSFusion())
156 if(m_fusionPage->isPCAFusion())
159 if(m_fusionPage->isWisperFusion())
160 return executeWisper();
168 std::list<te::map::AbstractLayerPtr> listLower = m_layerLowerSearchPage->getSearchWidget()->getSelecteds();
170 std::auto_ptr<te::da::DataSet> dsLower = lLower->getData();
177 std::list<te::map::AbstractLayerPtr> listHigher = m_layerHigherSearchPage->getSearchWidget()->getSelecteds();
179 std::auto_ptr<te::da::DataSet> dsHigher = lHigher->getData();
188 adjustRasters(inputRstLower, inputRstHigher, rasterLower, rasterHigher);
198 algoOutputParams.
m_rInfo = m_rasterInfoPage->getWidget()->getInfo();
199 algoOutputParams.
m_rType = m_rasterInfoPage->getWidget()->getType();
205 QApplication::setOverrideCursor(Qt::WaitCursor);
209 if(algorithmInstance.
initialize(algoInputParams))
211 if(algorithmInstance.
execute(algoOutputParams))
213 algoOutputParams.
reset();
217 m_rasterInfoPage->getWidget()->getInfo());
219 QMessageBox::information(
this, tr(
"Fusion"), tr(
"Fusion ended sucessfully"));
223 QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion execution error.") +
228 QApplication::restoreOverrideCursor();
238 QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion initialization error.") +
243 QApplication::restoreOverrideCursor();
251 catch(
const std::exception& e)
253 QMessageBox::warning(
this, tr(
"Fusion"), e.what());
257 QApplication::restoreOverrideCursor();
266 QMessageBox::warning(
this, tr(
"Fusion"), tr(
"An exception has occurred!"));
270 QApplication::restoreOverrideCursor();
280 QApplication::restoreOverrideCursor();
291 std::list<te::map::AbstractLayerPtr> listLower = m_layerLowerSearchPage->getSearchWidget()->getSelecteds();
293 std::auto_ptr<te::da::DataSet> dsLower = lLower->getData();
300 std::list<te::map::AbstractLayerPtr> listHigher = m_layerHigherSearchPage->getSearchWidget()->getSelecteds();
302 std::auto_ptr<te::da::DataSet> dsHigher = lHigher->getData();
311 adjustRasters(inputRstLower, inputRstHigher, rasterLower, rasterHigher);
322 algoOutputParams.
m_rInfo = m_rasterInfoPage->getWidget()->getInfo();
323 algoOutputParams.
m_rType = m_rasterInfoPage->getWidget()->getType();
329 QApplication::setOverrideCursor(Qt::WaitCursor);
333 if(algorithmInstance.
initialize(algoInputParams))
335 if(algorithmInstance.
execute(algoOutputParams))
337 algoOutputParams.
reset();
341 m_rasterInfoPage->getWidget()->getInfo());
343 QMessageBox::information(
this, tr(
"Fusion"), tr(
"Fusion ended sucessfully"));
347 QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion execution error.") +
352 QApplication::restoreOverrideCursor();
362 QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion initialization error.") +
367 QApplication::restoreOverrideCursor();
375 catch(
const std::exception& e)
377 QMessageBox::warning(
this, tr(
"Fusion"), e.what());
381 QApplication::restoreOverrideCursor();
390 QMessageBox::warning(
this, tr(
"Fusion"), tr(
"An exception has occurred!"));
394 QApplication::restoreOverrideCursor();
404 QApplication::restoreOverrideCursor();
415 std::list<te::map::AbstractLayerPtr> listLower = m_layerLowerSearchPage->getSearchWidget()->getSelecteds();
417 std::auto_ptr<te::da::DataSet> dsLower = lLower->getData();
424 std::list<te::map::AbstractLayerPtr> listHigher = m_layerHigherSearchPage->getSearchWidget()->getSelecteds();
426 std::auto_ptr<te::da::DataSet> dsHigher = lHigher->getData();
435 adjustRasters(inputRstLower, inputRstHigher, rasterLower, rasterHigher);
445 algoOutputParams.
m_rInfo = m_rasterInfoPage->getWidget()->getInfo();
446 algoOutputParams.
m_rType = m_rasterInfoPage->getWidget()->getType();
452 QApplication::setOverrideCursor(Qt::WaitCursor);
456 if(algorithmInstance.
initialize(algoInputParams))
458 if(algorithmInstance.
execute(algoOutputParams))
460 algoOutputParams.
reset();
464 m_rasterInfoPage->getWidget()->getInfo());
466 QMessageBox::information(
this, tr(
"Fusion"), tr(
"Fusion ended sucessfully"));
470 QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion execution error.") +
475 QApplication::restoreOverrideCursor();
485 QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion initialization error.") +
490 QApplication::restoreOverrideCursor();
498 catch(
const std::exception& e)
500 QMessageBox::warning(
this, tr(
"Fusion"), e.what());
504 QApplication::restoreOverrideCursor();
513 QMessageBox::warning(
this, tr(
"Fusion"), tr(
"An exception has occurred!"));
517 QApplication::restoreOverrideCursor();
527 QApplication::restoreOverrideCursor();
540 if(!m_fusionPage->cropRasters())
542 rOutLower = rInLower;
543 rOutHigher = rInHigher;
553 if(boxLower.
equals(boxHigher))
555 rOutLower = rInLower;
556 rOutHigher = rInHigher;
574 std::map<std::string, std::string> rLowerInfo;
575 rLowerInfo[
"FORCE_MEM_DRIVER"] =
"TRUE";
581 rOutLower = rInLower->
trim(&interBox, rLowerInfo);
584 std::map<std::string, std::string> rHigherInfo;
585 rHigherInfo[
"FORCE_MEM_DRIVER"] =
"TRUE";
598 rOutHigher = rInHigher->
trim(&interBox, rHigherInfo);
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).
Utility functions for the data access module.
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.
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.
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.
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...
int addViewer(AbstractProgressViewer *apv)
Attach a progress viewer.
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 ).
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
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.