#include <string.h>
void champlain_map_source_real_get_tile (ChamplainMapSource *map_source,
- ChamplainView *view, ChamplainZoomLevel *level, ChamplainTile *tile);
+ ChamplainView *view, gint zoom_level, ChamplainTile *tile);
enum
{
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));
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");
void (*get_tile) (ChamplainMapSource *map_source,
ChamplainView *view,
- ChamplainZoomLevel *zoom_level,
+ gint zoom_level,
ChamplainTile *tile);
};
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,
static gchar *
get_filename (ChamplainNetworkMapSource *network_map_source,
- ChamplainZoomLevel *level,
+ gint zoom_level,
ChamplainTile *tile)
{
//ChamplainNetworkMapSourcePrivate *priv = network_map_source->priv;
"%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;
champlain_tile_set_state (ctx->tile, CHAMPLAIN_STATE_DONE);
g_object_unref (ctx->tile);
- g_object_unref (ctx->zoom_level);
g_free (ctx);
return;
}
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;
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",
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);
void champlain_network_map_source_get_tile (ChamplainMapSource *map_source,
ChamplainView *view,
- ChamplainZoomLevel *level,
+ gint zoom_level,
ChamplainTile *tile);
G_END_DECLS
* 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:
+ * <itemizedlist>
+ * <listitem><para>Push: the normal behavior where the maps doesn't move
+ * after the user stopped scrolling;</para></listitem>
+ * <listitem><para>Kinetic: the iPhone-like behavior where the maps
+ * decelerate after the user stopped scrolling.</para></listitem>
+ * </itemizedlist>
+ *
+ * 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
+ * <ulink role="online-location"
+ * url="http://www.openstreetmap.org">OpenStreetMap</ulink>). 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"
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);
}