27 #include "../../../common/StringUtils.h" 
   28 #include "../../../common/STLUtils.h" 
   29 #include "../../../common/progress/ProgressManager.h" 
   30 #include "../../../dataaccess/dataset/DataSet.h" 
   31 #include "../../../dataaccess/utils/Utils.h" 
   32 #include "../../../raster/Raster.h" 
   33 #include "../../../rp/FeedersRaster.h" 
   34 #include "../../../rp/Functions.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(
"Compose / Decompose Bands"));
 
   60   this->setOption(QWizard::HaveHelpButton, 
true);
 
   61   this->setOption(QWizard::HelpButtonOnRight, 
false);
 
   65   this->setButton(QWizard::HelpButton, helpButton);
 
   79   if(currentPage() ==  m_layerSearchPage.get())
 
   81     std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
 
   83     m_composeBandsPage->setList(list);
 
   85     return m_layerSearchPage->isComplete();
 
   87   else if(currentPage() ==  m_composeBandsPage.get())
 
   89     return m_composeBandsPage->isComplete();
 
   91   else if(currentPage() ==  m_rasterInfoPage.get())
 
  101   m_layerSearchPage->getSearchWidget()->setList(layerList);
 
  102   m_layerSearchPage->getSearchWidget()->filterOnlyByRaster();
 
  107   return m_outputLayerList;
 
  116   addPage(m_layerSearchPage.get());
 
  117   addPage(m_composeBandsPage.get());
 
  118   addPage(m_rasterInfoPage.get());
 
  121   m_layerSearchPage->setSubTitle(tr(
"Allows selection of layers using filters for selection. Select one layer for DECOMPOSITION or multi layers for COMPOSITION."));
 
  122   m_layerSearchPage->getSearchWidget()->enableMultiSelection(
true);
 
  127   if(m_composeBandsPage->isCompose())
 
  128     return executeCompose();
 
  130   if(m_composeBandsPage->isDecompose())
 
  131     return executeDecompose();
 
  139   std::map<std::string, std::string> rinfo = m_rasterInfoPage->getWidget()->getInfo();
 
  140   std::string type = m_rasterInfoPage->getWidget()->getType();
 
  143   std::vector<const te::rst::Raster*> inputRasters;
 
  144   std::vector<unsigned int> inputRasterBands;
 
  147   m_composeBandsPage->getComposeParameters(inputRasters, inputRasterBands, interpMethod);
 
  153   std::auto_ptr<te::rst::Raster> outputRaster;
 
  155   QApplication::setOverrideCursor(Qt::WaitCursor);
 
  163   catch(
const std::exception& e)
 
  165     QMessageBox::warning(
this, tr(
"Compose"), e.what());
 
  167     QApplication::restoreOverrideCursor();
 
  175     QMessageBox::warning(
this, tr(
"Compose"), tr(
"An exception has occurred!"));
 
  177     QApplication::restoreOverrideCursor();
 
  184   QApplication::restoreOverrideCursor();
 
  189     outputRaster.reset();
 
  193     m_outputLayerList.push_back(layer);
 
  205   std::string outputDataSetNamePath = m_rasterInfoPage->getWidget()->getPath();
 
  206   std::string outputDataSetNamePrefix = m_rasterInfoPage->getWidget()->getShortName();
 
  207   std::string outputDataSetNameExt = m_rasterInfoPage->getWidget()->getExtension();
 
  208   std::string type = m_rasterInfoPage->getWidget()->getType();
 
  209   std::vector< std::map<std::string, std::string> > outputRastersInfos;
 
  213   std::vector<unsigned int> inputRasterBands;
 
  215   m_composeBandsPage->getDecomposeParameters(inputRaster, inputRasterBands);
 
  218   std::vector<std::string> outputDataSetNames;
 
  220   for(std::size_t t = 0; t < inputRasterBands.size(); ++t)
 
  222     std::string name = outputDataSetNamePrefix;
 
  225                 name += outputDataSetNameExt;
 
  227     outputDataSetNames.push_back(name);
 
  229     outputRastersInfos.push_back(m_rasterInfoPage->getWidget()->getInfo((
int)t));
 
  232   std::vector< boost::shared_ptr< te::rst::Raster > > outputRastersPtrs;
 
  239     res = 
te::rp::DecomposeBands(*inputRaster, inputRasterBands, outputRastersInfos, type, outputRastersPtrs);
 
  241   catch(
const std::exception& e)
 
  243     QMessageBox::warning(
this, tr(
"Decompose"), e.what());
 
  245     QApplication::restoreOverrideCursor();
 
  247     outputRastersPtrs.clear();
 
  253     QMessageBox::warning(
this, tr(
"Decompose"), tr(
"An exception has occurred!"));
 
  255     QApplication::restoreOverrideCursor();
 
  257     outputRastersPtrs.clear();
 
  262   QApplication::restoreOverrideCursor();
 
  267     outputRastersPtrs.clear();
 
  269     std::string type = m_rasterInfoPage->getWidget()->getType();
 
  271     for(std::size_t t = 0; t < outputDataSetNames.size(); ++t)
 
  273       std::map<std::string, std::string> rinfo;
 
  274       rinfo[
"URI"] = outputDataSetNamePath + outputDataSetNames[t];
 
  278       m_outputLayerList.push_back(layer);
 
Utility functions for the data access module. 
 
A feeder from a input rasters vector;. 
 
bool ComposeBands(te::rp::FeederConstRaster &feeder, const std::vector< unsigned int > &inputRasterBands, const te::rst::Interpolator::Method &interpMethod, const std::map< std::string, std::string > &outputRasterInfo, const std::string &outputDataSourceType, std::auto_ptr< te::rst::Raster > &outputRasterPtr)
Compose a set of bands into one multi-band raster. 
 
bool DecomposeBands(const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, const std::vector< std::map< std::string, std::string > > &outputRastersInfos, const std::string &outputDataSourceType, std::vector< boost::shared_ptr< te::rst::Raster > > &outputRastersPtrs)
Decompose a multi-band raster into a set of one-band rasters. 
 
InterpolationMethod
Allowed interpolation methods. 
 
This file defines a class for a Raster Info Wizard page. 
 
A Qt dialog that allows users to compose or decompose bands. 
 
This class is GUI used to defines a class for a Compose / Decompose Bands Wizard page. 
 
An abstract class for raster data strucutures. 
 
This class is GUI used to define the raster info parameters for raster factory. 
 
This file defines a class for a Compose / Decompose Bands Wizard page. 
 
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string. 
 
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
 
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...