Map double click zoom reviewed.
[situare] / src / map / mapcommon.h
index fb02134..f2f8b3d 100644 (file)
 
 #include <QtCore>
 
-const int TILE_SIZE_X = 256; ///< Tile image size in x direction
-const int TILE_SIZE_Y = 256; ///< Tile image size in y direction
+const int TILE_SIZE_X = 256;      ///< Tile image size in x direction
+const int TILE_SIZE_Y = 256;      ///< Tile image size in y direction
+const int MAP_TILE_MIN_INDEX = 0; ///< First index number of map tiles
 
 const int MIN_MAP_ZOOM_LEVEL = 0; ///< Minimum zoom level
 const int MAX_MAP_ZOOM_LEVEL = 18; ///< Maximum zoom level
 const int MIN_VIEW_ZOOM_LEVEL = 2; ///< Minimum zoom level for MapView
+
+/**
+* @var MIN_MAP_SCENE_NORMAL_LEVEL
+* @brief Used for shifting zValues of MapTiles
+*/
 const int MIN_MAP_SCENE_NORMAL_LEVEL = MAX_MAP_ZOOM_LEVEL + 1;
 
-const int MAX_TILES_PER_SIDE = (1 << MAX_MAP_ZOOM_LEVEL);
-const int MAP_PIXELS_X = MAX_TILES_PER_SIDE * TILE_SIZE_X;
+const int MAX_TILES_PER_SIDE = (1 << MAX_MAP_ZOOM_LEVEL);  ///< Amount of tiles per side
+const int MAP_PIXELS_X = MAX_TILES_PER_SIDE * TILE_SIZE_X; ///< Amount of horizontal pixels in map
+
+const int MAP_MIN_PIXEL_X = 0;                ///< First map horizontal pixel index
+const int MAP_MAX_PIXEL_X = MAP_PIXELS_X - 1; ///< Last map horizontal pixel index
+
+const int MAP_MIN_PIXEL_Y = 0;                                   ///< First map vertical pixel index
+const int MAP_MAX_PIXEL_Y = MAX_TILES_PER_SIDE * TILE_SIZE_Y - 1; ///< Last map vertical pixel index
 
-const int MAP_MIN_PIXEL_X = 0;
-const int MAP_MAX_PIXEL_X = MAP_PIXELS_X - 1;
+const double MAP_SCENE_VERTICAL_OVERSIZE_FACTOR = 0.5; ///< MapScene vertical oversize ( * map size)
 
-const int MAP_SCENE_MIN_PIXEL_X = -MAP_PIXELS_X / 2;
-const int MAP_SCENE_MAX_PIXEL_X = MAP_PIXELS_X * 2;
+/**
+* @var MAP_SCENE_MIN_PIXEL_X
+* @brief First scene horizontal pixel
+*/
+const int MAP_SCENE_MIN_PIXEL_X = -MAP_PIXELS_X * MAP_SCENE_VERTICAL_OVERSIZE_FACTOR;
+
+/**
+* @var MAP_SCENE_MAX_PIXEL_X
+* @brief Last scene horizontal pixel
+*/
+const int MAP_SCENE_MAX_PIXEL_X = MAP_PIXELS_X * (1 + MAP_SCENE_VERTICAL_OVERSIZE_FACTOR) - 1;
 
 /**
 * @var DEFAULT_START_ZOOM_LEVEL
@@ -67,15 +87,13 @@ const int PRESS_MANHATTAN_LENGTH = 30;   ///< Friend/group item press manhattan
 */
 const int OWN_LOCATION_ICON_Z_LEVEL = FRIEND_LOCATION_ICON_Z_LEVEL + 1;
 
-const qreal ZOOM_TIME = 250; ///< Length of the zoom effect (ms)
+const qreal ZOOM_TIME = 350; ///< Length of the zoom effect (ms)
 
 const qreal MAX_LATITUDE = 85.05112877980659237802;  ///< Maximum latitude value
 const qreal MIN_LATITUDE = -MAX_LATITUDE; ///< Minimum latitude value
 const qreal MIN_LONGITUDE = -180.0;  ///< Minimum longitude value
 const qreal MAX_LONGITUDE = 180.0;  ///< Maximum longitude value
 
-const int DEFAULT_SCREEN_WIDTH = 973;    ///< Default screen width
-const int DEFAULT_SCREEN_HEIGHT = 614;   ///< Default screen height
 const int DEFAULT_ZOOM_LEVEL = 14;       ///< Default zoom level
 const qreal DEFAULT_LONGITUDE = 0.0000;  ///< Default longitude value
 const qreal DEFAULT_LATITUDE = 0.0000; ///< Default latitude value
@@ -86,11 +104,11 @@ const int GRID_PADDING = 0;  ///< Grid padding used in tile grid calculation
 
 const QString OSM_LICENSE = QString::fromUtf8("© OpenStreetMap contributors, CC-BY-SA");
 
-const int AUTO_CENTERING_DISABLE_DISTANCE = 200; ///< Distance in pixels
+const int AUTO_CENTERING_DISABLE_DISTANCE = 100; ///< Distance in pixels
 
 //String constants for storing map settings:
-const QString MAP_LAST_ZOOMLEVEL = "Last_map_zoom_level"; ///< Maps last zoom level before logout
-const QString MAP_LAST_POSITION = "Last_map_location"; ///< Maps last postion before logout
+const QString MAP_LAST_ZOOMLEVEL = "LAST_MAP_ZOOM_LEVEL";   ///< Maps last zoom level before logout
+const QString MAP_LAST_POSITION = "LAST_MAP_LOCATION";      ///< Maps last postion before logout
 /**
 * @var ERROR_VALUE_NOT_FOUND_ON_SETTINGS
 * @brief Error string that program will get if value is not found on settings