[libchamplain] Add ChamplainMemphisMapSource to the factory



commit fa6367d7827c5248e4236e30b001f9f5b2d65050
Author: Simon Wenner <simon wenner ch>
Date:   Tue Jun 23 14:26:24 2009 +0200

    Add ChamplainMemphisMapSource to the factory

 champlain/champlain-map-source-factory.c |   42 ++++++++++++++++++++++++++++++
 champlain/champlain-map-source-factory.h |    3 ++
 champlain/champlain.h                    |    1 +
 3 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlain-map-source-factory.c b/champlain/champlain-map-source-factory.c
index 2141d2c..d78bebb 100644
--- a/champlain/champlain-map-source-factory.c
+++ b/champlain/champlain-map-source-factory.c
@@ -76,6 +76,10 @@ struct _ChamplainMapSourceFactoryPrivate
 static ChamplainMapSource * champlain_map_source_new_generic (
      ChamplainMapSourceDesc *desc, gpointer data);
 
+#ifdef MEMPHIS_ENABLED
+static ChamplainMapSource * champlain_map_source_new_memphis (
+    ChamplainMapSourceDesc *desc, gpointer user_data);
+#endif
 
 static void
 champlain_map_source_factory_get_property (GObject *object,
@@ -248,6 +252,23 @@ ChamplainMapSourceDesc MFF_RELIEF_DESC =
     NULL
   };
 
+#ifdef MEMPHIS_ENABLED
+static
+ChamplainMapSourceDesc MEMPHIS_LOCAL_DESC =
+  {
+    CHAMPLAIN_MAP_SOURCE_MEMPHIS_LOCAL,
+    "OpenStreetMap Memphis Local Map",
+    "(CC) BY 2.0 OpenStreetMap contributors",
+    "http://creativecommons.org/licenses/by/2.0/";,
+    12,
+    18,
+    CHAMPLAIN_MAP_PROJECTION_MERCATOR,
+    champlain_map_source_new_memphis,
+    "",
+    NULL
+  };
+#endif
+
 static void
 champlain_map_source_factory_init (ChamplainMapSourceFactory *factory)
 {
@@ -271,6 +292,10 @@ champlain_map_source_factory_init (ChamplainMapSourceFactory *factory)
 #endif
   champlain_map_source_factory_register (factory, &MFF_RELIEF_DESC,
       MFF_RELIEF_DESC.constructor, MFF_RELIEF_DESC.data);
+#ifdef MEMPHIS_ENABLED
+  champlain_map_source_factory_register (factory, &MEMPHIS_LOCAL_DESC,
+      MEMPHIS_LOCAL_DESC.constructor, MEMPHIS_LOCAL_DESC.data);
+#endif
 }
 
 /**
@@ -377,3 +402,20 @@ champlain_map_source_new_generic (
       desc->projection,
       desc->uri_format));
 }
+
+#ifdef MEMPHIS_ENABLED
+static ChamplainMapSource *
+champlain_map_source_new_memphis (ChamplainMapSourceDesc *desc,
+    gpointer user_data)
+{
+  ChamplainMapDataSource *map_data_source;
+
+  if (strcmp (desc->id, CHAMPLAIN_MAP_SOURCE_MEMPHIS_LOCAL) == 0)
+    map_data_source = CHAMPLAIN_MAP_DATA_SOURCE (champlain_local_map_data_source_new ());
+  else
+    return NULL;
+
+  return CHAMPLAIN_MAP_SOURCE (champlain_memphis_map_source_new_full (
+      desc, map_data_source));
+}
+#endif
diff --git a/champlain/champlain-map-source-factory.h b/champlain/champlain-map-source-factory.h
index 49226e9..dca6681 100644
--- a/champlain/champlain-map-source-factory.h
+++ b/champlain/champlain-map-source-factory.h
@@ -73,6 +73,9 @@ champlain_map_source_factory_register (ChamplainMapSourceFactory *factory,
 #define CHAMPLAIN_MAP_SOURCE_OSM_TRANSPORT_MAP "osm-transportmap"
 #define CHAMPLAIN_MAP_SOURCE_OAM "oam"
 #define CHAMPLAIN_MAP_SOURCE_MFF_RELIEF "mff-relief"
+#ifdef MEMPHIS_ENABLED
+#define CHAMPLAIN_MAP_SOURCE_MEMPHIS_LOCAL "memphis-local"
+#endif
 
 G_END_DECLS
 
diff --git a/champlain/champlain.h b/champlain/champlain.h
index dc34633..87be461 100644
--- a/champlain/champlain.h
+++ b/champlain/champlain.h
@@ -44,6 +44,7 @@
 #ifdef MEMPHIS_ENABLED
 #include "champlain/champlain-memphis-map-source.h"
 #include "champlain/champlain-map-data-source.h"
+#include "champlain/champlain-local-map-data-source.h"
 #endif
 
 #undef __CHAMPLAIN_CHAMPLAIN_H_INSIDE__



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]