static gboolean _coord_to_mapcoord ( VikMapSource *self, const VikCoord *src, gdouble xzoom, gdouble yzoom, MapCoord *dest );
static void _mapcoord_to_center_coord ( VikMapSource *self, MapCoord *src, VikCoord *dest );
-static int _download ( VikMapSource *self, MapCoord *src, const gchar *dest_fn );
+static int _download ( VikMapSource *self, MapCoord *src, const gchar *dest_fn, void *handle );
+static void * _download_handle_init ( VikMapSource *self );
+static void _download_handle_cleanup ( VikMapSource *self, void *handle );
/* FIXME Huge gruik */
-static DownloadOptions terraserver_options = { NULL, 0, a_check_map_file };
+static DownloadOptions terraserver_options = { 0, NULL, 0, a_check_map_file };
typedef struct _TerraserverMapSourcePrivate TerraserverMapSourcePrivate;
struct _TerraserverMapSourcePrivate
PROP_TYPE,
};
-G_DEFINE_TYPE_EXTENDED (TerraserverMapSource, terraserver_map_source, VIK_TYPE_MAP_SOURCE_DEFAULT, (GTypeFlags)0,);
+G_DEFINE_TYPE (TerraserverMapSource, terraserver_map_source, VIK_TYPE_MAP_SOURCE_DEFAULT);
static void
terraserver_map_source_init (TerraserverMapSource *self)
parent_class->coord_to_mapcoord = _coord_to_mapcoord;
parent_class->mapcoord_to_center_coord = _mapcoord_to_center_coord;
parent_class->download = _download;
+ parent_class->download_handle_init = _download_handle_init;
+ parent_class->download_handle_cleanup = _download_handle_cleanup;
pspec = g_param_spec_uint ("type",
"Type",
object_class->finalize = terraserver_map_source_finalize;
}
-#define TERRASERVER_SITE "terraserver-usa.com"
+#define TERRASERVER_SITE "msrmaps.com"
#define MARGIN_OF_ERROR 0.001
static int mpp_to_scale ( gdouble mpp, guint8 type )
TerraserverMapSourcePrivate *priv = TERRASERVER_MAP_SOURCE_PRIVATE(self);
int type = priv->type;
- g_assert ( src->mode == VIK_COORD_UTM );
+ if ( src->mode != VIK_COORD_UTM )
+ return FALSE;
if ( xmpp != ympp )
return FALSE;
}
static int
-_download ( VikMapSource *self, MapCoord *src, const gchar *dest_fn )
+_download ( VikMapSource *self, MapCoord *src, const gchar *dest_fn, void *handle )
{
g_return_val_if_fail(TERRASERVER_IS_MAP_SOURCE(self), FALSE);
int type = priv->type;
gchar *uri = g_strdup_printf ( "/tile.ashx?T=%d&S=%d&X=%d&Y=%d&Z=%d", type,
src->scale, src->x, src->y, src->z );
- res = a_http_download_get_url ( TERRASERVER_SITE, uri, dest_fn, &terraserver_options );
+ res = a_http_download_get_url ( TERRASERVER_SITE, uri, dest_fn, &terraserver_options, handle );
g_free ( uri );
return res;
}
+static void *
+_download_handle_init ( VikMapSource *self )
+{
+ return a_download_handle_init ();
+}
+
+
+static void
+_download_handle_cleanup ( VikMapSource *self, void *handle )
+{
+ return a_download_handle_cleanup ( handle );
+}
+
TerraserverMapSource *
terraserver_map_source_new_with_id (guint8 id, const char *label, int type)
{
return g_object_new(TERRASERVER_TYPE_MAP_SOURCE, "id", id, "label", label, "type", type, NULL);
-}
\ No newline at end of file
+}