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 00007 Situare is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License 00009 version 2 as published by the Free Software Foundation. 00010 00011 Situare is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with Situare; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00019 USA. 00020 */ 00021 00022 #ifndef MAPTILE_H 00023 #define MAPTILE_H 00024 00025 #include <QGraphicsPixmapItem> 00026 00027 class SceneCoordinate; 00028 00034 class MapTile : public QGraphicsPixmapItem 00035 { 00036 public: 00040 MapTile(); 00041 00042 /******************************************************************************* 00043 * MEMBER FUNCTIONS AND SLOTS 00044 ******************************************************************************/ 00045 public: 00053 static SceneCoordinate convertTileNumberToSceneCoordinate(int zoomLevel, QPoint tileNumber); 00054 00061 static int lastTileIndex(int zoomLevel); 00062 00072 void setSceneLevel(int currentZoomLevel); 00073 00080 void setTileNumber(QPoint tileNumber); 00081 00090 void setZoomLevel(int tileZoomLevel, int currentViewZoomLevel); 00091 00097 QPoint tileNumber(); 00098 00107 static QString tilePath(int zoomLevel, int x, int y); 00108 00115 static int tilesPerSide(int zoomLevel); 00116 00122 int zoomLevel(); 00123 00124 private: 00131 void setPosition(); 00132 00133 /******************************************************************************* 00134 * DATA MEMBERS 00135 ******************************************************************************/ 00136 private: 00137 int m_zoomLevel; 00138 00139 QPoint m_tileNumber; 00140 }; 00141 00142 #endif // MAPTILE_H