From: gnuite Date: Sun, 9 Mar 2008 20:17:53 +0000 (+0000) Subject: Added support for maps that behave like Yahoo Maps (signed Y tile X-Git-Tag: fremantle/3.0+alpha0~177 X-Git-Url: http://git.itanic.dy.fi/?p=maemo-mapper;a=commitdiff_plain;h=08d27d95b50cecc07427f529efc2155715f0e083 Added support for maps that behave like Yahoo Maps (signed Y tile numbers). git-svn-id: svn+ssh://garage/var/lib/gforge/svnroot/maemo-mapper/trunk@157 6c538b50-5814-0410-93ad-8bdf4c0149d1 --- diff --git a/src/maps.c b/src/maps.c index 177ff8c..9ec45c8 100644 --- a/src/maps.c +++ b/src/maps.c @@ -898,6 +898,8 @@ set_repo_type(RepoData *repo) repo->type = REPOTYPE_QUAD_QRST; else if(strstr(url, "%0d")) repo->type = REPOTYPE_XYZ_INV; + else if(strstr(url, "%-d")) + repo->type = REPOTYPE_XYZ_SIGNED; else if(strstr(url, "%0s")) repo->type = REPOTYPE_QUAD_ZERO; else @@ -1231,7 +1233,8 @@ static gchar* map_construct_url(RepoData *repo, gint zoom, gint tilex, gint tiley) { gchar *retval; - vprintf("%s()\n", __PRETTY_FUNCTION__); + vprintf("%s(%p, %d, %d, %d)\n", __PRETTY_FUNCTION__, + repo, zoom, tilex, tiley); switch(repo->type) { case REPOTYPE_XYZ: @@ -1244,6 +1247,13 @@ map_construct_url(RepoData *repo, gint zoom, gint tilex, gint tiley) MAX_ZOOM + 1 - zoom, tilex, tiley); break; + case REPOTYPE_XYZ_SIGNED: + retval = g_strdup_printf(repo->url, + tilex, + (1 << (MAX_ZOOM - zoom)) - tiley - 1, + zoom - (MAX_ZOOM - 17)); + break; + case REPOTYPE_QUAD_QRST: { gchar location[MAX_ZOOM + 2]; diff --git a/src/types.h b/src/types.h index 70ae7e1..23cd27e 100644 --- a/src/types.h +++ b/src/types.h @@ -63,6 +63,7 @@ typedef enum { REPOTYPE_NONE, /* No URL set. */ REPOTYPE_XYZ, /* x=%d, y=%d, and zoom=%d */ + REPOTYPE_XYZ_SIGNED, /* x=%d, y=%d, and zoom=%d-2 */ REPOTYPE_XYZ_INV, /* zoom=%0d, x=%d, y=%d */ REPOTYPE_QUAD_QRST, /* t=%s (%s = {qrst}*) */ REPOTYPE_QUAD_ZERO, /* t=%0s (%0s = {0123}*) */