27 #include "../../../dataaccess/dataset/DataSet.h"
28 #include "../../../dataaccess/utils/Utils.h"
29 #include "../../../raster/Grid.h"
30 #include "../../../raster/Raster.h"
31 #include "../../../rp/Register.h"
32 #include "../../../rp/Module.h"
33 #include "../../widgets/help/HelpPushButton.h"
49 #include <QtGui/QApplication>
50 #include <QtGui/QMessageBox>
57 this->setWizardStyle(QWizard::ModernStyle);
58 this->setWindowTitle(tr(
"Register"));
61 this->setOption(QWizard::HaveHelpButton,
true);
62 this->setOption(QWizard::HelpButtonOnRight,
false);
66 this->setButton(QWizard::HelpButton, helpButton);
80 if(currentPage() == m_layerRefPage.get())
82 std::list<te::map::AbstractLayerPtr> list = m_layerRefPage->getSearchWidget()->getSelecteds();
84 if(list.empty() ==
false)
86 m_refLayer = *list.begin();
88 m_tiePointLocatorDialog->setReferenceLayer(m_refLayer);
91 return m_layerRefPage->isComplete();
93 else if(currentPage() == m_layerAdjPage.get())
95 std::list<te::map::AbstractLayerPtr> list = m_layerAdjPage->getSearchWidget()->getSelecteds();
97 if(list.empty() ==
false)
99 m_adjLayer = *list.begin();
101 m_tiePointLocatorDialog->setAdjustLayer(m_adjLayer);
104 m_tiePointLocatorDialog->showMaximized();
106 return m_layerAdjPage->isComplete();
108 else if(currentPage() == m_rasterInfoPage.get())
110 std::vector< te::gm::GTParameters::TiePoint > tiePoints;
112 m_tiePointLocatorDialog->getWidget()->getTiePoints(tiePoints);
114 if(tiePoints.empty())
116 QMessageBox::warning(
this, tr(
"Register"), tr(
"Tie Points not aquired."));
128 m_layerRefPage->getSearchWidget()->setList(layerList);
129 m_layerAdjPage->getSearchWidget()->setList(layerList);
131 m_layerRefPage->getSearchWidget()->filterOnlyByRaster();
132 m_layerAdjPage->getSearchWidget()->filterOnlyByRaster();
137 return m_outputLayer;
147 addPage(m_layerRefPage.get());
148 addPage(m_layerAdjPage.get());
149 addPage(m_rasterInfoPage.get());
152 m_layerRefPage->setSubTitle(tr(
"Allows selection of layers using filters for selection. Select the layer to be used as REFERENCE."));
153 m_layerRefPage->getSearchWidget()->enableMultiSelection(
false);
154 m_layerAdjPage->setSubTitle(tr(
"Allows selection of layers using filters for selection. Select the layer to be used as ADJUST."));
155 m_layerAdjPage->getSearchWidget()->enableMultiSelection(
false);
160 if(m_rasterInfoPage->getWidget()->fileExists())
162 QMessageBox::warning(
this, tr(
"Register"), tr(
"File already exists."));
167 std::auto_ptr<te::da::DataSet> ds(m_adjLayer->getData());
169 std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
171 std::vector<unsigned int> vec;
172 for(
size_t t = 0; t < inputRst->getNumberOfBands(); ++t)
174 vec.push_back((
unsigned int)t);
177 std::vector< te::gm::GTParameters::TiePoint > tiePoints;
178 m_tiePointLocatorDialog->getWidget()->getTiePoints(tiePoints);
181 m_tiePointLocatorDialog->getWidget()->getOutputSRID(srid);
184 m_tiePointLocatorDialog->getWidget()->getOutputResolution(resX, resY);
197 algoOutputParams.
m_rType = m_rasterInfoPage->getWidget()->getType();
198 algoOutputParams.
m_rInfo = m_rasterInfoPage->getWidget()->getInfo();
200 QApplication::setOverrideCursor(Qt::WaitCursor);
206 if(!algorithmInstance.
initialize(algoInputParams))
208 QMessageBox::warning(
this, tr(
"Register"), tr(
"Algorithm initialization error.") +
211 QApplication::restoreOverrideCursor();
216 if(!algorithmInstance.
execute(algoOutputParams))
218 QMessageBox::warning(
this, tr(
"Register"), tr(
"Register Error.") +
221 QApplication::restoreOverrideCursor();
227 QMessageBox::warning(
this, tr(
"Register"), tr(
"Register Done!"));
229 algoOutputParams.
reset();
233 m_rasterInfoPage->getWidget()->getInfo());
236 catch(
const std::exception& e)
238 QMessageBox::warning(
this, tr(
"Register"), e.what());
240 QApplication::restoreOverrideCursor();
246 QMessageBox::warning(
this, tr(
"Register"), tr(
"An exception has occuried!"));
248 QApplication::restoreOverrideCursor();
253 QApplication::restoreOverrideCursor();
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.
This file defines a class for a Raster Info Wizard page.
This file has the RasterInfoWidget class.
te::rst::Raster const * m_inputRasterPtr
Input raster.
virtual bool validateCurrentPage()
This file has the TiePointLocatorWidget class.
Performs raster data registering into a SRS using a set of tie points.
Push button that uses te::qt::widgets::HelpManager on its mouse pressed implementation.
std::vector< te::gm::GTParameters::TiePoint > m_tiePoints
Tie-points between each raster point (te::gm::GTParameters::TiePoint::first are raster lines/columns ...
This file defines the LayerSearchWizardPage class.
This file defines the LayerSearchWidget class.
Register output parameters.
Utility functions for the data access module.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
TEQTWIDGETSEXPORT te::map::AbstractLayerPtr createLayer(const std::string &driverName, const std::map< std::string, std::string > &connInfo)
RegisterWizard(QWidget *parent)
void setPageReference(const QString &ref)
Sets the documentation page reference.
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
This class is GUI used to define the raster info parameters for raster factory.
Register input parameters.
double m_outputResolutionY
The output raster Y axis resolution (default:1).
te::map::AbstractLayerPtr getOutputLayer()
double m_outputResolutionX
The output raster X axis resolution (default:1).
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
void setList(std::list< te::map::AbstractLayerPtr > &layerList)
This file defines the RegisterWizard class.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
int m_outputSRID
The output raster SRID (default:0).
std::vector< unsigned int > m_inputRasterBands
Bands to process from the input raster.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.