]> git.street.me.uk Git - andy/viking.git/commitdiff
Replace vik-map-type-default by vikmapsourcedefault
authorGuilhem Bonnefille <guilhem.bonnefille@gmail.com>
Wed, 4 Mar 2009 21:14:23 +0000 (22:14 +0100)
committerGuilhem Bonnefille <guilhem.bonnefille@gmail.com>
Fri, 27 Mar 2009 11:14:42 +0000 (12:14 +0100)
src/Makefile.am
src/slippy-map-type-abstract.gob
src/slippy-map-type.gob
src/terraserver-map-type.gob
src/vik-map-type-default.gob [deleted file]
src/vikmapsourcedefault.c [new file with mode: 0644]
src/vikmapsourcedefault.h [new file with mode: 0644]

index 36151428042d2e4ea38c2f73c0182b29b18b9b77..a2ae1b6d449cafa4593547349e9593c248ba69af 100644 (file)
@@ -56,10 +56,10 @@ libviking_a_SOURCES = \
        vikcoord.c vikcoord.h \
        mapcache.c mapcache.h \
        vikmapsource.c vikmapsource.h \
+       vikmapsourcedefault.c vikmapsourcedefault.h \
        vikmapslayer.c vikmapslayer.h \
        vikmapslayer_compat.c vikmapslayer_compat.h \
-       vik-map-type-default.c vik-map-type-default.h \
-       old-vik-map-type.c old-vik-map-type.h \
+       vikmaptype.c vikmaptype.h \
        slippy-map-type-abstract.c slippy-map-type-abstract.h \
        slippy-map-type.c slippy-map-type.h \
         gpx.c gpx.h \
@@ -83,10 +83,8 @@ libviking_a_SOURCES = \
        preferences.c preferences.h
 
 BUILT_SOURCES += \
-       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 \
-       old-vik-map-type.c old-vik-map-type.h
+       slippy-map-type.c slippy-map-type.h
 
 if GOOGLE
 libviking_a_SOURCES += \
index 4021b4479e3859b975567337242553655810c1a9..eca502aef29695760ac378c42323cd856b4b334f 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "vikcoord.h"
 #include "mapcoord.h"
-#include "vik-map-type-default.h"
+#include "vikmapsourcedefault.h"
 #include "download.h"
 %}
 
@@ -53,13 +53,13 @@ static guint8 slippy_zoom ( gdouble mpp ) {
 
 %}
 
-class Slippy:Map:Type:Abstract from Vik:Map:Type:Default {
+class Slippy:Map:Type:Abstract from Vik:Map:Source:Default {
 
   init (self) {
           /* initialize the object here */
-          VIK_MAP_TYPE_DEFAULT(self)->tilesize_x = 256;
-          VIK_MAP_TYPE_DEFAULT(self)->tilesize_y = 256;
-          VIK_MAP_TYPE_DEFAULT(self)->drawmode = VIK_VIEWPORT_DRAWMODE_MERCATOR;
+          // FIXME VIK_MAP_SOURCE_DEFAULT(self)->tilesize_x = 256;
+          // FIXME VIK_MAP_SOURCE_DEFAULT(self)->tilesize_y = 256;
+          // FIXME VIK_MAP_SOURCE_DEFAULT(self)->drawmode = VIK_VIEWPORT_DRAWMODE_MERCATOR;
   }
 
   virtual gchar *
index 152ccc8d12320cd6061bd6ebbdbe8d42cd364e40..bc58ce615e97921a96fd3ed00e4106d8571fc75c 100644 (file)
@@ -43,15 +43,15 @@ class Slippy:Map:Type from Slippy:Map:Type:Abstract {
 
   init (self) {
           /* initialize the object here */
-          VIK_MAP_TYPE_DEFAULT(self)->tilesize_x = 256;
-          VIK_MAP_TYPE_DEFAULT(self)->tilesize_y = 256;
-          VIK_MAP_TYPE_DEFAULT(self)->drawmode = VIK_VIEWPORT_DRAWMODE_MERCATOR;
+          // FIXME VIK_MAP_SOURCE_DEFAULT(self)->tilesize_x = 256;
+          // FIXME VIK_MAP_SOURCE_DEFAULT(self)->tilesize_y = 256;
+          // FIXME VIK_MAP_SOURCE_DEFAULT(self)->drawmode = VIK_VIEWPORT_DRAWMODE_MERCATOR;
   }
 
   public GObject *
   new_with_id (guint8 id, const gchar *hostname, const gchar *url) {
          SlippyMapType *ret = GET_NEW;
-         VIK_MAP_TYPE_DEFAULT(ret)->uniq_id = id;
+         // FIXME VIK_MAP_SOURCE_DEFAULT(ret)->uniq_id = id;
          ret->_priv->hostname = g_strdup(hostname);
          ret->_priv->url = g_strdup(url);
          return G_OBJECT (ret);
index a4ff65465dbadb61e1384aac8028e47a1b505b0a..8f712cc528c7c994b6eb7c19b9a234a3af6b18d0 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "vikcoord.h"
 #include "mapcoord.h"
-#include "vik-map-type-default.h"
+#include "vikmapsourcedefault.h"
 %}
 
 %{
@@ -59,20 +59,20 @@ static gdouble scale_to_mpp ( gint scale )
 
 %}
 
-class Terraserver:Map:Type from Vik:Map:Type:Default {
+class Terraserver:Map:Type from Vik:Map:Source:Default {
   private int type;
 
   init (self) {
           /* initialize the object here */
-          VIK_MAP_TYPE_DEFAULT(self)->tilesize_x = 200;
-          VIK_MAP_TYPE_DEFAULT(self)->tilesize_y = 200;
-          VIK_MAP_TYPE_DEFAULT(self)->drawmode = VIK_VIEWPORT_DRAWMODE_UTM;
+          // FIXME VIK_MAP_SOURCE_DEFAULT(self)->tilesize_x = 200;
+          // FIXME VIK_MAP_SOURCE_DEFAULT(self)->tilesize_y = 200;
+          // FIXME VIK_MAP_SOURCE_DEFAULT(self)->drawmode = VIK_VIEWPORT_DRAWMODE_UTM;
   }
 
   public GObject *
   new_with_id (guint8 id, int type) {
          TerraserverMapType *ret = GET_NEW;
-         VIK_MAP_TYPE_DEFAULT(ret)->uniq_id = id;
+         // FIXME VIK_MAP_SOURCE_DEFAULT(ret)->uniq_id = id;
          ret->_priv->type = type;
          return G_OBJECT (ret);
   }
diff --git a/src/vik-map-type-default.gob b/src/vik-map-type-default.gob
deleted file mode 100644 (file)
index 309ed9f..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-%headertop{
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "vikmapsource.h"
-#include "vikviewport.h"
-#include "vikcoord.h"
-#include "mapcoord.h"
-%}
-
-class Vik:Map:Type:Default from Vik:Map:Source(abstract) {
-  public guint8 uniq_id;
-  public guint16 tilesize_x;
-  public guint16 tilesize_y;
-  public VikViewportDrawMode drawmode;
-
-  override (Vik:Map:Source) guint8
-  get_uniq_id ( Vik:Map:Source *self )
-  {
-    return SELF(self)->uniq_id;
-  }
-  
-  override (Vik:Map:Source) guint16
-  get_tilesize_x ( Vik:Map:Source *self )
-  {
-    return SELF(self)->tilesize_x;
-  }
-
-  override (Vik:Map:Source) guint16
-  get_tilesize_y ( Vik:Map:Source *self )
-  {
-    return SELF(self)->tilesize_y;
-  }
-
-  override (Vik:Map:Source) VikViewportDrawMode
-  get_drawmode ( Vik:Map:Source *self )
-  {
-    return SELF(self)->drawmode;
-  }
-
-}
-
diff --git a/src/vikmapsourcedefault.c b/src/vikmapsourcedefault.c
new file mode 100644 (file)
index 0000000..da33bf7
--- /dev/null
@@ -0,0 +1,106 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * viking
+ * Copyright (C) Guilhem Bonnefille 2009 <guilhem.bonnefille@gmail.com>
+ * 
+ * viking 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 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * viking 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "vikmapsourcedefault.h"
+
+static guint8 map_source_get_uniq_id (VikMapSource *self);
+static guint16 map_source_get_tilesize_x (VikMapSource *self);
+static guint16 map_source_get_tilesize_y (VikMapSource *self);
+static VikViewportDrawMode map_source_get_drawmode (VikMapSource *self);
+
+typedef struct _VikMapSourceDefaultPrivate VikMapSourceDefaultPrivate;
+struct _VikMapSourceDefaultPrivate
+{
+       guint8 uniq_id;
+       guint16 tilesize_x;
+       guint16 tilesize_y;
+       VikViewportDrawMode drawmode;
+};
+
+#define VIK_MAP_SOURCE_DEFAULT_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), VIK_TYPE_MAP_SOURCE_DEFAULT, VikMapSourceDefaultPrivate))
+
+
+G_DEFINE_TYPE_EXTENDED (VikMapSourceDefault, vik_map_source_default, VIK_TYPE_MAP_SOURCE, (GTypeFlags)G_TYPE_FLAG_ABSTRACT,);
+
+static void
+vik_map_source_default_init (VikMapSourceDefault *object)
+{
+       /* TODO: Add initialization code here */
+}
+
+static void
+vik_map_source_default_finalize (GObject *object)
+{
+       /* TODO: Add deinitalization code here */
+
+       G_OBJECT_CLASS (vik_map_source_default_parent_class)->finalize (object);
+}
+
+static void
+vik_map_source_default_class_init (VikMapSourceDefaultClass *klass)
+{
+       GObjectClass* object_class = G_OBJECT_CLASS (klass);
+       VikMapSourceClass* parent_class = VIK_MAP_SOURCE_CLASS (klass);
+
+       /* Overiding methods */
+       parent_class->get_uniq_id =    map_source_get_uniq_id;
+       parent_class->get_tilesize_x = map_source_get_tilesize_x;
+       parent_class->get_tilesize_y = map_source_get_tilesize_y;
+       parent_class->get_drawmode =   map_source_get_drawmode;
+
+       g_type_class_add_private (klass, sizeof (VikMapSourceDefaultPrivate));
+
+       object_class->finalize = vik_map_source_default_finalize;
+}
+
+static guint8
+map_source_get_uniq_id (VikMapSource *self)
+{
+    VikMapSourceDefaultPrivate *priv = VIK_MAP_SOURCE_DEFAULT_PRIVATE(self);
+       g_return_val_if_fail (priv != NULL, (guint8 )0);
+
+       return priv->uniq_id;
+}
+
+static guint16
+map_source_get_tilesize_x (VikMapSource *self)
+{
+    VikMapSourceDefaultPrivate *priv = VIK_MAP_SOURCE_DEFAULT_PRIVATE(self);
+       g_return_val_if_fail (self != NULL, (guint16 )0);
+
+       return priv->tilesize_x;
+}
+
+static guint16
+map_source_get_tilesize_y (VikMapSource *self)
+{
+    VikMapSourceDefaultPrivate *priv = VIK_MAP_SOURCE_DEFAULT_PRIVATE(self);
+       g_return_val_if_fail (self != NULL, (guint16 )0);
+
+       return priv->tilesize_y;
+}
+
+static VikViewportDrawMode
+map_source_get_drawmode (VikMapSource *self)
+{
+    VikMapSourceDefaultPrivate *priv = VIK_MAP_SOURCE_DEFAULT_PRIVATE(self);
+       g_return_val_if_fail (self != NULL, (VikViewportDrawMode )0);
+
+       return priv->drawmode;
+}
diff --git a/src/vikmapsourcedefault.h b/src/vikmapsourcedefault.h
new file mode 100644 (file)
index 0000000..2143fe3
--- /dev/null
@@ -0,0 +1,53 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * viking
+ * Copyright (C) Guilhem Bonnefille 2009 <guilhem.bonnefille@gmail.com>
+ * 
+ * viking 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 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * viking 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _VIK_MAP_SOURCE_DEFAULT_H_
+#define _VIK_MAP_SOURCE_DEFAULT_H_
+
+#include <glib-object.h>
+
+#include "vikmapsource.h"
+
+G_BEGIN_DECLS
+
+#define VIK_TYPE_MAP_SOURCE_DEFAULT             (vik_map_source_default_get_type ())
+#define VIK_MAP_SOURCE_DEFAULT(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIK_TYPE_MAP_SOURCE_DEFAULT, VikMapSourceDefault))
+#define VIK_MAP_SOURCE_DEFAULT_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), VIK_TYPE_MAP_SOURCE_DEFAULT, VikMapSourceDefaultClass))
+#define VIK_IS_MAP_SOURCE_DEFAULT(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIK_TYPE_MAP_SOURCE_DEFAULT))
+#define VIK_IS_MAP_SOURCE_DEFAULT_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), VIK_TYPE_MAP_SOURCE_DEFAULT))
+#define VIK_MAP_SOURCE_DEFAULT_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), VIK_TYPE_MAP_SOURCE_DEFAULT, VikMapSourceDefaultClass))
+
+typedef struct _VikMapSourceDefaultClass VikMapSourceDefaultClass;
+typedef struct _VikMapSourceDefault VikMapSourceDefault;
+
+struct _VikMapSourceDefaultClass
+{
+       VikMapSourceClass parent_class;
+};
+
+struct _VikMapSourceDefault
+{
+       VikMapSource parent_instance;
+};
+
+GType vik_map_source_default_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* _VIK_MAP_SOURCE_DEFAULT_H_ */