ImageGenerationDialog.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9 
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14 
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19 
20 /*!
21 \file terralib/mnt/qt/ImageGenerationDialog.cpp
22 
23 \brief A dialog for Image generation
24 */
25 
26 //terralib
27 #include "../../core/filesystem/FileSystem.h"
28 #include "../../core/logger/Logger.h"
29 #include "../../core/translator/Translator.h"
30 #include "../../common/Exception.h"
31 #include "../../dataaccess/datasource/DataSourceFactory.h"
32 #include "../../dataaccess/datasource/DataSourceInfoManager.h"
33 #include "../../dataaccess/datasource/DataSourceManager.h"
34 #include "../../dataaccess/utils/Utils.h"
35 #include "../../geometry/GeometryProperty.h"
36 #include "../../maptools/DataSetLayer.h"
37 #include "../../maptools/RasterContrast.h"
38 #include "../../maptools/Utils.h"
39 #include "../../mnt/core/Shadow.h"
40 #include "../../qt/widgets/canvas/Canvas.h"
41 #include "../../qt/widgets/datasource/selector/DataSourceSelectorDialog.h"
42 #include "../../qt/widgets/progress/ProgressViewerDialog.h"
43 #include "../../qt/widgets/rp/RasterNavigatorWidget.h"
44 #include "../../qt/widgets/rp/Utils.h"
45 #include "../../qt/widgets/srs/SRSManagerDialog.h"
46 #include "../../qt/widgets/tools/ExtentAcquire.h"
47 #include "../../qt/widgets/Utils.h"
48 #include "../../qt/widgets/utils/FileDialog.h"
49 #include "../../raster.h"
50 #include "../../raster/Interpolator.h"
51 #include "../../raster/RasterFactory.h"
52 #include "../../rp/Contrast.h"
53 #include "../../se/CoverageStyle.h"
54 #include "../../se/Utils.h"
55 #include "../../srs/SpatialReferenceSystemManager.h"
56 
57 #include "../core/CalculateGrid.h"
58 #include "../core/SplineGrass.h"
59 #include "../core/SplineGrassMitasova.h"
60 #include "../core/TINCalculateGrid.h"
61 #include "../core/Utils.h"
62 
63 #include "LayerSearchDialog.h"
64 #include "ImageGenerationDialog.h"
65 #include "ui_ImageGenerateDialogForm.h"
66 
67 // Qt
68 #include <QFileDialog>
69 #include <QMessageBox>
70 
71 // BOOST
72 #include <boost/algorithm/string.hpp>
73 #include <boost/filesystem.hpp>
74 #include <boost/lexical_cast.hpp>
75 #include <boost/uuid/random_generator.hpp>
76 #include <boost/uuid/uuid_io.hpp>
77 
78 
80  : QDialog(parent, f),
81  m_ui(new Ui::ImageGenerationDialogForm),
82  m_layers(std::list<te::map::AbstractLayerPtr>()),
83  m_inputLayer(nullptr),
84  m_mapDisplay(nullptr),
85  m_canvas(nullptr),
86  m_outputLayer(nullptr),
87  m_inDataSource(nullptr)
88 {
89  // add controls
90  m_ui->setupUi(this);
91 
92  //signals
93  connect(m_ui->m_layersComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onInputComboBoxChanged(int)));
94  connect(m_ui->m_layerSearchToolButton, SIGNAL(clicked()), this, SLOT(onlayerSearchToolButtonClicked()));
95 
96  connect(m_ui->m_dummycheckBox, SIGNAL(toggled(bool)), m_ui->m_dummylineEdit, SLOT(setEnabled(bool)));
97 
98  connect(m_ui->m_previewToolButton, SIGNAL(clicked()), this, SLOT(onPreviewPushButtonClicked()));
99 
100  m_ui->m_dimLLineEdit->setValidator(new QIntValidator(this));
101  m_ui->m_dimCLineEdit->setValidator(new QIntValidator(this));
102  m_ui->m_resXLineEdit->setValidator(new QDoubleValidator(this));
103  m_ui->m_resYLineEdit->setValidator(new QDoubleValidator(this));
104 
105  connect(m_ui->m_resXLineEdit, SIGNAL(editingFinished()), this, SLOT(onResXLineEditEditingFinished()));
106  connect(m_ui->m_resYLineEdit, SIGNAL(editingFinished()), this, SLOT(onResYLineEditEditingFinished()));
107 
108  m_ui->m_targetDatasourceToolButton->setIcon(QIcon::fromTheme("datasource"));
109  connect(m_ui->m_targetFileToolButton, SIGNAL(clicked()), this, SLOT(onTargetFileToolButtonPressed()));
110  connect(m_ui->m_targetDatasourceToolButton, SIGNAL(clicked()), this, SLOT(onTargetDatasourceToolButtonPressed()));
111 
112  connect(m_ui->m_OKPushButton, SIGNAL(clicked()), this, SLOT(onOkPushButtonClicked()));
113  connect(m_ui->m_CancelPushButton, SIGNAL(clicked()), this, SLOT(onCancelPushButtonClicked()));
114 
115  m_ui->m_HelpPushButton->setNameSpace("dpi.inpe.br.plugins");
116  m_ui->m_HelpPushButton->setPageReference("plugins/mnt/DTM_Shadow.html");
117 
118  m_ui->m_srsToolButton->setIcon(QIcon::fromTheme("srs"));
119  connect(m_ui->m_srsToolButton, SIGNAL(clicked()), this, SLOT(onSrsToolButtonClicked()));
120 
121  m_outsrid = 0;
122 }
123 
125 
126 void te::mnt::ImageGenerationDialog::setLayers(std::list<te::map::AbstractLayerPtr> layers)
127 {
128  m_layers = layers;
129 
130  std::list<te::map::AbstractLayerPtr>::iterator it = m_layers.begin();
131 
132  while (it != m_layers.end())
133  {
134  if (it->get())
135  {
136  if (it->get()->isValid())
137  {
138  std::unique_ptr<te::da::DataSetType> dsType(it->get()->getSchema());
139  if (dsType.get())
140  {
141  mntType type = getMNTType(dsType.get());
142 
143  if (type == GRID)
144  {
145  std::unique_ptr<te::da::DataSet> inds(it->get()->getData());
146  te::rst::RasterProperty* rasterProp = te::da::GetFirstRasterProperty(dsType.get());
147  if (rasterProp->getBandProperties().size() == 1)
148  m_ui->m_layersComboBox->addItem(QString(it->get()->getTitle().c_str()), QVariant(it->get()->getId().c_str()));
149  }
150  }
151  }
152  }
153  ++it;
154  }
155 }
156 
158 {
159  return m_outputLayer;
160 }
161 
163 {
164  m_inputLayer = nullptr;
165  std::list<te::map::AbstractLayerPtr>::iterator it = m_layers.begin();
166  std::string layerID = m_ui->m_layersComboBox->itemData(index, Qt::UserRole).toString().toUtf8().data();
167 
168  while (it != m_layers.end())
169  {
170  if(layerID == it->get()->getId())
171  {
172  m_inputLayer = it->get();
173 
174  setSRID(m_inputLayer->getSRID());
175 
176  std::unique_ptr<te::da::DataSetType> dsType (m_inputLayer->getSchema());
177  std::unique_ptr<te::da::DataSet> inds = m_inputLayer->getData();
178 
179  if (dsType->hasRaster())
180  {
181  std::size_t rpos = te::da::GetFirstPropertyPos(inds.get(), te::dt::RASTER_TYPE);
182  std::unique_ptr<te::rst::Raster> inputRst(inds->getRaster(rpos).release());
183 
184  te::mnt::getMinMax(inputRst.get(), m_min, m_max);
185  m_ui->m_dummycheckBox->setVisible(true);
186  m_ui->m_dummylineEdit->setVisible(true);
187  m_ui->m_dummylineEdit->setText(QString::number(inputRst->getBand(0)->getProperty()->m_noDataValue));
188  m_ui->m_vminRasterLineEdit->setText(QString::number(m_min));
189  m_ui->m_vmaxRasterLineEdit->setText(QString::number(m_max));
190  m_ui->m_vminLineEdit->setText(QString::number(m_min));
191  m_ui->m_vmaxLineEdit->setText(QString::number(m_max));
192  m_ui->m_resXLineEdit->setText(QString::number(inputRst->getResolutionX()));
193  m_ui->m_resYLineEdit->setText(QString::number(inputRst->getResolutionY()));
196  m_dummy = inputRst->getBand(0)->getProperty()->m_noDataValue;
197  }
198  break;
199  }
200  it++;
201  }
202 }
203 
205 {
206  LayerSearchDialog search(this->parentWidget());
207  search.setLayers(m_layers);
208 
209  if (search.exec() != QDialog::Accepted)
210  {
211  return;
212  }
213 
214  m_ui->m_layersComboBox->setCurrentIndex(search.getLayerIndex());
215 }
216 
218 {
219  double resX = m_ui->m_resXLineEdit->text().toDouble();
220 
221  te::gm::Envelope env = m_inputLayer->getExtent();
222 
223  if (!env.isValid())
224  {
225  QMessageBox::warning(this, tr("Image Generation"), tr("Invalid envelope!"));
226  return;
227  }
228 
229  int maxCols = (int)ceil((env.m_urx - env.m_llx) / resX);
230 
231  m_ui->m_dimCLineEdit->setText(QString::number(maxCols));
232 }
233 
235 {
236  double resY = m_ui->m_resYLineEdit->text().toDouble();
237 
238  te::gm::Envelope env = m_inputLayer->getExtent();
239 
240  if (!env.isValid())
241  {
242  QMessageBox::warning(this, tr("Image Generation"), tr("Invalid envelope!"));
243  return;
244  }
245 
246  int maxRows = (int)ceil((env.m_ury - env.m_lly) / resY);
247 
248  m_ui->m_dimLLineEdit->setText(QString::number(maxRows));
249 }
250 
252 {
253  m_ui->m_newLayerNameLineEdit->clear();
254  m_ui->m_repositoryLineEdit->clear();
255 
256  QString fileName = QFileDialog::getSaveFileName(this, tr("Select the output file name"),
258  te::qt::widgets::GetDiskRasterFileSelFilter(true), nullptr, nullptr).toUtf8().data();
259 
260  if (fileName.isEmpty())
261  return;
262 
263  try
264  {
265  te::core::FileSystem::remove(fileName.toUtf8().data());
266  }
267  catch (const std::exception& e)
268  {
269  QMessageBox::information(this, tr("Image Generation"), e.what());
270  return;
271  }
272 
273  boost::filesystem::path outfile(fileName.toUtf8().data());
274  std::string aux = outfile.leaf().string();
275  m_ui->m_newLayerNameLineEdit->setText(aux.c_str());
276  aux = outfile.string();
277  m_ui->m_repositoryLineEdit->setText(aux.c_str());
278 
279  m_ui->m_newLayerNameLineEdit->setEnabled(false);
280 }
281 
283 {
284  m_ui->m_newLayerNameLineEdit->clear();
285  m_ui->m_newLayerNameLineEdit->setEnabled(true);
287  dlg.exec();
288 
289  std::list<te::da::DataSourceInfoPtr> dsPtrList = dlg.getSelecteds();
290 
291  if (dsPtrList.empty())
292  return;
293 
294  std::list<te::da::DataSourceInfoPtr>::iterator it = dsPtrList.begin();
295 
296  m_ui->m_repositoryLineEdit->setText(QString(it->get()->getTitle().c_str()));
297 
298  m_outputDatasource = *it;
299 }
300 
302 {
303  try
304  {
305  QApplication::setOverrideCursor(Qt::WaitCursor);
306 
307  if (!m_inputLayer.get())
308  throw te::common::Exception(TE_TR("Select a input layer."));
309 
310  te::map::DataSetLayer* indsLayer = dynamic_cast<te::map::DataSetLayer*>(m_inputLayer.get());
311  if (!indsLayer)
312  throw te::common::Exception(TE_TR("Can not execute this operation on this type of layer."));
313 
314  te::da::DataSourcePtr inDataSource = te::da::GetDataSource(indsLayer->getDataSourceId(), true);
315  if (!inDataSource.get())
316  throw te::common::Exception(TE_TR("The selected input data source can not be accessed."));
317 
318  std::map<std::string, std::string> outdsinfo;
319  std::string inDsetName = indsLayer->getDataSetName();
320 
321  // Checking consistency of output paramenters
322  if (m_ui->m_repositoryLineEdit->text().isEmpty())
323  throw te::common::Exception(TE_TR("Select a repository for the resulting layer."));
324 
325  if (m_ui->m_newLayerNameLineEdit->text().isEmpty())
326  throw te::common::Exception(TE_TR("Define a name for the resulting layer."));
327 
328  std::string outputdataset = m_ui->m_newLayerNameLineEdit->text().toUtf8().data();
329  boost::filesystem::path uri(m_ui->m_repositoryLineEdit->text().toUtf8().data());
330 
331  if (te::core::FileSystem::exists(uri.string()))
332  throw te::common::Exception(TE_TR("Output file already exists. Remove it or select a new name and try again."));
333 
334  std::size_t idx = outputdataset.find(".");
335  if (idx != std::string::npos)
336  outputdataset = outputdataset.substr(0, idx);
337 
338  outdsinfo["URI"] = uri.string();
339 
340  bool ok;
341  if (m_ui->m_dummycheckBox->isChecked())
342  {
343  m_dummy = m_ui->m_dummylineEdit->text().toDouble(&ok);
344  if (!ok)
345  throw te::common::Exception(TE_TR("Define Dummy Value."));
346  }
347 
348  double resxo = m_ui->m_resXLineEdit->text().toDouble(&ok);
349  if (!ok)
350  throw te::common::Exception(TE_TR("Define X resolution."));
351  double resyo = m_ui->m_resYLineEdit->text().toDouble(&ok);
352  if (!ok)
353  throw te::common::Exception(TE_TR("Define Y resolution."));
354 
355  te::mnt::Shadow *somb = new te::mnt::Shadow();
356  somb->setInput(inDataSource, inDsetName, inDataSource->getDataSetType(inDsetName));
357  somb->setOutput(outdsinfo, "GDAL");
358  somb->setSRID(m_outsrid);
359 
360  somb->setParams(m_ui->m_azimuthLineEdit->text().toDouble(), m_ui->m_elevationLineEdit->text().toDouble(), m_ui->m_reliefLineEdit->text().toDouble(),
361  m_ui->m_vminRasterLineEdit->text().toDouble(), m_ui->m_vmaxRasterLineEdit->text().toDouble() - 1, m_ui->m_vminLineEdit->text().toDouble(), m_ui->m_vmaxLineEdit->text().toDouble() - 1,
362  m_dummy, m_ui->m_dimCLineEdit->text().toUInt(), m_ui->m_dimLLineEdit->text().toUInt(), resxo, resyo);
363 
364  somb->run();
365 
366  delete somb;
367 
368  m_outputLayer = te::qt::widgets::createLayer("GDAL", outdsinfo);
369  std::unique_ptr<te::rst::Raster> rst(te::map::GetRaster(m_outputLayer.get()));
370 
371  te::qt::widgets::applyRasterMultiResolution(tr("Image Generation"), rst.get());
372 
374 
375  (m_outputLayer.get())->setRasterContrast(contrast);
376  for (size_t b = 0; b < rst->getNumberOfBands(); ++b)
377  {
378  double min, max;
379  te::mnt::getMinMax(rst.get(), min, max);
380  double gain, offset1, offset2;
381  if (te::rp::Contrast::getGainAndOffset(te::rp::Contrast::InputParameters::LinearContrastT, min, max, 0., 255., gain, offset1, offset2))
382  {
383  contrast->setValues(gain, offset1, offset2, min, max, b);
384  }
385  }
386 
387  resetDraw();
388  }
389  catch (te::common::Exception& e)
390  {
391  QApplication::restoreOverrideCursor();
392  QMessageBox::information(this, "Shadow Image Generation", e.what());
393  return;
394  }
395 
396  QApplication::restoreOverrideCursor();
397  accept();
398 }
399 
401 {
402  resetDraw();
403  reject();
404 }
405 
407 {
408  m_canvas->clear();
409  m_mapDisplay->repaint();
410 
411  if (m_canvas)
412  {
413  delete m_canvas;
414  m_canvas = nullptr;
415  }
416 }
417 
419 {
420  te::qt::widgets::SRSManagerDialog srsDialog(this);
421  srsDialog.setWindowTitle(tr("Choose the SRS"));
422 
423  if (srsDialog.exec() == QDialog::Rejected)
424  return;
425 
426  int newSRID = srsDialog.getSelectedSRS().first;
427 
428  setSRID(newSRID);
429 
430 }
431 
433 {
434  if (newSRID <= 0)
435  {
436  m_ui->m_resSRIDLabel->setText("No SRS defined");
437  }
438  else
439  {
440  std::string name = te::srs::SpatialReferenceSystemManager::getInstance().getName((unsigned int)newSRID);
441  if (name.size())
442  m_ui->m_resSRIDLabel->setText(name.c_str());
443  else
444  m_ui->m_resSRIDLabel->setText(QString("%1").arg(newSRID));
445  }
446  m_outsrid = newSRID;
447 
448 }
449 
451 {
452  if (m_inputLayer)
453  {
454  std::unique_ptr<te::da::DataSet> ds = m_inputLayer->getData();
455 
456  if (ds.get())
457  {
458  std::size_t rpos = te::da::GetFirstPropertyPos(ds.get(), te::dt::RASTER_TYPE);
459  m_previewRaster = ds->getRaster(rpos);
460  }
461  }
462 }
463 
465 {
466  if (!m_previewRaster.get())
467  getRaster();
469 }
470 
471 void te::mnt::ImageGenerationDialog::drawPreview(std::unique_ptr<te::rst::Raster>& raster)
472 {
473  if (!raster.get())
474  return;
475 
476  if (raster->getNumberOfBands() > 1)
477  {
478  throw te::common::Exception(TE_TR("Layer isn't Regular Grid."));
479  }
480 
481  std::map<std::string, std::string> rinfo;
482  rinfo["MEM_RASTER_NROWS"] = boost::lexical_cast<std::string>(raster->getNumberOfRows());
483  rinfo["MEM_RASTER_NCOLS"] = boost::lexical_cast<std::string>(raster->getNumberOfColumns());
484  rinfo["MEM_RASTER_DATATYPE"] = boost::lexical_cast<std::string>(raster->getBandDataType(0));
485  rinfo["MEM_RASTER_NBANDS"] = boost::lexical_cast<std::string>(raster->getNumberOfBands());
486 
487  bool ok;
488  if (m_ui->m_dummycheckBox->isChecked())
489  {
490  m_dummy = m_ui->m_dummylineEdit->text().toDouble(&ok);
491  if (!ok)
492  throw te::common::Exception(TE_TR("Define Dummy Value."));
493  }
494 
495  double resxo = m_ui->m_resXLineEdit->text().toDouble(&ok);
496  if (!ok)
497  throw te::common::Exception(TE_TR("Define X resolution."));
498  double resyo = m_ui->m_resYLineEdit->text().toDouble(&ok);
499  if (!ok)
500  throw te::common::Exception(TE_TR("Define Y resolution."));
501 
502  te::mnt::Shadow *somb = new te::mnt::Shadow();
503  //somb->setInput(inDataSource, inDsetName, inDataSource->getDataSetType(inDsetName));
504  somb->setOutput(rinfo, "MEM");
505  somb->setSRID(m_outsrid);
506 
507  somb->setParams(m_ui->m_azimuthLineEdit->text().toDouble(), m_ui->m_elevationLineEdit->text().toDouble(), m_ui->m_reliefLineEdit->text().toDouble(),
508  m_ui->m_vminRasterLineEdit->text().toDouble(), m_ui->m_vmaxRasterLineEdit->text().toDouble() - 1, m_ui->m_vminLineEdit->text().toDouble(), m_ui->m_vmaxLineEdit->text().toDouble() - 1,
509  m_dummy, raster->getNumberOfColumns(), raster->getNumberOfRows(), resxo, resyo);
510 
511  te::rst::Raster *outrst = somb->GenerateImage(raster.get());
512 
513  const te::gm::Envelope& env = m_mapDisplay->getExtent();
514  const te::gm::Envelope* envRst = &env;
516  te::se::CoverageStyle* cs = dynamic_cast<te::se::CoverageStyle*>(style);
517  assert(cs);
518 
519  QApplication::setOverrideCursor(Qt::WaitCursor);
520 
521  try
522  {
523  // Draw raster
525  double min, max;
526  te::mnt::getMinMax(outrst, min, max);
527  double gain, offset1, offset2;
528  if (te::rp::Contrast::getGainAndOffset(te::rp::Contrast::InputParameters::LinearContrastT, min, max, 0., 255., gain, offset1, offset2))
529  {
530  contrast.setValues(gain, offset1, offset2, min, max, 0);
531  }
532  bool cancel = false;
533  te::map::DrawRaster(outrst, m_canvas, *envRst, m_mapDisplay->getSRID(), *envRst, m_outsrid, cs, &contrast, m_mapDisplay->getScale(), &cancel);
534 
535  m_mapDisplay->repaint();
536  }
537  catch (te::common::Exception&)
538  {
539 
540  }
541 
542  QApplication::restoreOverrideCursor();
543  delete somb;
544 }
545 
547 {
548  m_mapDisplay = mapDisplay;
549 
550  const te::gm::Envelope& env = m_mapDisplay->getExtent();
551 
552  QPixmap* draft = m_mapDisplay->getDraftPixmap();
553  draft->fill(Qt::transparent);
554 
555  if (m_canvas)
556  {
557  delete m_canvas;
558  m_canvas = nullptr;
559  }
560 
561  // Prepares the canvas
562  m_canvas = new te::qt::widgets::Canvas(m_mapDisplay->width(), m_mapDisplay->height());
563  m_canvas->setDevice(draft, false);
564  m_canvas->setWindow(env.m_llx, env.m_lly, env.m_urx, env.m_ury);
565 
569 
570  connect(m_mapDisplay, SIGNAL(extentChanged()), this, SLOT(onMapDisplayExtentChanged()));
571 }
572 
574 {
575  if (m_previewRaster.get())
577 }
578 
TEDATAACCESSEXPORT DataSourcePtr GetDataSource(const std::string &datasourceId, const bool opened=true)
Search for a data source with the informed id in the DataSourceManager.
TEDATAACCESSEXPORT te::rst::RasterProperty * GetFirstRasterProperty(const DataSetType *dt)
void drawPreview(std::unique_ptr< te::rst::Raster > &raster)
void clear()
It clears the canvas content and fills with the background color.
void setValues(const double &gain, const double &offset1, const double &offset2, const double &min, const double &max, const std::size_t &band)
It set the transformation values for contranst of one band.
static bool exists(const std::string &path)
Checks if a given path in UTF-8 exists.
Definition: FileSystem.cpp:142
void setDevice(QPaintDevice *device, bool takeOwnerShip)
It sets new device as QPrinter.
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:65
TEQTWIDGETSEXPORT QString GetDiskRasterFileSelFilter(const bool creationSupport)
Returns a disk raster file selection filter base on current supported formats.
boost::shared_ptr< DataSource > DataSourcePtr
virtual const char * what() const
It outputs the exception message.
The CoverageStyle defines the styling that is to be applied to a subset of Coverage data...
Definition: CoverageStyle.h:45
TESEEXPORT Style * CreateCoverageStyle(const std::vector< te::rst::BandProperty * > &properties)
Try creates an appropriate coverage style based on given band properties.
static bool getGainAndOffset(const InputParameters::ContrastType &type, const double &inRangeMin, const double &inRangeMax, const double &outRangeMin, const double &outRangeMax, double &gain, double &offset1, double &offset2)
Returns gain and offset values for contrast types (when applicable).
std::list< te::map::AbstractLayerPtr > m_layers
List of layers.
double m_urx
Upper right corner x-coordinate.
ImageGenerationDialog(QWidget *parent=0, Qt::WindowFlags f=0)
void setPolygonFillColor(const te::color::RGBAColor &color)
It sets the color used to fill the draw of polygon geometries.
virtual double getScale() const
Calculates and return the current scale.
void setInput(te::da::DataSourcePtr inDsrc, std::string inDsetName, const te::da::DataSetTypePtr &inDsetType)
Definition: Shadow.cpp:46
#define TE_OPAQUE
For an RGBA color this is the value of the alpha-channel for totally opaque.
A dialog Layer Search.
void setPolygonContourColor(const te::color::RGBAColor &color)
It sets the pen color used to draw the boundary of polygon geometries.
A widget to control the display of a set of layers.
static te::dt::Date ds(2010, 01, 01)
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:242
Raster property.
te::map::AbstractLayerPtr getLayer()
void setSRID(int srid)
Definition: Shadow.h:40
void setMapDisplay(te::qt::widgets::MapDisplay *mapDisplay)
int b
Definition: TsRtree.cpp:32
TEMAPEXPORT void DrawRaster(te::da::DataSetType *type, te::da::DataSourcePtr ds, Canvas *canvas, const te::gm::Envelope &bbox, int bboxSRID, const te::gm::Envelope &visibleArea, int srid, te::se::CoverageStyle *style, te::map::RasterContrast *rc, const double &scale, bool *cancel)
void setWindow(const double &llx, const double &lly, const double &urx, const double &ury)
It sets the world (or window) coordinates area (supposing a cartesian reference system).
double m_llx
Lower left corner x-coordinate.
static bool remove(const std::string &path)
Removes a file or directory from a given path in UTF-8.
Definition: FileSystem.cpp:166
static SpatialReferenceSystemManager & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
std::unique_ptr< Ui::ImageGenerationDialogForm > m_ui
void setLayers(std::list< te::map::AbstractLayerPtr > layers)
Set the layer that can be used.
void setLayers(std::list< te::map::AbstractLayerPtr > layers)
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.
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
te::map::AbstractLayerPtr m_outputLayer
Generated Layer.
URI C++ Library.
Definition: Attributes.h:37
void setPolygonContourWidth(int w)
It sets the polygon contour width.
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
A dialog Shadow image generation.
void setParams(double azimuth, double elevation, double relief, double dummy, double vmin, double vmax, double minval, double maxval, unsigned int outputWidth, unsigned int outputHeight, double resxo, double resyo)
Definition: Shadow.cpp:61
te::qt::widgets::Canvas * m_canvas
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
double m_lly
Lower left corner y-coordinate.
te::rst::Raster * GenerateImage(te::rst::Raster *raster)
Definition: Shadow.cpp:148
void setOutput(std::map< std::string, std::string > &dsinfo, std::string outRstDSType)
Definition: Shadow.cpp:55
This class contains the parameters needed to apply dynamic contrast over a raster.
TEMAPEXPORT te::rst::Raster * GetRaster(AbstractLayer *layer)
It gets the raster referenced by the given data set layer.
const std::string & getDataSetName() const
bool run()
Definition: Shadow.cpp:79
const std::list< te::da::DataSourceInfoPtr > & getSelecteds() const
TEQTWIDGETSEXPORT te::map::AbstractLayerPtr createLayer(const std::string &driverName, const te::core::URI &connInfo)
virtual QPixmap * getDraftPixmap() const
It returns the map display draft pixmap.
double m_ury
Upper right corner y-coordinate.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
A dialog for selecting a data source.
std::unique_ptr< te::rst::Raster > m_previewRaster
te::qt::widgets::MapDisplay * m_mapDisplay
A layer with reference to a dataset.
Definition: DataSetLayer.h:47
TEQTWIDGETSEXPORT QString GetFilePathFromSettings(const QString &typeFile)
Returns the value of the last saved file path for the typeFile required.
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
TEMNTEXPORT te::mnt::mntType getMNTType(const te::da::DataSetType *dt)
TEMNTEXPORT void getMinMax(te::rst::Raster *inputRst, double &vmin, double &vmax)
A dialog used to build a SRSManagerDialog element.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
virtual const std::string & getDataSourceId() const
const std::pair< int, std::string > & getSelectedSRS() const
Returns the selected SRS in the window.
bool isValid() const
It tells if the rectangle is valid or not.
te::da::DataSourceInfoPtr m_outputDatasource
DataSource information.
TEQTWIDGETSEXPORT void applyRasterMultiResolution(const QString &toolName, te::rst::Raster *raster)
te::map::AbstractLayerPtr m_inputLayer
Input layer.