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 "../../../maptools/Utils.h" 32 #include "../help/HelpPushButton.h" 33 #include "../layer/search/LayerSearchWidget.h" 34 #include "../layer/search/LayerSearchWizardPage.h" 35 #include "../progress/ProgressViewerDialog.h" 38 #include "../raster/RasterInfoWidget.h" 46 #include <QMessageBox> 47 #include <QApplication> 54 this->setWizardStyle(QWizard::ModernStyle);
55 this->setWindowTitle(tr(
"Mosaic"));
58 this->setOption(QWizard::HaveHelpButton,
true);
59 this->setOption(QWizard::HelpButtonOnRight,
false);
63 this->setButton(QWizard::HelpButton, helpButton);
67 connect(
this, SIGNAL(currentIdChanged(
int)), SLOT(
onPageChanged(
int)));
78 std::list<te::map::AbstractLayerPtr> list =
m_layerSearchPage->getSearchWidget()->getSelecteds();
123 QMessageBox::warning(
this, tr(
"Mosaic"), tr(
"File already exists."));
129 QMessageBox::warning(
this, tr(
"Mosaic"), tr(
"Invalid number of layers."));
151 std::list<te::map::AbstractLayerPtr> list =
m_layerSearchPage->getSearchWidget()->getSelecteds();
153 std::list<te::map::AbstractLayerPtr>::iterator it = list.begin();
154 std::vector<std::size_t>
bands;
156 std::vector<const te::rst::Raster*>
rasters;
158 while(it != list.end())
164 rasters.push_back(rst);
166 std::vector<unsigned int>
bands;
187 QApplication::setOverrideCursor(Qt::WaitCursor);
191 if(algorithmInstance.
initialize(algoInputParams))
193 if(algorithmInstance.
execute(algoOutputParams))
195 algoOutputParams.
reset();
205 QMessageBox::information(
this, tr(
"Mosaic"), tr(
"Mosaic ended sucessfully"));
209 QMessageBox::critical(
this, tr(
"Mosaic"), tr(
"Mosaic execution error.") +
212 QApplication::restoreOverrideCursor();
221 QMessageBox::critical(
this, tr(
"Mosaic"), tr(
"Mosaic initialization error.") +
224 QApplication::restoreOverrideCursor();
231 catch(
const std::exception& e)
233 QMessageBox::warning(
this, tr(
"Mosaic"), e.what());
235 QApplication::restoreOverrideCursor();
243 QMessageBox::warning(
this, tr(
"Mosaic"), tr(
"An exception has occurred!"));
245 QApplication::restoreOverrideCursor();
252 QApplication::restoreOverrideCursor();
268 std::list<te::map::AbstractLayerPtr> list;
269 list.push_back(
m_mosaicPage->getTiePointMosaicLayerA());
270 list.push_back(
m_mosaicPage->getTiePointMosaicLayerB());
272 std::list<te::map::AbstractLayerPtr>::iterator it = list.begin();
273 std::vector<std::size_t>
bands;
275 std::vector<const te::rst::Raster*>
rasters;
277 while(it != list.end())
283 rasters.push_back(rst);
285 std::vector<unsigned int>
bands;
305 QApplication::setOverrideCursor(Qt::WaitCursor);
309 if(algorithmInstance.
initialize(algoInputParams))
311 if(algorithmInstance.
execute(algoOutputParams))
313 algoOutputParams.
reset();
323 QMessageBox::information(
this, tr(
"Mosaic"), tr(
"Mosaic ended sucessfully"));
327 QMessageBox::critical(
this, tr(
"Mosaic"), tr(
"Mosaic execution error.") +
330 QApplication::restoreOverrideCursor();
337 QMessageBox::critical(
this, tr(
"Mosaic"), tr(
"Mosaic initialization error.") +
340 QApplication::restoreOverrideCursor();
345 catch(
const std::exception& e)
347 QMessageBox::warning(
this, tr(
"Mosaic"), e.what());
349 QApplication::restoreOverrideCursor();
355 QMessageBox::warning(
this, tr(
"Mosaic"), tr(
"An exception has occurred!"));
357 QApplication::restoreOverrideCursor();
362 QApplication::restoreOverrideCursor();
375 std::list<te::map::AbstractLayerPtr> list =
m_layerSearchPage->getSearchWidget()->getSelecteds();
377 std::list<te::map::AbstractLayerPtr>::iterator it = list.begin();
378 std::vector<std::size_t>
bands;
380 std::vector<const te::rst::Raster*>
rasters;
382 while(it != list.end())
388 rasters.push_back(rst);
390 std::vector<unsigned int>
bands;
406 std::unique_ptr<te::da::DataSource>
ds =
m_rasterInfoPage->getWidget()->getDataSource();
416 QApplication::setOverrideCursor(Qt::WaitCursor);
420 if(algorithmInstance.
initialize(algoInputParams))
422 if(algorithmInstance.
execute(algoOutputParams))
424 for(std::size_t t = 0; t < algoOutputParams.
m_sequencesInfo.size(); ++t)
429 std::map<std::string, std::string> rinfo;
430 rinfo[
"URI"] = path + name;
439 algoOutputParams.
reset();
441 QMessageBox::information(
this, tr(
"Mosaic"), tr(
"Mosaic ended sucessfully"));
445 QMessageBox::critical(
this, tr(
"Mosaic"), tr(
"Mosaic execution error.") +
448 QApplication::restoreOverrideCursor();
457 QMessageBox::critical(
this, tr(
"Mosaic"), tr(
"Mosaic initialization error.") +
460 QApplication::restoreOverrideCursor();
467 catch(
const std::exception& e)
469 QMessageBox::warning(
this, tr(
"Mosaic"), e.what());
471 QApplication::restoreOverrideCursor();
479 QMessageBox::warning(
this, tr(
"Mosaic"), tr(
"An exception has occurred!"));
481 QApplication::restoreOverrideCursor();
488 QApplication::restoreOverrideCursor();
const std::string & getErrorMessage() const
Return the current error message if there is any.
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).
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.
Create a mosaic from a set of geo-referenced rasters.
static te::dt::Date ds(2010, 01, 01)
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 ).
bool execute(AlgorithmOutputParameters &outputParams) _NOEXCEPT_OP(false)
Executes the algorithm using the supplied parameters.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
An abstract class for raster data strucutures.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
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 ).
Utility functions for the data access module.
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.
TEMAPEXPORT te::rst::Raster * GetRaster(AbstractLayer *layer)
It gets the raster referenced by the given data set layer.
bool initialize(const AlgorithmInputParameters &inputParams) _NOEXCEPT_OP(false)
Initialize the algorithm instance making it ready for execution.
GeoMosaic output parameters.
Mosaic output parameters.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
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...
void reset() _NOEXCEPT_OP(false)
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.