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 *self, GisTile *tile, GisCacheType mode,
94 GisChunkCallback callback, gpointer user_data)
96 gchar *uri = _make_uri(self, tile);
97 gchar *tilep = gis_tile_get_path(tile);
98 gchar *local = g_strdup_printf("%s%s", tilep, self->extension);
99 gchar *path = gis_http_fetch(self->http, uri, local,
100 mode, callback, user_data);
108 const gchar *uri_prefix, const gchar *uri_layer,
109 const gchar *uri_format, const gchar *prefix,
110 const gchar *extension, gint width, gint height)
112 g_debug("GisWms: new - %s", uri_prefix);
113 GisWms *self = g_new0(GisWms, 1);
114 self->http = gis_http_new(prefix);
115 self->uri_prefix = g_strdup(uri_prefix);
116 self->uri_layer = g_strdup(uri_layer);
117 self->uri_format = g_strdup(uri_format);
118 self->extension = g_strdup(extension);
120 self->height = height;
124 void gis_wms_free(GisWms *self)
126 g_debug("GisWms: free - %s", self->uri_prefix);
127 gis_http_free(self->http);
128 g_free(self->uri_prefix);
129 g_free(self->uri_layer);
130 g_free(self->uri_format);
131 g_free(self->extension);