vikcoord.c vikcoord.h \
mapcache.c mapcache.h \
vikmapslayer.c vikmapslayer.h \
+ vikmapslayer_compat.c vikmapslayer_compat.h \
vik-map-type.c vik-map-type.h \
vik-map-type-default.c vik-map-type-default.h \
+ old-vik-map-type.c old-vik-map-type.h \
slippy-map-type-abstract.c slippy-map-type-abstract.h \
slippy-map-type.c slippy-map-type.h \
gpx.c gpx.h \
vik-map-type.c vik-map-type.h \
vik-map-type-default.c vik-map-type-default.h \
slippy-map-type-abstract.c slippy-map-type-abstract.h \
- slippy-map-type.c slippy-map-type.h
+ slippy-map-type.c slippy-map-type.h \
+ old-vik-map-type.c old-vik-map-type.h
if GOOGLE
libviking_a_SOURCES += \
void bluemarble_init () {
VikMapType *bluemarble_type = VIK_MAP_TYPE(slippy_map_type_new_with_id( 15, "s3.amazonaws.com", "/com.modestmaps.bluemarble/%d-r%3$d-c%2$d.jpg" ));
- maps_layer_register_type("BlueMarble", 15, bluemarble_type);
+ maps_layer_register_map_type("BlueMarble", bluemarble_type);
}
--- /dev/null
+%headertop{
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "vik-map-type.h"
+#include "vikmapslayer_compat.h"
+%}
+
+class Old:Vik:Map:Type from Vik:Map:Type {
+
+ private VikMapsLayer_MapType map_type;
+
+ public GObject *
+ new_with_id (VikMapsLayer_MapType map_type) {
+ OldVikMapType *ret = GET_NEW;
+ ret->_priv->map_type = map_type;
+ return G_OBJECT (ret);
+ }
+
+ override (Vik:Map:Type) gboolean
+ coord_to_mapcoord ( Vik:Map:Type *self, const VikCoord *src, gdouble xzoom, gdouble yzoom, MapCoord *dest )
+ {
+ return SELF(self)->_priv->map_type.coord_to_mapcoord (src, xzoom, yzoom, dest);
+ }
+
+ override (Vik:Map:Type) void
+ mapcoord_to_center_coord ( Vik:Map:Type *self, MapCoord *src, VikCoord *dest )
+ {
+ SELF(self)->_priv->map_type.mapcoord_to_center_coord (src, dest);
+ }
+
+ override (Vik:Map:Type) int
+ download ( Vik:Map:Type *self, MapCoord *src, const gchar *dest_fn )
+ {
+ return SELF(self)->_priv->map_type.download(src, dest_fn);
+ }
+
+}
+
void openaerial_init () {
VikMapType *openaerialmap_type = VIK_MAP_TYPE(slippy_map_type_new_with_id( 20, "tile.openaerialmap.org", "/tiles/1.0.0/openaerialmap-900913/%d/%d/%d.jpg" ));
- maps_layer_register_type("OpenAerialMap", 20, openaerialmap_type);
+ maps_layer_register_map_type("OpenAerialMap", openaerialmap_type);
}
VikMapType *maplint_type = VIK_MAP_TYPE(slippy_map_type_new_with_id( 14, "tah.openstreetmap.org", "/Tiles/maplint.php/%d/%d/%d.png"));
VikMapType *cycle_type = VIK_MAP_TYPE(slippy_map_type_new_with_id( 17, "thunderflames.org/tiles/cycle/", "%d/%d/%d.png" ));
- maps_layer_register_type("OpenStreetMap (Osmarender)", 12, osmarender_type);
- maps_layer_register_type("OpenStreetMap (Mapnik)", 13, mapnik_type);
- maps_layer_register_type("OpenStreetMap (Maplint)", 14, maplint_type);
- maps_layer_register_type("OpenStreetMap (Cycle)", 17, cycle_type);
+ maps_layer_register_map_type("OpenStreetMap (Osmarender)", osmarender_type);
+ maps_layer_register_map_type("OpenStreetMap (Mapnik)", mapnik_type);
+ maps_layer_register_map_type("OpenStreetMap (Maplint)", maplint_type);
+ maps_layer_register_map_type("OpenStreetMap (Cycle)", cycle_type);
}
VikMapType *map_type_2 = VIK_MAP_TYPE(terraserver_map_type_new_with_id( 1, 1 ));
VikMapType *map_type_3 = VIK_MAP_TYPE(terraserver_map_type_new_with_id( 4, 4 ));
- maps_layer_register_type("Terraserver Topos", 2, map_type_1);
- maps_layer_register_type("Terraserver Aerials", 1, map_type_2);
- maps_layer_register_type("Terraserver Urban Areas", 4, map_type_3);
+ maps_layer_register_map_type("Terraserver Topos", map_type_1);
+ maps_layer_register_map_type("Terraserver Aerials", map_type_2);
+ maps_layer_register_map_type("Terraserver Urban Areas", map_type_3);
}
/******** MAPS LAYER TYPES **************/
/****************************************/
-void maps_layer_register_type ( const char *label, guint id, VikMapType *map_type )
+void maps_layer_register_map_type ( const char *label, VikMapType *map_type )
{
g_assert(label != NULL);
g_assert(map_type != NULL);
- g_assert(id == vik_map_type_get_uniq_id(map_type));
+
+ guint id = vik_map_type_get_uniq_id(map_type);
/* Add the label */
params_maptypes = g_list_append(params_maptypes, g_strdup(label));
#include "vikviewport.h"
#include "vik-map-type.h"
#include "mapcoord.h"
+#include "vikmapslayer_compat.h"
#define VIK_MAPS_LAYER_TYPE (vik_maps_layer_get_type ())
#define VIK_MAPS_LAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIK_MAPS_LAYER_TYPE, VikMapsLayer))
typedef struct _VikMapsLayer VikMapsLayer;
-void maps_layer_register_type ( const char *label, guint id, VikMapType *map_type );
+void maps_layer_register_map_type ( const char *label, VikMapType *map_type );
void maps_layer_download_section_without_redraw ( VikMapsLayer *vml, VikViewport *vvp, VikCoord *ul, VikCoord *br, gdouble zoom);
gint vik_maps_layer_get_map_type(VikMapsLayer *vml);
gchar *vik_maps_layer_get_map_label(VikMapsLayer *vml);
--- /dev/null
+/*
+ * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
+ *
+ * Copyright (C) 2005, Evan Battaglia <viking@greentorch.org>
+ * Copyright (C) 2008-2009, Guilhem Bonnefille <guilem.bonnefille@gmail.com>
+ * UTM multi-zone stuff by Kit Transue <notlostyet@didactek.com>
+ * Dynamic map type by Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "vikmapslayer.h"
+#include "vikmapslayer_compat.h"
+#include "old-vik-map-type.h"
+
+void maps_layer_register_type ( const char *label, guint id, VikMapsLayer_MapType *map_type )
+{
+ g_assert(id == map_type->uniq_id);
+ GObject *object = old_vik_map_type_new_with_id (*map_type);
+ maps_layer_register_map_type ( label, VIK_MAP_TYPE (object) );
+}
--- /dev/null
+/*
+ * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
+ *
+ * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef _VIKING_MAPSLAYER_COMPAT_H
+#define _VIKING_MAPSLAYER_COMPAT_H
+
+#include "vikcoord.h"
+#include "vikviewport.h"
+#include "mapcoord.h"
+
+typedef struct {
+ guint8 uniq_id;
+ guint16 tilesize_x;
+ guint16 tilesize_y;
+ guint drawmode;
+ gboolean (*coord_to_mapcoord) ( const VikCoord *src, gdouble xzoom, gdouble yzoom, MapCoord *dest );
+ void (*mapcoord_to_center_coord) ( MapCoord *src, VikCoord *dest );
+ int (*download) ( MapCoord *src, const gchar *dest_fn );
+ /* TODO: constant size (yay!) */
+} VikMapsLayer_MapType;
+
+void maps_layer_register_type ( const char *label, guint id, VikMapsLayer_MapType *map_type );
+
+#endif