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
41 WmsCacheNode *children[4][4];
44 WmsCacheNode *wms_cache_node_new(gdouble xmin, gdouble ymin, gdouble xmax, gdouble ymax);
46 void wms_cache_node_free(WmsCacheNode *node, WmsFreeer freeer);
59 gint resolution; // m/px
66 WmsCacheNode *cache_root;
70 WmsInfo *wms_info_new(WmsLoader loader, WmsFreeer freeer,
71 gchar *uri_prefix, gchar *uri_layer, gchar *uri_format,
72 gchar *cache_prefix, gchar *cache_ext,
73 gint resolution, gint width, gint height);
75 void wms_info_cache(WmsInfo *info, gdouble resolution, gdouble lat, gdouble lon,
76 WmsChunkCallback chunk_callback, WmsDoneCallback done_callback,
79 WmsCacheNode *wms_info_fetch(WmsInfo *info, gdouble resolution, gdouble lat, gdouble lon,
82 WmsCacheNode *wms_info_fetch_cache(WmsInfo *info, gdouble resolution, gdouble lat, gdouble lon,
83 WmsChunkCallback chunk_callback, WmsDoneCallback done_callback,
86 gboolean wms_info_gc(WmsInfo *self);
88 void wms_info_free(WmsInfo *info);
91 /********************************
92 * Specific things (bmng, srtm) *
93 ********************************/
94 typedef struct _WmsBil WmsBil;
101 void bmng_opengl_loader(WmsCacheNode *node, const gchar *path, gint width, gint height);
102 void bmng_opengl_freeer(WmsCacheNode *node);
104 void bmng_pixbuf_loader(WmsCacheNode *node, const gchar *path, gint width, gint height);
105 void bmng_pixbuf_freeer(WmsCacheNode *node);
107 WmsInfo *wms_info_new_for_bmng(WmsLoader loader, WmsFreeer freeer);
109 void srtm_bil_loader(WmsCacheNode *node, const gchar *path, gint width, gint height);
110 void srtm_bil_freeer(WmsCacheNode *node);
112 void srtm_pixbuf_loader(WmsCacheNode *node, const gchar *path, gint width, gint height);
113 void srtm_pixbuf_freeer(WmsCacheNode *node);
115 WmsInfo *wms_info_new_for_srtm(WmsLoader loader, WmsFreeer freeer);