[libchamplain] Rename MemphisMapSource to MemphisTileSource
- From: Pierre-Luc Beaudoin <plbeaudoin src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libchamplain] Rename MemphisMapSource to MemphisTileSource
- Date: Sun, 24 Jan 2010 20:15:12 +0000 (UTC)
commit b66a51ee2922ba60cab73867e8349a6b90e731a6
Author: JiÅ?Ã Techet <techet gmail com>
Date: Mon Jan 18 01:28:28 2010 +0100
Rename MemphisMapSource to MemphisTileSource
Rename MemphisMapSource to MemphisTileSource to follow the new naming
conventions of map sources
Signed-off-by: JiÅ?Ã Techet <techet gmail com>
champlain/Makefile.am | 6 +-
champlain/champlain-map-source-factory.c | 2 +-
champlain/champlain-memphis-map-source.h | 103 ----------
...ap-source.c => champlain-memphis-tile-source.c} | 214 ++++++++++----------
champlain/champlain-memphis-tile-source.h | 103 ++++++++++
champlain/champlain.h | 2 +-
demos/local-rendering.c | 48 +++---
7 files changed, 239 insertions(+), 239 deletions(-)
---
diff --git a/champlain/Makefile.am b/champlain/Makefile.am
index 30e049d..7b87d66 100644
--- a/champlain/Makefile.am
+++ b/champlain/Makefile.am
@@ -37,7 +37,7 @@ libchamplain_headers = \
champlain-map-source-desc.h \
champlain-polygon.h \
champlain-version.h \
- champlain-memphis-map-source.h \
+ champlain-memphis-tile-source.h \
champlain-map-data-source.h \
champlain-local-map-data-source.h \
champlain-network-map-data-source.h \
@@ -66,7 +66,7 @@ libchamplain_0_5_la_SOURCES = \
champlain-map-source-desc.c \
champlain-point.c \
champlain-polygon.c \
- champlain-memphis-map-source.c \
+ champlain-memphis-tile-source.c \
champlain-map-data-source.c \
champlain-local-map-data-source.c \
champlain-network-map-data-source.c \
@@ -120,7 +120,7 @@ libchamplain_include_HEADERS = \
champlain-polygon.h \
champlain-version.h
champlain-version.h \
- champlain-memphis-map-source.h \
+ champlain-memphis-tile-source.h \
champlain-map-data-source.h \
champlain-local-map-data-source.h \
champlain-network-map-data-source.h \
diff --git a/champlain/champlain-map-source-factory.c b/champlain/champlain-map-source-factory.c
index 90a7de3..d78153b 100644
--- a/champlain/champlain-map-source-factory.c
+++ b/champlain/champlain-map-source-factory.c
@@ -461,7 +461,7 @@ champlain_map_source_new_memphis (ChamplainMapSourceDesc *desc,
else
return NULL;
- return CHAMPLAIN_MAP_SOURCE (champlain_memphis_map_source_new_full (
+ return CHAMPLAIN_MAP_SOURCE (champlain_memphis_tile_source_new_full (
desc->id,
desc->name,
desc->license,
diff --git a/champlain/champlain-memphis-map-source.c b/champlain/champlain-memphis-tile-source.c
similarity index 71%
rename from champlain/champlain-memphis-map-source.c
rename to champlain/champlain-memphis-tile-source.c
index a72a669..f58ded6 100644
--- a/champlain/champlain-memphis-map-source.c
+++ b/champlain/champlain-memphis-tile-source.c
@@ -18,10 +18,10 @@
*/
/**
- * SECTION:champlain-memphis-map-source
+ * SECTION:champlain-memphis-tile-source
* @short_description: A map source that draws tiles locally
*
- * The #ChamplainMemphisMapSource uses the rendering library
+ * The #ChamplainMemphisTileSource uses the rendering library
* <ulink role="online-location" url="https://trac.openstreetmap.ch/trac/memphis/">
* LibMemphis</ulink> to draw <ulink role="online-location" url="http://www.openstreetmap.org/">
* OpenStreetMap</ulink> data. Tiles are rendered in separate threads.
@@ -38,11 +38,11 @@
*
* Rendered tiles are cached. The cache is deleted if the map data or rules
* are changed. This is the default behaviour, but it can be disabled with the
- * #ChamplainMemphisMapSource:persistent-cache property. A persistent cache
+ * #ChamplainMemphisTileSource:persistent-cache property. A persistent cache
* has to be managed by the client application.
*/
-#include "champlain-memphis-map-source.h"
+#include "champlain-memphis-tile-source.h"
#define DEBUG_FLAG CHAMPLAIN_DEBUG_MEMPHIS
#include "champlain-debug.h"
@@ -73,14 +73,14 @@ enum
PROP_MAP_DATA_SOURCE
};
-G_DEFINE_TYPE (ChamplainMemphisMapSource, champlain_memphis_map_source, CHAMPLAIN_TYPE_TILE_SOURCE)
+G_DEFINE_TYPE (ChamplainMemphisTileSource, champlain_memphis_tile_source, CHAMPLAIN_TYPE_TILE_SOURCE)
#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_MEMPHIS_MAP_SOURCE, ChamplainMemphisMapSourcePrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_MEMPHIS_TILE_SOURCE, ChamplainMemphisTileSourcePrivate))
-typedef struct _ChamplainMemphisMapSourcePrivate ChamplainMemphisMapSourcePrivate;
+typedef struct _ChamplainMemphisTileSourcePrivate ChamplainMemphisTileSourcePrivate;
-struct _ChamplainMemphisMapSourcePrivate
+struct _ChamplainMemphisTileSourcePrivate
{
ChamplainMapDataSource *map_data_source;
MemphisRuleSet *rules;
@@ -103,21 +103,21 @@ GStaticRWLock MemphisLock = G_STATIC_RW_LOCK_INIT;
static void fill_tile (ChamplainMapSource *map_source, ChamplainTile *tile);
-static void reload_tiles (ChamplainMemphisMapSource *self);
+static void reload_tiles (ChamplainMemphisTileSource *tile_source);
static void memphis_worker_thread (gpointer data, gpointer user_data);
static void map_data_changed_cb (ChamplainMapDataSource *map_data_source,
GParamSpec *gobject,
- ChamplainMemphisMapSource *map_source);
+ ChamplainMemphisTileSource *tile_source);
void argb_to_rgba(guchar *data, guint size);
static void
-champlain_memphis_map_source_get_property (GObject *object,
+champlain_memphis_tile_source_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
- ChamplainMemphisMapSource *self = CHAMPLAIN_MEMPHIS_MAP_SOURCE (object);
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainMemphisTileSource *tile_source = CHAMPLAIN_MEMPHIS_TILE_SOURCE (object);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
switch (property_id)
{
@@ -130,17 +130,17 @@ champlain_memphis_map_source_get_property (GObject *object,
}
static void
-champlain_memphis_map_source_set_property (GObject *object,
+champlain_memphis_tile_source_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
- ChamplainMemphisMapSource *self = CHAMPLAIN_MEMPHIS_MAP_SOURCE (object);
+ ChamplainMemphisTileSource *tile_source = CHAMPLAIN_MEMPHIS_TILE_SOURCE (object);
switch (property_id)
{
case PROP_MAP_DATA_SOURCE:
- champlain_memphis_map_source_set_map_data_source (self,
+ champlain_memphis_tile_source_set_map_data_source (tile_source,
g_value_get_object (value));
break;
default:
@@ -149,10 +149,10 @@ champlain_memphis_map_source_set_property (GObject *object,
}
static void
-champlain_memphis_map_source_dispose (GObject *object)
+champlain_memphis_tile_source_dispose (GObject *object)
{
- ChamplainMemphisMapSource *self = CHAMPLAIN_MEMPHIS_MAP_SOURCE(object);
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE(self);
+ ChamplainMemphisTileSource *tile_source = CHAMPLAIN_MEMPHIS_TILE_SOURCE(object);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE(tile_source);
if (priv->thpool)
{
@@ -175,44 +175,44 @@ champlain_memphis_map_source_dispose (GObject *object)
priv->rules = NULL;
}
- G_OBJECT_CLASS (champlain_memphis_map_source_parent_class)->dispose (object);
+ G_OBJECT_CLASS (champlain_memphis_tile_source_parent_class)->dispose (object);
}
static void
-champlain_memphis_map_source_finalize (GObject *object)
+champlain_memphis_tile_source_finalize (GObject *object)
{
- G_OBJECT_CLASS (champlain_memphis_map_source_parent_class)->finalize (object);
+ G_OBJECT_CLASS (champlain_memphis_tile_source_parent_class)->finalize (object);
}
static void
-champlain_memphis_map_source_constructed (GObject *object)
+champlain_memphis_tile_source_constructed (GObject *object)
{
ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE(object);
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE(object);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE(object);
memphis_renderer_set_resolution (priv->renderer, champlain_map_source_get_tile_size(map_source));
- G_OBJECT_CLASS (champlain_memphis_map_source_parent_class)->constructed (object);
+ G_OBJECT_CLASS (champlain_memphis_tile_source_parent_class)->constructed (object);
}
static void
-champlain_memphis_map_source_class_init (ChamplainMemphisMapSourceClass *klass)
+champlain_memphis_tile_source_class_init (ChamplainMemphisTileSourceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ChamplainMapSourceClass *map_source_class = CHAMPLAIN_MAP_SOURCE_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainMemphisMapSourcePrivate));
+ g_type_class_add_private (klass, sizeof (ChamplainMemphisTileSourcePrivate));
- object_class->get_property = champlain_memphis_map_source_get_property;
- object_class->set_property = champlain_memphis_map_source_set_property;
- object_class->dispose = champlain_memphis_map_source_dispose;
- object_class->finalize = champlain_memphis_map_source_finalize;
- object_class->constructed = champlain_memphis_map_source_constructed;
+ object_class->get_property = champlain_memphis_tile_source_get_property;
+ object_class->set_property = champlain_memphis_tile_source_set_property;
+ object_class->dispose = champlain_memphis_tile_source_dispose;
+ object_class->finalize = champlain_memphis_tile_source_finalize;
+ object_class->constructed = champlain_memphis_tile_source_constructed;
map_source_class->fill_tile = fill_tile;
/**
- * ChamplainMemphisMapSource:map-data-source:
+ * ChamplainMemphisTileSource:map-data-source:
*
* The data source of the renderer
*
@@ -228,9 +228,9 @@ champlain_memphis_map_source_class_init (ChamplainMemphisMapSourceClass *klass)
}
static void
-champlain_memphis_map_source_init (ChamplainMemphisMapSource *self)
+champlain_memphis_tile_source_init (ChamplainMemphisTileSource *tile_source)
{
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE(self);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE(tile_source);
priv->map_data_source = NULL;
priv->rules = NULL;
@@ -243,12 +243,12 @@ champlain_memphis_map_source_init (ChamplainMemphisMapSource *self)
priv->renderer = memphis_renderer_new_full (priv->rules, memphis_map_new ());
- priv->thpool = g_thread_pool_new (memphis_worker_thread, self,
+ priv->thpool = g_thread_pool_new (memphis_worker_thread, tile_source,
MAX_THREADS, FALSE, NULL);
}
/**
- * champlain_memphis_map_source_new_full:
+ * champlain_memphis_tile_source_new_full:
* @id: the map source's id
* @name: the map source's name
* @license: the map source's license
@@ -259,11 +259,11 @@ champlain_memphis_map_source_init (ChamplainMemphisMapSource *self)
* @projection: the map source's projection
* @map_data_source: a #ChamplainMapDataSource
*
- * Returns: a new ChamplainMemphisMapSource.
+ * Returns: a new ChamplainMemphisTileSource.
*
* Since: 0.6
*/
-ChamplainMemphisMapSource* champlain_memphis_map_source_new_full (const gchar *id,
+ChamplainMemphisTileSource* champlain_memphis_tile_source_new_full (const gchar *id,
const gchar *name,
const gchar *license,
const gchar *license_uri,
@@ -275,7 +275,7 @@ ChamplainMemphisMapSource* champlain_memphis_map_source_new_full (const gchar *i
{
g_return_val_if_fail (CHAMPLAIN_IS_MAP_DATA_SOURCE (map_data_source), NULL);
- return g_object_new (CHAMPLAIN_TYPE_MEMPHIS_MAP_SOURCE,
+ return g_object_new (CHAMPLAIN_TYPE_MEMPHIS_TILE_SOURCE,
"id", id,
"name", name,
"license", license,
@@ -291,13 +291,13 @@ ChamplainMemphisMapSource* champlain_memphis_map_source_new_full (const gchar *i
static void
map_data_changed_cb (ChamplainMapDataSource *map_data_source,
GParamSpec *gobject,
- ChamplainMemphisMapSource *map_source)
+ ChamplainMemphisTileSource *tile_source)
{
g_assert (CHAMPLAIN_IS_MAP_DATA_SOURCE (map_data_source) &&
- CHAMPLAIN_IS_MEMPHIS_MAP_SOURCE (map_source));
+ CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source));
MemphisMap *map;
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE(map_source);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE(tile_source);
ChamplainState state;
g_object_get (G_OBJECT (map_data_source), "state", &state, NULL);
@@ -319,7 +319,7 @@ map_data_changed_cb (ChamplainMapDataSource *map_data_source,
memphis_renderer_set_map (priv->renderer, map);
g_static_rw_lock_writer_unlock (&MemphisLock);
- reload_tiles (map_source);
+ reload_tiles (tile_source);
}
/*
@@ -448,9 +448,9 @@ memphis_worker_thread (gpointer data, gpointer user_data)
static void
fill_tile (ChamplainMapSource *map_source, ChamplainTile *tile)
{
- g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_MAP_SOURCE (map_source));
+ g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (map_source));
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE(map_source);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE(map_source);
DEBUG ("Render tile (%u, %u, %u)", champlain_tile_get_x (tile),
champlain_tile_get_y (tile),
@@ -486,12 +486,12 @@ fill_tile (ChamplainMapSource *map_source, ChamplainTile *tile)
}
static void
-reload_tiles (ChamplainMemphisMapSource *self)
+reload_tiles (ChamplainMemphisTileSource *tile_source)
{
- g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_MAP_SOURCE (self));
+ g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source));
- ChamplainTileSource *tile_source = CHAMPLAIN_TILE_SOURCE(self);
- ChamplainTileCache *tile_cache = champlain_tile_source_get_cache(tile_source);
+ ChamplainTileSource *tile_src = CHAMPLAIN_TILE_SOURCE(tile_source);
+ ChamplainTileCache *tile_cache = champlain_tile_source_get_cache(tile_src);
if (tile_cache && !champlain_tile_cache_get_persistent(tile_cache))
{
@@ -500,13 +500,13 @@ reload_tiles (ChamplainMemphisMapSource *self)
champlain_tile_cache_clean (tile_cache);
}
- g_signal_emit_by_name (CHAMPLAIN_MAP_SOURCE (self),
+ g_signal_emit_by_name (CHAMPLAIN_MAP_SOURCE (tile_src),
"reload-tiles", NULL);
}
/**
- * champlain_memphis_map_source_load_rules:
- * @map_source: a #ChamplainMemphisMapSource
+ * champlain_memphis_tile_source_load_rules:
+ * @tile_source: a #ChamplainMemphisTileSource
* @rules_path: a path to a rules file
*
* Loads a Memphis rules file.
@@ -514,11 +514,11 @@ reload_tiles (ChamplainMemphisMapSource *self)
* Since: 0.6
*/
void
-champlain_memphis_map_source_load_rules (
- ChamplainMemphisMapSource *self,
+champlain_memphis_tile_source_load_rules (
+ ChamplainMemphisTileSource *tile_source,
const gchar *rules_path)
{
- g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_MAP_SOURCE (self));
+ g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source));
// TODO: Remove test when memphis handles invalid paths properly
if (!g_file_test (rules_path, G_FILE_TEST_EXISTS))
@@ -527,7 +527,7 @@ champlain_memphis_map_source_load_rules (
return;
}
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
g_static_rw_lock_writer_lock (&MemphisLock);
if (rules_path)
@@ -537,12 +537,12 @@ champlain_memphis_map_source_load_rules (
strlen (default_rules));
g_static_rw_lock_writer_unlock (&MemphisLock);
- reload_tiles (self);
+ reload_tiles (tile_source);
}
/**
- * champlain_memphis_map_source_set_map_data_source:
- * @map_source: a #ChamplainMemphisMapSource
+ * champlain_memphis_tile_source_set_map_data_source:
+ * @tile_source: a #ChamplainMemphisTileSource
* @map_data_source: a #ChamplainMapDataSource
*
* Sets the map data source.
@@ -550,14 +550,14 @@ champlain_memphis_map_source_load_rules (
* Since: 0.6
*/
void
-champlain_memphis_map_source_set_map_data_source (
- ChamplainMemphisMapSource *self,
+champlain_memphis_tile_source_set_map_data_source (
+ ChamplainMemphisTileSource *tile_source,
ChamplainMapDataSource *map_data_source)
{
- g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_MAP_SOURCE (self) &&
+ g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source) &&
CHAMPLAIN_IS_MAP_DATA_SOURCE (map_data_source));
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
MemphisMap *map;
if (priv->map_data_source)
@@ -566,7 +566,7 @@ champlain_memphis_map_source_set_map_data_source (
priv->map_data_source = g_object_ref_sink(map_data_source);
g_signal_connect (priv->map_data_source, "notify::state",
- G_CALLBACK (map_data_changed_cb), self);
+ G_CALLBACK (map_data_changed_cb), tile_source);
map = champlain_map_data_source_get_map_data (priv->map_data_source);
if (map == NULL)
@@ -583,38 +583,38 @@ champlain_memphis_map_source_set_map_data_source (
}
/**
- * champlain_memphis_map_source_get_map_data_source:
- * @map_source: a #ChamplainMemphisMapSource
+ * champlain_memphis_tile_source_get_map_data_source:
+ * @map_source: a #ChamplainMemphisTileSource
*
* Returns the #ChamplainMapDataSource.
*
* Since: 0.6
*/
ChamplainMapDataSource *
-champlain_memphis_map_source_get_map_data_source (
- ChamplainMemphisMapSource *self)
+champlain_memphis_tile_source_get_map_data_source (
+ ChamplainMemphisTileSource *tile_source)
{
- g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_MAP_SOURCE (self), NULL);
+ g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source), NULL);
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
return priv->map_data_source;
}
/**
- * champlain_memphis_map_source_get_background_color:
- * @map_source: a #ChamplainMemphisMapSource
+ * champlain_memphis_tile_source_get_background_color:
+ * @map_source: a #ChamplainMemphisTileSource
*
* Returns the background color of the map as a newly-allocated
* #ClutterColor.
*
* Since: 0.6
*/
-ClutterColor * champlain_memphis_map_source_get_background_color (
- ChamplainMemphisMapSource *self)
+ClutterColor * champlain_memphis_tile_source_get_background_color (
+ ChamplainMemphisTileSource *tile_source)
{
- g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_MAP_SOURCE (self), NULL);
+ g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source), NULL);
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
ClutterColor color;
guint8 r, b, g, a;
@@ -630,8 +630,8 @@ ClutterColor * champlain_memphis_map_source_get_background_color (
}
/**
- * champlain_memphis_map_source_set_background_color:
- * @map_source: a #ChamplainMemphisMapSource
+ * champlain_memphis_tile_source_set_background_color:
+ * @map_source: a #ChamplainMemphisTileSource
* @color: a #ClutterColor
*
* Sets the background color of the map from a #ClutterColor.
@@ -639,25 +639,25 @@ ClutterColor * champlain_memphis_map_source_get_background_color (
* Since: 0.6
*/
void
-champlain_memphis_map_source_set_background_color (
- ChamplainMemphisMapSource *self,
+champlain_memphis_tile_source_set_background_color (
+ ChamplainMemphisTileSource *tile_source,
const ClutterColor *color)
{
- g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_MAP_SOURCE (self));
+ g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source));
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
g_static_rw_lock_writer_lock (&MemphisLock);
memphis_rule_set_set_bg_color (priv->rules, color->red,
color->green, color->blue, color->alpha);
g_static_rw_lock_writer_unlock (&MemphisLock);
- reload_tiles (self);
+ reload_tiles (tile_source);
}
/**
- * champlain_memphis_map_source_set_rule:
- * @map_source: a #ChamplainMemphisMapSource
+ * champlain_memphis_tile_source_set_rule:
+ * @map_source: a #ChamplainMemphisTileSource
* @rule: a #MemphisRule
*
* Edits or adds a #MemphisRule to the rules-set. New rules are appended
@@ -666,24 +666,24 @@ champlain_memphis_map_source_set_background_color (
* Since: 0.6
*/
void
-champlain_memphis_map_source_set_rule (ChamplainMemphisMapSource *self,
+champlain_memphis_tile_source_set_rule (ChamplainMemphisTileSource *tile_source,
MemphisRule *rule)
{
- g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_MAP_SOURCE (self) &&
+ g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source) &&
MEMPHIS_RULE (rule));
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
g_static_rw_lock_writer_lock (&MemphisLock);
memphis_rule_set_set_rule (priv->rules, rule);
g_static_rw_lock_writer_unlock (&MemphisLock);
- reload_tiles (self);
+ reload_tiles (tile_source);
}
/**
- * champlain_memphis_map_source_get_rule:
- * @map_source: a #ChamplainMemphisMapSource
+ * champlain_memphis_tile_source_get_rule:
+ * @map_source: a #ChamplainMemphisTileSource
* @id: an id string
*
* Returns the requested #MemphisRule or NULL if none is found.
@@ -691,13 +691,13 @@ champlain_memphis_map_source_set_rule (ChamplainMemphisMapSource *self,
* Since: 0.6
*/
MemphisRule *
-champlain_memphis_map_source_get_rule (ChamplainMemphisMapSource *self,
+champlain_memphis_tile_source_get_rule (ChamplainMemphisTileSource *tile_source,
const gchar *id)
{
- g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_MAP_SOURCE (self) &&
+ g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source) &&
id != NULL, NULL);
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
MemphisRule *rule;
g_static_rw_lock_reader_lock (&MemphisLock);
@@ -708,8 +708,8 @@ champlain_memphis_map_source_get_rule (ChamplainMemphisMapSource *self,
}
/**
- * champlain_memphis_map_source_get_rule_ids:
- * @map_source: a #ChamplainMemphisMapSource
+ * champlain_memphis_tile_source_get_rule_ids:
+ * @map_source: a #ChamplainMemphisTileSource
*
* Returns a #GList of id strings of the form:
* key1|key2|...|keyN:value1|value2|...|valueM
@@ -719,11 +719,11 @@ champlain_memphis_map_source_get_rule (ChamplainMemphisMapSource *self,
* Since: 0.6
*/
GList *
-champlain_memphis_map_source_get_rule_ids (ChamplainMemphisMapSource *self)
+champlain_memphis_tile_source_get_rule_ids (ChamplainMemphisTileSource *tile_source)
{
- g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_MAP_SOURCE (self), NULL);
+ g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source), NULL);
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
GList *list;
g_static_rw_lock_reader_lock (&MemphisLock);
@@ -734,25 +734,25 @@ champlain_memphis_map_source_get_rule_ids (ChamplainMemphisMapSource *self)
}
/**
- * champlain_memphis_map_source_remove_rule:
- * @map_source: a #ChamplainMemphisMapSource
+ * champlain_memphis_tile_source_remove_rule:
+ * @map_source: a #ChamplainMemphisTileSource
* @id: an id string
*
* Removes the rule with the given id.
*
* Since: 0.6
*/
-void champlain_memphis_map_source_remove_rule (
- ChamplainMemphisMapSource *self,
+void champlain_memphis_tile_source_remove_rule (
+ ChamplainMemphisTileSource *tile_source,
const gchar *id)
{
- g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_MAP_SOURCE (self));
+ g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source));
- ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
g_static_rw_lock_writer_lock (&MemphisLock);
memphis_rule_set_remove_rule (priv->rules, id);
g_static_rw_lock_writer_unlock (&MemphisLock);
- reload_tiles (self);
+ reload_tiles (tile_source);
}
diff --git a/champlain/champlain-memphis-tile-source.h b/champlain/champlain-memphis-tile-source.h
new file mode 100644
index 0000000..ee037c9
--- /dev/null
+++ b/champlain/champlain-memphis-tile-source.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2009 Simon Wenner <simon wenner ch>
+ * Copyright (C) 2010 Jiri Techet <techet gmail com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _CHAMPLAIN_MEMPHIS_TILE_SOURCE
+#define _CHAMPLAIN_MEMPHIS_TILE_SOURCE
+
+#include <champlain/champlain-tile-source.h>
+#include <champlain/champlain-map-data-source.h>
+#include <memphis/memphis.h>
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define CHAMPLAIN_TYPE_MEMPHIS_TILE_SOURCE champlain_memphis_tile_source_get_type()
+
+#define CHAMPLAIN_MEMPHIS_TILE_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_MEMPHIS_TILE_SOURCE, ChamplainMemphisTileSource))
+
+#define CHAMPLAIN_MEMPHIS_TILE_SOURCE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_MEMPHIS_TILE_SOURCE, ChamplainMemphisTileSourceClass))
+
+#define CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_MEMPHIS_TILE_SOURCE))
+
+#define CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_MEMPHIS_TILE_SOURCE))
+
+#define CHAMPLAIN_MEMPHIS_TILE_SOURCE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_MEMPHIS_TILE_SOURCE, ChamplainMemphisTileSourceClass))
+
+typedef struct {
+ ChamplainTileSource parent;
+} ChamplainMemphisTileSource;
+
+typedef struct {
+ ChamplainTileSourceClass parent_class;
+} ChamplainMemphisTileSourceClass;
+
+GType champlain_memphis_tile_source_get_type (void);
+
+ChamplainMemphisTileSource* champlain_memphis_tile_source_new_full (const gchar *id,
+ const gchar *name,
+ const gchar *license,
+ const gchar *license_uri,
+ guint min_zoom,
+ guint max_zoom,
+ guint tile_size,
+ ChamplainMapProjection projection,
+ ChamplainMapDataSource *map_data_source);
+
+void champlain_memphis_tile_source_load_rules (
+ ChamplainMemphisTileSource *tile_source,
+ const gchar *rules_path);
+
+void champlain_memphis_tile_source_set_map_data_source (
+ ChamplainMemphisTileSource *tile_source,
+ ChamplainMapDataSource *map_data_source);
+
+ChamplainMapDataSource * champlain_memphis_tile_source_get_map_data_source (
+ ChamplainMemphisTileSource *tile_source);
+
+ClutterColor * champlain_memphis_tile_source_get_background_color (
+ ChamplainMemphisTileSource *tile_source);
+
+void champlain_memphis_tile_source_set_background_color (
+ ChamplainMemphisTileSource *tile_source,
+ const ClutterColor *color);
+
+GList * champlain_memphis_tile_source_get_rule_ids (
+ ChamplainMemphisTileSource *tile_source);
+
+void champlain_memphis_tile_source_set_rule (
+ ChamplainMemphisTileSource *tile_source,
+ MemphisRule *rule);
+
+MemphisRule * champlain_memphis_tile_source_get_rule (
+ ChamplainMemphisTileSource *tile_source,
+ const gchar *id);
+
+void champlain_memphis_tile_source_remove_rule (
+ ChamplainMemphisTileSource *tile_source,
+ const gchar *id);
+
+G_END_DECLS
+
+#endif /* _CHAMPLAIN_MEMPHIS_TILE_SOURCE */
diff --git a/champlain/champlain.h b/champlain/champlain.h
index 43fd5ba..27cafaa 100644
--- a/champlain/champlain.h
+++ b/champlain/champlain.h
@@ -45,7 +45,7 @@
#include "champlain/champlain-error-tile-source.h"
#include "champlain/champlain-map-source-factory.h"
#include "champlain/champlain-version.h"
-#include "champlain/champlain-memphis-map-source.h"
+#include "champlain/champlain-memphis-tile-source.h"
#include "champlain/champlain-map-data-source.h"
#include "champlain/champlain-local-map-data-source.h"
#include "champlain/champlain-network-map-data-source.h"
diff --git a/demos/local-rendering.c b/demos/local-rendering.c
index c2d4034..971fb79 100644
--- a/demos/local-rendering.c
+++ b/demos/local-rendering.c
@@ -96,8 +96,8 @@ load_local_map_data (ChamplainMapSource *source)
ChamplainLocalMapDataSource *map_data_source;
map_data_source = CHAMPLAIN_LOCAL_MAP_DATA_SOURCE (
- champlain_memphis_map_source_get_map_data_source (
- CHAMPLAIN_MEMPHIS_MAP_SOURCE (source)));
+ champlain_memphis_tile_source_get_map_data_source (
+ CHAMPLAIN_MEMPHIS_TILE_SOURCE (source)));
champlain_local_map_data_source_load_map_data (map_data_source,
maps[map_index]);
@@ -110,8 +110,8 @@ load_network_map_data (ChamplainMapSource *source, ChamplainView *view)
gdouble lat, lon;
map_data_source = CHAMPLAIN_NETWORK_MAP_DATA_SOURCE (
- champlain_memphis_map_source_get_map_data_source (
- CHAMPLAIN_MEMPHIS_MAP_SOURCE (source)));
+ champlain_memphis_tile_source_get_map_data_source (
+ CHAMPLAIN_MEMPHIS_TILE_SOURCE (source)));
g_signal_connect (map_data_source, "notify::state", G_CALLBACK (data_source_state_changed),
map_data_state_img);
@@ -131,11 +131,11 @@ load_rules_into_gui (ChamplainView *view)
GdkColor gdk_color;
ClutterColor *clutter_color;
- ids = champlain_memphis_map_source_get_rule_ids (
- CHAMPLAIN_MEMPHIS_MAP_SOURCE(tile_source));
+ ids = champlain_memphis_tile_source_get_rule_ids (
+ CHAMPLAIN_MEMPHIS_TILE_SOURCE(tile_source));
- clutter_color = champlain_memphis_map_source_get_background_color (
- CHAMPLAIN_MEMPHIS_MAP_SOURCE(tile_source));
+ clutter_color = champlain_memphis_tile_source_get_background_color (
+ CHAMPLAIN_MEMPHIS_TILE_SOURCE(tile_source));
color_clutter_to_gdk (clutter_color, &gdk_color);
clutter_color_free (clutter_color);
@@ -166,7 +166,7 @@ rule_window_close_cb (GtkWidget *widget, gpointer data)
}
static void
-rule_apply_cb (GtkWidget *widget, ChamplainMemphisMapSource *source)
+rule_apply_cb (GtkWidget *widget, ChamplainMemphisTileSource *source)
{
MemphisRule *rule = current_rule;
GdkColor color;
@@ -211,7 +211,7 @@ rule_apply_cb (GtkWidget *widget, ChamplainMemphisMapSource *source)
rule->text->z_max = gtk_spin_button_get_value (GTK_SPIN_BUTTON (textmaxz));
}
- champlain_memphis_map_source_set_rule (source, rule);
+ champlain_memphis_tile_source_set_rule (source, rule);
}
GtkWidget *
@@ -274,7 +274,7 @@ gtk_memphis_prop_new (gint type, MemphisRuleAttr *attr)
static void
create_rule_edit_window (MemphisRule *rule, gchar* id,
- ChamplainMemphisMapSource *source)
+ ChamplainMemphisTileSource *source)
{
GtkWidget *label, *table, *props, *button;
@@ -361,7 +361,7 @@ zoom_to_map_data (GtkWidget *widget, ChamplainView *view)
ChamplainBoundingBox *bbox;
gdouble lat, lon;
- data_source = champlain_memphis_map_source_get_map_data_source (CHAMPLAIN_MEMPHIS_MAP_SOURCE(tile_source));
+ data_source = champlain_memphis_tile_source_get_map_data_source (CHAMPLAIN_MEMPHIS_TILE_SOURCE(tile_source));
g_object_get (G_OBJECT (data_source), "bounding-box", &bbox, NULL);
champlain_bounding_box_get_center (bbox, &lat, &lon);
@@ -379,8 +379,8 @@ request_osm_data_cb (GtkWidget *widget, ChamplainView *view)
{
ChamplainNetworkMapDataSource *data_source =
CHAMPLAIN_NETWORK_MAP_DATA_SOURCE (
- champlain_memphis_map_source_get_map_data_source (
- CHAMPLAIN_MEMPHIS_MAP_SOURCE(tile_source)));
+ champlain_memphis_tile_source_get_map_data_source (
+ CHAMPLAIN_MEMPHIS_TILE_SOURCE(tile_source)));
champlain_network_map_data_source_load_map_data (data_source,
lon - 0.008, lat - 0.008, lon + 0.008, lat + 0.008);
@@ -399,8 +399,8 @@ bg_color_set_cb (GtkColorButton *widget, ChamplainView *view)
ClutterColor clutter_color;
color_gdk_to_clutter (&gdk_color, &clutter_color);
- champlain_memphis_map_source_set_background_color (
- CHAMPLAIN_MEMPHIS_MAP_SOURCE (tile_source), &clutter_color);
+ champlain_memphis_tile_source_set_background_color (
+ CHAMPLAIN_MEMPHIS_TILE_SOURCE (tile_source), &clutter_color);
}
}
@@ -432,8 +432,8 @@ map_source_changed (GtkWidget *widget, ChamplainView *view)
if (g_strcmp0 (id, "memphis-local") == 0)
{
- champlain_memphis_map_source_load_rules (
- CHAMPLAIN_MEMPHIS_MAP_SOURCE (source), rules[rules_index]);
+ champlain_memphis_tile_source_load_rules (
+ CHAMPLAIN_MEMPHIS_TILE_SOURCE (source), rules[rules_index]);
load_local_map_data (source);
gtk_widget_hide_all (memphis_box);
gtk_widget_set_no_show_all (memphis_box, FALSE);
@@ -443,8 +443,8 @@ map_source_changed (GtkWidget *widget, ChamplainView *view)
}
else if (g_strcmp0 (id, "memphis-network") == 0)
{
- champlain_memphis_map_source_load_rules (
- CHAMPLAIN_MEMPHIS_MAP_SOURCE (source), rules[rules_index]);
+ champlain_memphis_tile_source_load_rules (
+ CHAMPLAIN_MEMPHIS_TILE_SOURCE (source), rules[rules_index]);
load_network_map_data (source, view);
gtk_widget_hide_all (memphis_box);
gtk_widget_set_no_show_all (memphis_box, FALSE);
@@ -516,8 +516,8 @@ rules_changed (GtkWidget *widget, ChamplainView *view)
if (strncmp (champlain_map_source_get_id (tile_source), "memphis", 7) == 0)
{
- champlain_memphis_map_source_load_rules (
- CHAMPLAIN_MEMPHIS_MAP_SOURCE (tile_source),
+ champlain_memphis_tile_source_load_rules (
+ CHAMPLAIN_MEMPHIS_TILE_SOURCE (tile_source),
file);
load_rules_into_gui (view);
}
@@ -663,10 +663,10 @@ void list_item_selected_cb (GtkTreeView *tree_view,
{
gtk_tree_model_get (model, &iter, 0, &id, -1);
- rule = champlain_memphis_map_source_get_rule (CHAMPLAIN_MEMPHIS_MAP_SOURCE(tile_source), id);
+ rule = champlain_memphis_tile_source_get_rule (CHAMPLAIN_MEMPHIS_TILE_SOURCE(tile_source), id);
if (rule != NULL)
- create_rule_edit_window (rule, id, CHAMPLAIN_MEMPHIS_MAP_SOURCE(tile_source));
+ create_rule_edit_window (rule, id, CHAMPLAIN_MEMPHIS_TILE_SOURCE(tile_source));
g_free (id);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]