27 #include "../../../common/progress/ProgressManager.h"
28 #include "../../../common/STLUtils.h"
29 #include "../../../dataaccess/dataset/DataSet.h"
30 #include "../../../dataaccess/utils/Utils.h"
31 #include "../help/HelpPushButton.h"
32 #include "../layer/search/LayerSearchWidget.h"
33 #include "../layer/search/LayerSearchWizardPage.h"
34 #include "../progress/ProgressViewerDialog.h"
45 #include <QMessageBox>
46 #include <QApplication>
53 this->setWizardStyle(QWizard::ModernStyle);
54 this->setWindowTitle(tr(
"Mosaic"));
57 this->setOption(QWizard::HaveHelpButton,
true);
58 this->setOption(QWizard::HelpButtonOnRight,
false);
62 this->setButton(QWizard::HelpButton, helpButton);
76 if(currentPage() == m_layerSearchPage.get())
78 std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
80 m_mosaicPage->setList(list);
82 return m_layerSearchPage->isComplete();
84 else if(currentPage() == m_mosaicPage.get())
86 return m_mosaicPage->isComplete();
88 else if(currentPage() == m_rasterInfoPage.get())
98 m_layerSearchPage->getSearchWidget()->setList(layerList);
99 m_layerSearchPage->getSearchWidget()->filterOnlyByRaster();
100 m_layerSearchPage->getSearchWidget()->enableMultiSelection(
true);
105 return m_outputLayerList;
114 addPage(m_layerSearchPage.get());
115 addPage(m_mosaicPage.get());
116 addPage(m_rasterInfoPage.get());
121 if(m_mosaicPage->isGeoMosaic())
122 return executeGeoMosaic();
123 else if(m_mosaicPage->isTiePointMosaic())
124 return executeTiePointMosaic();
125 else if(m_mosaicPage->isSequenceMosaic())
126 return executeSequenceMosaic();
139 std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
141 std::list<te::map::AbstractLayerPtr>::iterator it = list.begin();
142 std::vector<std::size_t> bands;
144 std::vector<const te::rst::Raster*> rasters;
146 while(it != list.end())
150 std::auto_ptr<te::da::DataSet> ds = l->getData();
154 rasters.push_back(rst);
156 std::vector<unsigned int> bands;
158 for(
unsigned int i = 0; i < rst->getNumberOfBands(); ++i)
171 algoOutputParams.
m_rInfo = m_rasterInfoPage->getWidget()->getInfo();
172 algoOutputParams.
m_rType = m_rasterInfoPage->getWidget()->getType();
178 QApplication::setOverrideCursor(Qt::WaitCursor);
182 if(algorithmInstance.
initialize(algoInputParams))
184 if(algorithmInstance.
execute(algoOutputParams))
186 algoOutputParams.
reset();
190 m_rasterInfoPage->getWidget()->getInfo());
192 m_outputLayerList.push_back(outputLayer);
194 QMessageBox::information(
this, tr(
"Mosaic"), tr(
"Mosaic ended sucessfully"));
198 QMessageBox::critical(
this, tr(
"Mosaic"), tr(
"Mosaic execution error.") +
203 QApplication::restoreOverrideCursor();
212 QMessageBox::critical(
this, tr(
"Mosaic"), tr(
"Mosaic initialization error.") +
217 QApplication::restoreOverrideCursor();
224 catch(
const std::exception& e)
226 QMessageBox::warning(
this, tr(
"Mosaic"), e.what());
230 QApplication::restoreOverrideCursor();
238 QMessageBox::warning(
this, tr(
"Mosaic"), tr(
"An exception has occurred!"));
242 QApplication::restoreOverrideCursor();
251 QApplication::restoreOverrideCursor();
267 std::list<te::map::AbstractLayerPtr> list;
268 list.push_back(m_mosaicPage->getTiePointMosaicLayerA());
269 list.push_back(m_mosaicPage->getTiePointMosaicLayerB());
271 std::list<te::map::AbstractLayerPtr>::iterator it = list.begin();
272 std::vector<std::size_t> bands;
274 std::vector<const te::rst::Raster*> rasters;
276 while(it != list.end())
280 std::auto_ptr<te::da::DataSet> ds = l->getData();
284 rasters.push_back(rst);
286 std::vector<unsigned int> bands;
288 for(
unsigned int i = 0; i < rst->getNumberOfBands(); ++i)
300 algoOutputParams.
m_rInfo = m_rasterInfoPage->getWidget()->getInfo();
301 algoOutputParams.
m_rType = m_rasterInfoPage->getWidget()->getType();
307 QApplication::setOverrideCursor(Qt::WaitCursor);
311 if(algorithmInstance.
initialize(algoInputParams))
313 if(algorithmInstance.
execute(algoOutputParams))
315 algoOutputParams.
reset();
319 m_rasterInfoPage->getWidget()->getInfo());
321 m_outputLayerList.push_back(outputLayer);
323 QMessageBox::information(
this, tr(
"Mosaic"), tr(
"Mosaic ended sucessfully"));
327 QMessageBox::critical(
this, tr(
"Mosaic"), tr(
"Mosaic execution error.") +
332 QApplication::restoreOverrideCursor();
339 QMessageBox::critical(
this, tr(
"Mosaic"), tr(
"Mosaic initialization error.") +
344 QApplication::restoreOverrideCursor();
349 catch(
const std::exception& e)
351 QMessageBox::warning(
this, tr(
"Mosaic"), e.what());
355 QApplication::restoreOverrideCursor();
361 QMessageBox::warning(
this, tr(
"Mosaic"), tr(
"An exception has occurred!"));
365 QApplication::restoreOverrideCursor();
372 QApplication::restoreOverrideCursor();
385 std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
387 std::list<te::map::AbstractLayerPtr>::iterator it = list.begin();
388 std::vector<std::size_t> bands;
390 std::vector<const te::rst::Raster*> rasters;
392 while(it != list.end())
396 std::auto_ptr<te::da::DataSet> ds = l->getData();
400 rasters.push_back(rst);
402 std::vector<unsigned int> bands;
404 for(
unsigned int i = 0; i < rst->getNumberOfBands(); ++i)
418 std::auto_ptr<te::da::DataSource> ds = m_rasterInfoPage->getWidget()->getDataSource();
429 QApplication::setOverrideCursor(Qt::WaitCursor);
433 if(algorithmInstance.
initialize(algoInputParams))
435 if(algorithmInstance.
execute(algoOutputParams))
437 for(std::size_t t = 0; t < algoOutputParams.
m_sequencesInfo.size(); ++t)
440 std::string path = m_rasterInfoPage->getWidget()->getPath();
442 std::map<std::string, std::string> rinfo;
443 rinfo[
"URI"] = path + name;
447 m_outputLayerList.push_back(outputLayer);
450 algoOutputParams.
reset();
452 QMessageBox::information(
this, tr(
"Mosaic"), tr(
"Mosaic ended sucessfully"));
456 QMessageBox::critical(
this, tr(
"Mosaic"), tr(
"Mosaic execution error.") +
461 QApplication::restoreOverrideCursor();
470 QMessageBox::critical(
this, tr(
"Mosaic"), tr(
"Mosaic initialization error.") +
475 QApplication::restoreOverrideCursor();
482 catch(
const std::exception& e)
484 QMessageBox::warning(
this, tr(
"Mosaic"), e.what());
488 QApplication::restoreOverrideCursor();
496 QMessageBox::warning(
this, tr(
"Mosaic"), tr(
"An exception has occurred!"));
500 QApplication::restoreOverrideCursor();
509 QApplication::restoreOverrideCursor();
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
A Qt dialog that allows users to run a mosaic operation defined by RP module.
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.
A feeder from a input rasters vector;.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
Mosaic output parameters.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
Create a mosaic from a set of geo-referenced rasters.
std::vector< MosaicSequenceInfo > m_sequencesInfo
This file defines a class for a Raster Info Wizard page.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
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 abstract class for raster data strucutures.
This class is GUI used to define the raster info parameters for raster factory.
Create a mosaic from a set of rasters using tie-points.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
This file defines a class for a Mosaic Wizard page.
This class is GUI used to define the mosaic parameters for the RP mosaic operation.
int addViewer(AbstractProgressViewer *apv)
Attach a progress viewer.
GeoMosaic output parameters.
Mosaic output parameters.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
Create mosaics from a sequence of overlapped rasters using an automatic tie-points detection method...
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...
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
te::da::DataSource * m_outputDSPtr
The mosaic sequences info.