-#define MACRO_RECALC_CENTER(center_unitx, center_unity) { \
- switch(_center_mode) \
- { \
- case CENTER_LEAD: \
- center_unitx = leadx2unit(); \
- center_unity = leady2unit(); \
- break; \
- case CENTER_LATLON: \
- center_unitx = _pos.unitx; \
- center_unity = _pos.unity; \
- break; \
- default: \
- center_unitx = _center.unitx; \
- center_unity = _center.unity; \
- ; \
- } \
-};
-
-#define MERCATOR_SPAN (-6.28318377773622f)
-#define MERCATOR_TOP (3.14159188886811f)
-
-#define latlon2unit(lat, lon, unitx, unity) { \
- gfloat tmp; \
- unitx = (lon + 180.f) * (WORLD_SIZE_UNITS / 360.f) + 0.5f; \
- tmp = sinf(lat * (PI / 180.f)); \
- unity = 0.5f + (WORLD_SIZE_UNITS / MERCATOR_SPAN) \
- * (logf((1.f + tmp) / (1.f - tmp)) * 0.5f - MERCATOR_TOP); \
-}
-
-#define unit2latlon(unitx, unity, lat, lon) { \
- (lon) = ((unitx) * (360.f / WORLD_SIZE_UNITS)) - 180.f; \
- (lat) = (360.f * (atanf(expf(((unity) \
- * (MERCATOR_SPAN / WORLD_SIZE_UNITS)) \
- + MERCATOR_TOP)))) * (1.f / PI) - 90.f; \
-}
-
-#define MACRO_RECALC_OFFSET() { \
- _offsetx = grid2pixel( \
- unit2grid(_center.unitx) \
- - _screen_grids_halfwidth \
- - tile2grid(_base_tilex)); \
- _offsety = grid2pixel( \
- unit2grid(_center.unity) \
- - _screen_grids_halfheight \
- - tile2grid(_base_tiley)); \
-}
-
-#define MACRO_RECALC_FOCUS_BASE() { \
- _focus.unitx = x2unit(_screen_width_pixels * _center_ratio / 20); \
- _focus.unity = y2unit(_screen_height_pixels * _center_ratio / 20); \
-}
-
-#define MACRO_RECALC_FOCUS_SIZE() { \
- _focus_unitwidth = pixel2unit( \
- (10 - _center_ratio) * _screen_width_pixels / 10); \
- _focus_unitheight = pixel2unit( \
- (10 - _center_ratio) * _screen_height_pixels / 10); \
-}
-
-#define MACRO_RECALC_CENTER_BOUNDS() { \
- _min_center.unitx = pixel2unit(grid2pixel(_screen_grids_halfwidth)); \
- _min_center.unity = pixel2unit(grid2pixel(_screen_grids_halfheight)); \
- _max_center.unitx = WORLD_SIZE_UNITS-grid2unit(_screen_grids_halfwidth) - 1;\
- _max_center.unity = WORLD_SIZE_UNITS-grid2unit(_screen_grids_halfheight)- 1;\
-}
-
-#define MACRO_PATH_INIT(path) { \
- (path).head = (path).tail = g_new(Point, ARRAY_CHUNK_SIZE); \
- *((path).tail) = _point_null; \
- (path).cap = (path).head + ARRAY_CHUNK_SIZE; \
- (path).whead = g_new(WayPoint, ARRAY_CHUNK_SIZE); \
- (path).wtail = (path).whead - 1; \
- (path).wcap = (path).whead + ARRAY_CHUNK_SIZE; \
-}
-
-#define MACRO_PATH_FREE(path) if((path).head) { \
- WayPoint *curr; \
- g_free((path).head); \
- (path).head = (path).tail = (path).cap = NULL; \
- for(curr = (path).whead - 1; curr++ != (path).wtail; ) \
- g_free(curr->desc); \
- g_free((path).whead); \
- (path).whead = (path).wtail = (path).wcap = NULL; \
-}
-
-#define MACRO_PATH_INCREMENT_TAIL(route) { \
- if(++(route).tail == (route).cap) \
- path_resize(&(route), (route).cap - (route).head + ARRAY_CHUNK_SIZE);\
-}
-
-#define MACRO_PATH_INCREMENT_WTAIL(route) { \
- if(++(route).wtail == (route).wcap) \
- path_wresize(&(route), \
- (route).wcap - (route).whead + ARRAY_CHUNK_SIZE); \
-}
-
-#define DISTANCE_SQUARED(a, b) \
- ((guint64)((((gint64)(b).unitx)-(a).unitx)*(((gint64)(b).unitx)-(a).unitx))\
- + (guint64)((((gint64)(b).unity)-(a).unity)*(((gint64)(b).unity)-(a).unity)))
-
-#define MACRO_QUEUE_DRAW_AREA() \
- gtk_widget_queue_draw_area( \
- _map_widget, \
- 0, 0, \
- _screen_width_pixels, \
- _screen_height_pixels)
-
-/* Render all on-map metadata an annotations, including POI and paths. */
-#define MACRO_MAP_RENDER_DATA() { \
- if(_show_poi) \
- map_render_poi(); \
- if(_show_tracks > 0) \
- map_render_paths(); \
-}
-
-#ifdef WITH_HILDON