priv->sel_y_start = 0.0;
}
+/**
+ * gtk_mapserver_new:
+ *
+ * Returns: the new created #GtkMapserver object.
+ */
GtkWidget
*gtk_mapserver_new ()
{
return gtk_mapserver;
}
+/**
+ * gtk_mapserver_get_soup_message:
+ * @gtkm:
+ * @url:
+ *
+ * Returns:
+ */
SoupMessage
*gtk_mapserver_get_soup_message (GtkMapserver *gtkm,
const gchar *url)
return msg;
}
+/**
+ * gtk_mapserver_set_home:
+ * @gtkm:
+ * @url:
+ */
void
gtk_mapserver_set_home (GtkMapserver *gtkm,
const gchar *url)
{
gdk_pixbuf_loader_close (pxb_loader, NULL);
}
+
+ g_object_unref (msg);
}
- g_object_unref (msg);
if (pxb_loader != NULL)
{
g_object_set (G_OBJECT (priv->img),
}
}
+/**
+ * gtk_mapserver_get_extent:
+ * @gtkm:
+ * @url:
+ *
+ * Returns: a #GtkMapserverExtent. Mapserver must returns an html page in the form "minx miny maxx maxy".
+ */
+GtkMapserverExtent
+*gtk_mapserver_get_extent (GtkMapserver *gtkm, const gchar *url)
+{
+ GtkMapserverExtent *ext;
+ SoupMessage *msg;
+
+ ext = NULL;
+
+ msg = gtk_mapserver_get_soup_message (gtkm, url);
+ if (msg != NULL)
+ {
+ gchar **coords;
+
+ ext = (GtkMapserverExtent *)g_new0 (GtkMapserverExtent, 1);
+
+ coords = g_strsplit (msg->response_body->data, " ", -1);
+ ext->minx = g_strtod (coords[0], NULL);
+ ext->miny = g_strtod (coords[1], NULL);
+ ext->maxx = g_strtod (coords[2], NULL);
+ ext->maxy = g_strtod (coords[3], NULL);
+
+ g_strfreev (coords);
+
+ g_object_unref (msg);
+ }
+
+ return ext;
+}
+
/* PRIVATE */
static void
gtk_mapserver_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
{
GtkWidget *window;
GtkWidget *gtkmap;
+ GtkMapserverExtent *ext;
/* Initialize GTK+. */
gtk_init (&argc, &argv);
gtk_mapserver_set_home (GTK_MAPSERVER (gtkmap), "http://atlante/cgi-bin/mapserv?map=/var/www_mapper/www_pm4/config/cdu/RU_cdu.map&mode=map&layers=catasto");
+ ext = gtk_mapserver_get_extent (GTK_MAPSERVER (gtkmap), "http://atlante/cgi-bin/mapserv?map=/var/www_mapper/www_pm4/config/cdu/RU_cdu.map&mode=itemquery&qlayer=catasto&qstring=\"foglio\"='2' and \"part\"='22'&map.layer[catasto]=TEMPLATE \"shpext.html\"");
+ if (ext != NULL)
+ {
+ g_message ("Extent: %f %f %f %f", ext->minx, ext->miny, ext->maxx, ext->maxy);
+ }
+
/* Pass control to the GTK+ main event loop. */
gtk_main ();