2 * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * http://labs.metacarta.com/wms/vmap0?
27 * EXCEPTIONS=application/vnd.ogc.se_inimage&
36 * http://www.nasa.network.com/elev?
43 * BBOX=-180,-90,180,90&
48 * http://www.nasa.network.com/elev?
55 * BBOX=-180,-90,180,90&
56 * FORMAT=application/bil32&
68 static gchar *_make_uri(GisWms *wms, GisTile *tile)
70 return g_strdup_printf(
93 gchar *gis_wms_fetch(GisWms *wms, GisTile *tile, GisCacheType mode,
94 GisChunkCallback callback, gpointer user_data)
96 gchar *uri = _make_uri(wms, tile);
97 gchar *tilep = gis_tile_get_path(tile);
98 gchar *local = g_strdup_printf("%s%s", tilep, wms->extension);
100 gchar *path = gis_http_fetch(wms->http, uri, local,
101 mode, callback, user_data);
109 const gchar *uri_prefix, const gchar *uri_layer,
110 const gchar *uri_format, const gchar *prefix,
111 const gchar *extension, gint width, gint height)
113 g_debug("GisWms: new - %s", uri_prefix);
114 GisWms *wms = g_new0(GisWms, 1);
115 wms->http = gis_http_new(prefix);
116 wms->uri_prefix = g_strdup(uri_prefix);
117 wms->uri_layer = g_strdup(uri_layer);
118 wms->uri_format = g_strdup(uri_format);
119 wms->extension = g_strdup(extension);
121 wms->height = height;
125 void gis_wms_free(GisWms *wms)
127 g_debug("GisWms: free - %s", wms->uri_prefix);
128 gis_http_free(wms->http);
129 g_free(wms->uri_prefix);
130 g_free(wms->uri_layer);
131 g_free(wms->uri_format);
132 g_free(wms->extension);