All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ROIManagerWidget.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2011-2012 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/qt/widgets/classification/ROIManagerWidget.cpp
22 
23  \brief This file has the ROIManagerWidget class.
24 */
25 
26 // TerraLib
27 #include "../../../classification/ROI.h"
28 #include "../../../classification/ROISet.h"
29 #include "../../../dataaccess/utils/Utils.h"
30 #include "../../../geometry/Coord2D.h"
31 #include "../../../geometry/Geometry.h"
32 #include "../../../geometry/GeometryProperty.h"
33 #include "../../../geometry/MultiPolygon.h"
34 #include "../../../geometry/Point.h"
35 #include "../../../geometry/Utils.h"
36 #include "../../../se/PolygonSymbolizer.h"
37 #include "../../../se/Fill.h"
38 #include "../../../se/Rule.h"
39 #include "../../../se/Style.h"
40 #include "../../../se/Symbolizer.h"
41 #include "../../../se/Utils.h"
42 #include "../canvas/Canvas.h"
43 #include "../canvas/MapDisplay.h"
44 #include "../rp/RasterNavigatorWidget.h"
45 #include "../utils/ColorPickerToolButton.h"
46 #include "ROIManagerWidget.h"
47 #include "ui_ROIManagerWidgetForm.h"
48 
49 // Qt
50 #include <QFileDialog>
51 #include <QGridLayout>
52 #include <QMessageBox>
53 #include <QPointF>
54 
55 //STL
56 #include <memory>
57 
58 // Boost
59 #include <boost/uuid/random_generator.hpp>
60 #include <boost/uuid/uuid_io.hpp>
61 
63 
64 #define ROI_TREE_ITEM 0
65 #define ROI_POLYGON_TREE_ITEM 1
66 
67 te::qt::widgets::ROIManagerWidget::ROIManagerWidget(QWidget* parent, Qt::WindowFlags f)
68  : QWidget(parent, f),
69  m_ui(new Ui::ROIManagerWidgetForm),
70  m_rs(0),
71  m_sampleCounter(0)
72 {
73  m_ui->setupUi(this);
74 
75  m_ui->m_openLayerROIToolButton->setIcon(QIcon::fromTheme("folder-open"));
76  m_ui->m_removeROIToolButton->setIcon(QIcon::fromTheme("list-remove"));
77  m_ui->m_exportROISetToolButton->setIcon(QIcon::fromTheme("document-export"));
78  m_ui->m_addROIToolButton->setIcon(QIcon::fromTheme("list-add"));
79  m_ui->m_vectorLayerToolButton->setIcon(QIcon::fromTheme("map-draw"));
80 
81  // Color Picker
83  m_colorPicker->setFixedSize(70, 24);
84  m_colorPicker->setColor(QColor(255, 255, 0, 128));
85 
86  //build form
87  QGridLayout* colorPickerLayout = new QGridLayout(m_ui->m_colorWidget);
88  colorPickerLayout->setContentsMargins(0, 0, 0, 0);
89  colorPickerLayout->addWidget(m_colorPicker);
90 
91  QGridLayout* layout = new QGridLayout(m_ui->m_navigatorWidget);
92  m_navigator.reset( new te::qt::widgets::RasterNavigatorWidget(m_ui->m_navigatorWidget));
93  layout->addWidget(m_navigator.get(), 0, 0);
94  layout->setContentsMargins(0,0,0,0);
95  layout->setSizeConstraint(QLayout::SetMinimumSize);
96 
97  m_navigator->setSelectionMode(true);
98  m_navigator->hidePickerTool(true);
99  m_navigator->hideInfoTool(true);
100  m_navigator->hideBoxTool(true);
101 
102  //connects
103  connect(m_ui->m_openLayerROIToolButton, SIGNAL(clicked()), this, SLOT(onOpenLayerROIToolButtonClicked()));
104  connect(m_ui->m_addROIToolButton, SIGNAL(clicked()), this, SLOT(onAddROIToolButtonClicked()));
105  connect(m_ui->m_removeROIToolButton, SIGNAL(clicked()), this, SLOT(onRemoveROIToolButtonClicked()));
106  connect(m_ui->m_fileDialogToolButton, SIGNAL(clicked()), this, SLOT(onFileDialogToolButtonClicked()));
107  connect(m_ui->m_exportROISetToolButton, SIGNAL(clicked()), this, SLOT(onExportROISetToolButtonClicked()));
108  connect(m_ui->m_vectorLayerToolButton, SIGNAL(clicked(bool)), this, SLOT(onVectorLayerToolButtonClicked(bool)));
109  connect(m_ui->m_roiSetTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(onROITreItemClicked(QTreeWidgetItem*, int)));
110  connect(m_navigator.get(), SIGNAL(mapDisplayExtentChanged()), this, SLOT(onMapDisplayExtentChanged()));
111  connect(m_navigator.get(), SIGNAL(geomAquired(te::gm::Polygon*)), this, SLOT(onGeomAquired(te::gm::Polygon*)));
112  connect(m_navigator.get(), SIGNAL(pointPicked(double, double)), this, SLOT(onPointPicked(double, double)));
113 }
114 
116 {
117  if(m_vectorLayer.get())
118  {
119  m_vectorLayer->setVisibility(m_vectorLayerVisibility);
120 
121  te::se::Style* s = m_vectorLayer->getStyle();
122  te::se::Rule* r = s->getRule(0);
123 
124  r->setSymbolizer(0, m_symb);
125  }
126 }
127 
128 Ui::ROIManagerWidgetForm* te::qt::widgets::ROIManagerWidget::getForm() const
129 {
130  return m_ui.get();
131 }
132 
133 void te::qt::widgets::ROIManagerWidget::setList(std::list<te::map::AbstractLayerPtr>& layerList)
134 {
135  m_ui->m_layerROIComboBox->clear();
136  m_ui->m_vectorLayerComboBox->clear();
137 
138  std::list<te::map::AbstractLayerPtr>::iterator it = layerList.begin();
139 
140  while(it != layerList.end())
141  {
143 
144  std::auto_ptr<te::da::DataSetType> dsType = l->getSchema();
145 
146  if(dsType->hasGeom())
147  {
149 
150  if(gp && gp->getGeometryType() == te::gm::MultiPolygonType)
151  m_ui->m_vectorLayerComboBox->addItem(it->get()->getTitle().c_str(), QVariant::fromValue(l));
152 
153 
154  if(dsType->getProperties().size() == 5 &&
155  dsType->getProperty(1)->getName() == TE_CL_ROI_GEOM_ID_NAME &&
156  dsType->getProperty(2)->getName() == TE_CL_ROI_LABEL_NAME &&
157  dsType->getProperty(3)->getName() == TE_CL_ROI_COLOR_NAME)
158  {
159  m_ui->m_layerROIComboBox->addItem(it->get()->getTitle().c_str(), QVariant::fromValue(l));
160  }
161  }
162 
163  ++it;
164  }
165 }
166 
168 {
169  m_layer = layer;
170 
171  m_navigator->set(layer);
172 }
173 
175 {
176  return m_rs;
177 }
178 
180 {
181  if(!m_rs)
182  return;
183 
184  te::qt::widgets::MapDisplay* mapDisplay = m_navigator->getDisplay();
185 
186  mapDisplay->getDraftPixmap()->fill(QColor(0, 0, 0, 0));
187 
188  const te::gm::Envelope& mapExt = mapDisplay->getExtent();
189 
190  te::qt::widgets::Canvas canvasInstance(mapDisplay->getDraftPixmap());
191  canvasInstance.setWindow(mapExt.m_llx, mapExt.m_lly, mapExt.m_urx, mapExt.m_ury);
192 
193  std::map<std::string, te::cl::ROI*> roiMap = m_rs->getROISet();
194  std::map<std::string, te::cl::ROI*>::iterator it = roiMap.begin();
195 
196  while(it != roiMap.end())
197  {
198  te::cl::ROI* roi = it->second;
199 
200  std::map<std::string, te::gm::Polygon*> polyMap = roi->getPolygons();
201  std::map<std::string, te::gm::Polygon*>::iterator itPoly = polyMap.begin();
202 
203  te::color::RGBAColor rgba(roi->getColor());
204 
205  canvasInstance.setPolygonContourWidth(2);
206  canvasInstance.setPolygonContourColor(rgba);
207  canvasInstance.setPolygonFillColor(te::color::RGBAColor(rgba.getRed(), rgba.getGreen(), rgba.getBlue(), 80));
208 
209  while(itPoly != polyMap.end())
210  {
211  te::gm::Polygon* poly = itPoly->second;
212 
213  canvasInstance.draw(poly);
214 
215  ++itPoly;
216  }
217  ++it;
218  }
219 
220  //draw selected
221  if(!m_ui->m_roiSetTreeWidget->selectedItems().isEmpty())
222  {
223  QTreeWidgetItem* item = m_ui->m_roiSetTreeWidget->selectedItems()[0];
224 
225  if(item->type() == ROI_POLYGON_TREE_ITEM)
226  {
227  std::string id = item->data(0, Qt::UserRole).toString().toStdString();
228 
229  QTreeWidgetItem* parent = item->parent();
230 
231  std::string label = parent->text(0).toStdString();
232 
233  te::cl::ROI* roi = m_rs->getROI(label);
234 
235  te::color::RGBAColor rgba(roi->getColor());
236 
237  te::gm::Polygon* p = roi->getPolygons()[id];
238 
239  canvasInstance.setPolygonContourWidth(1);
240  canvasInstance.setPolygonContourColor(rgba);
241  canvasInstance.setPolygonFillColor(rgba);
242 
243  canvasInstance.draw(p);
244  }
245  }
246 
247  mapDisplay->repaint();
248 }
249 
251 {
252  int idxLayer = m_ui->m_layerROIComboBox->currentIndex();
253  QVariant varLayer = m_ui->m_layerROIComboBox->itemData(idxLayer, Qt::UserRole);
254  te::map::AbstractLayerPtr layer = varLayer.value<te::map::AbstractLayerPtr>();
255 
256  std::auto_ptr<te::da::DataSet> ds = layer->getData();
257 
258  if(m_rs)
259  delete m_rs;
260 
261  m_ui->m_roiSetTreeWidget->clear();
262 
263  m_sampleCounter = 0;
264 
265  try
266  {
267  m_rs = te::cl::ROISet::createROISet(ds);
268  }
269  catch(...)
270  {
271  QMessageBox::warning(this, tr("Warning"), tr("Error extracting ROISet Information. Invalid layer."));
272  return;
273  }
274 
275  std::map<std::string, te::cl::ROI*> roiMap = m_rs->getROISet();
276  std::map<std::string, te::cl::ROI*>::iterator it = roiMap.begin();
277 
278  while(it != roiMap.end())
279  {
280  te::cl::ROI* roi = it->second;
281 
282  std::map<std::string, te::gm::Polygon*> polyMap = roi->getPolygons();
283  std::map<std::string, te::gm::Polygon*>::iterator itPoly = polyMap.begin();
284 
285  //update roi set tree
286  QPixmap pix(16,16);
287  pix.fill(QColor(roi->getColor().c_str()));
288  QIcon icon(pix);
289 
290  QTreeWidgetItem* item = new QTreeWidgetItem(m_ui->m_roiSetTreeWidget, ROI_TREE_ITEM);
291  item->setText(0, roi->getLabel().c_str());
292  item->setIcon(0, icon);
293 
294  m_ui->m_roiSetTreeWidget->addTopLevelItem(item);
295 
296  while(itPoly != polyMap.end())
297  {
298  te::gm::Polygon* poly = itPoly->second;
299 
300  //update tree
301  m_sampleCounter ++;
302 
303  QString sampleCounter;
304  sampleCounter.setNum(m_sampleCounter);
305  QString sampleName(tr("Sample"));
306  QString fullName;
307  fullName.append(sampleName);
308  fullName.append(" - ");
309  fullName.append(sampleCounter);
310 
311  QTreeWidgetItem* subItem = new QTreeWidgetItem(item, ROI_POLYGON_TREE_ITEM);
312  subItem->setText(0, fullName);
313  subItem->setData(0, Qt::UserRole, QVariant(itPoly->first.c_str()));
314  subItem->setIcon(0, QIcon::fromTheme("file-vector"));
315  item->addChild(subItem);
316  item->setExpanded(true);
317 
318  ++itPoly;
319  }
320  ++it;
321  }
322 
323  emit roiSetChanged(m_rs);
324 
325  drawROISet();
326 }
327 
329 {
330  if(m_ui->m_labelROILineEdit->text().isEmpty())
331  {
332  QMessageBox::warning(this, tr("Warning"), tr("ROI Label is empty."));
333  return;
334  }
335 
336  //get roi info
337  std::string label = m_ui->m_labelROILineEdit->text().toStdString();
338  std::string color = m_colorPicker->getColor().name().toStdString();
339 
340  //create roi
341  te::cl::ROI* roi = new te::cl::ROI(label);
342  roi->setColor(color);
343 
344  //check if roi set exist
345  if(!m_rs)
346  {
347  m_rs = new te::cl::ROISet();
348  }
349 
350  //add roi into roi set
351  m_rs->addROI(roi);
352 
353  //update roi set tree
354  QPixmap pix(16,16);
355  pix.fill(m_colorPicker->getColor());
356  QIcon icon(pix);
357 
358  QTreeWidgetItem* item = new QTreeWidgetItem(m_ui->m_roiSetTreeWidget, ROI_TREE_ITEM);
359  item->setText(0, roi->getLabel().c_str());
360  item->setIcon(0, icon);
361 
362  m_ui->m_roiSetTreeWidget->addTopLevelItem(item);
363 
364  m_ui->m_labelROILineEdit->clear();
365 
366  emit roiSetChanged(m_rs);
367 }
368 
370 {
371  if(m_ui->m_roiSetTreeWidget->selectedItems().empty())
372  {
373  QMessageBox::warning(this, tr("Warning"), tr("Select a item first."));
374  return;
375  }
376 
377  QTreeWidgetItem* item = m_ui->m_roiSetTreeWidget->selectedItems()[0];
378 
379  if(item->type() == ROI_TREE_ITEM)
380  {
381  std::string label = item->text(0).toStdString();
382  m_rs->removeROI(label);
383 
384  delete item;
385  }
386  else if(item->type() == ROI_POLYGON_TREE_ITEM)
387  {
388  std::string id = item->data(0, Qt::UserRole).toString().toStdString();
389 
390  QTreeWidgetItem* parent = item->parent();
391 
392  std::string label = parent->text(0).toStdString();
393 
394  te::cl::ROI* roi = m_rs->getROI(label);
395 
396  roi->removePolygon(id);
397 
398  parent->removeChild(item);
399  }
400 
401  if(m_rs && m_rs->getROISet().empty())
402  {
403  m_sampleCounter = 0;
404  }
405 
406  drawROISet();
407 
408  emit roiSetChanged(m_rs);
409 }
410 
412 {
413  QString fileName = QFileDialog::getSaveFileName(this, tr("Save ROI Set to File"), "", tr("Shape Files (*.shp *.SHP)"));
414 
415  if (fileName.isEmpty())
416  return;
417 
418  QFileInfo file(fileName);
419 
420  if(file.suffix().isEmpty())
421  fileName.append(".shp");
422 
423  m_ui->m_roiSetNameLineEdit->setText(fileName);
424 }
425 
426 void te::qt::widgets::ROIManagerWidget::onROITreItemClicked(QTreeWidgetItem* item, int column)
427 {
428  drawROISet();
429 
430  if(!item || item->type() != ROI_POLYGON_TREE_ITEM)
431  return;
432 
433  te::qt::widgets::MapDisplay* mapDisplay = m_navigator->getDisplay();
434  const te::gm::Envelope& mapExt = mapDisplay->getExtent();
435 
436  te::qt::widgets::Canvas canvasInstance(mapDisplay->getDraftPixmap());
437  canvasInstance.setWindow(mapExt.m_llx, mapExt.m_lly, mapExt.m_urx, mapExt.m_ury);
438 
439  std::string id = item->data(0, Qt::UserRole).toString().toStdString();
440 
441  QTreeWidgetItem* parent = item->parent();
442 
443  std::string label = parent->text(0).toStdString();
444 
445  te::cl::ROI* roi = m_rs->getROI(label);
446 
447  te::color::RGBAColor rgba(roi->getColor());
448 
449  te::gm::Polygon* p = roi->getPolygons()[id];
450 
451  canvasInstance.setPolygonContourWidth(1);
452  canvasInstance.setPolygonContourColor(rgba);
453  canvasInstance.setPolygonFillColor(rgba);
454 
455  canvasInstance.draw(p);
456 
457  mapDisplay->repaint();
458 
459 }
460 
462 {
463  if(m_ui->m_roiSetNameLineEdit->text().isEmpty())
464  {
465  QMessageBox::warning(this, tr("Warning"), tr("File name not defined."));
466  return;
467  }
468  std::string fileName = m_ui->m_roiSetNameLineEdit->text().toStdString();
469 
470  if(m_rs->getROISet().empty())
471  {
472  QMessageBox::warning(this, tr("Warning"), tr("ROI Set is empty."));
473  return;
474  }
475  int srid = m_layer->getSRID();
476 
477  try
478  {
479  m_rs->exportToFile(fileName, srid);
480  }
481  catch(...)
482  {
483  QMessageBox::warning(this, tr("Warning"), tr("Error exporting ROI Set."));
484  return;
485  }
486 
487  QMessageBox::warning(this, tr("Warning"), tr("ROI Set exported successfully."));
488 }
489 
491 {
492  if(flag)
493  {
494  int idxLayer = m_ui->m_vectorLayerComboBox->currentIndex();
495  QVariant varLayer = m_ui->m_vectorLayerComboBox->itemData(idxLayer, Qt::UserRole);
496  te::map::AbstractLayerPtr layer = varLayer.value<te::map::AbstractLayerPtr>();
497 
498  m_vectorLayer = layer;
499  m_vectorLayerVisibility = m_layer->getVisibility();
500  m_vectorLayer->setVisibility(te::map::VISIBLE);
501 
502  te::se::Style* s = m_vectorLayer->getStyle();
503  te::se::Rule* r = s->getRule(0);
504  const te::se::Symbolizer* symb = r->getSymbolizer(0);
505 
506  m_symb = symb->clone();
507 
508  if(symb->getType() == "PolygonSymbolizer")
509  {
511 
512  te::se::Fill* fill = ps->getFill()->clone();
513  fill->setOpacity("0.2");
514 
515  ps->setFill(fill);
516 
517  r->setSymbolizer(0, ps);
518  }
519 
520  m_navigator->setVectorial(m_vectorLayer);
521  m_navigator->hidePickerTool(false);
522  }
523  else
524  {
525  m_navigator->removeVectorial();
526  m_navigator->hidePickerTool(true);
527  }
528 }
529 
531 {
532  drawROISet();
533 }
534 
536 {
537  if(m_ui->m_roiSetTreeWidget->selectedItems().empty())
538  {
539  QMessageBox::warning(this, tr("Warning"), tr("Select a ROI item first."));
540  return;
541  }
542 
543  QTreeWidgetItem* item = m_ui->m_roiSetTreeWidget->selectedItems()[0];
544 
545  if(item->type() != ROI_TREE_ITEM)
546  {
547  QMessageBox::warning(this, tr("Warning"), tr("Select a ROI item first."));
548  }
549 
550  //get roi
551  std::string label = item->text(0).toStdString();
552  te::cl::ROI* roi = m_rs->getROI(label);
553 
554  if(roi)
555  {
556  //create a polygon id
557  static boost::uuids::basic_random_generator<boost::mt19937> gen;
558  boost::uuids::uuid u = gen();
559  std::string id = boost::uuids::to_string(u);
560 
561  //add polygon into roi
562  roi->addPolygon(poly, id);
563 
564  //update tree
565  m_sampleCounter ++;
566 
567  QString sampleCounter;
568  sampleCounter.setNum(m_sampleCounter);
569  QString sampleName(tr("Sample"));
570  QString fullName;
571  fullName.append(sampleName);
572  fullName.append(" - ");
573  fullName.append(sampleCounter);
574 
575  QTreeWidgetItem* subItem = new QTreeWidgetItem(item, ROI_POLYGON_TREE_ITEM);
576  subItem->setText(0, fullName);
577  subItem->setData(0, Qt::UserRole, QVariant(id.c_str()));
578  subItem->setIcon(0, QIcon::fromTheme("file-vector"));
579  item->addChild(subItem);
580  item->setExpanded(true);
581  }
582 
583  emit roiSetChanged(m_rs);
584 
585  drawROISet();
586 }
587 
589 {
590  if(!m_ui->m_vectorLayerToolButton->isChecked())
591  return;
592 
593  te::qt::widgets::MapDisplay* mapDisplay = m_navigator->getDisplay();
594 
595  int idxLayer = m_ui->m_vectorLayerComboBox->currentIndex();
596  QVariant varLayer = m_ui->m_vectorLayerComboBox->itemData(idxLayer, Qt::UserRole);
597  te::map::AbstractLayerPtr layer = varLayer.value<te::map::AbstractLayerPtr>();
598 
599  //create envelope
600  te::gm::Envelope envelope(x, y, x, y);
601 
602  //reproject rect if needs
603  te::gm::Envelope reprojectedEnvelope(envelope);
604 
605  if((layer->getSRID() != TE_UNKNOWN_SRS) && (mapDisplay->getSRID() != TE_UNKNOWN_SRS) && (layer->getSRID() != mapDisplay->getSRID()))
606  reprojectedEnvelope.transform(mapDisplay->getSRID(), layer->getSRID());
607 
608  if(!reprojectedEnvelope.intersects(layer->getExtent()))
609  return;
610 
611  //get geometries
612  try
613  {
614  // Gets the layer schema
615  std::auto_ptr<const te::map::LayerSchema> schema(layer->getSchema());
616  if(!schema->hasGeom())
617  return;
618 
620 
621  // Gets the dataset
622  std::auto_ptr<te::da::DataSet> dataset = layer->getData(gp->getName(), &reprojectedEnvelope, te::gm::INTERSECTS);
623 
624  // Generates a geometry from the given extent. It will be used to refine the results
625  std::auto_ptr<te::gm::Geometry> geometryFromEnvelope(te::gm::GetGeomFromEnvelope(&reprojectedEnvelope, layer->getSRID()));
626 
627  // The restriction point. It will be used to refine the results
628  te::gm::Coord2D center = reprojectedEnvelope.getCenter();
629  te::gm::Point point(center.x, center.y, layer->getSRID());
630 
631  while(dataset->moveNext())
632  {
633  std::auto_ptr<te::gm::Geometry> g(dataset->getGeometry(gp->getName()));
634 
635  if(g->contains(&point) || g->crosses(geometryFromEnvelope.get()) || geometryFromEnvelope->contains(g.get()))
636  {
637  te::gm::MultiPolygon* mp = (te::gm::MultiPolygon*)dataset->getGeometry(gp->getName()).release();
639 
640  onGeomAquired(p);
641 
642  break;
643  }
644  }
645  }
646  catch(...)
647  {
648  }
649 }
650 
void onROITreItemClicked(QTreeWidgetItem *item, int column)
void onPointPicked(double x, double y)
const Fill * getFill() const
Gets the Fill associates with the PolygonSymbolizer.
#define ROI_POLYGON_TREE_ITEM
MultiPolygon is a MultiSurface whose elements are Polygons.
Definition: MultiPolygon.h:50
Geometric property.
double y
y-coordinate.
Definition: Coord2D.h:87
#define TE_CL_ROI_LABEL_NAME
This mark defines the label attribute name.
Definition: Config.h:52
bool intersects(const Envelope &rhs) const
It returns true if the envelopes "spatially intersects".
Definition: Envelope.h:493
std::auto_ptr< te::qt::widgets::RasterNavigatorWidget > m_navigator
void setList(std::list< te::map::AbstractLayerPtr > &layerList)
This method is used to set the list of layers.
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:65
This file has the ROIManagerWidget class.
A PolygonSymbolizer is used to draw a polygon (or other area-type geometries), including filling its ...
double x
x-coordinate.
Definition: Coord2D.h:86
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:80
static te::cl::ROISet * createROISet(std::auto_ptr< te::da::DataSet > ds)
Imports the ROISet from a dataset.
Definition: ROISet.cpp:126
double m_urx
Upper right corner x-coordinate.
Definition: Envelope.h:346
void addPolygon(te::gm::Polygon *p, std::string id)
Add a new region into this ROI.
Definition: ROI.cpp:67
A widget to control the display of a set of layers.
Definition: MapDisplay.h:65
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
A ROISet is a set of ROI's.
Definition: ROISet.h:53
std::auto_ptr< Ui::ROIManagerWidgetForm > m_ui
Rule * getRule(std::size_t i) const
Definition: Style.cpp:105
Coord2D getCenter() const
It returns the rectangle's center coordinate.
Definition: Envelope.cpp:49
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).
Definition: Canvas.cpp:147
double m_llx
Lower left corner x-coordinate.
Definition: Envelope.h:344
Custom tool button used to pick a color.
A point with x and y coordinate values.
Definition: Point.h:50
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
Definition: Config.h:44
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
Definition: MapDisplay.cpp:73
GeomType getGeometryType() const
It returns the geometry subtype allowed for the property.
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
Definition: MapDisplay.cpp:63
void setOpacity(const std::string &opacity)
Definition: Fill.cpp:71
void set(te::map::AbstractLayerPtr layer)
This method is used to set current layer.
A Fill specifies the pattern for filling an area geometry.
Definition: Fill.h:59
void onGeomAquired(te::gm::Polygon *poly)
void setColor(std::string color)
Set the ROI color using the hexadecimal color name.
Definition: ROI.cpp:52
A region of interest (often abbreviated ROI), is a selected subset of samples within a dataset identi...
Definition: ROI.h:60
Ui::ROIManagerWidgetForm * getForm() const
double m_lly
Lower left corner y-coordinate.
Definition: Envelope.h:345
A canvas built on top of Qt.
Definition: Canvas.h:54
Fill * clone() const
It creates a new copy of this object.
Definition: Fill.cpp:86
void removePolygon(std::string id)
Removes a region from this ROI.
Definition: ROI.cpp:72
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
Definition: Rule.h:78
virtual QPixmap * getDraftPixmap() const
It returns the map display draft pixmap.
Definition: MapDisplay.cpp:226
double m_ury
Upper right corner y-coordinate.
Definition: Envelope.h:347
This class is used to navigate over a DataSetLayer (having a raster representation) and given a set o...
#define TE_CL_ROI_GEOM_ID_NAME
This mark defines the geom id attribute name.
Definition: Config.h:45
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
std::string toString() const
It returns the data value in a WKT representation.
Definition: Geometry.h:858
const std::vector< Geometry * > & getGeometries() const
It returns a reference to the internal list of geometries.
std::string getLabel()
Get the ROI label.
Definition: ROI.cpp:47
Symbolizer * clone() const
It creates a new copy of this object.
void setFill(Fill *f)
A Fill specifies the pattern for filling an area geometry.
Q_DECLARE_METATYPE(te::map::AbstractLayerPtr)
void setSymbolizer(std::size_t i, Symbolizer *s)
Definition: Rule.cpp:144
#define TE_CL_ROI_COLOR_NAME
This mark defines the color attribute name.
Definition: Config.h:59
TEDATAACCESSEXPORT te::gm::GeometryProperty * GetFirstGeomProperty(const DataSetType *dt)
Definition: Utils.cpp:508
virtual const std::string & getType() const =0
It returns the symbolizer type.
virtual Symbolizer * clone() const =0
It creates a new copy of this object.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
void transform(int oldsrid, int newsrid)
It will transform the coordinates of the Envelope from the old SRS to the new one.
Definition: Envelope.cpp:90
#define ROI_TREE_ITEM
const Symbolizer * getSymbolizer(std::size_t i) const
Definition: Rule.cpp:163
ROIManagerWidget(QWidget *parent=0, Qt::WindowFlags f=0)
TEGEOMEXPORT Geometry * GetGeomFromEnvelope(const Envelope *const e, int srid)
It creates a Geometry (a polygon) from the given envelope.
Definition: Utils.cpp:35
ColorPickerToolButton * m_colorPicker
std::map< std::string, te::gm::Polygon * > & getPolygons()
Get all polygons belongs to this roi.
Definition: ROI.cpp:62
const std::string & getName() const
It returns the property name.
Definition: Property.h:126
std::string getColor()
Get the ROI color defined by a hexadecimal color name.
Definition: ROI.cpp:57