2 * Copyright (C) 2009 Andy Spencer <spenceal@rose-hulman.edu>
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/>.
23 #include <libsoup/soup.h>
25 typedef struct _WmsCacheNode WmsCacheNode;
26 typedef struct _WmsInfo WmsInfo;
28 typedef void (*WmsChunkCallback)(gsize cur, gsize total, gpointer user_data);
29 typedef void (*WmsDoneCallback)(WmsCacheNode *node, gpointer user_data);
30 typedef void (*WmsLoader)(WmsCacheNode *node, const gchar *path, gint width, gint height);
31 typedef void (*WmsFreeer)(WmsCacheNode *node);
36 struct _WmsCacheNode {
38 gdouble latlon[4]; // xmin,ymin,xmax,ymax
39 gdouble res; // xmin,ymin,xmax,ymax
43 WmsCacheNode *children[4][4];
46 WmsCacheNode *wms_cache_node_new(WmsCacheNode *parent, gdouble xmin, gdouble ymin, gdouble xmax, gdouble ymax, gint width);
48 void wms_cache_node_free(WmsCacheNode *node, WmsFreeer freeer);
59 gint resolution; // m/px
68 WmsCacheNode *cache_root;
72 WmsInfo *wms_info_new(WmsLoader loader, WmsFreeer freeer,
73 gchar *uri_prefix, gchar *uri_layer, gchar *uri_format,
74 gchar *cache_prefix, gchar *cache_ext,
75 gint resolution, gint width, gint height);
77 void wms_info_cache(WmsInfo *info, gdouble resolution, gdouble lat, gdouble lon,
78 WmsChunkCallback chunk_callback, WmsDoneCallback done_callback,
81 WmsCacheNode *wms_info_fetch(WmsInfo *info, WmsCacheNode *root,
82 gdouble resolution, gdouble lat, gdouble lon,
85 WmsCacheNode *wms_info_fetch_cache(WmsInfo *info, WmsCacheNode *root,
86 gdouble resolution, gdouble lat, gdouble lon,
87 WmsChunkCallback chunk_callback, WmsDoneCallback done_callback,
90 gboolean wms_info_gc(WmsInfo *self);
92 void wms_info_free(WmsInfo *info);
95 /********************************
96 * Specific things (bmng, srtm) *
97 ********************************/
98 typedef struct _WmsBil WmsBil;
105 void bmng_opengl_loader(WmsCacheNode *node, const gchar *path, gint width, gint height);
106 void bmng_opengl_freeer(WmsCacheNode *node);
108 void bmng_pixbuf_loader(WmsCacheNode *node, const gchar *path, gint width, gint height);
109 void bmng_pixbuf_freeer(WmsCacheNode *node);
111 WmsInfo *wms_info_new_for_bmng(WmsLoader loader, WmsFreeer freeer);
113 void srtm_bil_loader(WmsCacheNode *node, const gchar *path, gint width, gint height);
114 void srtm_bil_freeer(WmsCacheNode *node);
116 void srtm_pixbuf_loader(WmsCacheNode *node, const gchar *path, gint width, gint height);
117 void srtm_pixbuf_freeer(WmsCacheNode *node);
119 WmsInfo *wms_info_new_for_srtm(WmsLoader loader, WmsFreeer freeer);