From: Pierre-Luc Beaudoin Date: Sat, 2 May 2009 04:33:14 +0000 (-0400) Subject: Remove ChamplainZoomLevel from public API X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d1c41912fe480e6e8688de6386bea4b9607397b;p=libchamplain Remove ChamplainZoomLevel from public API It is not needed --- diff --git a/champlain/champlain-map-source.c b/champlain/champlain-map-source.c index c71e79f..dee4abf 100644 --- a/champlain/champlain-map-source.c +++ b/champlain/champlain-map-source.c @@ -35,7 +35,7 @@ #include void champlain_map_source_real_get_tile (ChamplainMapSource *map_source, - ChamplainView *view, ChamplainZoomLevel *level, ChamplainTile *tile); + ChamplainView *view, gint zoom_level, ChamplainTile *tile); enum { @@ -350,7 +350,7 @@ champlain_map_source_get_column_count (ChamplainMapSource *map_source, void champlain_map_source_get_tile (ChamplainMapSource *map_source, ChamplainView *view, - ChamplainZoomLevel *zoom_level, + gint zoom_level, ChamplainTile *tile) { g_return_if_fail (CHAMPLAIN_IS_MAP_SOURCE (map_source)); @@ -361,7 +361,7 @@ champlain_map_source_get_tile (ChamplainMapSource *map_source, void champlain_map_source_real_get_tile (ChamplainMapSource *map_source, ChamplainView *view, - ChamplainZoomLevel *zoom_level, + gint zoom_level, ChamplainTile *tile) { g_error ("Should not be reached"); diff --git a/champlain/champlain-map-source.h b/champlain/champlain-map-source.h index 3073cbb..536ecad 100644 --- a/champlain/champlain-map-source.h +++ b/champlain/champlain-map-source.h @@ -59,7 +59,7 @@ struct _ChamplainMapSourceClass void (*get_tile) (ChamplainMapSource *map_source, ChamplainView *view, - ChamplainZoomLevel *zoom_level, + gint zoom_level, ChamplainTile *tile); }; @@ -95,7 +95,7 @@ guint champlain_map_source_get_column_count (ChamplainMapSource *map_source, void champlain_map_source_get_tile (ChamplainMapSource *map_source, ChamplainView *view, - ChamplainZoomLevel *level, + gint zoom_level, ChamplainTile *tile); void champlain_map_source_set_name (ChamplainMapSource *map_source, diff --git a/champlain/champlain-network-map-source.c b/champlain/champlain-network-map-source.c index 27359ef..ae12ff0 100644 --- a/champlain/champlain-network-map-source.c +++ b/champlain/champlain-network-map-source.c @@ -344,7 +344,7 @@ champlain_map_source_new_mff_relief (void) static gchar * get_filename (ChamplainNetworkMapSource *network_map_source, - ChamplainZoomLevel *level, + gint zoom_level, ChamplainTile *tile) { //ChamplainNetworkMapSourcePrivate *priv = network_map_source->priv; @@ -352,13 +352,12 @@ get_filename (ChamplainNetworkMapSource *network_map_source, "%s" G_DIR_SEPARATOR_S "%d" G_DIR_SEPARATOR_S "%d" G_DIR_SEPARATOR_S "%d.png", g_get_user_cache_dir (), CACHE_SUBDIR, champlain_map_source_get_name (CHAMPLAIN_MAP_SOURCE (network_map_source)), - champlain_zoom_level_get_zoom_level (level), + zoom_level, champlain_tile_get_x (tile), champlain_tile_get_y (tile)); } typedef struct { ChamplainView *view; - ChamplainZoomLevel *zoom_level; ChamplainTile *tile; } FileLoadedCallbackContext; @@ -442,7 +441,6 @@ file_loaded_cb (SoupSession *session, champlain_tile_set_state (ctx->tile, CHAMPLAIN_STATE_DONE); g_object_unref (ctx->tile); - g_object_unref (ctx->zoom_level); g_free (ctx); return; } @@ -547,14 +545,13 @@ cleanup: finish: champlain_tile_set_state (ctx->tile, CHAMPLAIN_STATE_DONE); g_object_unref (ctx->tile); - g_object_unref (ctx->zoom_level); g_free (ctx); } void champlain_network_map_source_get_tile (ChamplainMapSource *map_source, ChamplainView *view, - ChamplainZoomLevel *zoom_level, + gint zoom_level, ChamplainTile *tile) { gchar* filename; @@ -592,14 +589,12 @@ champlain_network_map_source_get_tile (ChamplainMapSource *map_source, gchar *uri; FileLoadedCallbackContext *ctx = g_new0 (FileLoadedCallbackContext, 1); ctx->view = view; - ctx->zoom_level = zoom_level; ctx->tile = tile; /* Ref the tile as it may be freeing during the loading * Unref when the loading is done. */ g_object_ref (tile); - g_object_ref (zoom_level); if (!soup_session) soup_session = soup_session_async_new_with_options ("proxy-uri", @@ -611,7 +606,7 @@ champlain_network_map_source_get_tile (ChamplainMapSource *map_source, uri = champlain_network_map_source_get_tile_uri (network_map_source, champlain_tile_get_x (tile), champlain_tile_get_y (tile), - champlain_zoom_level_get_zoom_level (zoom_level)); + zoom_level); champlain_tile_set_uri (tile, uri); champlain_tile_set_state (tile, CHAMPLAIN_STATE_LOADING); msg = soup_message_new (SOUP_METHOD_GET, uri); diff --git a/champlain/champlain-network-map-source.h b/champlain/champlain-network-map-source.h index e3b531b..88636aa 100644 --- a/champlain/champlain-network-map-source.h +++ b/champlain/champlain-network-map-source.h @@ -75,7 +75,7 @@ void champlain_network_map_source_set_tile_uri (ChamplainNetworkMapSource *netwo void champlain_network_map_source_get_tile (ChamplainMapSource *map_source, ChamplainView *view, - ChamplainZoomLevel *level, + gint zoom_level, ChamplainTile *tile); G_END_DECLS diff --git a/champlain/champlain-tile.c b/champlain/champlain-tile.c index f8ba6f7..7717e7f 100644 --- a/champlain/champlain-tile.c +++ b/champlain/champlain-tile.c @@ -15,6 +15,34 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +/** + * SECTION:champlain-tile + * @short_description: An object that represent map tiles + * + * The #ChamplainView is a ClutterActor to display maps. It supports two modes + * of scrolling: + * + * Push: the normal behavior where the maps doesn't move + * after the user stopped scrolling; + * Kinetic: the iPhone-like behavior where the maps + * decelerate after the user stopped scrolling. + * + * + * You can use the same #ChamplainView to display many types of maps. In + * Champlain they are called map sources. You can change the #map-source + * property at anytime to replace the current displayed map. + * + * The maps are downloaded from Internet from open maps sources (like + * OpenStreetMap). Maps are divided + * in tiles for each zoom level. When a tile is requested, #ChamplainView will + * first check if it is in cache (in the user's cache dir under champlain). If + * an error occurs during download, an error tile will be displayed. + * + * The button-press-event and button-release-event signals are emitted each + * time a mouse button is pressed on the @view. Coordinates can be converted + * with #champlain_view_get_coords_from_event. + */ #include "champlain-tile.h" diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c index 0c84840..0fdceb9 100644 --- a/champlain/champlain-view.c +++ b/champlain/champlain-view.c @@ -1513,7 +1513,8 @@ view_load_visible_tiles (ChamplainView *view) champlain_tile_get_actor (tile), NULL); champlain_zoom_level_add_tile (level, tile); - champlain_map_source_get_tile (priv->map_source, view, level, tile); + champlain_map_source_get_tile (priv->map_source, view, + champlain_zoom_level_get_zoom_level (level), tile); g_object_unref (tile); }