]> err.no Git - libchamplain/commitdiff
Add license data to maps
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Thu, 13 Nov 2008 04:07:17 +0000 (23:07 -0500)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Thu, 13 Nov 2008 04:07:17 +0000 (23:07 -0500)
champlain/champlainview.c
champlain/map.h
champlain/sources/debugmap.c
champlain/sources/mffrelief.c
champlain/sources/oam.c
champlain/sources/osmmapnik.c

index 6774bea64c8a18ac963687b521d0b66ca088eb9c..a5bbdd35aa79b9ddf73627f0447fdeb10f753ac3 100644 (file)
@@ -52,7 +52,8 @@ enum
   PROP_MAP_SOURCE,
   PROP_OFFLINE,
   PROP_DECEL_RATE,
-  PROP_KEEP_CENTER_ON_RESIZE
+  PROP_KEEP_CENTER_ON_RESIZE,
+  PROP_SHOW_LICENSE
 };
 
 // static guint champlain_view_signals[LAST_SIGNAL] = { 0, };
@@ -74,6 +75,7 @@ struct _ChamplainViewPrivate
   ClutterActor *viewport;
   ClutterActor *finger_scroll;
   ChamplainRectangle viewport_size;
+  ClutterActor *license_actor;
 
   ClutterActor *user_layers;
 
@@ -81,6 +83,7 @@ struct _ChamplainViewPrivate
 
   gboolean offline;
   gboolean keep_center_on_resize;
+  gboolean show_license;
 };
 
 G_DEFINE_TYPE (ChamplainView, champlain_view, CLUTTER_TYPE_GROUP);
@@ -351,6 +354,9 @@ champlain_view_get_property(GObject *object, guint prop_id, GValue *value, GPara
       case PROP_KEEP_CENTER_ON_RESIZE:
         g_value_set_boolean(value, priv->keep_center_on_resize);
         break;
+      case PROP_SHOW_LICENSE:
+        g_value_set_boolean(value, priv->show_license);
+        break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
     }
@@ -387,7 +393,7 @@ champlain_view_set_property(GObject *object, guint prop_id, const GValue *value,
                     resize_viewport(view);
                     clutter_container_remove_actor (CLUTTER_CONTAINER (priv->map_layer), group);
                     clutter_container_add_actor (CLUTTER_CONTAINER (priv->map_layer), priv->map->current_level->group);
-                    champlain_view_center_on(view, priv->latitude, priv->longtitude);
+                    champlain_view_center_on(view, priv->latitude, priv->longitude);
                   }
               }
           }
@@ -438,6 +444,9 @@ champlain_view_set_property(GObject *object, guint prop_id, const GValue *value,
     case PROP_KEEP_CENTER_ON_RESIZE:
       priv->keep_center_on_resize = g_value_get_boolean(value);
       break;
+    case PROP_SHOW_LICENSE:
+      priv->show_license = g_value_get_boolean(value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
   }
@@ -574,6 +583,21 @@ champlain_view_class_init (ChamplainViewClass *champlainViewClass)
                                                          "upon resizing",
                                                          TRUE,
                                                          CHAMPLAIN_PARAM_READWRITE));
+  /**
+  * ChamplainView:show-license:
+  *
+  * Show the license on the map view.  The license information should always be available 
+  * in a way or another in your application.  You can have it in About, or on the map. 
+  *
+  * Since: 0.2.8
+  */
+  g_object_class_install_property (object_class,
+                                   PROP_SHOW_LICENSE,
+                                   g_param_spec_boolean ("show-license",
+                                                         "Show the map data license",
+                                                         "Show the map data license on the map view",
+                                                         TRUE,
+                                                         CHAMPLAIN_PARAM_READWRITE));
 }
 
 static void
@@ -726,6 +750,12 @@ champlain_view_new (ChamplainViewMode mode)
                     "button-press-event",
                     G_CALLBACK (finger_scroll_clicked),
                     view);
+  // License layer 
+  priv->license_actor = clutter_group_new();
+  clutter_actor_show(priv->license_actor);
+  clutter_container_add_actor (CLUTTER_CONTAINER (priv->stage), priv->license_actor);
+  clutter_actor_raise_top (priv->license_actor);
 
   // Setup user_layers
   priv->user_layers = clutter_group_new();
index e52c81561c165a20325676bb3e739aae7957c422..3c68bbba6fb0b64cc535270091fd115b53470410 100644 (file)
@@ -32,6 +32,8 @@ struct _Map
 {
   guint zoom_levels;
   const gchar *name;
+  const gchar *license;
+  const gchar *license_uri;
   int tile_size;
 
   ZoomLevel *current_level;
@@ -49,8 +51,6 @@ struct _Map
   gchar *(* get_tile_uri) (Map *map, Tile *tile);
 };
 
-
-
 Map *map_new (ChamplainMapSource source);
 
 void map_load_visible_tiles (Map *map, ChamplainRectangle viewport, gboolean offline);
index 333d184d09af856a4e9cc9a16031829227517e73..5e30730628b5e022bed62675660dc4258261f788 100644 (file)
@@ -34,6 +34,8 @@ debugmap_init(Map *map)
 {
   map->name = "Debug";
   map->zoom_levels = 1;
+  map->license = "Map data available under GNU Free Documentation license, Version 1.2 or later";
+  map->license_uri = "http://www.gnu.org/copyleft/fdl.html";
   map->tile_size = 256;
 
   map->get_row_count = debugmap_row_count;
index 6956a2e54b7a76e39906e35d3105a26c789e17f9..220436ba368035f99ae4eaa5760189c1dc80309c 100644 (file)
@@ -41,6 +41,8 @@ void
 mff_relief_init(Map *map)
 {
   map->name = "Maps For Free Relief";
+  map->license = "Map data available under GNU Free Documentation license, Version 1.2 or later";
+  map->license_uri = "http://www.gnu.org/copyleft/fdl.html";
   map->zoom_levels = 11;
   map->tile_size = 256;
 
index 9cb0e8883fc6ed20b5697faafcf4a98e30dfb21f..de72b5d9da4c429c1622d4138f8af6eb8015f7b3 100644 (file)
@@ -38,6 +38,8 @@ void
 oam_init(Map *map)
 {
   map->name = "OpenArialMap";
+  map->license = "Map data is CC BY 3.0 by OpenArialMap Contributors";
+  map->license_uri = "http://creativecommons.org/licenses/by/3.0/";
   map->zoom_levels = 17;
   map->tile_size = 256;
 
index 1425e53fd373e54efe724c47d37a38c0ca73c976..45dda6e35a5c67474c966cc802b205f952341576 100644 (file)
@@ -41,6 +41,8 @@ void
 osm_mapnik_init(Map *map)
 {
   map->name = "OpenStreetMap";
+  map->license = "Map data is CC BY-SA 2.0 by OpenStreetMap Contributors";
+  map->license_uri = "http://creativecommons.org/licenses/by-sa/2.0/";
   map->zoom_levels = 18;
   map->tile_size = 256;