src/terralib/qt/af/connectors/MapDisplay.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 TerraView - A GIS Application.
4 
5  TerraView is free software: you can redistribute it and/or modify
6  it under the terms of the GNU 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  TerraView 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 General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with TerraLib Code Editor. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@dpi.inpe.br>.
18  */
19 
20 /*!
21  \file terralib/qt/af/connectors/MapDisplay.cpp
22 
23  \brief A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
24 */
25 
26 // TerraLib
27 #include "../../../dataaccess/dataset/DataSet.h"
28 #include "../../../dataaccess/dataset/ObjectId.h"
29 #include "../../../dataaccess/dataset/ObjectIdSet.h"
30 #include "../../../dataaccess/utils/Utils.h"
31 #include "../../../geometry/Coord2D.h"
32 #include "../../../geometry/Envelope.h"
33 #include "../../../geometry/Geometry.h"
34 #include "../../../geometry/Utils.h"
35 #include "../../../maptools/CanvasConfigurer.h"
36 #include "../../../maptools/Utils.h"
37 #include "../../../se/Rule.h"
38 #include "../../../se/Style.h"
39 #include "../../../se/Symbolizer.h"
40 #include "../../../srs/Config.h"
41 #include "../../widgets/canvas/Canvas.h"
42 #include "../../widgets/canvas/EyeBirdMapDisplayWidget.h"
43 #include "../../widgets/canvas/MapDisplay.h"
44 #include "../../widgets/canvas/ZoomInMapDisplayWidget.h"
45 #include "../../widgets/layer/explorer/LayerItemView.h"
46 #include "../../widgets/tools/AbstractTool.h"
47 #include "../../widgets/tools/CoordTracking.h"
48 #include "../../widgets/tools/PanMiddleClick.h"
49 #include "../../widgets/tools/ZoomWheel.h"
50 #include "../../widgets/Utils.h"
51 #include "../events/ApplicationEvents.h"
52 #include "../events/LayerEvents.h"
53 #include "../events/MapEvents.h"
54 #include "../events/TableEvents.h"
55 //#include "../events/ProjectEvents.h"
56 #include "../events/ToolEvents.h"
57 #include "../ApplicationController.h"
58 //#include "../Project.h"
59 #include "../Utils.h"
60 #include "MapDisplay.h"
61 
62 // Qt
63 #include <QAction>
64 #include <QContextMenuEvent>
65 #include <QMessageBox>
66 
67 // STL
68 #include <cassert>
69 #include <memory>
70 #include <utility>
71 
74  : m_app(app),
75  m_display(display),
76  m_menu(nullptr),
77  m_currentExtentIndex(-1),
78  m_extentStackMaxSize(5),
79  m_coordTracking(nullptr),
80  m_zoomWheel(nullptr),
81  m_pan(nullptr),
82  m_zoomInDisplay(nullptr),
83  m_eyeBirdDisplay(nullptr),
84  m_autoPanEnabled(false)
85 {
86  // CoordTracking tool
88  connect(m_coordTracking, SIGNAL(coordTracked(QPointF&)), SLOT(onCoordTracked(QPointF&)));
89  m_display->installEventFilter(m_coordTracking);
90 
91  // Zoom Wheel tool
92  m_zoomWheel = new te::qt::widgets::ZoomWheel(m_display, 1.5, false, this);
93  m_display->installEventFilter(m_zoomWheel);
94 
95  // Pan Middle Click tool
97  m_display->installEventFilter(m_pan);
98 
99  // Signals & slots
100  connect(m_display, SIGNAL(drawLayersFinished(const QMap<QString, QString>&)), SLOT(onDrawLayersFinished(const QMap<QString, QString>&)));
101  connect(m_display, SIGNAL(extentChanged()), SLOT(onExtentChanged()));
102 
103  // Gets the popup menu
104  m_menu = m_app->findMenu("Map");
105 
106  // To show popup menu
107  m_display->installEventFilter(this);
108 
109  // Config the default SRS
111 
112  // Getting default display color
114 
115  int dpiX = -1;
116  int dpiY = -1;
117 
119 
120  m_display->setOverrideDPI(dpiX, dpiY);
121 }
122 
124 {
125  delete m_coordTracking;
126  delete m_zoomWheel;
127  delete m_pan;
128  delete m_display;
129 }
130 
132 {
133  return m_display;
134 }
135 
137 {
138  m_zoomInDisplay = display;
139 }
140 
142 {
143  m_eyeBirdDisplay = display;
144 }
145 
147 {
148  switch(e->type())
149  {
150  case QEvent::ContextMenu:
151  {
152  if (m_menu)
153  {
154  if (m_menu->objectName() == "Map")
155  m_menu->exec(static_cast<QContextMenuEvent*>(e)->globalPos());
156  }
157  }
158  break;
159 
160  default:
161  break;
162  }
163 
164  return false;
165 }
166 
167 void te::qt::af::MapDisplay::draw(const std::list<te::map::AbstractLayerPtr>& layers)
168 {
169  if(layers.empty())
170  {
171  clear();
172  return;
173  }
174 
175  std::list<te::map::AbstractLayerPtr> visibleLayers;
176  te::map::GetVisibleLayers(layers, visibleLayers);
177 
178  configSRS(visibleLayers);
179 
180  if(!m_display->getExtent().isValid())
181  {
182  te::gm::Envelope displayExtent = te::map::GetExtent(layers, m_display->getSRID(), true);
183  m_display->setExtent(displayExtent, false);
184  }
185 
186  m_display->setLayerList(layers);
187 
188  m_display->refresh();
189 
190  if(m_zoomInDisplay)
191  m_zoomInDisplay->setList(visibleLayers, m_display->getSRID());
192 
193  if(m_eyeBirdDisplay)
194  m_eyeBirdDisplay->setList(visibleLayers, m_display->getSRID());
195 
196 }
197 
199 {
200  std::list<te::map::AbstractLayerPtr> empty;
201  m_display->setLayerList(empty);
202  m_display->refresh();
203 }
204 
206 {
207  if(m_extentStack.empty())
208  return;
209 
210  if(m_currentExtentIndex < static_cast<int>(m_extentStack.size() - 1))
211  {
214  }
215 
216  emit hasNextExtent(m_currentExtentIndex < static_cast<int>(m_extentStack.size() - 1));
218 }
219 
221 {
222  if(m_extentStack.empty())
223  return;
224 
225  if(m_currentExtentIndex > 0)
226  {
229  }
230 
231  emit hasNextExtent(m_currentExtentIndex < static_cast<int>(m_extentStack.size() - 1));
233 }
234 
235 void te::qt::af::MapDisplay::fit(const std::list<te::map::AbstractLayerPtr>& layers)
236 {
237  std::list<te::map::AbstractLayerPtr> visibleLayers;
238  te::map::GetVisibleLayers(layers, visibleLayers);
239 
240  configSRS(visibleLayers);
241 
242  te::gm::Envelope displayExtent = te::map::GetExtent(layers, m_display->getSRID(), true);
243 
244  m_display->setExtent(displayExtent, false);
245 
246  m_display->setLayerList(layers);
247 
248  m_display->refresh(true);
249 
250  if(m_zoomInDisplay)
251  m_zoomInDisplay->setList(visibleLayers, m_display->getSRID());
252 
253  if(m_eyeBirdDisplay)
254  m_eyeBirdDisplay->setList(visibleLayers, m_display->getSRID());
255 }
256 
257 void te::qt::af::MapDisplay::pan(const std::list<te::map::AbstractLayerPtr>& layers)
258 {
259  if (layers.empty())
260  return;
261 
262  std::list<te::map::AbstractLayerPtr> visibleLayers;
263  te::map::GetVisibleLayers(layers, visibleLayers);
264 
265  if (visibleLayers.empty())
266  return;
267 
268  bool hasSelectedObjs = false;
269  for (auto i : visibleLayers)
270  {
271  const te::da::ObjectIdSet* idSet = i->getSelected();
272 
273  if (idSet && (i->getSelected()->size() > 0))
274  {
275  hasSelectedObjs = true;
276  break;
277  }
278  }
279 
280  if (!hasSelectedObjs)
281  return;
282 
283  configSRS(visibleLayers);
284 
285  te::gm::Envelope selectedExtent = te::map::GetSelectedExtent(visibleLayers, m_display->getSRID(), true);
286 
287  if (!selectedExtent.isValid())
288  return;
289 
290  te::gm::Coord2D centerOfSelectedExtent = selectedExtent.getCenter();
291 
292  te::gm::Envelope displayExtent = m_display->getExtent();
293 
294  double halfWidth = displayExtent.getWidth() * 0.5;
295  double halfHeight = displayExtent.getHeight() * 0.5;
296 
297  te::gm::Envelope newExtent;
298 
299  newExtent.m_llx = centerOfSelectedExtent.x - halfWidth;
300  newExtent.m_lly = centerOfSelectedExtent.y - halfHeight;
301 
302  newExtent.m_urx = centerOfSelectedExtent.x + halfWidth;
303  newExtent.m_ury = centerOfSelectedExtent.y + halfHeight;
304 
305  m_display->setExtent(newExtent);
306 }
307 
308 void te::qt::af::MapDisplay::onCoordTracked(QPointF& coordinate)
309 {
310  te::qt::af::evt::CoordinateTracked e(coordinate.x(), coordinate.y());
311  emit triggered(&e);
312 
313  if(m_zoomInDisplay)
314  m_zoomInDisplay->drawCursorPosition(static_cast<double>(coordinate.x()), static_cast<double>(coordinate.ry()));
315 }
316 
317 void te::qt::af::MapDisplay::onDrawLayersFinished(const QMap<QString, QString>& /*errors*/)
318 {
319  // Stores the clean pixmap!
321 
322  // Draw the layers selection
323  std::list<te::map::AbstractLayerPtr> ls = getSelectedLayer();
324 
325  if(!ls.empty())
327 
328  // Informs the end of drawing
329  te::qt::af::evt::DrawingFinished drawingFinished(this);
330  emit triggered(&drawingFinished);
331 }
332 
334 {
335  switch(e->m_id)
336  {
338  clear();
339  break;
340 
342  {
343  QPixmap* content = m_display->getDisplayPixmap();
344  content->fill(Qt::transparent);
345 
346  QPainter painter(content);
347  painter.drawPixmap(0, 0, m_lastDisplayContent);
348  painter.end();
349 
350  // Fred: revisar
352 
353  if(m_autoPanEnabled)
355 
356  }
357  break;
358 
360  {
362  drawDataSet(highlightEvent->m_dataset, highlightEvent->m_layer->getGeomPropertyName(), highlightEvent->m_layer->getSRID(), highlightEvent->m_style);
363  m_display->repaint();
364  }
365  break;
366 
368  {
370  m_display->updateLayer(lEvent->m_layer, lEvent->m_redraw);
371  }
372  break;
373 
375 // draw(getSelectedLayer());
376  break;
377 
379  {
381 
383 
384  if (lEvent->m_redraw)
385  m_display->refresh();
386  }
387  break;
388 
390  {
391  te::qt::af::evt::MapColorChanged* mapColorChanged = static_cast<te::qt::af::evt::MapColorChanged*>(e);
392  m_display->setBackgroundColor(mapColorChanged->m_color);
393  m_display->refresh();
394  }
395  break;
396 
398  {
400  getDisplay->m_display = this;
401  }
402  break;
403 
405  {
406  te::qt::af::evt::AutoPanEnabled* autoPanEnabled = static_cast<te::qt::af::evt::AutoPanEnabled*>(e);
407  m_autoPanEnabled = autoPanEnabled->m_isEnabled;
408  }
409  break;
410 
411  default:
412  return;
413  }
414 }
415 
417 {
418  return m_pantoSelectedAction->isChecked();
419 }
420 
421 void te::qt::af::MapDisplay::drawLayersSelection(const std::list<te::map::AbstractLayerPtr>& layers)
422 {
423  if(layers.empty())
424  return;
425 
426  std::list<te::map::AbstractLayerPtr>::const_iterator it;
427  for(it = layers.begin(); it != layers.end(); ++it)
428  drawLayerSelection(*it);
429 
430  m_display->repaint();
431 }
432 
434 {
435  assert(layer.get());
436 
437  if(layer.get() == nullptr || layer->getVisibility() != te::map::VISIBLE)
438  return;
439 
440  std::unique_ptr<te::da::DataSetType> dsType = layer->getSchema();
441 
442  if(!dsType.get() || !dsType->hasGeom())
443  return;
444 
445  const te::da::ObjectIdSet* oids = layer->getSelected();
446 
447  if(oids == nullptr || oids->size() == 0)
448  return;
449 
450  try
451  {
452  std::size_t maxOids = 4000;
453 
454  if(oids->size() > maxOids)
455  {
456  std::unique_ptr<te::da::ObjectIdSet> oidsBatch(new te::da::ObjectIdSet(*oids, false));
457 
458  // Count the all oids
459  std::size_t nOids = 0;
460 
461  // Count the processed oids
462  std::size_t nProcessedOids = 0;
463 
464  std::set<te::da::ObjectId*, te::common::LessCmp<te::da::ObjectId*> >::const_iterator it;
465  for(it = oids->begin(); it != oids->end(); ++it)
466  {
467 
468  oidsBatch->add((*it)->clone());
469 
470  ++nOids;
471  ++nProcessedOids;
472 
473  if(nProcessedOids == maxOids || nOids == oids->size())
474  {
475  // Try to retrieve the layer selection batch
476  std::unique_ptr<te::da::DataSet> selected(layer->getData(oidsBatch.get()));
477 
478  if (layer->getSelectionStyle())
479  drawDataSet(selected.get(), layer->getGeomPropertyName(), layer->getSRID(), layer->getSelectionStyle(), te::da::HasLinkedTable(layer->getSchema().get()));
480  else
481  drawDataSet(selected.get(), layer->getGeomPropertyName(), layer->getSRID(), m_app->getSelectionColor(), te::da::HasLinkedTable(layer->getSchema().get()));
482 
483  // Prepares to next batch
484  oidsBatch->clear();
485  nProcessedOids = 0;
486  }
487  }
488  }
489  else
490  {
491  std::unique_ptr<te::da::DataSet> selected(layer->getData(oids->getExpression()));
492 
493  if (layer->getSelectionStyle())
494  drawDataSet(selected.get(), layer->getGeomPropertyName(), layer->getSRID(), layer->getSelectionStyle(), te::da::HasLinkedTable(layer->getSchema().get()));
495  else
496  drawDataSet(selected.get(), layer->getGeomPropertyName(), layer->getSRID(), m_app->getSelectionColor(), te::da::HasLinkedTable(layer->getSchema().get()));
497  }
498  }
499  catch(std::exception& e)
500  {
501  QMessageBox::critical(m_display, tr("Error"), QString(tr("The layer selection cannot be drawn. Details:") + " %1.").arg(e.what()));
502  return;
503  }
504 
505  return;
506 }
507 
508 void te::qt::af::MapDisplay::drawDataSet(te::da::DataSet* dataset, const std::string& geomPropertyName, int srid, const QColor& color, bool isLinked)
509 {
510  assert(dataset);
511  assert(color.isValid());
512 
513  if(srid == TE_UNKNOWN_SRS && m_display->getSRID() != TE_UNKNOWN_SRS)
514  return;
515 
516  bool needRemap = false;
517 
518  if((srid != TE_UNKNOWN_SRS) && (m_display->getSRID() != TE_UNKNOWN_SRS) && (srid != m_display->getSRID()))
519  needRemap = true;
520 
521  std::size_t gpos = std::string::npos;
522  geomPropertyName.empty() ? gpos = te::da::GetFirstPropertyPos(dataset, te::dt::GEOMETRY_TYPE): gpos = te::da::GetPropertyPos(dataset, geomPropertyName);
523 
524  assert(gpos != std::string::npos);
525 
526  QPixmap* content = m_display->getDisplayPixmap();
527 
528  const te::gm::Envelope& displayExtent = m_display->getExtent();
529 
530  te::qt::widgets::Canvas canvas(content);
531  canvas.setWindow(displayExtent.m_llx, displayExtent.m_lly, displayExtent.m_urx, displayExtent.m_ury);
532 
534 
535  dataset->moveBeforeFirst();
536 
537  std::set<std::string> highlightedGeoms;
538 
539  while(dataset->moveNext())
540  {
541  std::unique_ptr<te::gm::Geometry> g(dataset->getGeometry(gpos));
542  if(needRemap)
543  {
544  g->setSRID(srid);
545  g->transform(m_display->getSRID());
546  }
547 
548  if(currentGeomType != g->getGeomTypeId())
549  {
550  currentGeomType = g->getGeomTypeId();
551  te::qt::widgets::Config2DrawLayerSelection(&canvas, color, currentGeomType);
552  }
553 
554  if(isLinked)
555  {
556  if(highlightedGeoms.insert(g->asText()).second)
557  {
558  canvas.draw(g.get());
559  }
560  }
561  else
562  canvas.draw(g.get());
563  }
564 }
565 
566 void te::qt::af::MapDisplay::drawDataSet(te::da::DataSet* dataset, const std::string& geomPropertyName, int srid, te::se::Style* style, bool isLinked)
567 {
568  assert(dataset);
569  assert(style);
570 
571  if (srid == TE_UNKNOWN_SRS && m_display->getSRID() != TE_UNKNOWN_SRS)
572  return;
573 
574  bool needRemap = false;
575 
576  if ((srid != TE_UNKNOWN_SRS) && (m_display->getSRID() != TE_UNKNOWN_SRS) && (srid != m_display->getSRID()))
577  needRemap = true;
578 
579  std::size_t gpos = std::string::npos;
580  geomPropertyName.empty() ? gpos = te::da::GetFirstPropertyPos(dataset, te::dt::GEOMETRY_TYPE) : gpos = te::da::GetPropertyPos(dataset, geomPropertyName);
581 
582  assert(gpos != std::string::npos);
583 
584  QPixmap* content = m_display->getDisplayPixmap();
585 
586  const te::gm::Envelope& displayExtent = m_display->getExtent();
587 
588  te::qt::widgets::Canvas canvas(content);
589  canvas.setWindow(displayExtent.m_llx, displayExtent.m_lly, displayExtent.m_urx, displayExtent.m_ury);
590 
591  //configure canvas style
592  te::map::CanvasConfigurer cc(&canvas);
593 
594 
595  if (style->getRules().empty())
596  return;
597 
598  te::se::Rule* rule = style->getRule(0);
599 
600  const std::vector<te::se::Symbolizer*>& symbolizers = rule->getSymbolizers();
601 
602  if (symbolizers.empty())
603  return;
604 
605  te::se::Symbolizer* symb = symbolizers[0];
606 
607  cc.config(symb);
608 
609 
610  dataset->moveBeforeFirst();
611 
612  std::set<std::string> highlightedGeoms;
613 
614  while (dataset->moveNext())
615  {
616  if (dataset->isNull(gpos))
617  continue;
618 
619  std::unique_ptr<te::gm::Geometry> g(dataset->getGeometry(gpos));
620  if (needRemap)
621  {
622  g->setSRID(srid);
623  g->transform(m_display->getSRID());
624  }
625 
626  if (isLinked)
627  {
628  if (highlightedGeoms.insert(g->asText()).second)
629  {
630  canvas.draw(g.get());
631  }
632  }
633  else
634  canvas.draw(g.get());
635  }
636 }
637 
639 {
641  return;
642 
643  if(m_currentExtentIndex != m_extentStackMaxSize)
644  {
645  m_extentStack.push_back(m_display->getExtent());
646  m_currentExtentIndex += 1;
647  }
648  else
649  {
650  m_extentStack.erase(m_extentStack.begin());
651  m_extentStack.push_back(m_display->getExtent());
652  m_currentExtentIndex = m_extentStackMaxSize;
653  }
654 
655  emit hasNextExtent(m_currentExtentIndex < static_cast<int>(m_extentStack.size() - 1));
656  emit hasPreviousExtent(m_currentExtentIndex > 0);
657 }
658 
659 void te::qt::af::MapDisplay::configSRS(const std::list<te::map::AbstractLayerPtr>& layers)
660 {
661  if(layers.size() == 1 && (*layers.begin())->getSRID() == TE_UNKNOWN_SRS && m_display->getSRID() != TE_UNKNOWN_SRS)
662  {
663  const te::map::AbstractLayerPtr& layer = *layers.begin();
664 
666 
667  std::pair<int, std::string> srid(layer->getSRID(), "EPSG");
668  te::qt::af::evt::MapSRIDChanged mapSRIDChanged(srid);
669  emit triggered(&mapSRIDChanged);
670  }
671  else if(m_display->getSRID() == TE_UNKNOWN_SRS)
672  {
673  std::list<te::map::AbstractLayerPtr>::const_iterator it;
674 
675  for(it = layers.begin(); it != layers.end(); ++it)
676  {
677  const te::map::AbstractLayerPtr& layer = *it;
678 
679  if(layer->getSRID() == TE_UNKNOWN_SRS)
680  continue;
681 
682  m_display->setSRID(layer->getSRID(), false);
683 
684  std::pair<int, std::string> srid(layer->getSRID(), "EPSG");
685 
686  te::qt::af::evt::MapSRIDChanged mapSRIDChanged(srid);
687  emit triggered(&mapSRIDChanged);
688 
689  break;
690  }
691  }
692 }
693 
694 std::list<te::map::AbstractLayerPtr> te::qt::af::MapDisplay::getSelectedLayer()
695 {
697  emit triggered(&evt);
698 
699  std::list<te::map::AbstractLayerPtr> lst;
700 
701  if(evt.m_layer != nullptr)
702  lst.push_back(evt.m_layer);
703 
704  return lst;
705 }
706 
707 std::list<te::map::AbstractLayerPtr> te::qt::af::MapDisplay::getVisibleLayers()
708 {
709  std::list<te::map::AbstractLayerPtr> layers;
710 
712  emit triggered(&evt);
713 
714  if(evt.m_layerExplorer == nullptr)
715  return layers;
716 
718 
719  te::qt::widgets::GetValidLayers(view->model(), QModelIndex(), layers);
720 
721  return layers;
722 }
QPixmap m_lastDisplayContent
The last map display content. i.e. a "clean" pixmap.
virtual std::unique_ptr< te::gm::Geometry > getGeometry(std::size_t i) const =0
Method for retrieving a geometric attribute value.
bool eventFilter(QObject *watched, QEvent *e)
virtual void refresh(bool redraw=false)
It updates the contents in the map display.
TEQTAFEXPORT QColor GetDefaultDisplayColorFromSettings()
This class defines the map display EyeBird, this component is only a specific map that shows the orig...
TEQTWIDGETSEXPORT void Config2DrawLayerSelection(te::map::Canvas *canvas, const QColor &selectionColor, const te::gm::GeomType &type)
It configs (i.e. prepares) the given canvas to draw a layer selection.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
This class defines the map display ZoomIn, this component is only a specific map that shows the curre...
std::list< te::map::AbstractLayerPtr > getVisibleLayers()
te::map::AbstractLayerPtr m_layer
Layer selected.
Definition: LayerEvents.h:336
double y
y-coordinate.
Definition: Coord2D.h:114
This event is used to get a single layer selected in layer tree.
Definition: LayerEvents.h:325
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:65
void drawLayersSelection(const std::list< te::map::AbstractLayerPtr > &layers)
bool isPanToSelectedEnabled()
Returns the pan selected flag;.
This class implements a concrete tool to geographic pan operation with mouse middle click...
void setZoomInDisplay(te::qt::widgets::ZoomInMapDisplayWidget *display)
te::qt::widgets::ZoomWheel * m_zoomWheel
Tool for zoom using the wheel mouse button.
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
void fit(const std::list< te::map::AbstractLayerPtr > &layers)
te::qt::widgets::EyeBirdMapDisplayWidget * m_eyeBirdDisplay
Pointer to a component that represents a eye bird display.
virtual void setBackgroundColor(const QColor &color)
Sets the map display background color.
double x
x-coordinate.
Definition: Coord2D.h:113
TEDATAACCESSEXPORT bool HasLinkedTable(te::da::DataSetType *type)
It checks if the datasettype has a linked table.
TEMAPEXPORT te::gm::Envelope GetExtent(const std::list< te::map::AbstractLayerPtr > &layers, int srid, bool onlyVisibles)
It calculates the extent of the given layers in the given SRID.
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:80
int m_extentStackMaxSize
The max size of the extent stack. Used on previousExtent and nextExtent.
A base class for application events.
te::qt::widgets::LayerItemView * m_layerExplorer
QMenu * m_menu
The map display popup menu.
std::vector< te::gm::Envelope > m_extentStack
The stack of MapDisplay extents.
This event indicates that the objects of the given layer must be highlighted.
Definition: LayerEvents.h:227
void hasNextExtent(bool value)
This event signals that the srid of the map display changed.
Definition: MapEvents.h:54
The base API for TerraLib applications.
TEDATAACCESSEXPORT std::size_t GetPropertyPos(const DataSet *dataset, const std::string &name)
double m_urx
Upper right corner x-coordinate.
void onApplicationTriggered(te::qt::af::evt::Event *e)
Listener to the application framewrork events.
double getWidth() const
It returns the envelope width.
A widget to control the display of a set of layers.
void onDrawLayersFinished(const QMap< QString, QString > &errors)
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
void draw(const te::gm::Geometry *geom)
It draws the geometry on canvas.
te::qt::widgets::ZoomInMapDisplayWidget * m_zoomInDisplay
Pointer to a component that represents a zoom in display.
This event signals that table has auto pan enabled.
Definition: TableEvents.h:74
MapDisplay(te::qt::widgets::MapDisplay *display, te::qt::af::ApplicationController *app)
Constructor.
void drawDataSet(te::da::DataSet *dataset, const std::string &geomPropertyName, int srid, const QColor &color, bool isLinked=false)
QAction * m_pantoSelectedAction
Action to enable / disable pan to selected operation.
Rule * getRule(std::size_t i) const
Definition: Style.cpp:105
TEQTWIDGETSEXPORT void GetValidLayers(QAbstractItemModel *model, const QModelIndex &parent, std::vector< te::map::AbstractLayerPtr > &layers)
const std::vector< Rule * > & getRules() const
Definition: Style.cpp:94
TEMAPEXPORT te::gm::Envelope GetSelectedExtent(const std::list< te::map::AbstractLayerPtr > layers, int srid, bool onlyVisibles)
It calculates the extent of selected objects of the given layers in the given SRID.
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection.
bool m_redraw
Flag used to indicate if has to redraw the layer.
Definition: LayerEvents.h:368
Coord2D getCenter() const
It returns the rectangle&#39;s center coordinate.
virtual void setLayerList(const std::list< te::map::AbstractLayerPtr > &layers)
It sets the layer list to be showed in the Map Display.
QMenu * findMenu(const QString &id) const
Returns the menu registered with key id.
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.
te::qt::widgets::CoordTracking * m_coordTracking
Tool for tracking mouse position.
QColor getSelectionColor() const
Returns the application selection color.
A connector of the te::qt::widgets::MapDisplay class to the Application Framework.
An Envelope defines a 2D rectangular region.
This event signals that the color of the map display changed.
Definition: MapEvents.h:75
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:55
void hasPreviousExtent(bool value)
te::qt::af::ApplicationController * m_app
Pointer to applicatin controller;.
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
std::size_t size() const
It returns the object id set size.
This event can be used to retrieve the MapDisplat component.
Definition: MapEvents.h:96
TEQTAFEXPORT void GetDPIValuesFromSettings(int &dpiX, int &dpiY)
Load setted dpi X and Y. If there is no configuration to load, it fills dpiX and dpiY with -1...
void pan(const std::list< te::map::AbstractLayerPtr > &layers)
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
A specialization of QTreeView for manipulate layers.
Definition: LayerItemView.h:78
void draw(const std::list< te::map::AbstractLayerPtr > &layers)
It draws the given layer list.
int m_currentExtentIndex
The current extent index.
This class implements a concrete tool to geographic coordinate tracking on mouse move operation...
Definition: CoordTracking.h:52
bool equals(const Envelope &rhs) const
It returns true if the envelopes are "spatially equal".
const std::vector< Symbolizer * > & getSymbolizers() const
Definition: Rule.cpp:158
double m_lly
Lower left corner y-coordinate.
Signals a mouse moved over the current display.
Definition: ToolEvents.h:78
void setList(std::list< te::map::AbstractLayerPtr > &layerList, int srid)
This method is used to set the selected layer for mixture model operation.
virtual void updateLayer(te::map::AbstractLayerPtr layer, bool redraw=true)
A dataset is the unit of information manipulated by the data access module of TerraLib.
This event is used to inform that drawing is finished.
Definition: MapEvents.h:115
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
Definition: Rule.h:76
bool m_autoPanEnabled
Define if auto pan is enabled.
double m_ury
Upper right corner y-coordinate.
std::set< ObjectId *, te::common::LessCmp< ObjectId * > >::const_iterator end() const
Returns an iterator for the object ids in container.
virtual void setOverrideDPI(int dpiX, int dpiY)
Overrides the values of the DPI that had been acquired from the device. This is done in order to make...
te::da::DataSet * m_dataset
The dataset that represents the objects that must be highlighted.
Definition: LayerEvents.h:245
virtual bool moveBeforeFirst()=0
It moves the internal pointer to a position before the first item in the collection.
This class implements a concrete tool to geographic zoom operation using the mouse wheel...
Definition: ZoomWheel.h:49
void drawLayerSelection(te::map::AbstractLayerPtr layer)
te::qt::widgets::PanMiddleClick * m_pan
Tool for pan using the middle mouse button.
te::se::Style * m_style
The color used to highlight.
Definition: LayerEvents.h:246
virtual bool isNull(std::size_t i) const =0
It checks if the attribute value is NULL.
te::map::AbstractLayer * m_layer
Layer selected.
Definition: LayerEvents.h:367
TEDATAACCESSEXPORT std::size_t GetFirstPropertyPos(const te::da::DataSet *dataset, int datatype)
void triggered(te::qt::af::evt::Event *e)
void config(const te::se::Symbolizer *symbolizer)
It configs the canvas based on given symbolizer.
te::qt::af::MapDisplay * m_display
Definition: MapEvents.h:107
void setList(std::list< te::map::AbstractLayerPtr > &layerList, int srid)
This method is used to set the selected layer for mixture model operation.
virtual void setSRID(const int &srid, bool doRefresh=true)
It sets a new Spatial Reference System to be used by the Map Display.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
std::set< ObjectId *, te::common::LessCmp< ObjectId * > >::const_iterator begin() const
Returns an iterator for the object ids in container.
bool m_redraw
This flag is used to redraw layers after a layers was removed.
Definition: LayerEvents.h:155
virtual void setExtent(te::gm::Envelope &e, bool doRefresh=true)
It sets the world visible area and refreshes the contents in the map display.
double getHeight() const
It returns the envelope height.
Expression * getExpression() const
It returns the expression that can be used to retrieve the data set that contains the all indentified...
void configSRS(const std::list< te::map::AbstractLayerPtr > &layers)
te::qt::widgets::MapDisplay * m_display
Pointer to a component te::qt::widgets::MapDisplay.
bool isValid() const
It tells if the rectangle is valid or not.
std::list< te::map::AbstractLayerPtr > getSelectedLayer()
te::map::AbstractLayerPtr m_layer
The layer whose objects must be highlighted.
Definition: LayerEvents.h:244
TEMAPEXPORT void GetVisibleLayers(const std::list< te::map::AbstractLayerPtr > &layers, std::list< te::map::AbstractLayerPtr > &visibleLayers)
It gets the visible layers of the given layer list.
int getDefaultSRID() const
Returns the most recent project.
virtual QPixmap * getDisplayPixmap() const
It returns the map display pixmap.
void setEyeBirdDisplay(te::qt::widgets::EyeBirdMapDisplayWidget *display)
A Symbology Enconding visitor that configures a given canvas based on symbolizers elements...