2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Sami Rämö - sami.ramo@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
25 #include <QGraphicsView>
28 * @brief Map view widget
30 * QAbstractKineticScroller is enabled when built for Maemo5.
31 * @author Sami Rämö - sami.ramo (at) ixonos.com
33 class MapView : public QGraphicsView
40 * @param parent Parent
42 MapView(QWidget *parent = 0);
45 void scrollContentsBy(int dx, int dy);
50 * @brief get current horizontal scale (vertical should be same)
52 * @return qreal Current horizontal scale value
58 * @brief Signal for view scroll events
60 * Signal is emitted when view scroll is requested with mouse (or finger).
61 * @param sceneCoordinate Scene coordinates of the new requested center point of the view
63 void viewScrolled(QPointF sceneCoordinate);
65 void viewResized(const QSize &size);
69 * @brief Slot for centering view to new location
71 * @param sceneCoordinate Scene coordinates of the new center point
73 void centerToSceneCoordinates(QPointF sceneCoordinate);
76 * @brief Set zoom level of the view
78 * @param zoomLevel Zoom level
80 void setZoomLevel(int zoomLevel);
83 void resizeEvent(QResizeEvent *event);
87 * @brief Slot for mouse move events
89 * Does calculate mouse movement delta from last event position and new view center
90 * based on that delta. Saves current event position for next round. Emits viewScrolled
91 * signal and doesn't actually scroll the view.
92 * @param event Mouse event
94 // void mouseMoveEvent(QMouseEvent *event);
97 * @brief Slot for mouse press events
99 * Saves inial values for mouse and scene location for dragging view.
100 * @param event Mouse event
102 // void mousePressEvent(QMouseEvent *event);
105 * @brief Timer events for smooth zoom effect
109 void timerEvent(QTimerEvent *event);
112 QPointF m_mousePosition; ///< Previous mouse event position
113 QPointF m_scenePosition; ///< New center position
114 qreal m_zoomTargetScale; ///< Scaling factor of the target zoom level
115 qreal m_zoomScaleDelta; ///< Scaling factor delta for smooth zoom transition effect