Map double click zoom reviewed.
[situare] / src / map / mapcommon.h
index 389594d..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 = 3; ///< Minimum zoom level for MapView
+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 WORLD_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 double MAP_SCENE_VERTICAL_OVERSIZE_FACTOR = 0.5; ///< MapScene vertical oversize ( * map size)
+
+/**
+* @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
 * @brief Maps Default zoom level, used when latest zoom level is not available.
 */
-const int DEFAULT_START_ZOOM_LEVEL = 3;
+const int DEFAULT_START_ZOOM_LEVEL = MIN_VIEW_ZOOM_LEVEL;
 
 /**
 * @var FRIEND_LOCATION_ICON_Z_LEVEL
@@ -53,8 +79,7 @@ const int GROUP_ITEM_FRIENDS_COUNT_Y = 13;  ///< Group item friends count y valu
 const int GROUP_ITEM_FRIENDS_COUNT_WIDTH = 17;  ///< Group item friends count width value
 const int GROUP_ITEM_FRIENDS_COUNT_HEIGHT = 17; ///< Group item friends count height value
 
-const int FRIEND_ITEM_PRESS_WIDTH = 30;   ///< Friend item press area width
-const int FRIEND_ITEM_PRESS_HEIGHT = 30;  ///< Friend item press area height
+const int PRESS_MANHATTAN_LENGTH = 30;   ///< Friend/group item press manhattan length
 
 /**
 * @var OWN_LOCATION_ICON_Z_LEVEL
@@ -62,28 +87,28 @@ const int FRIEND_ITEM_PRESS_HEIGHT = 30;  ///< Friend item press area height
 */
 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 = 25.5000; ///< Default longitude value
-const qreal DEFAULT_LATITUDE = 65.0000;  ///< Default latitude value
+const qreal DEFAULT_LONGITUDE = 0.0000;  ///< Default longitude value
+const qreal DEFAULT_LATITUDE = 0.0000; ///< Default latitude value
+
+const qreal EARTH_RADIUS = 6371.01;         ///< Earth radius in km
 
-const int GRID_PADDING = 1;  ///< Grid padding used in tile grid calculation
+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
@@ -94,8 +119,6 @@ const QString ERROR_VALUE_NOT_FOUND_ON_SETTINGS = "Value_not_found";
 * @var UNDEFINED
 * @brief Value to be used when zoom level, tile numbers or position are not defined
 */
-const int UNDEFINED = -1;
-
-enum ScrollDirection { SCROLL_EAST, SCROLL_WEST };
+const int UNDEFINED = INT_MIN;
 
 #endif // MAPCOMMON_H