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 "../help/HelpPushButton.h" 
   35 #include "../layer/search/LayerSearchWidget.h" 
   36 #include "../layer/search/LayerSearchWizardPage.h" 
   37 #include "../progress/ProgressViewerDialog.h" 
   48 #include <QMessageBox> 
   49 #include <QApplication> 
   56   this->setWizardStyle(QWizard::ModernStyle);
 
   57   this->setWindowTitle(tr(
"Fusion"));
 
   60   this->setOption(QWizard::HaveHelpButton, 
true);
 
   61   this->setOption(QWizard::HelpButtonOnRight, 
false);
 
   65   this->setButton(QWizard::HelpButton, helpButton);
 
   79   if(currentPage() ==  m_layerLowerSearchPage.get())
 
   81     std::list<te::map::AbstractLayerPtr> list = m_layerLowerSearchPage->getSearchWidget()->getSelecteds();
 
   83     if(list.empty() == 
false)
 
   87       m_fusionPage->setLower(l);
 
   90     return m_layerLowerSearchPage->isComplete();
 
   92   else if(currentPage() ==  m_layerHigherSearchPage.get())
 
   94     std::list<te::map::AbstractLayerPtr> list = m_layerHigherSearchPage->getSearchWidget()->getSelecteds();
 
   96     if(list.empty() == 
false)
 
  100       m_fusionPage->setHigher(l);
 
  103     return m_layerHigherSearchPage->isComplete();
 
  105   else if(currentPage() ==  m_fusionPage.get())
 
  107     return m_fusionPage->isComplete();
 
  109   else if(currentPage() ==  m_rasterInfoPage.get())
 
  119   m_layerLowerSearchPage->getSearchWidget()->setList(layerList);
 
  120   m_layerLowerSearchPage->getSearchWidget()->filterOnlyByRaster();
 
  122   m_layerHigherSearchPage->getSearchWidget()->setList(layerList);
 
  123   m_layerHigherSearchPage->getSearchWidget()->filterOnlyByRaster();
 
  128   return m_outputLayer;
 
  138   addPage(m_layerLowerSearchPage.get());
 
  139   addPage(m_layerHigherSearchPage.get());
 
  140   addPage(m_fusionPage.get());
 
  141   addPage(m_rasterInfoPage.get());
 
  144   m_layerLowerSearchPage->setSubTitle(tr(
"Allows selection of layers using filters for selection. Select the layer with a LOWER raster resolution."));
 
  145   m_layerLowerSearchPage->getSearchWidget()->enableMultiSelection(
false);
 
  146   m_layerHigherSearchPage->setSubTitle(tr(
"Allows selection of layers using filters for selection. Select the layer with a HIGHER raster resolution."));
 
  147   m_layerHigherSearchPage->getSearchWidget()->enableMultiSelection(
false);
 
  152   if(m_fusionPage->isIHSFusion())
 
  155   if(m_fusionPage->isPCAFusion())
 
  164   std::list<te::map::AbstractLayerPtr> listLower = m_layerLowerSearchPage->getSearchWidget()->getSelecteds();
 
  166   std::auto_ptr<te::da::DataSet> dsLower = lLower->getData();
 
  173   std::list<te::map::AbstractLayerPtr> listHigher = m_layerHigherSearchPage->getSearchWidget()->getSelecteds();
 
  175   std::auto_ptr<te::da::DataSet> dsHigher = lHigher->getData();
 
  184   adjustRasters(inputRstLower, inputRstHigher, rasterLower, rasterHigher);
 
  194   algoOutputParams.
m_rInfo = m_rasterInfoPage->getWidget()->getInfo();
 
  195   algoOutputParams.
m_rType = m_rasterInfoPage->getWidget()->getType();
 
  201   QApplication::setOverrideCursor(Qt::WaitCursor);
 
  205     if(algorithmInstance.
initialize(algoInputParams))
 
  207       if(algorithmInstance.
execute(algoOutputParams))
 
  209         algoOutputParams.
reset();
 
  213                                                      m_rasterInfoPage->getWidget()->getInfo());
 
  215         QMessageBox::information(
this, tr(
"Fusion"), tr(
"Fusion ended sucessfully"));
 
  219         QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion execution error.") +
 
  224         QApplication::restoreOverrideCursor();
 
  234       QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion initialization error.") +
 
  239       QApplication::restoreOverrideCursor();
 
  247   catch(
const std::exception& e)
 
  249     QMessageBox::warning(
this, tr(
"Fusion"), e.what());
 
  253     QApplication::restoreOverrideCursor();
 
  262     QMessageBox::warning(
this, tr(
"Fusion"), tr(
"An exception has occurred!"));
 
  266     QApplication::restoreOverrideCursor();
 
  276   QApplication::restoreOverrideCursor();
 
  287   std::list<te::map::AbstractLayerPtr> listLower = m_layerLowerSearchPage->getSearchWidget()->getSelecteds();
 
  289   std::auto_ptr<te::da::DataSet> dsLower = lLower->getData();
 
  296   std::list<te::map::AbstractLayerPtr> listHigher = m_layerHigherSearchPage->getSearchWidget()->getSelecteds();
 
  298   std::auto_ptr<te::da::DataSet> dsHigher = lHigher->getData();
 
  307   adjustRasters(inputRstLower, inputRstHigher, rasterLower, rasterHigher);
 
  318   algoOutputParams.
m_rInfo = m_rasterInfoPage->getWidget()->getInfo();
 
  319   algoOutputParams.
m_rType = m_rasterInfoPage->getWidget()->getType();
 
  325   QApplication::setOverrideCursor(Qt::WaitCursor);
 
  329     if(algorithmInstance.
initialize(algoInputParams))
 
  331       if(algorithmInstance.
execute(algoOutputParams))
 
  333         algoOutputParams.
reset();
 
  337                                                      m_rasterInfoPage->getWidget()->getInfo());
 
  339         QMessageBox::information(
this, tr(
"Fusion"), tr(
"Fusion ended sucessfully"));
 
  343         QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion execution error.") +
 
  348         QApplication::restoreOverrideCursor();
 
  358       QMessageBox::critical(
this, tr(
"Fusion"), tr(
"Fusion initialization error.") +
 
  363       QApplication::restoreOverrideCursor();
 
  371   catch(
const std::exception& e)
 
  373     QMessageBox::warning(
this, tr(
"Fusion"), e.what());
 
  377     QApplication::restoreOverrideCursor();
 
  386     QMessageBox::warning(
this, tr(
"Fusion"), tr(
"An exception has occurred!"));
 
  390     QApplication::restoreOverrideCursor();
 
  400   QApplication::restoreOverrideCursor();
 
  413   if(!m_fusionPage->cropRasters())
 
  415     rOutLower = rInLower;
 
  416     rOutHigher = rInHigher;
 
  426   if(boxLower.
equals(boxHigher))
 
  428     rOutLower = rInLower;
 
  429     rOutHigher = rInHigher;
 
  447   std::map<std::string, std::string> rLowerInfo;
 
  448   rLowerInfo[
"FORCE_MEM_DRIVER"] = 
"TRUE";
 
  449   rLowerInfo[
"MEM_RASTER_NROWS"] = boost::lexical_cast<std::string>(interBox.
getHeight() / rInLower->
getResolutionX());
 
  450   rLowerInfo[
"MEM_RASTER_NCOLS"] = boost::lexical_cast<std::string>(interBox.
getWidth() / rInLower->
getResolutionY());
 
  451   rLowerInfo[
"MEM_RASTER_DATATYPE"] = boost::lexical_cast<std::string>(rInLower->
getBandDataType(0));
 
  452   rLowerInfo[
"MEM_RASTER_NBANDS"] = boost::lexical_cast<std::string>(rInLower->
getNumberOfBands());
 
  454   rOutLower = rInLower->
trim(&interBox, rLowerInfo);
 
  457   std::map<std::string, std::string> rHigherInfo;
 
  458   rHigherInfo[
"FORCE_MEM_DRIVER"] = 
"TRUE";
 
  459   rHigherInfo[
"MEM_RASTER_NROWS"] = boost::lexical_cast<std::string>(interBox.
getHeight() / rInHigher->
getResolutionX());
 
  460   rHigherInfo[
"MEM_RASTER_NCOLS"] = boost::lexical_cast<std::string>(interBox.
getWidth() / rInHigher->
getResolutionY());
 
  461   rHigherInfo[
"MEM_RASTER_DATATYPE"] = boost::lexical_cast<std::string>(rInHigher->
getBandDataType(0));
 
  462   rHigherInfo[
"MEM_RASTER_NBANDS"] = boost::lexical_cast<std::string>(rInHigher->
getNumberOfBands());
 
  471     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 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 ). 
 
const double & getUpperRightX() const 
It returns a constant refernce to the x coordinate of the upper right corner. 
 
const double & getLowerLeftY() const 
It returns a constant refernce to the y coordinate of the lower left corner. 
 
PCAFusion output parameters. 
 
double getWidth() const 
It returns the envelope width. 
 
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...
 
This file defines a class for a Raster Info Wizard page. 
 
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. 
 
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster. 
 
double getResolutionX() const 
Returns the raster horizontal (x-axis) resolution. 
 
virtual Raster * trim(const te::gm::Envelope *env, const std::map< std::string, std::string > &rinfo)
Subsetting operation for trimming (cropping) the raster. 
 
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". 
 
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. 
 
double getResolutionY() const 
Returns the raster vertical (y-axis) resolution. 
 
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. 
 
virtual int getBandDataType(std::size_t i) const =0
Returns the data type in a particular band (or dimension). 
 
double getHeight() const 
It returns the envelope height.