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 <QGraphicsPixmapItem>
27 class SceneCoordinate;
30 * @brief Map tile item
32 * @author Sami Rämö - sami.ramo (at) ixonos.com
34 class MapTile : public QGraphicsPixmapItem
42 /*******************************************************************************
43 * MEMBER FUNCTIONS AND SLOTS
44 ******************************************************************************/
47 * @brief Convert tile x & y numbers to MapScene coordinates
49 * @param zoomLevel Zoom level
50 * @param tileNumber x & y numbers of the tile
51 * @return Scene coordinate
53 static SceneCoordinate convertTileNumberToSceneCoordinate(int zoomLevel, QPoint tileNumber);
56 * @brief Calculate maximum value for tile in this zoom level.
58 * @param zoomLevel zoom level
59 * @return int tile's maximum value
61 static int lastTileIndex(int zoomLevel);
64 * @brief Set drawing level of the tile based on current zoom level
66 * Drawing order of MapTiles, which has the zoom level higher than the current
67 * zoom level, is reversed and those MapTiles are mapped between lower level MapTiles.
68 * Example: If maximum zoom level is 18 and current view zoomlevel is 15, then
69 * the drawing order from top to bottom is 15, 16, 14, 17, 13, 18, 12, 11, 10, ...
70 * @param currentZoomLevel current zoom level
72 void setSceneLevel(int currentZoomLevel);
75 * @brief Setter for tile number
77 * Does also set the position for the item in the MapScene coordinate system
78 * @param tileNumber Tile number
80 void setTileNumber(QPoint tileNumber);
83 * @brief Setter for zoom level
85 * Does also set the zValue.
87 * @param tileZoomLevel Zoom level of the tile
88 * @param currentViewZoomLevel Current view zoom level
90 void setZoomLevel(int tileZoomLevel, int currentViewZoomLevel);
93 * @brief Getter for tile number
100 * @brief Return tile path created from tile values.
102 * @param zoomLevel tile's zoom level
103 * @param x tile's x value
104 * @param y tile's y value
105 * @return QString tile path
107 static QString tilePath(int zoomLevel, int x, int y);
110 * @brief Maximum number of individual tiles per side at given zoom level
112 * @param zoomLevel Zoom level
113 * @return amount of tiles per side at given zoom level
115 static int tilesPerSide(int zoomLevel);
118 * @brief Getter for zoom level
126 * @brief Set position of the tile in the MapScene coordinate system
128 * Does set the position based on the m_zoomLevel and the m_TileNumber. Position is set to
129 * (UNDEFINED, UNDEFINED) if there is something wrong with zoom level or tile numbers
133 /*******************************************************************************
135 ******************************************************************************/
137 int m_zoomLevel; ///< Zoom level
139 QPoint m_tileNumber; ///< Tile number