src/terralib/qt/widgets/canvas/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 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/canvas/MapDisplay.cpp
22 
23  \brief A Qt widget to control the display of a set of layers.
24 */
25 #include "MapDisplay.h"
26 
27 // TerraLib
28 #include "../../../common/STLUtils.h"
29 #include "../../../common/StringUtils.h"
30 #include "../../../geometry/Coord2D.h"
31 #include "../../../geometry/Envelope.h"
32 #include "../../../maptools/AbstractLayer.h"
33 #include "../../../maptools/Utils.h"
34 #include "../tools/AbstractTool.h"
35 #include "../utils/ScopedCursor.h"
36 #include "Canvas.h"
37 #include "Grid.h"
38 #include "ScaleWidget.h"
39 
40 // Qt
41 #include <QMimeData>
42 #include <QPaintDevice>
43 #include <QResizeEvent>
44 #include <QString>
45 #include <QTimer>
46 #include <QGraphicsView>
47 
49  Qt::WindowFlags f)
50  : QWidget(parent, f),
51 
52  m_displayPixmap(new QPixmap(size)),
53  m_draftPixmap(new QPixmap(size)),
54  m_backgroundColor(Qt::white),
55  m_resizePolicy(te::qt::widgets::MapDisplay::Fixed),
56  m_timer(new QTimer(this)),
57  m_interval(200),
58  m_isDrawing(false),
59  m_scale(0),
60  m_overridedDpiX(-1),
61  m_overridedDpiY(-1),
62  m_minScale(0.0),
63  m_maxScale(0.0),
64  m_digitalization(0.0),
65  m_tool(nullptr),
66  m_graphicScale(nullptr),
67  m_grid(nullptr)
68 {
69  m_timer->setSingleShot(true);
70  connect(m_timer, SIGNAL(timeout()), this, SLOT(onResizeTimeout()));
71 
73  m_draftPixmap->fill(Qt::transparent);
74 
75  resize(size);
76  setAcceptDrops(true);
77 }
78 
80  : QWidget(parent, f),
81 
82  m_displayPixmap(new QPixmap(size())),
83  m_draftPixmap(new QPixmap(size())),
84  m_backgroundColor(Qt::white),
85  m_resizePolicy(te::qt::widgets::MapDisplay::Fixed),
86  m_timer(new QTimer(this)),
87  m_interval(200),
88  m_isDrawing(false),
89  m_scale(0),
90  m_overridedDpiX(-1),
91  m_overridedDpiY(-1),
92  m_minScale(0.0),
93  m_maxScale(0.0),
94  m_digitalization(0.0),
95  m_tool(nullptr),
96  m_graphicScale(nullptr),
97  m_grid(nullptr)
98 {
99  m_timer->setSingleShot(true);
100  connect(m_timer, SIGNAL(timeout()), this, SLOT(onResizeTimeout()));
101 
103  m_draftPixmap->fill(Qt::transparent);
104 
105  setAcceptDrops(true);
106 }
107 
109 {
110  if ( m_tool != nullptr )
111  delete m_tool;
112 
113  delete m_displayPixmap;
114  delete m_draftPixmap;
115 }
116 
118 {
119  // limpe todos os canvas antes usados
120  //std::map<te::map::AbstractLayer*, te::qt::widgets::Canvas*>::iterator it;
121  //for(it = m_layerCanvasMap.begin(); it != m_layerCanvasMap.end(); ++it)
122  //{
123  // te::map::Canvas* c = getCanvas(it->first);
124  // delete c;
125  //}
126  //m_layerCanvasMap.clear();
127  m_srid = nsrid;
128 
129  if(al.get() == nullptr)
130  return;
131 
132  std::list<te::map::AbstractLayerPtr> vis, visibleLayers;
133  te::map::GetVisibleLayers(al, vis);
134  // remove folders
135  std::list<te::map::AbstractLayerPtr>::iterator vit;
136  for(vit = vis.begin(); vit != vis.end(); ++vit)
137  {
138  if((*vit)->getType() == "DATASETLAYER" ||
139  (*vit)->getType() == "QUERYLAYER" ||
140  (*vit)->getType() == "RASTERLAYER")
141  {
142  visibleLayers.push_front(*vit);
143  }
144  }
145 
146  setLayerList(visibleLayers);
147 
148  if(m_srid == TE_UNKNOWN_SRS)
149  {
150  // calcule SRID e extent
151  te::gm::Envelope envelope;
152 
153  std::list<te::map::AbstractLayerPtr>::iterator lit;
154  for(lit = visibleLayers.begin(); lit != visibleLayers.end(); ++lit)
155  {
156  te::gm::Envelope env = (*lit)->getExtent();
157 
158  int srid = (*lit)->getSRID();
159  if(m_srid <= 0)
160  m_srid = srid;
161  if(srid != m_srid)
162  env.transform(srid, m_srid);
163 
164  envelope.Union(env);
165  }
166  setExtent(envelope);
167  }
168 }
169 
171 {
172  te::map::MapDisplay::setExtent(e, doRefresh);
173 
174  //std::map<te::map::AbstractLayer*, te::qt::widgets::Canvas*>::iterator it;
175  //for(it = m_layerCanvasMap.begin(); it != m_layerCanvasMap.end(); ++it)
176  //{
177  // te::qt::widgets::Canvas* canvas = it->second;
178  // canvas->calcAspectRatio(m_extent.m_llx, m_extent.m_lly, m_extent.m_urx, m_extent.m_ury, m_hAlign, m_vAlign);
179  // canvas->setWindow(m_extent.m_llx, m_extent.m_lly, m_extent.m_urx, m_extent.m_ury);
180  // canvas->clear();
181  // e = m_extent;
182  //}
183 
184 // if(doRefresh)
185  refresh();
186 
187  if (m_graphicScale != nullptr)
189 
190  emit extentChanged();
191 }
192 
194 {
195  //ScopedCursor cursor(Qt::WaitCursor);
196 
197  //m_isDrawing = true;
198 
199  //// Cleaning...
200  //m_displayPixmap->fill(m_backgroundColor);
201 
202  //QPainter painter(m_displayPixmap);
203 
204  //std::list<te::map::AbstractLayerPtr>::reverse_iterator it;
205 
206  //for(it = m_layerList.rbegin(); it != m_layerList.rend(); ++it) // for each layer
207  // draw(it->get(), painter);
208 
209  //m_isDrawing = false;
210 
211  //update();
212 }
213 
215 {
216  return static_cast<unsigned int>(width());
217 }
218 
220 {
221  return static_cast<unsigned int>(height());
222 }
223 
225 {
226  if(m_overridedDpiX > 0 && m_overridedDpiY > 0)
227  {
228  unsigned int widthPixels = getWidth();
229  double widthInches = (double) widthPixels / (double)m_overridedDpiX;
230  double widthMM = widthInches * 25.4;
231 
232  return widthMM;
233  }
234 
235  return static_cast<double>(widthMM());
236 }
237 
239 {
240  if(m_overridedDpiX> 0 && m_overridedDpiY > 0)
241  {
242  unsigned int heightPixels = getHeight();
243  double heightInches = (double) heightPixels / (double)m_overridedDpiY;
244  double heightMM = heightInches * 25.4;
245 
246  return heightMM;
247  }
248 
249  return static_cast<double>(heightMM());
250 }
251 
252 void te::qt::widgets::MapDisplay::setSRID(const int& srid, bool doRefresh)
253 {
254  te::map::MapDisplay::setSRID(srid, doRefresh);
255  emit displaySridChanged();
256 }
257 
259 {
260  return m_displayPixmap;
261 }
262 
264 {
265  return m_draftPixmap;
266 }
267 
269 {
270  m_resizePolicy = policy;
271 }
272 
274 {
275  m_interval = msec;
276 }
277 
279 {
280  // Checking the visibility...
281  if(layer->getVisibility() == te::map::NOT_VISIBLE)
282  return;
283 
284  // Recursive draw
285  for(std::size_t i = 0; i < layer->getChildrenCount(); ++i)
286  draw(boost::dynamic_pointer_cast<te::map::AbstractLayer>(layer->getChild(i)).get(), painter);
287 
288  // Retrieves a canvas to current layer
289  te::qt::widgets::Canvas* canvas = getCanvas(layer);
290 
291  double curScale = getScale();
292 
293  // Draw the current layer
294  try
295  {
296  layer->draw(canvas, m_extent, m_srid, curScale, &m_cancel);
297  }
298  catch(...)
299  {
300  return;
301  }
302 
303  // Compose the result
304  QPaintDevice* device = canvas->getDevice();
305 
306  if(device->devType() == QInternal::Pixmap)
307  painter.drawPixmap(0, 0, *static_cast<QPixmap*>(device));
308  else if(device->devType() == QInternal::Image)
309  painter.drawImage(0, 0, *static_cast<QImage*>(device));
310 }
311 
313  te::map::AbstractLayer* /*layer*/, int type)
314 {
315  // Is there a canvas associated with the given layer?
316 
317  // else, create one!
318  te::qt::widgets::Canvas* canvas = new te::qt::widgets::Canvas(m_displayPixmap->width(), m_displayPixmap->height(), type);
321  canvas->clear();
322 
323  return canvas;
324 }
325 
327 {
328  //std::map<te::map::AbstractLayer*, te::qt::widgets::Canvas*>::iterator it;
329  //for(it = m_layerCanvasMap.begin(); it != m_layerCanvasMap.end(); ++it)
330  // it->second->resize(m_displayPixmap->width(), m_displayPixmap->height());
331 }
332 
334 {
335  QPainter painter(this);
336  painter.drawPixmap(0, 0, *m_displayPixmap);
337 
338  emit displayPaintEvent(&painter);
339 
340  painter.drawPixmap(0, 0, *m_draftPixmap);
341 }
342 
344 {
345  QWidget::resizeEvent(e);
346 
347  if(m_interval == 0)
348  onResizeTimeout();
349  else
350  {
351  // Stores the old size
352  if(!m_oldSize.isValid())
353  e->oldSize().isValid() ? m_oldSize = e->oldSize() : m_oldSize = e->size();
354 
355  // Setups the timer controller
356  m_timer->start(m_interval);
357  }
358 
359  if (m_graphicScale != nullptr)
361 }
362 
363 QPointF te::qt::widgets::MapDisplay::transform(const QPointF& /*p*/)
364 {
365 // if(m_layerCanvasMap.empty())
366  return QPointF();
367 
368 // te::qt::widgets::Canvas* canvas = m_layerCanvasMap.begin()->second;
369  //if(canvas == 0)
370  // return QPointF();
371 
372  //return canvas->getMatrix().inverted().map(p);
373 }
374 
376 {
377  return m_backgroundColor;
378 }
379 
381 {
382  m_backgroundColor = color;
383 }
384 
386 {
387  return m_isDrawing;
388 }
389 
391 {
392  // Rebulding the map display pixmaps
393  delete m_displayPixmap;
394  m_displayPixmap = new QPixmap(size());
396 
397  delete m_draftPixmap;
398  m_draftPixmap = new QPixmap(size());
399  m_draftPixmap->fill(Qt::transparent);
400 
401  // Resizing all canvas
402  resizeAllCanvas();
403 
404  // Adjust the extent based on resize policy
405  adjustExtent(m_oldSize, size());
406 
407  // Invalidate old size
408  m_oldSize = QSize();
409 }
410 
411 void te::qt::widgets::MapDisplay::adjustExtent(const QSize& oldSize, const QSize& size)
412 {
413  if(!m_extent.isValid())
414  {
415  update();
416  return;
417  }
418 
420  //if(m_resizePolicy == te::qt::widgets::MapDisplay::Fixed)
421  // setExtent(e);
423  {
424  setExtent(e);
425  return;
426  }
427 
428  double widthW = e.m_urx - e.m_llx;
429  double heightW = e.m_ury - e.m_lly;
430 
431  double newWidthW = (size.width() * widthW) / oldSize.width();
432  double newHeightW = (size.height() * heightW) / oldSize.height();
433 
434  switch(m_resizePolicy)
435  {
437  {
438  e.m_urx = e.m_llx + newWidthW;
439  e.m_lly = e.m_ury - newHeightW;
440  }
441  break;
442 
444  {
445  te::gm::Coord2D center = e.getCenter();
446  e.m_llx = center.x - (newWidthW * 0.5);
447  e.m_urx = center.x + (newWidthW * 0.5);
448  e.m_lly = center.y - (newHeightW * 0.5);
449  e.m_ury = center.y + (newHeightW * 0.5);
450  }
451  break;
452 
453  default:
454  break;
455  }
456 
457  setExtent(e);
458 }
460 {
461  double wPixels = this->getWidth();
462  double hPixels = this->getHeight();
463  double wMM = this->getWidthMM();
464 
467 
468  te::gm::Envelope envelope = this->getExtent();
469 
470  double wdx = envelope.getWidth();
471 
472  double wdy = envelope.getHeight();
473 
474 
475  if (unitPtr != nullptr) {
476 
477  std::string unit = unitPtr->getName();
478 
479  if (unit == "DEGREE")
480  {
481  if (envelope.getLowerLeftX() < -180. ||
482  envelope.getLowerLeftY() < -80. ||
483  envelope.getUpperRightX() > 180. ||
484  envelope.getUpperRightY() > 80.)
485  {
486  wdx = envelope.getWidth() * 111133.;
487  wdy = envelope.getHeight() * 111133.;
488  }
489  else
490  {
491  try
492  {
493  te::gm::Envelope planarEnvelope = te::map::GetWorldBoxInPlanar(envelope, m_srid);
494 
495  wdx = planarEnvelope.getWidth();
496  wdy = planarEnvelope.getHeight();
497  }
498  catch (...)
499  {
500  wdx = envelope.getWidth() * 111133.;
501  wdy = envelope.getHeight() * 111133.;
502  }
503  }
504 
505  unit ="METRE";
506  }
507 
508  double dx = wPixels / wdx, dy = hPixels / wdy, f = (dx > dy) ? dx : dy;
509 
510  double wT = wMM;
511 
512  if (unit == "METRE")
513  wT = wMM / 1000.;
514  else if (unit == "KILOMETRE")
515  wT = wMM / 1000000.;
516  else if (unit == "FOOT")
517  wT = wMM / (12. * 25.4);
518 
519  double wp = wT / wPixels;
520  m_scale = (1. / f) / wp;
521  }
522 
523  return m_scale;
524 }
525 bool te::qt::widgets::MapDisplay::setScale(const double& scale)
526 {
527  double oldScale = this->getScale();
528 
529  double ff = scale / oldScale;
530  double xmin, ymin, xmax, ymax;
531 
532  te::gm::Envelope envelope = this->getExtent();
533  double wdx = envelope.getWidth();
534  double wdy = envelope.getHeight();
535 
536  if(ff < 1)
537  {
538  double dx = (wdx - (wdx * ff)) / 2.;
539  double dy = (wdy - (wdy * ff)) / 2.;
540  xmin = envelope.getLowerLeftX() + dx;
541  ymin = envelope.getLowerLeftY() + dy;
542  xmax = envelope.getUpperRightX() - dx;
543  ymax = envelope.getUpperRightY() - dy;
544  }
545  else
546  {
547  double dx = ((wdx * ff) - wdx) / 2.;
548  double dy = ((wdy * ff) - wdy) / 2.;
549  xmin = envelope.getLowerLeftX() - dx;
550  ymin = envelope.getLowerLeftY() - dy;
551  xmax = envelope.getUpperRightX() + dx;
552  ymax = envelope.getUpperRightY() + dy;
553  }
554  te::gm::Envelope newEnvelope(xmin, ymin, xmax, ymax);
555 
556  this->setExtent(newEnvelope, false);
557 
558  if (m_graphicScale != nullptr)
560 
561  return true;
562 }
563 
564 void te::qt::widgets::MapDisplay::getDPI(int& dpiX, int& dpiY) const
565 {
566  if(m_overridedDpiX > 0 && m_overridedDpiY > 0)
567  {
568  dpiX = m_overridedDpiX;
569  dpiY = m_overridedDpiY;
570  }
571  else
572  {
573  dpiX = this->logicalDpiX();
574  dpiY = this->logicalDpiY();
575  }
576 }
577 
579 {
580  m_overridedDpiX = dpiX;
581  m_overridedDpiY = dpiY;
582 }
583 
585 {
586  m_overridedDpiX = -1;
587  m_overridedDpiY = -1;
588 }
589 
591 {
592  if (m_tool != nullptr)
593  {
594  removeEventFilter(m_tool);
595 
596  if (delPrevious)
597  delete m_tool;
598  }
599 
600  m_tool = tool;
601 
602  if (m_tool != nullptr)
603  installEventFilter(m_tool);
604 }
605 
606 void te::qt::widgets::MapDisplay::setLimitScale(double minScale, double maxScale)
607 {
608  if ((minScale > maxScale) || (minScale < 1 || maxScale < 1))
609  {
610  m_minScale = 0.0;
611  m_maxScale = 0.0;
612  return;
613  }
614 
615  m_minScale = minScale;
616  m_maxScale = maxScale;
617 }
618 
620 {
621  m_digitalization = digitalization;
622 }
623 
625 {
626  return m_graphicScale;
627 }
628 
630 {
631  return m_grid;
632 }
633 
635 {
636  if (visible)
637  {
638  m_graphicScale = new ScaleWidget(this);
640 
642 
643  m_graphicScale->setUnit(this->getSRID());
644 
645  m_graphicScale->show();
646  }
647  else
648  {
649  m_graphicScale->close();
650 
651  delete m_graphicScale;
652  m_graphicScale = nullptr;
653  }
654 }
655 
657 {
658  if (visible)
659  {
660  m_grid = new Grid(this);
661  m_grid->show();
662  }
663  else
664  {
665  m_grid->close();
666 
667  delete m_grid;
668  m_grid = nullptr;
669  }
670 }
671 
672 
674 {
675  return m_digitalization;
676 }
virtual void setCurrentTool(te::qt::widgets::AbstractTool *tool, const bool &delPrevious=true)
Updates the current tool being used on te::qt::widgets::MapDisplay.
virtual void refresh(bool redraw=false)
It updates the contents in the map display.
A widget that shows the graphic scale associated with a display.
Definition: ScaleWidget.h:99
virtual double getDigitalization() const
Gets the digitalization factor.
A canvas built on top of Qt.
void clear()
It clears the canvas content and fills with the background color.
const TreeItemPtr & getChild(std::size_t i) const
It returns the n-th child.
unsigned int getWidth() const
It returns the MapDisplay current width in pixels.
double y
y-coordinate.
Definition: Coord2D.h:114
std::size_t getChildrenCount() const
It returns the number of children of this node.
This is the base class for layers.
Definition: AbstractLayer.h:77
te::map::AlignType m_hAlign
The display horizontal align.
static te::dt::Date dx(2010, 12, 31)
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
virtual void setBackgroundColor(const QColor &color)
Sets the map display background color.
virtual te::qt::widgets::Canvas * getCanvas(te::map::AbstractLayer *layer, int type=QInternal::Pixmap)
It retrieves an associated canvas to the given layer.
double x
x-coordinate.
Definition: Coord2D.h:113
double getWidthMM() const
It returns the MapDisplay current width in millimeters.
virtual void restoreDPI()
Returns the default value of the DPI. In this case, the values from the device will be acquired...
double getHeightMM() const
It returns the MapDisplay current height in millimeters.
Grid * m_grid
Planar grid pointer.
bool m_isDrawing
A flag that indicates if the map display is drawing.
virtual void paintEvent(QPaintEvent *e)
It assembles the final image and draws the widget.
const double & getUpperRightX() const
It returns a constant refernce to the x coordinate of the upper right corner.
void showGraphicScale(bool visible)
Shows / hides the graphic scale.
virtual void getDPI(int &dpiX, int &dpiY) const
Returns the current values of the DPI in X-axis and in Y-axis.
double m_urx
Upper right corner x-coordinate.
virtual double getScale() const
Calculates and return the current scale.
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
double getWidth() const
It returns the envelope width.
te::map::AlignType m_vAlign
The display vertical align.
virtual Visibility getVisibility() const
It returns the layer visibility.
A widget to control the display of a set of layers.
A Qt4 widget to control the display of a set of layers.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
QPixmap * m_displayPixmap
This pixmap will be the result of all canvas pixmap drawing, i. e., the result of drawing all visible...
double m_scale
Current calculated scale.
const double & getUpperRightY() const
It returns a constant refernce to the x coordinate of the upper right corner.
This class defines an interface for objects that can receive application events and respond to them...
Definition: AbstractTool.h:63
virtual void resizeAllCanvas()
It resizes all canvas of map display.
QSize m_oldSize
Stores the last size of map display on start resize event.
ScaleWidget * getGraphicScale() const
Returns the pointer for the graphic scale object;.
void Union(const Envelope &rhs)
It updates the envelop with coordinates of another envelope.
ResizePolicy m_resizePolicy
Resize policy for this map display.
double m_digitalization
Factor used in digitalization.
virtual void setExtent(te::gm::Envelope &e, bool doRefresh=true)
It sets the world visible area and refreshes the contents in the map display.
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.
MapDisplay()
It initializes a new MapDisplay.
int m_interval
Timeout interval in milliseconds to redraw.
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.
virtual QPointF transform(const QPointF &p)
Transforms the given point, in screen coordinates, to a point in world coordinates.
virtual void setResizePolicy(const ResizePolicy &policy)
Sets the resize policy to this map display.
te::qt::widgets::AbstractTool * m_tool
Pointer to the current tool being used.
QPaintDevice * getDevice() const
It returns the internal device used to draw geographical objects.
static SpatialReferenceSystemManager & getInstance()
It returns a reference to the singleton instance.
int m_overridedDpiX
Overrided value of the DPI in the X-axis, so the scale can be correctly computed. ...
An Envelope defines a 2D rectangular region.
void calcAspectRatio(double &llx, double &lly, double &urx, double &ury, const te::map::AlignType hAlign=te::map::Center, const te::map::AlignType vAlign=te::map::Center)
It calculates the best aspect ratio for world (or window) coordinates area (supposing a cartesian ref...
void setBackgroundColor(const QColor &color)
Changes the color of the background.
virtual void setSRID(const int &srid, bool doRefresh=true)
It sets a new Spatial Reference System to be used by the Map Display.
virtual int getSRID() const
It return the Spatial Reference System used by the Map Display.
virtual void setResizeInterval(int msec)
Sets the timeout interval in milliseconds to redraw on resize event.
virtual void changeData(te::map::AbstractLayerPtr, int nsrid=TE_UNKNOWN_SRS)
URI C++ Library.
Definition: Attributes.h:37
virtual void draw(te::map::AbstractLayer *layer, QPainter &painter)
It displays the given layer.
virtual const te::gm::Envelope & getExtent() const
It returns the world extent showned by the MapDisplay.
void setUnit(const int &SRID)
Sets the unit using SRID.
int m_srid
The display SRS.
te::gm::Envelope m_extent
The display extent.
ScaleWidget * m_graphicScale
Graphic scale pointer.
This class implements the grid, planar or geographic, to be used with the MapDisplay.
int m_overridedDpiY
Overrided value of the DPI in the X-axis, so the scale can be correctly computed. ...
double m_lly
Lower left corner y-coordinate.
ResizePolicy
Defines the resize policy for map display.
virtual void draw(Canvas *canvas, const te::gm::Envelope &bbox, int srid, const double &scale, bool *cancel)=0
It draws the layer geographic objects in the given canvas using the informed SRS. ...
boost::shared_ptr< UnitOfMeasure > UnitOfMeasurePtr
unsigned int getHeight() const
It returns the MapDisplay current height in pixels.
void displayPaintEvent(QPainter *)
virtual QPixmap * getDraftPixmap() const
It returns the map display draft pixmap.
double m_ury
Upper right corner y-coordinate.
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...
Contains an implementation of a grid.
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
virtual void adjustExtent(const QSize &oldSize, const QSize &size)
It adjusts the map display extent based on resize policy.
bool isDrawing() const
Returns if the map display is drawing.
void updateScalePosition()
Changes the current position of the widget, centralizing it in the display.
virtual void resizeEvent(QResizeEvent *e)
This event handler receives widget resize events wich are passed in the event parameter.
QPixmap * m_draftPixmap
The draft pixmap can be used to draw some feedback on map display.
virtual void setSRID(const int &srid, bool doRefresh=true)
It sets a new Spatial Reference System to be used by the Map Display.
virtual QColor getBackgroundColor()
Gets the map display background color.
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.
QColor m_backgroundColor
Background color.
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.
bool isValid() const
It tells if the rectangle is valid or not.
virtual bool setScale(const double &scale)
Defines the scale and calculates envelope based on the requested scale.
Contains an implementation of a graphic scale.
void updateScaleFactor()
Updates the scale values.
virtual void setDigitalization(double digitalization)
Sets the digitalization factor.
TEMAPEXPORT te::gm::Envelope GetWorldBoxInPlanar(const te::gm::Envelope &worldBox, int srid)
It gets the requested envelope on a UTM planar projection.
QTimer * m_timer
Timer to execute redraw on resize action.
virtual void setLimitScale(double minScale, double maxScale)
Defines the min scale and max scale.
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.
virtual QPixmap * getDisplayPixmap() const
It returns the map display pixmap.