]> git.street.me.uk Git - andy/viking.git/commitdiff
Start using GoogleMapType GObject
author(null) <(null)>
Tue, 9 Sep 2008 11:58:31 +0000 (13:58 +0200)
committerGuilhem Bonnefille <guilhem.bonnefille@gmail.com>
Fri, 27 Mar 2009 11:14:39 +0000 (12:14 +0100)
src/google-map-type.gob
src/google.c

index d19fb64edf1a9e8b6874ef9db2d753f6be7ba3c5..bf3d84d7ca93024ee5a22a94c2ac4b365be3354c 100644 (file)
@@ -199,6 +199,26 @@ static int real_google_download ( MapCoord *src, const gchar *dest_fn, const cha
 class Google:Map:Type from Vik:Map:Type {
   private GoogleType type;
 
 class Google:Map:Type from Vik:Map:Type {
   private GoogleType type;
 
+  init (self) {
+          /* initialize the object here */
+          self->tilesize_x = 256;
+          self->tilesize_y = 256;
+          self->drawmode = VIK_VIEWPORT_DRAWMODE_MERCATOR;
+  }
+
+  public GObject *
+  new_with_id (guint8 id) {
+         GObject *ret = GET_NEW;
+         VIK_MAP_TYPE(ret)->uniq_id = id;
+         return G_OBJECT (ret);
+  }
+
+  public GObject *
+  new (void) {
+         GObject *ret = GET_NEW;
+         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 )
   {
   override (Vik:Map:Type) gboolean
   coord_to_mapcoord ( Vik:Map:Type *self, const VikCoord *src, gdouble xzoom, gdouble yzoom, MapCoord *dest )
   {
index 9092d9e06c1f75584c58749a17165dd7f682050f..d1c4e41ff1a3e8ac32e687a876f93b11ee1716b9 100644 (file)
@@ -36,6 +36,7 @@
 #include "curl_download.h"
 #include "globals.h"
 #include "google.h"
 #include "curl_download.h"
 #include "globals.h"
 #include "google.h"
+#include "google-map-type.h"
 #include "vikmapslayer.h"
 
 
 #include "vikmapslayer.h"
 
 
@@ -49,15 +50,18 @@ static gboolean google_coord_to_mapcoord ( const VikCoord *src, gdouble xzoom, g
 static DownloadOptions google_options = { "http://maps.google.com/", 0, a_check_map_file };
 
 void google_init () {
 static DownloadOptions google_options = { "http://maps.google.com/", 0, a_check_map_file };
 
 void google_init () {
-  VikMapsLayer_MapType google_1 = { 7, 256, 256, VIK_VIEWPORT_DRAWMODE_MERCATOR, google_coord_to_mapcoord, google_mapcoord_to_center_coord, google_download };
-  VikMapsLayer_MapType google_2 = { 10, 256, 256, VIK_VIEWPORT_DRAWMODE_MERCATOR, google_coord_to_mapcoord, google_mapcoord_to_center_coord, google_trans_download };
-  VikMapsLayer_MapType google_3 = { 11, 256, 256, VIK_VIEWPORT_DRAWMODE_MERCATOR, google_coord_to_mapcoord, google_mapcoord_to_center_coord, google_kh_download };
-  VikMapsLayer_MapType google_4 = { 16, 256, 256, VIK_VIEWPORT_DRAWMODE_MERCATOR, google_coord_to_mapcoord, google_mapcoord_to_center_coord, google_terrain_download };
-
-  maps_layer_register_type(_("Google Maps"), 7, &google_1);
-  maps_layer_register_type(_("Transparent Google Maps"), 10, &google_2);
-  maps_layer_register_type(_("Google Satellite Images"), 11, &google_3);
-  maps_layer_register_type(_("Google Terrain Maps"), 16, &google_4);
+  VikMapType *google_1 = VIK_MAP_TYPE(google_map_type_new_with_id(7));
+  VikMapType *google_2 = VIK_MAP_TYPE(google_map_type_new_with_id(10));
+  //{ 10, 256, 256, VIK_VIEWPORT_DRAWMODE_MERCATOR, google_coord_to_mapcoord, google_mapcoord_to_center_coord, google_trans_download };
+  VikMapType *google_3 = VIK_MAP_TYPE(google_map_type_new_with_id(11));
+  //{ 11, 256, 256, VIK_VIEWPORT_DRAWMODE_MERCATOR, google_coord_to_mapcoord, google_mapcoord_to_center_coord, google_kh_download };
+  VikMapType *google_4 = VIK_MAP_TYPE(google_map_type_new_with_id(16));
+  //{ 16, 256, 256, VIK_VIEWPORT_DRAWMODE_MERCATOR, google_coord_to_mapcoord, google_mapcoord_to_center_coord, google_terrain_download };
+
+  maps_layer_register_type(_("Google Maps"), 7, google_1);
+  maps_layer_register_type(_("Transparent Google Maps"), 10, google_2);
+  maps_layer_register_type(_("Google Satellite Images"), 11, google_3);
+  maps_layer_register_type(_("Google Terrain Maps"), 16, google_4);
 }
 
 /* 1 << (x) is like a 2**(x) */
 }
 
 /* 1 << (x) is like a 2**(x) */
@@ -78,15 +82,6 @@ guint8 google_zoom ( gdouble mpp ) {
   return 255;
 }
 
   return 255;
 }
 
-typedef enum {
-       TYPE_GOOGLE_MAPS = 0,
-       TYPE_GOOGLE_TRANS,
-       TYPE_GOOGLE_SAT,
-       TYPE_GOOGLE_TERRAIN,
-
-       TYPE_GOOGLE_NUM
-} GoogleType;
-
 static gchar *parse_version_number(gchar *text)
 {
   int i;
 static gchar *parse_version_number(gchar *text)
 {
   int i;