]> err.no Git - mapper/commitdiff
MapWidget: Add gobject properties for showing speed, scale and velocity vector
authorKaj-Michael Lang <milang@tal.org>
Thu, 5 Jun 2008 09:17:47 +0000 (12:17 +0300)
committerKaj-Michael Lang <milang@tal.org>
Thu, 5 Jun 2008 09:17:47 +0000 (12:17 +0300)
libs/libgtkmap/gtkmap.c

index 7ae96cb1b2461708906bb3af430decff85fbc064..e81c4fe64cc568e603395c9f2e735c5c76d1f7fb 100644 (file)
@@ -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;