/** * champlain_map_source_factory_create_cached_source: * @factory: the Factory * @id: the wanted map source id * * Creates a cached map source. * * Returns: (transfer none): a ready to use #ChamplainMapSourceChain consisting of * #ChamplainMemoryCache, #ChamplainFileCache, #ChamplainMapSource matching the given name, and * an error tile source created with champlain_map_source_factory_create_error_source (). * * Since: 0.6 */ ChamplainMapSource * champlain_map_source_factory_create_cached_source (ChamplainMapSourceFactory *factory, const gchar *id) { ChamplainMapSourceChain *source_chain; ChamplainMapSource *tile_source; ChamplainMapSource *error_source; ChamplainMapSource *memory_cache; 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); renderer = CHAMPLAIN_RENDERER (champlain_image_renderer_new ()); file_cache = CHAMPLAIN_MAP_SOURCE (champlain_file_cache_new_full (100000000, NULL, renderer)); renderer = CHAMPLAIN_RENDERER (champlain_image_renderer_new ()); memory_cache = CHAMPLAIN_MAP_SOURCE (champlain_memory_cache_new_full (100, renderer)); source_chain = champlain_map_source_chain_new (); champlain_map_source_chain_push (source_chain, error_source); champlain_map_source_chain_push (source_chain, tile_source); champlain_map_source_chain_push (source_chain, file_cache); champlain_map_source_chain_push (source_chain, memory_cache); return CHAMPLAIN_MAP_SOURCE (source_chain); }
/** * champlain_map_source_factory_create_cached_source: * @factory: the Factory * @id: the wanted map source id * * Creates a cached map source. * * Returns: a ready to use #ChamplainMapSourceChain consisting of * #ChamplainFileCache, #ChamplainMapSource matching the given name, and * #ChamplainErrorTileSource. * * Since: 0.6 */ ChamplainMapSource * champlain_map_source_factory_create_cached_source (ChamplainMapSourceFactory *factory, const gchar *id) { ChamplainMapSourceChain *source_chain; ChamplainMapSource *tile_source; ChamplainMapSource *error_source; ChamplainMapSource *file_cache; guint tile_size; tile_source = champlain_map_source_factory_create (factory, id); tile_size = champlain_map_source_get_tile_size (tile_source); error_source = CHAMPLAIN_MAP_SOURCE(champlain_error_tile_source_new_full (tile_size)); file_cache = CHAMPLAIN_MAP_SOURCE(champlain_file_cache_new ()); source_chain = champlain_map_source_chain_new (); champlain_map_source_chain_push (source_chain, error_source); champlain_map_source_chain_push (source_chain, tile_source); champlain_map_source_chain_push (source_chain, file_cache); return CHAMPLAIN_MAP_SOURCE(source_chain); }