27 #include "../../../common/progress/ProgressManager.h"
28 #include "../../../geometry/Envelope.h"
29 #include "../../../dataaccess/dataset/DataSet.h"
30 #include "../../../dataaccess/utils/Utils.h"
31 #include "../../../raster/Raster.h"
32 #include "../../../raster/Interpolator.h"
33 #include "../help/HelpPushButton.h"
34 #include "../layer/search/LayerSearchWidget.h"
35 #include "../layer/search/LayerSearchWizardPage.h"
36 #include "../progress/ProgressViewerDialog.h"
47 #include <QMessageBox>
54 this->setWizardStyle(QWizard::ModernStyle);
55 this->setWindowTitle(tr(
"Clipping"));
58 this->setOption(QWizard::HaveHelpButton,
true);
59 this->setOption(QWizard::HelpButtonOnRight,
false);
63 this->setButton(QWizard::HelpButton, helpButton);
77 if(currentPage() == m_layerSearchPage.get())
79 std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
81 if(list.empty() ==
false)
85 m_clippingPage->set(l);
88 return m_layerSearchPage->isComplete();
90 else if(currentPage() == m_clippingPage.get())
92 bool res = m_clippingPage->isComplete();
95 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Select at least one band."));
99 else if(currentPage() == m_rasterInfoPage.get())
109 m_layerSearchPage->getSearchWidget()->setList(layerList);
110 m_layerSearchPage->getSearchWidget()->filterOnlyByRaster();
112 m_clippingPage->setList(layerList);
117 m_clippingPage->set(layer);
122 return m_outputLayer;
131 addPage(m_layerSearchPage.get());
132 addPage(m_clippingPage.get());
133 addPage(m_rasterInfoPage.get());
136 m_layerSearchPage->getSearchWidget()->enableMultiSelection(
false);
141 if(m_rasterInfoPage->getWidget()->fileExists())
143 QMessageBox::warning(
this, tr(
"Clipping"), tr(
"File already exists."));
147 if(m_clippingPage->isExtentClipping())
148 return executeExtentClipping();
149 else if(m_clippingPage->isDimensionClipping())
150 return executeDimensionClipping();
151 else if(m_clippingPage->isLayerClipping())
152 return executeLayerClipping();
161 std::auto_ptr<te::da::DataSet> ds = layer->getData();
164 std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
169 m_clippingPage->getExtentClipping(env);
173 QMessageBox::warning(
this, tr(
"Clipping"), tr(
"Selected area do not intersects the raster extent."));
177 std::map<std::string, std::string> info = m_rasterInfoPage->getWidget()->getInfo();
188 m_rasterInfoPage->getWidget()->getInfo());
197 std::auto_ptr<te::da::DataSet> ds = layer->getData();
200 std::auto_ptr<te::rst::Raster> inputRst = ds->getRaster(rpos);
203 int x, y, width, height;
205 m_clippingPage->getDimensionClipping(x, y, width, height);
207 std::map<std::string, std::string> info = m_rasterInfoPage->getWidget()->getInfo();
218 m_rasterInfoPage->getWidget()->getInfo());
Utility functions for the data access module.
bool intersects(const Envelope &rhs) const
It returns true if the envelopes "spatially intersects".
virtual Raster * resample(int method, unsigned int drow, unsigned int dcolumn, unsigned int height, unsigned int width, unsigned int newheight, unsigned int newwidth, const std::map< std::string, std::string > &rinfo) const
Resample a subset of the raster, given a box.
A Qt dialog that allows users to run a clipping operation defined by RP module.
This file defines a class for a Raster Info Wizard page.
This file defines a class for a Clipping Wizard page.
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.
virtual Raster * trim(const te::gm::Envelope *env, const std::map< std::string, std::string > &rinfo)
Subsetting operation for trimming (cropping) the raster.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
Near neighborhood interpolation method.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
This class is GUI used to define the clipping parameters for the RP constast operation.