00001 /* 00002 Situare - A location system for Facebook 00003 Copyright (C) 2010 Ixonos Plc. Authors: 00004 00005 Sami Rämö - sami.ramo@ixonos.com 00006 Pekka Nissinen - pekka.nissinen@ixonos.com 00007 00008 Situare is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU General Public License 00010 version 2 as published by the Free Software Foundation. 00011 00012 Situare is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Situare; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00020 USA. 00021 */ 00022 00023 #ifndef MAPVIEW_H 00024 #define MAPVIEW_H 00025 00026 #include <QGraphicsView> 00027 00028 class QPropertyAnimation; 00029 00036 class MapView : public QGraphicsView 00037 { 00038 Q_OBJECT 00039 00045 Q_PROPERTY(qreal viewScale READ viewScale WRITE setViewScale) 00046 00047 public: 00053 MapView(QWidget *parent = 0); 00054 00055 /******************************************************************************* 00056 * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS 00057 ******************************************************************************/ 00058 protected: 00064 void resizeEvent(QResizeEvent *event); 00065 00066 private: 00075 void mouseMoveEvent(QMouseEvent *event); 00076 00083 void mousePressEvent(QMouseEvent *event); 00084 00085 /******************************************************************************* 00086 * MEMBER FUNCTIONS AND SLOTS 00087 ******************************************************************************/ 00088 public slots: 00094 void centerToSceneCoordinates(QPoint sceneCoordinate); 00095 00101 void setZoomLevel(int zoomLevel); 00102 00103 private: 00109 void setViewScale(qreal viewScale); 00110 00116 qreal viewScale(); 00117 00118 /******************************************************************************* 00119 * SIGNALS 00120 ******************************************************************************/ 00121 signals: 00128 void viewResized(const QSize &size); 00129 00136 void viewScrolled(QPoint sceneCoordinate); 00137 00141 void viewZoomFinished(); 00142 00143 /******************************************************************************* 00144 * DATA MEMBERS 00145 ******************************************************************************/ 00146 private: 00147 QPoint m_mousePosition; 00148 QPoint m_scenePosition; 00149 QPropertyAnimation *m_zoomAnimation; 00150 }; 00151 00152 #endif // MAPVIEW_H