Fix misc bugs and bump version to 0.3 v0.3
authorAndy Spencer <andy753421@gmail.com>
Mon, 9 Nov 2009 15:00:20 +0000 (15:00 +0000)
committerAndy Spencer <andy753421@gmail.com>
Mon, 9 Nov 2009 16:10:44 +0000 (16:10 +0000)
18 files changed:
Makefile.am
configure.ac
docs/api/Makefile.am
docs/api/libgis-docs.sgml [new file with mode: 0644]
src/Makefile.am
src/gis-opengl.c
src/gis-opengl.h
src/gis-plugin.c
src/gis-prefs.c
src/gis-tile.c
src/gis-wms.c
src/plugins/Makefile.am
src/plugins/bmng.c
src/plugins/bmng.h
src/plugins/srtm.c
src/plugins/srtm.h
src/roam.c
src/wms_test.c

index 3f41410..f8becba 100644 (file)
@@ -16,7 +16,7 @@ release: all dist
        git push --all
        echo $(VERSION) > LATEST
        scp LATEST $(PACKAGE)-$(VERSION).tar.* \
-               "lug@lug.rose-hulman.edu:/home/lug/htdocs/proj/$(PACKAGE)"; \
+               "spenceal@lug.rose-hulman.edu:/home/lug/htdocs/proj/$(PACKAGE)"; \
        rm -f LATEST
 
 depscan:
index d3b9360..e9d4b08 100644 (file)
@@ -1,5 +1,5 @@
 # Init and options
-AC_INIT([libgis], [0.3-p1], [spenceal@rose-hulman.edu])
+AC_INIT([libgis], [0.3], [spenceal@rose-hulman.edu])
 AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability foreign])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
index 57a416d..742a495 100644 (file)
@@ -1,6 +1,6 @@
 AM_CPPFLAGS=$(SOUP_CFLAGS) $(GLIB_CFLAGS) $(GTK_CFLAGS)
 
-GTKDOC_LIBS        = $(SOUP_LIBS) $(GLIB_LIBS) $(GTK_LIBS) $(top_srcdir)/src/libgis.la
+GTKDOC_LIBS        = $(SOUP_LIBS) $(GLIB_LIBS) $(GTK_LIBS) $(top_srcdir)/src/libgis.la $(top_srcdir)/src/plugins/*.la
 DOC_MODULE         = libgis
 DOC_SOURCE_DIR     = $(top_srcdir)/src/
 DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.sgml
@@ -10,4 +10,4 @@ include $(top_srcdir)/gtk-doc.make
 CLEANFILES += libgis-sections.txt
 
 MAINTAINERCLEANFILES=\
-       tmpl/* Makefile.in libgis-docs.sgml libgis-overrides.txt libgis.types libgis-scan.*
+       tmpl/* Makefile.in libgis-overrides.txt libgis.types libgis-scan.*
diff --git a/docs/api/libgis-docs.sgml b/docs/api/libgis-docs.sgml
new file mode 100644 (file)
index 0000000..16957c0
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
+"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<book id="index" xmlns:xi="http://www.w3.org/2001/XInclude">
+       <bookinfo>
+               <title>libgis Reference Manual</title>
+       </bookinfo>
+
+       <chapter>
+               <title>Core API</title>
+               <xi:include href="xml/gis-world.xml"/>
+               <xi:include href="xml/gis-view.xml"/>
+               <xi:include href="xml/gis-opengl.xml"/>
+               <xi:include href="xml/gis-prefs.xml"/>
+       </chapter>
+
+       <chapter>
+               <title>Support</title>
+               <xi:include href="xml/gis-wms.xml"/>
+               <xi:include href="xml/gis-tile.xml"/>
+               <xi:include href="xml/gis-data.xml"/>
+               <xi:include href="xml/gpqueue.xml"/>
+               <xi:include href="xml/roam.xml"/>
+       </chapter>
+
+       <chapter>
+               <title>Plugins</title>
+               <xi:include href="xml/gis-plugin.xml"/>
+               <xi:include href="xml/bmng.xml"/>
+               <xi:include href="xml/srtm.xml"/>
+       </chapter>
+
+       <index>
+               <title>Index</title>
+       </index>
+
+</book>
index 5e3da6d..70ebf3c 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = plugins
+SUBDIRS = plugins
 
 AM_CFLAGS   = -Wall --std=gnu99 
 AM_CPPFLAGS = $(GLIB_CFLAGS) $(GTK_CFLAGS) $(SOUP_CFLAGS)
index 86fba80..1b21990 100644 (file)
@@ -370,6 +370,25 @@ void gis_opengl_set_height_func(GisOpenGL *self, GisTile *tile,
        g_list_free(triangles);
 }
 
+static void _gis_opengl_clear_height_func_rec(RoamTriangle *root)
+{
+       if (!root)
+               return;
+       RoamPoint *points[] = {root->p.l, root->p.m, root->p.r, root->split};
+       for (int i = 0; i < G_N_ELEMENTS(points); i++) {
+               points[i]->height_func = NULL;
+               points[i]->height_data = NULL;
+               roam_point_update_height(points[i]);
+       }
+       _gis_opengl_clear_height_func_rec(root->kids[0]);
+       _gis_opengl_clear_height_func_rec(root->kids[1]);
+}
+void gis_opengl_clear_height_func(GisOpenGL *self)
+{
+       for (int i = 0; i < G_N_ELEMENTS(self->sphere->roots); i++)
+               _gis_opengl_clear_height_func_rec(self->sphere->roots[i]);
+}
+
 void gis_opengl_redraw(GisOpenGL *self)
 {
        g_debug("GisOpenGL: redraw");
index 37099a7..256d0d0 100644 (file)
@@ -74,6 +74,8 @@ void gis_opengl_render_tiles(GisOpenGL *opengl, GisTile *root);
 void gis_opengl_set_height_func(GisOpenGL *self, GisTile *tile,
                RoamHeightFunc height_func, gpointer user_data, gboolean update);
 
+void gis_opengl_clear_height_func(GisOpenGL *self);
+
 void gis_opengl_redraw(GisOpenGL *opengl);
 
 void gis_opengl_begin(GisOpenGL *opengl);
index b0619f9..eb162b7 100644 (file)
@@ -56,7 +56,8 @@ void gis_plugin_expose(GisPlugin *self)
 GtkWidget *gis_plugin_get_config(GisPlugin *self)
 {
        g_return_val_if_fail(GIS_IS_PLUGIN(self), NULL);
-       return GIS_PLUGIN_GET_INTERFACE(self)->get_config(self);
+       GisPluginInterface *iface = GIS_PLUGIN_GET_INTERFACE(self);
+       return iface->get_config ? iface->get_config (self) : NULL;
 }
 
 
index 02d456d..d7d7d6d 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
+
 #include <glib.h>
 #include "gis-marshal.h"
 #include "gis-prefs.h"
 
-
 enum {
        SIG_PREF_CHANGED,
        NUM_SIGNALS,
 };
 static guint signals[NUM_SIGNALS];
 
-
 /***********
  * Methods *
  ***********/
@@ -38,7 +38,7 @@ GisPrefs *gis_prefs_new(const gchar *config, const gchar *defaults)
                self->key_path = g_strdup(config);
        else
                self->key_path = g_build_filename(g_get_user_config_dir(),
-                               "gis", "config.ini", NULL);
+                               PACKAGE, "config.ini", NULL);
        GError *error = NULL;
        g_key_file_load_from_file(self->key_file, self->key_path,
                        G_KEY_FILE_KEEP_COMMENTS, &error);
@@ -57,7 +57,6 @@ GisPrefs *gis_prefs_new(const gchar *config, const gchar *defaults)
                g_free(tmp);
        }
        if (error) {
-               g_clear_error(&error);
                g_warning("GisPrefs: new - Unable to load key file `%s': %s",
                        self->key_path, error->message);
        }
index 7a0f0b8..07baa09 100644 (file)
@@ -22,8 +22,8 @@
 #include "gis-tile.h"
 
 gchar *gis_tile_path_table[2][2] = {
-       {".00", ".01"},
-       {".10", ".11"},
+       {"00.", "01."},
+       {"10.", "11."},
 };
 
 GisTile *gis_tile_new(GisTile *parent,
index 0c15e87..bd4704d 100644 (file)
@@ -86,11 +86,9 @@ char *gis_wms_make_local(GisWms *self, GisTile *tile)
 {
        /* Get file path */
        gchar *tile_path = gis_tile_get_path(tile);
-       gchar *path = g_strdup_printf("%s/wms/%s%s%s",
-               g_get_user_cache_dir(),
-               self->cache_prefix,
-               tile_path,
-               self->cache_ext);
+       gchar *path = g_strdup_printf("%s/%s/%s%s%s",
+               g_get_user_cache_dir(), PACKAGE,
+               self->cache_prefix, tile_path, self->cache_ext);
        g_free(tile_path);
 
        /* Return if it already exists */
index 6e49cb8..3ebba58 100644 (file)
@@ -1,21 +1,17 @@
 MAINTAINERCLEANFILES = Makefile.in
 
-AM_CFLAGS       = -Wall --std=gnu99  -I../
-AM_CPPFLAGS     = $(GLIB_CFLAGS) $(GTK_CFLAGS) $(SOUP_CFLAGS)
-AM_LDFLAGS      = -module -avoid-version
-LIBS            = $(top_srcdir)/src/libgis.la
+AM_CFLAGS   = -Wall --std=gnu99  -I../
+AM_CPPFLAGS = $(GLIB_CFLAGS) $(GTK_CFLAGS) $(SOUP_CFLAGS)
+AM_LDFLAGS  = -module -avoid-version
+LIBS        = $(top_srcdir)/src/libgis.la
 
-pluginsdir  = $(pkglibdir)
+pluginsdir  = "$(libdir)/gis"
 
 plugins_LTLIBRARIES = bmng.la srtm.la
 bmng_la_SOURCES     = bmng.c bmng.h
+bmng_la_LIBADD      = $(top_srcdir)/src/libgis.la
 srtm_la_SOURCES     = srtm.c srtm.h
+srtm_la_LIBADD      = $(top_srcdir)/src/libgis.la
 
 test:
        ( cd ../; make test )
-
-# Fixme...
-bmng_la_DEPENDENCIES = $(top_srcdir)/src/libgis.la
-srtm_la_DEPENDENCIES = $(top_srcdir)/src/libgis.la
-$(top_srcdir)/src/libgis.la: $(wildcard ../*.[ch])
-       ( cd ../; make libgis.la )
index 8b02749..7aff2a7 100644 (file)
@@ -136,7 +136,8 @@ GisPluginBmng *gis_plugin_bmng_new(GisWorld *world, GisView *view, GisOpenGL *op
        g_thread_create(_update_tiles, self, FALSE, NULL);
 
        /* Connect signals */
-       g_signal_connect(self->view, "location-changed", G_CALLBACK(_on_location_changed), self);
+       self->sigid = g_signal_connect(self->view, "location-changed",
+                       G_CALLBACK(_on_location_changed), self);
 
        return self;
 }
@@ -144,7 +145,8 @@ GisPluginBmng *gis_plugin_bmng_new(GisWorld *world, GisView *view, GisOpenGL *op
 static void gis_plugin_bmng_expose(GisPlugin *_self)
 {
        GisPluginBmng *self = GIS_PLUGIN_BMNG(_self);
-       g_debug("GisPluginBmng: expose");
+       g_debug("GisPluginBmng: expose opengl=%p tiles=%p,%p",
+                       self->opengl, self->tiles, self->tiles->data);
        gis_opengl_render_tiles(self->opengl, self->tiles);
 }
 
@@ -172,13 +174,14 @@ static void gis_plugin_bmng_init(GisPluginBmng *self)
        self->tiles = gis_tile_new(NULL, NORTH, SOUTH, EAST, WEST);
        self->wms   = gis_wms_new(
                "http://www.nasa.network.com/wms", "bmng200406", "image/jpeg",
-               "bmng", ".jpg", TILE_WIDTH, TILE_HEIGHT);
+               "bmng/", "jpg", TILE_WIDTH, TILE_HEIGHT);
 }
 static void gis_plugin_bmng_dispose(GObject *gobject)
 {
        g_debug("GisPluginBmng: dispose");
        GisPluginBmng *self = GIS_PLUGIN_BMNG(gobject);
        /* Drop references */
+       g_signal_handler_disconnect(self->view, self->sigid);
        G_OBJECT_CLASS(gis_plugin_bmng_parent_class)->dispose(gobject);
 }
 static void gis_plugin_bmng_finalize(GObject *gobject)
index 5ebed78..f8eadca 100644 (file)
@@ -39,6 +39,7 @@ struct _GisPluginBmng {
        GisTile   *tiles;
        GisWms    *wms;
        GMutex    *mutex;
+       gulong     sigid;
 };
 
 struct _GisPluginBmngClass {
index 67dd7e0..e4460fe 100644 (file)
@@ -162,8 +162,7 @@ static gboolean _load_tile_cb(gpointer _load)
        /* Do necessasairy processing */
        /* TODO: Lock this and move to thread, can remove self from _load then */
        if (LOAD_BIL)
-               gis_opengl_set_height_func(self->opengl, tile,
-                       _height_func, self, TRUE);
+               gis_opengl_set_height_func(self->opengl, tile, _height_func, self, TRUE);
 
        /* Cleanup unneeded things */
        if (!LOAD_BIL)
@@ -250,7 +249,8 @@ GisPluginSrtm *gis_plugin_srtm_new(GisWorld *world, GisView *view, GisOpenGL *op
        g_thread_create(_update_tiles, self, FALSE, NULL);
 
        /* Connect signals */
-       g_signal_connect(view, "location-changed", G_CALLBACK(_on_location_changed), self);
+       self->sigid = g_signal_connect(self->view, "location-changed",
+                       G_CALLBACK(_on_location_changed), self);
 
        return self;
 }
@@ -288,13 +288,16 @@ static void gis_plugin_srtm_init(GisPluginSrtm *self)
        self->tiles = gis_tile_new(NULL, NORTH, SOUTH, EAST, WEST);
        self->wms   = gis_wms_new(
                "http://www.nasa.network.com/elev", "srtm30", "application/bil",
-               "srtm", ".bil", TILE_WIDTH, TILE_HEIGHT);
+               "srtm/", "bil", TILE_WIDTH, TILE_HEIGHT);
 }
 static void gis_plugin_srtm_dispose(GObject *gobject)
 {
        g_debug("GisPluginSrtm: dispose");
        GisPluginSrtm *self = GIS_PLUGIN_SRTM(gobject);
        /* Drop references */
+       g_signal_handler_disconnect(self->view, self->sigid);
+       if (LOAD_BIL)
+               gis_opengl_clear_height_func(self->opengl);
        G_OBJECT_CLASS(gis_plugin_srtm_parent_class)->dispose(gobject);
 }
 static void gis_plugin_srtm_finalize(GObject *gobject)
index 32fc08a..890fd2e 100644 (file)
@@ -39,6 +39,7 @@ struct _GisPluginSrtm {
        GisTile   *tiles;
        GisWms    *wms;
        GMutex    *mutex;
+       gulong     sigid;
 };
 
 struct _GisPluginSrtmClass {
index 9f2474f..de09bce 100644 (file)
@@ -672,7 +672,8 @@ GList *roam_sphere_get_intersect(RoamSphere *self,
         * time = 30      * 2*333           * i_cost = 20000 * i_cost */
        GList *list = NULL;
        for (int i = 0; i < G_N_ELEMENTS(self->roots); i++)
-               list = _roam_sphere_get_intersect_rec(self->roots[i], list, n, s, e, w);
+               list = _roam_sphere_get_intersect_rec(self->roots[i],
+                               list, n, s, e, w);
        return list;
 }
 void roam_sphere_free_tri(RoamTriangle *tri)
index c456659..625d83f 100644 (file)
@@ -40,7 +40,7 @@ gpointer do_cache(gpointer _image)
        g_message("Fetching image");
        GisWms *bmng_wms = gis_wms_new(
                "http://www.nasa.network.com/wms", "bmng200406", "image/jpeg",
-               "bmng", ".jpg", 512, 256);
+               "bmng_test/", "jpg", 512, 256);
        const char *path = gis_wms_make_local(bmng_wms, tile);
 
        g_message("Loading image: [%s]", path);