/*
* viking -- GPS Data and Topo Analyzer, Explorer, and Manager
*
- * Copyright (C) 2011, Rob Norris <rw_norris@hotmail.com>
+ * Copyright (C) 2011-2015, Rob Norris <rw_norris@hotmail.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
#include "globals.h"
-static void webtool_bounds_class_init ( VikWebtoolBoundsClass *klass );
-static void webtool_bounds_init ( VikWebtoolBounds *vwd );
-
static GObjectClass *parent_class;
static void webtool_bounds_finalize ( GObject *gob );
-
static gchar *webtool_bounds_get_url ( VikWebtool *vw, VikWindow *vwindow );
+static gchar *webtool_bounds_get_url_at_position ( VikWebtool *vw, VikWindow *vwindow, VikCoord *vc );
typedef struct _VikWebtoolBoundsPrivate VikWebtoolBoundsPrivate;
VIK_WEBTOOL_BOUNDS_TYPE, \
VikWebtoolBoundsPrivate))
-GType vik_webtool_bounds_get_type()
-{
- static GType w_type = 0;
-
- if (!w_type)
- {
- static const GTypeInfo w_info =
- {
- sizeof (VikWebtoolBoundsClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) webtool_bounds_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (VikWebtoolBounds),
- 0,
- (GInstanceInitFunc) webtool_bounds_init,
- };
- w_type = g_type_register_static ( VIK_WEBTOOL_TYPE, "VikWebtoolBounds", &w_info, 0 );
- }
-
- return w_type;
-}
+G_DEFINE_TYPE (VikWebtoolBounds, vik_webtool_bounds, VIK_WEBTOOL_TYPE)
enum
{
}
}
-static void webtool_bounds_class_init ( VikWebtoolBoundsClass *klass )
+static void
+vik_webtool_bounds_class_init ( VikWebtoolBoundsClass *klass )
{
GObjectClass *gobject_class;
VikWebtoolClass *base_class;
base_class = VIK_WEBTOOL_CLASS ( klass );
base_class->get_url = webtool_bounds_get_url;
-
- //klass->mpp_to_zoom = webtool_bounds_mpp_to_zoom;
+ base_class->get_url_at_position = webtool_bounds_get_url_at_position;
g_type_class_add_private (klass, sizeof (VikWebtoolBoundsPrivate));
}
return result;
}
-static void webtool_bounds_init ( VikWebtoolBounds *self )
+static void
+vik_webtool_bounds_init ( VikWebtoolBounds *self )
{
VikWebtoolBoundsPrivate *priv = WEBTOOL_BOUNDS_GET_PRIVATE (self);
priv->url = NULL;
return g_strdup_printf ( priv->url, sminlon, smaxlon, sminlat, smaxlat );
}
+
+static gchar *webtool_bounds_get_url_at_position ( VikWebtool *self, VikWindow *vwindow, VikCoord *vc )
+{
+ // TODO: could use zoom level to generate an offset from center lat/lon to get the bounds
+ // For now simply use the existing function to use bounds from the viewport
+ return webtool_bounds_get_url ( self, vwindow );
+}