current location, and it can be used to calculate a route from
that location.
</listitem>
+ <listitem>
+ <display_text>Map Correction</display_text> - Enables and disables
+ map correction. When enabling map correction, the tap point is
+ used as the correction reference point. See the note below for
+ more details.
+ </listitem>
</list>
+ <note>
+ Map Correction is a little-used feature that corrects a rare problem
+ with map data. In some locations around the world (like Brazil and
+ Québec), road data from a particular map repository may not be
+ accurate, although the error is consistent. For example, as you
+ travel, you may find that your actual track (as indicated by your
+ GPS receiver) is a few hundred meters away from the road on which
+ Maemo Mapper is drawing your current position. Map Correction fixes
+ this. When your GPS receiver has an accurate fix, and if Maemo
+ Mapper shows your current location as somewhere other than where you
+ expect to be, simply tap-and-hold on the location on the map where
+ you think your current location <i>should</i> be drawn, then select
+ this context menu item. The correction is saved as part of your
+ configuration (so it persists even if you restart Maemo Mapper or
+ your device).
+ </note>
<heading>Waypoint</heading>
<para>
The <display_text>Waypoint</display_text> submenu performs actions
return TRUE;
}
+static gboolean
+cmenu_cb_loc_apply_correction(GtkMenuItem *item)
+{
+ printf("%s()\n", __PRETTY_FUNCTION__);
+
+ if(gtk_check_menu_item_get_active(item))
+ {
+ /* Get difference between tap point and GPS location. */
+ gint unitx, unity;
+ screen2unit(_cmenu_position_x, _cmenu_position_y, unitx, unity);
+ _map_correction_unitx = unitx - _pos.unitx;
+ _map_correction_unity = unity - _pos.unity;
+ map_refresh_mark(TRUE);
+ MACRO_BANNER_SHOW_INFO(_window, _("Map correction applied."));
+ }
+ else
+ {
+ _map_correction_unitx = 0;
+ _map_correction_unity = 0;
+ map_refresh_mark(TRUE);
+ MACRO_BANNER_SHOW_INFO(_window, _("Map correction removed."));
+ }
+
+ printf("Map correction now set to: %d, %d\n");
+
+ vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
+ return TRUE;
+}
+
static gboolean
cmenu_cb_way_show_latlon(GtkMenuItem *item)
{
gtk_menu_append(submenu, gtk_separator_menu_item_new());
gtk_menu_append(submenu, _cmenu_loc_set_gps_item
= gtk_menu_item_new_with_label(_("Set as GPS Location")));
+ gtk_menu_append(submenu, _cmenu_loc_apply_correction_item
+ = gtk_check_menu_item_new_with_label(
+ _("Map Correction")));
+ gtk_check_menu_item_set_active(
+ GTK_CHECK_MENU_ITEM(_cmenu_loc_apply_correction_item),
+ _map_correction_unitx != 0 || _map_correction_unity != 0);
/* Setup the waypoint context menu. */
gtk_menu_append(menu, menu_item
G_CALLBACK(cmenu_cb_loc_add_poi), NULL);
g_signal_connect(G_OBJECT(_cmenu_loc_set_gps_item), "activate",
G_CALLBACK(cmenu_cb_loc_set_gps), NULL);
+ g_signal_connect(G_OBJECT(_cmenu_loc_apply_correction_item), "toggled",
+ G_CALLBACK(cmenu_cb_loc_apply_correction), NULL);
g_signal_connect(G_OBJECT(_cmenu_way_show_latlon_item), "activate",
G_CALLBACK(cmenu_cb_way_show_latlon), NULL);
GdkPixbuf *_redraw_wait_icon = NULL;
GdkRectangle _redraw_wait_bounds = { 0, 0, 0, 0};
+gint _map_correction_unitx = 0;
+gint _map_correction_unity = 0;
/** CACHED SCREEN INFORMATION THAT IS DEPENDENT ON THE CURRENT VIEW. */
gint _view_width_pixels = 0;
GtkWidget *_cmenu_loc_add_way_item = NULL;
GtkWidget *_cmenu_loc_add_poi_item = NULL;
GtkWidget *_cmenu_loc_set_gps_item = NULL;
+GtkWidget *_cmenu_loc_apply_correction_item = NULL;
/* Menu items for the "Waypoint" context menu. */
GtkWidget *_cmenu_way_show_latlon_item = NULL;
extern GdkPixbuf *_redraw_wait_icon;
extern GdkRectangle _redraw_wait_bounds;
+extern gint _map_correction_unitx;
+extern gint _map_correction_unity;
/** CACHED SCREEN INFORMATION THAT IS DEPENDENT ON THE CURRENT VIEW. */
extern gint _view_width_pixels;
extern GtkWidget *_cmenu_loc_add_way_item;
extern GtkWidget *_cmenu_loc_add_poi_item;
extern GtkWidget *_cmenu_loc_set_gps_item;
+extern GtkWidget *_cmenu_loc_apply_correction_item;
/* Menu items for the "Waypoint" context menu. */
extern GtkWidget *_cmenu_way_show_latlon_item;
gdk_pixbuf_rotate_matrix_mult_number(
_map_rotate_matrix, 1 << zoff);
gdk_pixbuf_rotate(_map_pixbuf,
- destx, desty,
+ /* Apply Map Correction. */
+ destx - unit2pixel(_map_correction_unitx),
+ desty - unit2pixel(_map_correction_unity),
_map_rotate_matrix,
mut->pixbuf,
TILE_SIZE_PIXELS / 2,
+ MAX(mrt->screen_width_pixels, mrt->screen_height_pixels) / 2,
mrt->zoom);
start_tilex = unit2ztile(
- mrt->new_center.unitx - diag_halflength_units, mrt->zoom);
+ mrt->new_center.unitx - diag_halflength_units
+ + _map_correction_unitx, mrt->zoom);
start_tilex = MAX(start_tilex - (cache_amount - 1), 0);
start_tiley = unit2ztile(
- mrt->new_center.unity - diag_halflength_units, mrt->zoom);
+ mrt->new_center.unity - diag_halflength_units
+ + _map_correction_unity, mrt->zoom);
start_tiley = MAX(start_tiley - (cache_amount - 1), 0);
- stop_tilex = unit2ztile(mrt->new_center.unitx + diag_halflength_units,
- mrt->zoom);
+ stop_tilex = unit2ztile(mrt->new_center.unitx + diag_halflength_units
+ + _map_correction_unitx, mrt->zoom);
stop_tilex = MIN(stop_tilex + (cache_amount - 1),
unit2ztile(WORLD_SIZE_UNITS, mrt->zoom));
- stop_tiley = unit2ztile(mrt->new_center.unity + diag_halflength_units,
- mrt->zoom);
+ stop_tiley = unit2ztile(mrt->new_center.unity + diag_halflength_units
+ + _map_correction_unity, mrt->zoom);
stop_tiley = MIN(stop_tiley + (cache_amount - 1),
unit2ztile(WORLD_SIZE_UNITS, mrt->zoom));
devx, devy,
mrt->new_center, mrt->zoom, matrix);
+ /* Apply Map Correction. */
+ devx -= unit2zpixel(_map_correction_unitx, mrt->zoom);
+ devy -= unit2zpixel(_map_correction_unity, mrt->zoom);
+
/* Skip this tile under the following conditions:
* devx < -tile_rothalf_pixels
* devx > _view_width_pixels + tile_rothalf_pixels
#define GCONF_KEY_CENTER_LAT GCONF_KEY_PREFIX"/center_latitude"
#define GCONF_KEY_CENTER_LON GCONF_KEY_PREFIX"/center_longitude"
#define GCONF_KEY_CENTER_ANGLE GCONF_KEY_PREFIX"/center_angle"
+#define GCONF_KEY_MAP_CORRECTION_UNITX GCONF_KEY_PREFIX"/map_correction_unitx"
+#define GCONF_KEY_MAP_CORRECTION_UNITY GCONF_KEY_PREFIX"/map_correction_unity"
#define GCONF_KEY_ZOOM GCONF_KEY_PREFIX"/zoom"
#define GCONF_KEY_ROUTEDIR GCONF_KEY_PREFIX"/route_directory"
#define GCONF_KEY_TRACKFILE GCONF_KEY_PREFIX"/track_file"
GCONF_KEY_CENTER_ANGLE, _map_rotate_angle, NULL);
}
+ /* Save map correction. */
+ gconf_client_set_int(gconf_client,
+ GCONF_KEY_MAP_CORRECTION_UNITX, _map_correction_unitx, NULL);
+ gconf_client_set_int(gconf_client,
+ GCONF_KEY_MAP_CORRECTION_UNITY, _map_correction_unity, NULL);
+
/* Save last Zoom Level. */
gconf_client_set_int(gconf_client,
GCONF_KEY_ZOOM, _zoom, NULL);
_next_center = _center;
}
+ /* Get map correction. Default is 0. */
+ _map_correction_unitx = gconf_client_get_int(gconf_client,
+ GCONF_KEY_MAP_CORRECTION_UNITX, NULL);
+ _map_correction_unity = gconf_client_get_int(gconf_client,
+ GCONF_KEY_MAP_CORRECTION_UNITY, NULL);
+
/* Get last viewing angle. Default is 0. */
_map_rotate_angle = _next_map_rotate_angle = gconf_client_get_int(
gconf_client, GCONF_KEY_CENTER_ANGLE, NULL);