28 #include "../core/Utils.h"
35 #include <QtGui/QtGui>
38 #include <boost/filesystem.hpp>
43 QCursor c(Qt::CursorShape::WaitCursor);
49 QCursor c(Qt::CursorShape::ArrowCursor);
60 copyBandTypeComboBox->setEnabled(
false);
63 sridLineEdit->setValidator(
new QIntValidator());
64 llxLineEdit->setValidator(
new QDoubleValidator());
65 llyLineEdit->setValidator(
new QDoubleValidator());
66 urxLineEdit->setValidator(
new QDoubleValidator());
67 uryLineEdit->setValidator(
new QDoubleValidator());
87 std::string file = QFileDialog::getOpenFileName(
this, tr(
"Open Raster"),
"",
"").toStdString();
92 inputLineEdit->setText(file.c_str());
94 std::string errorMessage;
95 if(!m_rm->init(file, errorMessage))
97 QMessageBox::warning(
this, tr(
"Warning"), errorMessage.c_str());
101 std::ostringstream output;
102 if(!m_rm->getRasterInfo(output, errorMessage))
104 QMessageBox::warning(
this, tr(
"Warning"), errorMessage.c_str());
108 infoTextEdit->setText(output.str().c_str());
113 QMessageBox::warning(
this, tr(
"Warning"), errorMessage.c_str());
119 copyBandsListWidget->clear();
126 std::vector<std::string> extents;
127 m_rm->getSupportedExtensions(extents, errorMessage);
128 for(
size_t i = 0; i < extents.size(); i++)
129 extensionComboBox->addItem(extents[i].c_str());
134 methodComboBox->addItem(
"");
135 methodComboBox->addItem(tr(
"Nearest Neighbor"));
136 methodComboBox->addItem(tr(
"Bilinear method"));
137 methodComboBox->addItem(tr(
"Bicubic method"));
145 std::string extension = boost::filesystem3::extension(inputLineEdit->text().toStdString());
146 std::string inName = boost::filesystem3::basename(inputLineEdit->text().toStdString());
149 std::string file = QFileDialog::getSaveFileName(
this, tr(
"Save Raster"), inName.c_str(),
"").toStdString();
154 outputLineEdit->setText(file.c_str());
159 if(outputLineEdit->text().isEmpty() || inputLineEdit->text().isEmpty())
164 std::string errorMessage;
165 if(!m_rm->init(inputLineEdit->text().toStdString(), errorMessage))
168 QMessageBox::warning(
this, tr(
"Warning"), errorMessage.c_str());
172 std::vector<int> bands;
174 while(it != copyBandsListWidget->selectedItems().count())
176 bands.push_back(atoi(copyBandsListWidget->selectedItems()[it]->text().toLatin1()));
181 if(!m_rm->copyRaster(outputLineEdit->text().toStdString(), bands, int(), errorMessage))
184 QMessageBox::warning(
this, tr(
"Warning"), errorMessage.c_str());
189 QMessageBox::information(
this, tr(
"Copy Executed"), tr(
"Copy Executed Satisfactorily!"));
195 if(outputLineEdit->text().isEmpty() || inputLineEdit->text().isEmpty())
200 std::string errorMessage;
201 if(!m_rm->init(inputLineEdit->text().toStdString(), errorMessage))
204 QMessageBox::warning(
this, tr(
"Warning"), errorMessage.c_str());
208 if(!m_rm->reproject(outputLineEdit->text().toStdString(), atoi(sridLineEdit->text().toLatin1()), errorMessage))
211 QMessageBox::warning(
this, tr(
"Warning"), errorMessage.c_str());
216 QMessageBox::information(
this, tr(
"Reproject Executed"), tr(
"Reproject Executed Satisfactorily!"));
221 if(inputLineEdit->text().isEmpty())
226 std::string errorMessage;
227 if(!m_rm->init(inputLineEdit->text().toStdString(), errorMessage))
230 QMessageBox::warning(
this, tr(
"Warning"), errorMessage.c_str());
234 if(!m_rm->convert(outputLineEdit->text().toStdString(), extensionComboBox->currentText().toStdString(),
235 std::vector<int>(), errorMessage))
238 QMessageBox::warning(
this, tr(
"Warning"), errorMessage.c_str());
243 QMessageBox::information(
this, tr(
"Conversion Executed"), tr(
"Conversion Executed Satisfactorily!"));
248 if(outputLineEdit->text().isEmpty() || inputLineEdit->text().isEmpty())
253 if(methodComboBox->currentIndex() == 0)
256 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Select a Method!"));
260 std::string errorMessage;
261 if(!m_rm->init(inputLineEdit->text().toStdString(), errorMessage))
264 QMessageBox::warning(
this, tr(
"Warning"), errorMessage.c_str());
268 if(!m_rm->changeResolution(outputLineEdit->text().toStdString(), methodComboBox->currentIndex(),
269 scaleSpinBox->value(), errorMessage))
272 QMessageBox::warning(
this, tr(
"Warning"), errorMessage.c_str());
277 QMessageBox::information(
this, tr(
"Change Resolution Executed"), tr(
"Resolution Changed Satisfactorily!"));
283 if(outputLineEdit->text().isEmpty() || inputLineEdit->text().isEmpty())
288 if(llxLineEdit->text().isEmpty() || llyLineEdit->text().isEmpty()
289 || urxLineEdit->text().isEmpty() || uryLineEdit->text().isEmpty())
292 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Complete the required parameters!"));
296 std::string errorMessage;
297 if(!m_rm->init(inputLineEdit->text().toStdString(), errorMessage))
300 QMessageBox::warning(
this, tr(
"Warning"), errorMessage.c_str());
304 std::vector<double> env;
305 env[0] = atof(llxLineEdit->text().toLatin1());
306 env[1] = atof(llyLineEdit->text().toLatin1());
307 env[2] = atof(urxLineEdit->text().toLatin1());
308 env[3] = atof(uryLineEdit->text().toLatin1());
310 if(!m_rm->trim(outputLineEdit->text().toStdString(), env, errorMessage))
313 QMessageBox::warning(
this, tr(
"Warning"), errorMessage.c_str());
318 QMessageBox::information(
this, tr(
"Trim Executed"), tr(
"Raster Trimmed Satisfactorily!"));
325 outputGroupBox->setEnabled(
false);
327 if(!outputGroupBox->isEnabled())
328 outputGroupBox->setEnabled(
true);
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 file contains include headers for the TerraLib Common Runtime module.
void setWaitCursor(QWidget *w)
std::string Convert2String(boost::int16_t value)
It converts a short integer value to a string.
void setReleaseCursor(QWidget *w)