All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
te::qt::widgets::MapDisplay Class Reference

A widget to control the display of a set of layers. More...

#include <MapDisplay.h>

Inheritance diagram for te::qt::widgets::MapDisplay:
te::map::MapDisplay te::map::AbstractMapDisplay te::qt::widgets::MultiThreadMapDisplay

Public Types

enum  ResizePolicy { Fixed, Cut, Center }
 Defines the resize policy for map display. More...
 

Signals

void displayPaintEvent (QPainter *)
 
void displaySridChanged ()
 
void extentChanged ()
 

Public Member Functions

virtual QColor getBackgroundColor ()
 Gets the map display background color. More...
 
virtual QPixmap * getDisplayPixmap () const
 It returns the map display pixmap. More...
 
virtual QPixmap * getDraftPixmap () const
 It returns the map display draft pixmap. More...
 
virtual const te::gm::EnvelopegetExtent () const
 It returns the world extent showned by the MapDisplay. More...
 
virtual te::map::AlignType getHAlign () const
 It returns the MapDisplay current horizontal align. More...
 
virtual int getSRID () const
 It return the Spatial Reference System used by the Map Display. More...
 
virtual te::map::AlignType getVAlign () const
 It returns the MapDisplay current vertical align. More...
 
bool isDrawing () const
 Returns if the map display is drawing. More...
 
virtual void setAlign (te::map::AlignType h, te::map::AlignType v)
 It will set the align rendering of objects into the map display. Just successive drawings will be affected by this modification. More...
 
virtual void setBackgroundColor (const QColor &color)
 Sets the map display background color. More...
 
virtual void setLayerList (const std::list< te::map::AbstractLayerPtr > &layers)
 It sets the layer list to be showed in the Map Display. More...
 
virtual void setResizeInterval (int msec)
 Sets the timeout interval in milliseconds to redraw on resize event. More...
 
virtual void setResizePolicy (const ResizePolicy &policy)
 Sets the resize policy to this map display. More...
 
virtual QPointF transform (const QPointF &p)
 Transforms the given point, in screen coordinates, to a point in world coordinates. More...
 
Initializer Methods

Methods related to instantiation and destruction.

 MapDisplay (const QSize &size, QWidget *parent=0, Qt::WindowFlags f=0)
 It constructs an empty map display with the given dimensions which is a child of parent, with widget flags set to f. More...
 
 MapDisplay (QWidget *parent=0, Qt::WindowFlags f=0)
 
virtual ~MapDisplay ()
 Destructor. More...
 
AbstractMapDisplay Methods
virtual void changeData (te::map::AbstractLayerPtr, int nsrid=TE_UNKNOWN_SRS)
 
virtual void setExtent (te::gm::Envelope &e, bool doRefresh=true)
 It sets the world visible area and refreshes the contents in the map display. More...
 
virtual void refresh ()
 It updates the contents in the map display. More...
 
unsigned int getWidth () const
 It returns the MapDisplay current width in pixels. More...
 
unsigned int getHeight () const
 It returns the MapDisplay current height in pixels. More...
 
double getWidthMM () const
 It returns the MapDisplay current width in millimeters. More...
 
double getHeightMM () const
 It returns the MapDisplay current height in millimeters. More...
 
virtual void setSRID (const int &srid, bool doRefresh=true)
 It sets a new Spatial Reference System to be used by the Map Display. More...
 

Protected Slots

virtual void onResizeTimeout ()
 

Protected Member Functions

virtual void adjustExtent (const QSize &oldSize, const QSize &size)
 It adjusts the map display extent based on resize policy. More...
 
virtual void draw (te::map::AbstractLayer *layer, QPainter &painter)
 It displays the given layer. More...
 
virtual te::qt::widgets::CanvasgetCanvas (te::map::AbstractLayer *layer, int type=QInternal::Pixmap)
 It retrieves an associated canvas to the given layer. More...
 
virtual void paintEvent (QPaintEvent *e)
 It assembles the final image and draws the widget. More...
 
virtual void resizeAllCanvas ()
 It resizes all canvas of map display. More...
 
virtual void resizeEvent (QResizeEvent *e)
 This event handler receives widget resize events wich are passed in the event parameter. More...
 

Protected Attributes

QColor m_backgroundColor
 Background color. More...
 
QPixmap * m_displayPixmap
 This pixmap will be the result of all canvas pixmap drawing, i. e., the result of drawing all visible layers. More...
 
QPixmap * m_draftPixmap
 The draft pixmap can be used to draw some feedback on map display. More...
 
te::gm::Envelope m_extent
 The display extent. More...
 
te::map::AlignType m_hAlign
 The display horizontal align. More...
 
int m_interval
 Timeout interval in milliseconds to redraw. More...
 
bool m_isDrawing
 A flag that indicates if the map display is drawing. More...
 
std::map
< te::map::AbstractLayer
*, te::qt::widgets::Canvas * > 
m_layerCanvasMap
 A map that associates a layer to a canvas. More...
 
std::list
< te::map::AbstractLayerPtr
m_layerList
 The layer list to be displayed. More...
 
QSize m_oldSize
 Stores the last size of map display on start resize event. More...
 
ResizePolicy m_resizePolicy
 Resize policy for this map display. More...
 
int m_srid
 The display SRS. More...
 
QTimer * m_timer
 Timer to execute redraw on resize action. More...
 
te::map::AlignType m_vAlign
 The display vertical align. More...
 

Private Member Functions

Copy Constructor and Assignment Operator

Copy constructor and assignment operator not allowed.

This signal is sent to others know that is drag enter event.

This signal is sent to others know that is drop event.

 MapDisplay (const MapDisplay &rhs)
 Copy constructor not allowed. More...
 
MapDisplayoperator= (const MapDisplay &rhs)
 Assignment operator not allowed. More...
 

Detailed Description

A widget to control the display of a set of layers.

See also
te::map::AbstractMapDisplay, te::map::MapDisplay

Definition at line 66 of file MapDisplay.h.

Member Enumeration Documentation

Defines the resize policy for map display.

Enumerator
Fixed 

Document-me!

Cut 

Document-me!

Center 

Document-me!

Definition at line 77 of file MapDisplay.h.

Constructor & Destructor Documentation

te::qt::widgets::MapDisplay::MapDisplay ( const QSize &  size,
QWidget *  parent = 0,
Qt::WindowFlags  f = 0 
)

It constructs an empty map display with the given dimensions which is a child of parent, with widget flags set to f.

Parameters
sizeThe map display size.
parentThe widget's parent.
fWidget window flags.

Definition at line 44 of file MapDisplay.cpp.

References m_backgroundColor, m_displayPixmap, m_draftPixmap, m_timer, and onResizeTimeout().

te::qt::widgets::MapDisplay::MapDisplay ( QWidget *  parent = 0,
Qt::WindowFlags  f = 0 
)
te::qt::widgets::MapDisplay::~MapDisplay ( )
virtual

Destructor.

Reimplemented from te::map::MapDisplay.

Definition at line 85 of file MapDisplay.cpp.

te::qt::widgets::MapDisplay::MapDisplay ( const MapDisplay rhs)
private

Copy constructor not allowed.

Parameters
rhsThe right-hand-side copy that would be used to copy from.

Member Function Documentation

void te::qt::widgets::MapDisplay::adjustExtent ( const QSize &  oldSize,
const QSize &  size 
)
protectedvirtual

It adjusts the map display extent based on resize policy.

Parameters
oldSizeThe size before the resize.
sizeThe size after the resize.

Definition at line 369 of file MapDisplay.cpp.

References Center, Cut, Fixed, te::gm::Envelope::getCenter(), te::gm::Envelope::m_llx, te::gm::Envelope::m_lly, te::gm::Envelope::m_urx, te::gm::Envelope::m_ury, te::gm::Coord2D::x, and te::gm::Coord2D::y.

void te::qt::widgets::MapDisplay::changeData ( te::map::AbstractLayerPtr  al,
int  nsrid = TE_UNKNOWN_SRS 
)
virtual
void te::qt::widgets::MapDisplay::displayPaintEvent ( QPainter *  )
signal

this signal is issued to others draw on this display.

void te::qt::widgets::MapDisplay::displaySridChanged ( )
signal

This signal is sent to others know that the projection was changed.

void te::qt::widgets::MapDisplay::draw ( te::map::AbstractLayer layer,
QPainter &  painter 
)
protectedvirtual

It displays the given layer.

Parameters
layerThe layer that will be drawn.
painterThe painter that will composed the draw result.
Note
This method is called recursively for each child of the given layer.
It may need to retrieve data in order top display the layers.

Definition at line 237 of file MapDisplay.cpp.

References te::map::AbstractLayer::draw(), te::common::TreeItem::getChild(), te::common::TreeItem::getChildrenCount(), te::qt::widgets::Canvas::getDevice(), te::map::AbstractLayer::getVisibility(), and te::map::NOT_VISIBLE.

void te::qt::widgets::MapDisplay::extentChanged ( )
signal

This signal is emitted when the map display extent changed.

QColor te::qt::widgets::MapDisplay::getBackgroundColor ( )
virtual

Gets the map display background color.

Returns
The map display background color.

Definition at line 333 of file MapDisplay.cpp.

te::qt::widgets::Canvas * te::qt::widgets::MapDisplay::getCanvas ( te::map::AbstractLayer layer,
int  type = QInternal::Pixmap 
)
protectedvirtual

It retrieves an associated canvas to the given layer.

Parameters
layerThe layer for wich we want to get an associated canvas.
Note
If there is not a canvas associated to the given layer, one will be created.
Returns
A canvas associated to the layer.

Definition at line 269 of file MapDisplay.cpp.

References te::qt::widgets::Canvas::calcAspectRatio().

QPixmap * te::qt::widgets::MapDisplay::getDisplayPixmap ( ) const
virtual

It returns the map display pixmap.

Returns
The map display pixmap.
Note
The caller of this method will NOT take the ownership of the returned pixmap.

Definition at line 217 of file MapDisplay.cpp.

QPixmap * te::qt::widgets::MapDisplay::getDraftPixmap ( ) const
virtual

It returns the map display draft pixmap.

Returns
The map display draft pixmap.
Note
This pixmap can be used to draw some feedback on map display.
The caller of this method will NOT take the ownership of the returned pixmap.

Definition at line 222 of file MapDisplay.cpp.

Referenced by te::qt::widgets::ClippingWizardPage::drawGeom(), te::qt::widgets::MixtureModelWizardPage::drawMarks(), te::qt::widgets::ROIManagerWidget::drawROISet(), te::qt::widgets::TiePointLocatorWidget::drawTiePoints(), te::qt::widgets::TiePointsLocatorDialog::on_mapDisplay1_extentChanged(), te::qt::widgets::TiePointsLocatorDialog::on_mapDisplay2_extentChanged(), and te::qt::widgets::ROIManagerWidget::onROITreItemClicked().

te::map::AlignType te::map::MapDisplay::getHAlign ( ) const
virtualinherited

It returns the MapDisplay current horizontal align.

Returns
The MapDisplay current horizontal align.

Implements te::map::AbstractMapDisplay.

Definition at line 47 of file MapDisplay.cpp.

unsigned int te::qt::widgets::MapDisplay::getHeight ( ) const
virtual

It returns the MapDisplay current height in pixels.

Returns
The MapDisplay current height in pixels.

Implements te::map::AbstractMapDisplay.

Definition at line 196 of file MapDisplay.cpp.

Referenced by te::qt::plugins::edit::ApplicationListener::onApplicationTriggered().

double te::qt::widgets::MapDisplay::getHeightMM ( ) const
virtual

It returns the MapDisplay current height in millimeters.

Returns
The MapDisplay current height in millimeters.

Implements te::map::AbstractMapDisplay.

Definition at line 206 of file MapDisplay.cpp.

int te::map::MapDisplay::getSRID ( ) const
virtualinherited
te::map::AlignType te::map::MapDisplay::getVAlign ( ) const
virtualinherited

It returns the MapDisplay current vertical align.

Returns
The MapDisplay current vertical align.

Implements te::map::AbstractMapDisplay.

Definition at line 52 of file MapDisplay.cpp.

unsigned int te::qt::widgets::MapDisplay::getWidth ( ) const
virtual

It returns the MapDisplay current width in pixels.

Returns
The MapDisplay current width in pixels.

Implements te::map::AbstractMapDisplay.

Definition at line 191 of file MapDisplay.cpp.

Referenced by te::qt::plugins::edit::ApplicationListener::onApplicationTriggered().

double te::qt::widgets::MapDisplay::getWidthMM ( ) const
virtual

It returns the MapDisplay current width in millimeters.

Returns
The MapDisplay current width in millimeters.

Implements te::map::AbstractMapDisplay.

Definition at line 201 of file MapDisplay.cpp.

bool te::qt::widgets::MapDisplay::isDrawing ( ) const

Returns if the map display is drawing.

Definition at line 343 of file MapDisplay.cpp.

void te::qt::widgets::MapDisplay::onResizeTimeout ( )
protectedvirtualslot

Definition at line 348 of file MapDisplay.cpp.

Referenced by MapDisplay().

MapDisplay& te::qt::widgets::MapDisplay::operator= ( const MapDisplay rhs)
private

Assignment operator not allowed.

Parameters
rhsThe right-hand-side copy that would be used to copy from.
Returns
A reference to this object.
void te::qt::widgets::MapDisplay::paintEvent ( QPaintEvent *  e)
protectedvirtual

It assembles the final image and draws the widget.

Parameters
eThe event received by this widget.

Definition at line 294 of file MapDisplay.cpp.

void te::qt::widgets::MapDisplay::refresh ( )
virtual

It updates the contents in the map display.

Implements te::map::AbstractMapDisplay.

Reimplemented in te::qt::widgets::MultiThreadMapDisplay.

Definition at line 170 of file MapDisplay.cpp.

void te::qt::widgets::MapDisplay::resizeAllCanvas ( )
protectedvirtual

It resizes all canvas of map display.

Definition at line 287 of file MapDisplay.cpp.

void te::qt::widgets::MapDisplay::resizeEvent ( QResizeEvent *  e)
protectedvirtual

This event handler receives widget resize events wich are passed in the event parameter.

Parameters
eThe resize event.

Definition at line 304 of file MapDisplay.cpp.

void te::map::MapDisplay::setAlign ( te::map::AlignType  h,
te::map::AlignType  v 
)
virtualinherited

It will set the align rendering of objects into the map display. Just successive drawings will be affected by this modification.

Parameters
hThe new horizontal align.
vThe new vertical align.
Note
It will not automatically redraw the objects, you must explicit call the setExtent method.

Implements te::map::AbstractMapDisplay.

Definition at line 57 of file MapDisplay.cpp.

void te::qt::widgets::MapDisplay::setBackgroundColor ( const QColor &  color)
virtual

Sets the map display background color.

Parameters
colorThe color.

Definition at line 338 of file MapDisplay.cpp.

Referenced by te::qt::af::MapDisplay::MapDisplay().

void te::qt::widgets::MapDisplay::setExtent ( te::gm::Envelope e,
bool  doRefresh = true 
)
virtual

It sets the world visible area and refreshes the contents in the map display.

If the given area is not proportional to the device width and height, the MapDisplay will change it in order to preserve the aspect ratio.

Parameters
eThe world visible area.
doRefreshIf true the display will refresh its contents.
Precondition
The world coordinates must be in the map display SRS.

Reimplemented from te::map::MapDisplay.

Reimplemented in te::qt::widgets::MultiThreadMapDisplay.

Definition at line 150 of file MapDisplay.cpp.

References te::qt::widgets::Canvas::calcAspectRatio(), te::qt::widgets::Canvas::clear(), te::map::MapDisplay::setExtent(), and te::qt::widgets::Canvas::setWindow().

Referenced by te::qt::widgets::MixtureModelDialog::MixtureModelDialog(), te::qt::af::BaseApplication::onLayerFitOnMapDisplayTriggered(), te::qt::widgets::TiePointsLocatorDialog::refreshMapDisplay1(), te::qt::widgets::TiePointsLocatorDialog::refreshMapDisplay2(), te::qt::widgets::TiePointsLocatorDialog::TiePointsLocatorDialog(), and te::qt::widgets::TimeSliderWidget::TimeSliderWidget().

void te::map::MapDisplay::setLayerList ( const std::list< te::map::AbstractLayerPtr > &  layers)
virtualinherited

It sets the layer list to be showed in the Map Display.

Parameters
layersThe layer list.

Implements te::map::AbstractMapDisplay.

Definition at line 42 of file MapDisplay.cpp.

Referenced by te::qt::widgets::MixtureModelDialog::MixtureModelDialog(), and te::qt::widgets::TiePointsLocatorDialog::TiePointsLocatorDialog().

void te::qt::widgets::MapDisplay::setResizeInterval ( int  msec)
virtual

Sets the timeout interval in milliseconds to redraw on resize event.

Parameters
msecThe timeout interval in milliseconds.

Definition at line 232 of file MapDisplay.cpp.

void te::qt::widgets::MapDisplay::setSRID ( const int &  srid,
bool  doRefresh = true 
)
virtual

It sets a new Spatial Reference System to be used by the Map Display.

It will also convert the current envelope coordinates to the new SRS. This may cause changes to the world visible area. In this case, the extent will be updated and new internal transformation function will be calculated.

Parameters
sridThe new Spatial Reference System to be used by the Map Display.
doRefreshIf true the display will refresh its contents.

Reimplemented from te::map::MapDisplay.

Definition at line 211 of file MapDisplay.cpp.

References te::map::MapDisplay::setSRID().

Referenced by te::qt::af::MapDisplay::MapDisplay(), te::qt::widgets::MixtureModelDialog::MixtureModelDialog(), te::qt::af::BaseApplication::onLayerFitOnMapDisplayTriggered(), te::qt::widgets::TiePointsLocatorDialog::TiePointsLocatorDialog(), and te::qt::widgets::TimeSliderWidget::TimeSliderWidget().

QPointF te::qt::widgets::MapDisplay::transform ( const QPointF &  p)
virtual

Transforms the given point, in screen coordinates, to a point in world coordinates.

Parameters
pA point in screen coordinates.
Returns
The point in world coordinates.
Note
This method will return a null point if the transform can not be done.

Reimplemented in te::qt::widgets::MultiThreadMapDisplay.

Definition at line 321 of file MapDisplay.cpp.

References te::qt::widgets::Canvas::getMatrix().

Member Data Documentation

QColor te::qt::widgets::MapDisplay::m_backgroundColor
protected

Background color.

Definition at line 288 of file MapDisplay.h.

Referenced by MapDisplay().

QPixmap* te::qt::widgets::MapDisplay::m_displayPixmap
protected

This pixmap will be the result of all canvas pixmap drawing, i. e., the result of drawing all visible layers.

Definition at line 286 of file MapDisplay.h.

Referenced by MapDisplay().

QPixmap* te::qt::widgets::MapDisplay::m_draftPixmap
protected

The draft pixmap can be used to draw some feedback on map display.

Definition at line 287 of file MapDisplay.h.

Referenced by MapDisplay().

te::gm::Envelope te::map::MapDisplay::m_extent
protectedinherited

The display extent.

Definition at line 73 of file MapDisplay.h.

te::map::AlignType te::map::MapDisplay::m_hAlign
protectedinherited

The display horizontal align.

Definition at line 76 of file MapDisplay.h.

int te::qt::widgets::MapDisplay::m_interval
protected

Timeout interval in milliseconds to redraw.

Definition at line 292 of file MapDisplay.h.

bool te::qt::widgets::MapDisplay::m_isDrawing
protected

A flag that indicates if the map display is drawing.

Definition at line 293 of file MapDisplay.h.

std::map<te::map::AbstractLayer*, te::qt::widgets::Canvas*> te::qt::widgets::MapDisplay::m_layerCanvasMap
protected

A map that associates a layer to a canvas.

Definition at line 294 of file MapDisplay.h.

std::list<te::map::AbstractLayerPtr> te::map::MapDisplay::m_layerList
protectedinherited

The layer list to be displayed.

Definition at line 74 of file MapDisplay.h.

QSize te::qt::widgets::MapDisplay::m_oldSize
protected

Stores the last size of map display on start resize event.

Definition at line 290 of file MapDisplay.h.

ResizePolicy te::qt::widgets::MapDisplay::m_resizePolicy
protected

Resize policy for this map display.

Definition at line 289 of file MapDisplay.h.

int te::map::MapDisplay::m_srid
protectedinherited

The display SRS.

Definition at line 75 of file MapDisplay.h.

QTimer* te::qt::widgets::MapDisplay::m_timer
protected

Timer to execute redraw on resize action.

Definition at line 291 of file MapDisplay.h.

Referenced by MapDisplay().

te::map::AlignType te::map::MapDisplay::m_vAlign
protectedinherited

The display vertical align.

Definition at line 77 of file MapDisplay.h.


The documentation for this class was generated from the following files: