MapView Class Reference

Map view widget. More...

#include <mapview.h>

Collaboration diagram for MapView:
Collaboration graph
[legend]

List of all members.

Public Slots

void centerToSceneCoordinates (const SceneCoordinate &coordinate)
 Slot for centering view to new location.
void setZoomLevel (int zoomLevel)
 Set zoom level of the view.

Signals

void horizontalShiftingChanged (int shifting)
 Emitted when map center point shiftin is changed.
void viewResized (const QSize &size)
 Signal for view resize events.
void viewScrolled (const SceneCoordinate &coordinate)
 Signal for view scroll events.
void viewZoomFinished ()
 Signal for informing that zooming animation is finished.
void zoomIn ()
 Signal for informing that double click zoom is finished.

Public Member Functions

 MapView (QWidget *parent=0)
 Constructor.
 ~MapView ()
 Destructor.

Protected Member Functions

void resizeEvent (QResizeEvent *event)
 Called when view is resized.

Properties

qreal viewScale
 View scaling.
qreal viewShift
 View shifting.

Private Slots

void disableCenterShift ()
 Disables shifting of the center point.
void doubleTapZoomFinished ()
 Double tap zoom finished.
void enableCenterShift ()
 Enables shifting of the center point.

Private Member Functions

void mouseDoubleClickEvent (QMouseEvent *event)
 Event handler for mouse double click event.
void mouseMoveEvent (QMouseEvent *event)
 Event handler for mouse move events.
void mousePressEvent (QMouseEvent *event)
 Event handler for mouse press events.
void mouseReleaseEvent (QMouseEvent *event)
 Event handler for mouse release events.
QPointF center () const
 Returns the point which is considered by user as the visible center point.
void setViewScale (qreal viewScale)
 Set new view scale.
void setViewShift (qreal viewShift)
 Set new view shifting.
void updateCenterShift ()
 Update center shifting value.
qreal viewScale () const
 Get current view scale.
qreal viewShift () const
 Get current view shifting.

Private Attributes

bool m_doubleTapZoomRunning
 Double tap zoom running flag.
int m_dragTime [VALUES]
 Table of mouse event durations.
int m_index
 Current index of mouse event values table.
int m_zoomLevel
 Current zoom level.
qreal m_centerHorizontalShiftViewPixels
 Center point horizontal shift in the view.
qreal m_kineticMaxViewDistance
 Maximum kinetic scroll distance in view pixels.
QParallelAnimationGroup * m_scrollAndZoomAnimation
 Double click zoom animation.
QPoint m_dragMovement [VALUES]
 Table of mouse event distances.
QPoint m_internalScenePosition
 New center position (used for dragging).
QPoint m_lastMouseEventScenePosition
 Previous mouse event position in the scene.
QPoint m_lastMouseEventViewPosition
 Previous mouse event position in the view.
QPoint m_viewCenterPoint
 Center point of the MapView.
QPointF m_centerHorizontalShiftPoint
 Current amount of center point shifting.
QPropertyAnimation * m_zoomAnimation
 Zoom animation.
QTime m_time
 Elapsed time between mouse events.
QPropertyAnimation * m_centerShiftAnimation
 Animation for shifting the center point.
MapScrollerm_scroller
 Kinetic scroller.
SceneCoordinate m_lastSetScenePosition
 Last center point coordinate set by MapEngine.

Detailed Description

Map view widget.

Author:
Sami Rämö - sami.ramo (at) ixonos.com
Pekka Nissinen - pekka.nissinen (at) ixonos.com

Constructor & Destructor Documentation

MapView::MapView ( QWidget *  parent = 0  ) 

Constructor.

Parameters:
parent Parent
MapView::~MapView (  ) 

Destructor.

Takes MapScroller animation from double click zoom animation group and deletes animation group.


Member Function Documentation

QPointF MapView::center (  )  const [private]

Returns the point which is considered by user as the visible center point.

Differs from view's center point when panel is open and view center point is shifted.

Returns:
Center point
void MapView::centerToSceneCoordinates ( const SceneCoordinate coordinate  )  [slot]

Slot for centering view to new location.

Does also shift the center point horizontally, if required.

Parameters:
coordinate Scene coordinates of the new center point
void MapView::doubleTapZoomFinished (  )  [private, slot]

Double tap zoom finished.

Disables double tap zoom flag and emits zoomIn signal.

void MapView::horizontalShiftingChanged ( int  shifting  )  [signal]

Emitted when map center point shiftin is changed.

Parameters:
shifting New shifting value
void MapView::mouseDoubleClickEvent ( QMouseEvent *  event  )  [private]

Event handler for mouse double click event.

Emits zoomIn signal.

Parameters:
event QMouseEvent
void MapView::mouseMoveEvent ( QMouseEvent *  event  )  [private]

Event handler for mouse move events.

Does calculate mouse movement delta from last event position and new view center based on that delta. Saves current event position for next round. Emits viewScrolled signal and doesn't actually scroll the view.

Saves mouse movement deltas and durations for last few move events to be used for calculating the kinetic scrolling speed.

Parameters:
event Mouse event
void MapView::mousePressEvent ( QMouseEvent *  event  )  [private]

Event handler for mouse press events.

Saves inial values for mouse and scene location for dragging the view. Does stop currently running kinetic scroll effect.

Parameters:
event Mouse event
void MapView::mouseReleaseEvent ( QMouseEvent *  event  )  [private]

Event handler for mouse release events.

Set up and start kinetic scrolling effect if time elapsed from last mouseMoveEvent is below the limit and drag length is over the limit.

Kinetic scroll distance is calculated based on mouse movement event values saved in mouseMoveEvent(). The distance is also limited so that map doesn't run too far.

Parameters:
event Mouse event
void MapView::resizeEvent ( QResizeEvent *  event  )  [protected]

Called when view is resized.

Parameters:
event resize event
void MapView::setViewScale ( qreal  viewScale  )  [private]

Set new view scale.

Parameters:
viewScale New scaling factor
void MapView::setViewShift ( qreal  viewShift  )  [private]

Set new view shifting.

Parameters:
viewShift New shifting amount
void MapView::setZoomLevel ( int  zoomLevel  )  [slot]

Set zoom level of the view.

Parameters:
zoomLevel Zoom level
void MapView::viewResized ( const QSize &  size  )  [signal]

Signal for view resize events.

Signal is emitted when view has been resized.

Parameters:
size view size
qreal MapView::viewScale (  )  const [private]

Get current view scale.

Returns:
Current view scaling factor
void MapView::viewScrolled ( const SceneCoordinate coordinate  )  [signal]

Signal for view scroll events.

Signal is emitted when view is scrolled.

Parameters:
coordinate Scene coordinates of the new center point of the view
qreal MapView::viewShift (  )  const [private]

Get current view shifting.

Returns:
Current view shifting amount

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

Generated on Fri Sep 3 12:05:41 2010 for Situare client for Maemo by  doxygen 1.6.1