diff options
-rw-r--r-- | champlain/champlain-file-cache.c | 25 | ||||
-rw-r--r-- | champlain/champlain-file-cache.h | 4 | ||||
-rw-r--r-- | champlain/champlain-file-tile-source.c | 18 | ||||
-rw-r--r-- | champlain/champlain-file-tile-source.h | 3 | ||||
-rw-r--r-- | champlain/champlain-map-source-factory.c | 28 | ||||
-rw-r--r-- | champlain/champlain-memory-cache.c | 11 | ||||
-rw-r--r-- | champlain/champlain-memory-cache.h | 3 | ||||
-rw-r--r-- | champlain/champlain-network-bbox-tile-source.c | 4 | ||||
-rw-r--r-- | champlain/champlain-network-bbox-tile-source.h | 3 | ||||
-rw-r--r-- | champlain/champlain-network-tile-source.c | 20 | ||||
-rw-r--r-- | champlain/champlain-network-tile-source.h | 3 | ||||
-rw-r--r-- | champlain/champlain-null-tile-source.c | 6 | ||||
-rw-r--r-- | champlain/champlain-null-tile-source.h | 2 | ||||
-rw-r--r-- | demos/local-rendering.c | 2 |
14 files changed, 69 insertions, 63 deletions
diff --git a/champlain/champlain-file-cache.c b/champlain/champlain-file-cache.c index 3aab7c7..4c019ab 100644 --- a/champlain/champlain-file-cache.c +++ b/champlain/champlain-file-cache.c @@ -357,21 +357,6 @@ champlain_file_cache_init (ChamplainFileCache *file_cache) } /** - * champlain_file_cache_new: - * - * Default constructor of #ChamplainFileCache. - * - * Returns: a constructed cache of maximal size 100000000 B inside - * ~/.cache/champlain. - * - * Since: 0.6 - */ -ChamplainFileCache* champlain_file_cache_new (void) -{ - return CHAMPLAIN_FILE_CACHE (g_object_new (CHAMPLAIN_TYPE_FILE_CACHE, NULL)); -} - -/** * champlain_file_cache_new_full: * @size_limit: maximal size of the cache in bytes * @cache_dir: the directory where the cache is created. For temporary caches @@ -385,11 +370,15 @@ ChamplainFileCache* champlain_file_cache_new (void) * Since: 0.6 */ ChamplainFileCache* champlain_file_cache_new_full (guint size_limit, - const gchar *cache_dir) + const gchar *cache_dir, + ChamplainRenderer *renderer) { ChamplainFileCache * cache; - cache = g_object_new (CHAMPLAIN_TYPE_FILE_CACHE, "size-limit", size_limit, - "cache-dir", cache_dir, NULL); + cache = g_object_new (CHAMPLAIN_TYPE_FILE_CACHE, + "size-limit", size_limit, + "cache-dir", cache_dir, + "renderer", renderer, + NULL); return cache; } diff --git a/champlain/champlain-file-cache.h b/champlain/champlain-file-cache.h index 39243b1..a25c270 100644 --- a/champlain/champlain-file-cache.h +++ b/champlain/champlain-file-cache.h @@ -55,9 +55,9 @@ struct _ChamplainFileCacheClass GType champlain_file_cache_get_type (void); -ChamplainFileCache* champlain_file_cache_new (void); ChamplainFileCache* champlain_file_cache_new_full (guint size_limit, - const gchar *cache_dir); + const gchar *cache_dir, + ChamplainRenderer *renderer); guint champlain_file_cache_get_size_limit (ChamplainFileCache *file_cache); void champlain_file_cache_set_size_limit (ChamplainFileCache *file_cache, diff --git a/champlain/champlain-file-tile-source.c b/champlain/champlain-file-tile-source.c index aba3f5c..6978175 100644 --- a/champlain/champlain-file-tile-source.c +++ b/champlain/champlain-file-tile-source.c @@ -86,13 +86,21 @@ champlain_file_tile_source_new_full (const gchar *id, guint min_zoom, guint max_zoom, guint tile_size, - ChamplainMapProjection projection) + ChamplainMapProjection projection, + ChamplainRenderer *renderer) { ChamplainFileTileSource * source; - source = g_object_new (CHAMPLAIN_TYPE_FILE_TILE_SOURCE, "id", id, - "name", name, "license", license, "license-uri", license_uri, - "min-zoom-level", min_zoom, "max-zoom-level", max_zoom, - "tile-size", tile_size, "projection", projection, NULL); + source = g_object_new (CHAMPLAIN_TYPE_FILE_TILE_SOURCE, + "id", id, + "name", name, + "license", license, + "license-uri", license_uri, + "min-zoom-level", min_zoom, + "max-zoom-level", max_zoom, + "tile-size", tile_size, + "projection", projection, + "renderer", renderer, + NULL); return source; } diff --git a/champlain/champlain-file-tile-source.h b/champlain/champlain-file-tile-source.h index 6276772..d022252 100644 --- a/champlain/champlain-file-tile-source.h +++ b/champlain/champlain-file-tile-source.h @@ -66,7 +66,8 @@ champlain_file_tile_source_new_full (const gchar *id, guint min_zoom, guint max_zoom, guint tile_size, - ChamplainMapProjection projection); + ChamplainMapProjection projection, + ChamplainRenderer *renderer); void champlain_file_tile_source_load_map_data ( ChamplainFileTileSource *map_data_source, diff --git a/champlain/champlain-map-source-factory.c b/champlain/champlain-map-source-factory.c index 518b964..eec7f84 100644 --- a/champlain/champlain-map-source-factory.c +++ b/champlain/champlain-map-source-factory.c @@ -409,13 +409,15 @@ champlain_map_source_factory_create_cached_source (ChamplainMapSourceFactory *fa ChamplainMapSource *error_source; ChamplainMapSource *file_cache; guint tile_size; + ChamplainRenderer *renderer; tile_source = champlain_map_source_factory_create (factory, id); tile_size = champlain_map_source_get_tile_size (tile_source); error_source = champlain_map_source_factory_create_error_source (factory, tile_size); - file_cache = CHAMPLAIN_MAP_SOURCE(champlain_file_cache_new ()); + renderer = CHAMPLAIN_RENDERER (champlain_image_renderer_new ()); + file_cache = CHAMPLAIN_MAP_SOURCE(champlain_file_cache_new_full (100000000, NULL, renderer)); source_chain = champlain_map_source_chain_new (); champlain_map_source_chain_push (source_chain, error_source); @@ -433,9 +435,8 @@ champlain_map_source_factory_create_error_source (ChamplainMapSourceFactory *fac ChamplainMapSource *null_source; ChamplainRenderer *renderer; - null_source = CHAMPLAIN_MAP_SOURCE (champlain_null_tile_source_new ()); renderer = CHAMPLAIN_RENDERER (champlain_error_tile_renderer_new (tile_size)); - champlain_map_source_set_renderer (null_source, renderer); + null_source = CHAMPLAIN_MAP_SOURCE (champlain_null_tile_source_new_full (renderer)); return null_source; } @@ -477,8 +478,9 @@ champlain_map_source_new_generic ( ChamplainMapSourceDesc *desc, G_GNUC_UNUSED gpointer user_data) { ChamplainMapSource *map_source; - ChamplainImageRenderer *renderer; + ChamplainRenderer *renderer; + renderer = CHAMPLAIN_RENDERER (champlain_image_renderer_new ()); map_source = CHAMPLAIN_MAP_SOURCE (champlain_network_tile_source_new_full ( desc->id, desc->name, @@ -488,10 +490,8 @@ champlain_map_source_new_generic ( desc->max_zoom_level, 256, desc->projection, - desc->uri_format)); - - renderer = champlain_image_renderer_new(); - champlain_map_source_set_renderer(map_source, CHAMPLAIN_RENDERER(renderer)); + desc->uri_format, + renderer)); return map_source; } @@ -502,8 +502,9 @@ champlain_map_source_new_memphis (ChamplainMapSourceDesc *desc, G_GNUC_UNUSED gpointer user_data) { ChamplainMapSource *map_source; - ChamplainMemphisRenderer *renderer; + ChamplainRenderer *renderer; + renderer = CHAMPLAIN_RENDERER (champlain_memphis_renderer_new_full (256)); if (g_strcmp0 (desc->id, CHAMPLAIN_MAP_SOURCE_MEMPHIS_LOCAL) == 0) { map_source = CHAMPLAIN_MAP_SOURCE (champlain_file_tile_source_new_full ( @@ -514,7 +515,8 @@ champlain_map_source_new_memphis (ChamplainMapSourceDesc *desc, desc->min_zoom_level, desc->max_zoom_level, 256, - desc->projection)); + desc->projection, + renderer)); } else { @@ -526,12 +528,10 @@ champlain_map_source_new_memphis (ChamplainMapSourceDesc *desc, desc->min_zoom_level, desc->max_zoom_level, 256, - desc->projection)); + desc->projection, + renderer)); } - renderer = champlain_memphis_renderer_new_full (256); - champlain_map_source_set_renderer(map_source, CHAMPLAIN_RENDERER(renderer)); - return map_source; } #endif diff --git a/champlain/champlain-memory-cache.c b/champlain/champlain-memory-cache.c index e8f473a..9354967 100644 --- a/champlain/champlain-memory-cache.c +++ b/champlain/champlain-memory-cache.c @@ -162,19 +162,14 @@ champlain_memory_cache_class_init (ChamplainMemoryCacheClass *klass) ChamplainMemoryCache * -champlain_memory_cache_new (void) -{ - return CHAMPLAIN_MEMORY_CACHE (g_object_new (CHAMPLAIN_TYPE_MEMORY_CACHE, NULL)); -} - - -ChamplainMemoryCache * -champlain_memory_cache_new_full (guint size_limit) +champlain_memory_cache_new_full (guint size_limit, + ChamplainRenderer *renderer) { ChamplainMemoryCache *cache; cache = g_object_new (CHAMPLAIN_TYPE_MEMORY_CACHE, "size-limit", size_limit, + "renderer", renderer, NULL); return cache; diff --git a/champlain/champlain-memory-cache.h b/champlain/champlain-memory-cache.h index 33a1993..b3c5c75 100644 --- a/champlain/champlain-memory-cache.h +++ b/champlain/champlain-memory-cache.h @@ -54,8 +54,7 @@ struct _ChamplainMemoryCacheClass GType champlain_memory_cache_get_type (void); -ChamplainMemoryCache *champlain_memory_cache_new (void); -ChamplainMemoryCache *champlain_memory_cache_new_full (guint size_limit); +ChamplainMemoryCache *champlain_memory_cache_new_full (guint size_limit, ChamplainRenderer *renderer); guint champlain_memory_cache_get_size_limit (ChamplainMemoryCache *memory_cache); void champlain_memory_cache_set_size_limit (ChamplainMemoryCache *memory_cache, diff --git a/champlain/champlain-network-bbox-tile-source.c b/champlain/champlain-network-bbox-tile-source.c index f626534..d407d53 100644 --- a/champlain/champlain-network-bbox-tile-source.c +++ b/champlain/champlain-network-bbox-tile-source.c @@ -247,7 +247,8 @@ champlain_network_bbox_tile_source_new_full (const gchar *id, guint min_zoom, guint max_zoom, guint tile_size, - ChamplainMapProjection projection) + ChamplainMapProjection projection, + ChamplainRenderer *renderer) { ChamplainNetworkBboxTileSource * source; source = g_object_new (CHAMPLAIN_TYPE_NETWORK_BBOX_TILE_SOURCE, "id", id, @@ -258,6 +259,7 @@ champlain_network_bbox_tile_source_new_full (const gchar *id, "max-zoom-level", max_zoom, "tile-size", tile_size, "projection", projection, + "renderer", renderer, NULL); return source; } diff --git a/champlain/champlain-network-bbox-tile-source.h b/champlain/champlain-network-bbox-tile-source.h index 175bb32..0ab6770 100644 --- a/champlain/champlain-network-bbox-tile-source.h +++ b/champlain/champlain-network-bbox-tile-source.h @@ -63,7 +63,8 @@ ChamplainNetworkBboxTileSource* champlain_network_bbox_tile_source_new_full (con guint min_zoom, guint max_zoom, guint tile_size, - ChamplainMapProjection projection); + ChamplainMapProjection projection, + ChamplainRenderer *renderer); void champlain_network_bbox_tile_source_load_map_data ( ChamplainNetworkBboxTileSource *map_data_source, diff --git a/champlain/champlain-network-tile-source.c b/champlain/champlain-network-tile-source.c index a18baee..c99a142 100644 --- a/champlain/champlain-network-tile-source.c +++ b/champlain/champlain-network-tile-source.c @@ -297,14 +297,22 @@ champlain_network_tile_source_new_full (const gchar *id, guint max_zoom, guint tile_size, ChamplainMapProjection projection, - const gchar *uri_format) + const gchar *uri_format, + ChamplainRenderer *renderer) { ChamplainNetworkTileSource * source; - source = g_object_new (CHAMPLAIN_TYPE_NETWORK_TILE_SOURCE, "id", id, - "name", name, "license", license, "license-uri", license_uri, - "min-zoom-level", min_zoom, "max-zoom-level", max_zoom, - "tile-size", tile_size, "projection", projection, - "uri-format", uri_format, NULL); + source = g_object_new (CHAMPLAIN_TYPE_NETWORK_TILE_SOURCE, + "id", id, + "name", name, + "license", license, + "license-uri", license_uri, + "min-zoom-level", min_zoom, + "max-zoom-level", max_zoom, + "tile-size", tile_size, + "projection", projection, + "uri-format", uri_format, + "renderer", renderer, + NULL); return source; } diff --git a/champlain/champlain-network-tile-source.h b/champlain/champlain-network-tile-source.h index 1c1a4b3..532e86f 100644 --- a/champlain/champlain-network-tile-source.h +++ b/champlain/champlain-network-tile-source.h @@ -63,7 +63,8 @@ ChamplainNetworkTileSource* champlain_network_tile_source_new_full (const gchar guint max_zoom, guint tile_size, ChamplainMapProjection projection, - const gchar *uri_format); + const gchar *uri_format, + ChamplainRenderer *renderer); const gchar * champlain_network_tile_source_get_uri_format (ChamplainNetworkTileSource *tile_source); void champlain_network_tile_source_set_uri_format (ChamplainNetworkTileSource *tile_source, diff --git a/champlain/champlain-null-tile-source.c b/champlain/champlain-null-tile-source.c index 9b8a959..dd8d96a 100644 --- a/champlain/champlain-null-tile-source.c +++ b/champlain/champlain-null-tile-source.c @@ -73,11 +73,13 @@ champlain_null_tile_source_init (ChamplainNullTileSource *self) * Since: 0.8 */ ChamplainNullTileSource * -champlain_null_tile_source_new (void) +champlain_null_tile_source_new_full (ChamplainRenderer *renderer) { ChamplainNullTileSource *source; - source = g_object_new (CHAMPLAIN_TYPE_NULL_TILE_SOURCE, NULL); + source = g_object_new (CHAMPLAIN_TYPE_NULL_TILE_SOURCE, + "renderer", renderer, + NULL); return source; } diff --git a/champlain/champlain-null-tile-source.h b/champlain/champlain-null-tile-source.h index 8127464..373d5b5 100644 --- a/champlain/champlain-null-tile-source.h +++ b/champlain/champlain-null-tile-source.h @@ -60,7 +60,7 @@ typedef struct GType champlain_null_tile_source_get_type (void); -ChamplainNullTileSource *champlain_null_tile_source_new (void); +ChamplainNullTileSource *champlain_null_tile_source_new_full (ChamplainRenderer *renderer); G_END_DECLS diff --git a/demos/local-rendering.c b/demos/local-rendering.c index e9d57c7..c114117 100644 --- a/demos/local-rendering.c +++ b/demos/local-rendering.c @@ -444,7 +444,7 @@ map_source_changed (GtkWidget *widget, ChamplainView *view) champlain_map_source_chain_push (source_chain, src); champlain_map_source_chain_push (source_chain, tile_source); - src = CHAMPLAIN_MAP_SOURCE(champlain_memory_cache_new_full (100)); + src = CHAMPLAIN_MAP_SOURCE(champlain_memory_cache_new_full (100, CHAMPLAIN_RENDERER (champlain_image_renderer_new ()))); champlain_map_source_set_renderer (src, CHAMPLAIN_RENDERER (champlain_image_renderer_new ())); champlain_map_source_chain_push (source_chain, src); |