From: Kaj-Michael Lang Date: Thu, 5 Jun 2008 09:17:47 +0000 (+0300) Subject: MapWidget: Add gobject properties for showing speed, scale and velocity vector X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb4a267fd963c54cc64a4e0dc93ecbc9d5f98b85;p=mapper MapWidget: Add gobject properties for showing speed, scale and velocity vector --- diff --git a/libs/libgtkmap/gtkmap.c b/libs/libgtkmap/gtkmap.c index 7ae96cb..e81c4fe 100644 --- a/libs/libgtkmap/gtkmap.c +++ b/libs/libgtkmap/gtkmap.c @@ -331,6 +331,9 @@ enum { PROP_MAX_LAT, PROP_MIN_LON, PROP_MAX_LON, + PROP_SHOW_VELVEC, + PROP_SHOW_SCALE, + PROP_SHOW_SPEED, PROP_LAST }; @@ -475,24 +478,34 @@ g_object_class_install_property (object_class, PROP_CENTER_MODE, pspec); /* Center lat/lon */ pspec=g_param_spec_double("center-lat","Center Lat","Latitude", -90, 90, 0, G_PARAM_READABLE); -g_object_class_install_property (object_class, PROP_CENTER_LAT, pspec); +g_object_class_install_property(object_class, PROP_CENTER_LAT, pspec); pspec=g_param_spec_double("center-lon","Center Lon","Longitude", -180, 180, 0, G_PARAM_READABLE); -g_object_class_install_property (object_class, PROP_CENTER_LAT, pspec); +g_object_class_install_property(object_class, PROP_CENTER_LAT, pspec); /* Min/Max latitude */ pspec=g_param_spec_double("max-lat","Max Lat","View max latitude", -90, 90, 0, G_PARAM_READABLE); -g_object_class_install_property (object_class, PROP_MAX_LAT, pspec); +g_object_class_install_property(object_class, PROP_MAX_LAT, pspec); pspec=g_param_spec_double("min-lat","Min Lat","View min latitude", -90, 90, 0, G_PARAM_READABLE); -g_object_class_install_property (object_class, PROP_MIN_LAT, pspec); +g_object_class_install_property(object_class, PROP_MIN_LAT, pspec); /* Min/Max longitude */ pspec=g_param_spec_double("max-lon","Max Lon","View max longitude", -180, 180, 0, G_PARAM_READABLE); -g_object_class_install_property (object_class, PROP_MAX_LAT, pspec); +g_object_class_install_property(object_class, PROP_MAX_LAT, pspec); pspec=g_param_spec_double("min-lon","Min Lon","View min longitude", -180, 180, 0, G_PARAM_READABLE); -g_object_class_install_property (object_class, PROP_MIN_LAT, pspec); +g_object_class_install_property(object_class, PROP_MIN_LAT, pspec); + +/* Map features flags */ +pspec=g_param_spec_boolean("show-velvec","Show velocity vector","Display track velocity vector", TRUE, G_PARAM_READWRITE); +g_object_class_install_property(object_class, PROP_SHOW_VELVEC, pspec); + +pspec=g_param_spec_boolean("show-scale","Show map scale","Display map scale box", TRUE, G_PARAM_READWRITE); +g_object_class_install_property(object_class, PROP_SHOW_SCALE, pspec); + +pspec=g_param_spec_boolean("show-speed","Show speed","Display current speed on map", TRUE, G_PARAM_READWRITE); +g_object_class_install_property(object_class, PROP_SHOW_SPEED, pspec); gtk_map_signals[MAP_ZOOM_CHANGED]=g_signal_new("zoom-changed", G_OBJECT_CLASS_TYPE(object_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET(GtkMapClass, zoom_changed), @@ -584,6 +597,15 @@ switch (prop_id) { case PROP_CENTER_MODE: gtk_map_set_center_mode(map, g_value_get_int(value)); break; + case PROP_SHOW_VELVEC: + priv->show_velvec=g_value_get_boolean(value); + break; + case PROP_SHOW_SCALE: + priv->show_scale=g_value_get_boolean(value); + break; + case PROP_SHOW_SPEED: + priv->show_speed=g_value_get_boolean(value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -629,6 +651,15 @@ switch (prop_id) { unit2latlon(x2unit(0), y2unit(0), &lat, &lon); g_value_set_double(value, lon); break; + case PROP_SHOW_VELVEC: + g_value_set_boolean(value, priv->show_velvec); + break; + case PROP_SHOW_SPEED: + g_value_set_boolean(value, priv->show_speed); + break; + case PROP_SHOW_SCALE: + g_value_set_boolean(value, priv->show_scale); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break;