]> Pileus Git - grits/commitdiff
Use GisBounds for height_func instead of GisTile
authorAndy Spencer <andy753421@gmail.com>
Sun, 24 Oct 2010 11:50:15 +0000 (11:50 +0000)
committerAndy Spencer <andy753421@gmail.com>
Sun, 24 Oct 2010 11:50:15 +0000 (11:50 +0000)
src/gis-opengl.c
src/gis-test.c
src/gis-viewer.c
src/gis-viewer.h
src/plugins/elev.c

index ecbf47a4c140fa457de449051e88eb39696ceb00..8b711426e123c7e76c60bc0b8d4c01af0de3662d 100644 (file)
@@ -41,6 +41,7 @@
 #include "roam.h"
 
 #include "objects/gis-object.h"
+#include "objects/gis-tile.h"
 #include "objects/gis-marker.h"
 #include "objects/gis-callback.h"
 
@@ -567,22 +568,20 @@ static void gis_opengl_project(GisViewer *_opengl,
                px, py, pz);
 }
 
-static void gis_opengl_set_height_func(GisViewer *_opengl, GisTile *tile,
+static void gis_opengl_set_height_func(GisViewer *_opengl, GisBounds *bounds,
                RoamHeightFunc height_func, gpointer user_data, gboolean update)
 {
        GisOpenGL *opengl = GIS_OPENGL(_opengl);
-       if (!tile)
-               return;
        /* TODO: get points? */
        g_mutex_lock(opengl->sphere_lock);
        GList *triangles = roam_sphere_get_intersect(opengl->sphere, TRUE,
-                       tile->edge.n, tile->edge.s, tile->edge.e, tile->edge.w);
+                       bounds->n, bounds->s, bounds->e, bounds->w);
        for (GList *cur = triangles; cur; cur = cur->next) {
                RoamTriangle *tri = cur->data;
                RoamPoint *points[] = {tri->p.l, tri->p.m, tri->p.r, tri->split};
                for (int i = 0; i < G_N_ELEMENTS(points); i++) {
-                       if (tile->edge.n >= points[i]->lat && points[i]->lat >= tile->edge.s &&
-                           tile->edge.e >= points[i]->lon && points[i]->lon >= tile->edge.w) {
+                       if (bounds->n >= points[i]->lat && points[i]->lat >= bounds->s &&
+                           bounds->e >= points[i]->lon && points[i]->lon >= bounds->w) {
                                points[i]->height_func = height_func;
                                points[i]->height_data = user_data;
                                roam_point_update_height(points[i]);
index 3423af5a389f665c6bdd0f587f33c7fef451d62e..153cbda88bea4adda3f361a6d9771878fc4929c8 100644 (file)
@@ -88,8 +88,8 @@ int main(int argc, char **argv)
 
        /* Configurable stuff */
        gis_viewer_set_offline(viewer, TRUE);
-       //load_plugin(plugins, "elev",  viewer, prefs, GTK_NOTEBOOK(config));
-       //load_plugin(plugins, "env",   viewer, prefs, GTK_NOTEBOOK(config));
+       load_plugin(plugins, "elev",  viewer, prefs, GTK_NOTEBOOK(config));
+       load_plugin(plugins, "env",   viewer, prefs, GTK_NOTEBOOK(config));
        //load_plugin(plugins, "map",   viewer, prefs, GTK_NOTEBOOK(config));
        load_plugin(plugins, "sat",   viewer, prefs, GTK_NOTEBOOK(config));
        load_plugin(plugins, "test",  viewer, prefs, GTK_NOTEBOOK(config));
index 8679ff990104d4a79758a41c8f5491689a0e631c..38c820718b0bcdf333c90a587a9d6e3b1b633571 100644 (file)
@@ -482,21 +482,21 @@ void gis_viewer_clear_height_func(GisViewer *viewer)
 /**
  * gis_viewer_set_height_func:
  * @viewer:      the viewer
- * @tile:        the area to set the height function for
+ * @bounds:      the area to set the height function for
  * @height_func: the height function 
  * @user_data:   user data to pass to the height function
- * @update:      %TRUE if the heights inside the tile should be updated.
+ * @update:      %TRUE if the heights inside the bounds should be updated.
  *
  * Set the height function to be used for a given part of the surface..
  */
-void gis_viewer_set_height_func(GisViewer *viewer, GisTile *tile,
+void gis_viewer_set_height_func(GisViewer *viewer, GisBounds *bounds,
                GisHeightFunc height_func, gpointer user_data,
                gboolean update)
 {
        GisViewerClass *klass = GIS_VIEWER_GET_CLASS(viewer);
        if (!klass->set_height_func)
                g_warning("GisViewer: set_height_func - Unimplemented");
-       klass->set_height_func(viewer, tile, height_func, user_data, update);
+       klass->set_height_func(viewer, bounds, height_func, user_data, update);
 }
 
 /**
index 76a2d117c098dcd4843aa1c8f6448794f6580329..848206866687ee661549531d8f9f41eb81fcca6a 100644 (file)
@@ -81,7 +81,6 @@ typedef gdouble (*GisHeightFunc)(gdouble lat, gdouble lon, gpointer user_data);
 #include "gis-plugin.h"
 #include "gis-prefs.h"
 #include "objects/gis-object.h"
-#include "objects/gis-tile.h"
 
 struct _GisViewer {
        GtkDrawingArea parent_instance;
@@ -111,7 +110,7 @@ struct _GisViewerClass {
                                  gdouble *px, gdouble *py, gdouble *pz);
 
        void (*clear_height_func)(GisViewer *viewer);
-       void (*set_height_func)  (GisViewer *viewer, GisTile *tile,
+       void (*set_height_func)  (GisViewer *viewer, GisBounds *bounds,
                                  GisHeightFunc height_func, gpointer user_data,
                                  gboolean update);
 
@@ -151,7 +150,7 @@ void gis_viewer_project(GisViewer *viewer,
                gdouble *px, gdouble *py, gdouble *pz);
 
 void gis_viewer_clear_height_func(GisViewer *viewer);
-void gis_viewer_set_height_func(GisViewer *viewer, GisTile *tile,
+void gis_viewer_set_height_func(GisViewer *viewer, GisBounds *bounds,
                GisHeightFunc height_func, gpointer user_data,
                gboolean update);
 
index a6589ff0b6aff8af717ea2055611a46d10abeca3..0ee96db3f7c98034a19cf18ea731e179a57896d7 100644 (file)
@@ -188,7 +188,7 @@ static gboolean _load_tile_cb(gpointer _load)
        /* Do necessasairy processing */
        /* TODO: Lock this and move to thread, can remove elev from _load then */
        if (LOAD_BIL)
-               gis_viewer_set_height_func(elev->viewer, tile, _height_func, elev, TRUE);
+               gis_viewer_set_height_func(elev->viewer, &tile->edge, _height_func, elev, TRUE);
 
        /* Cleanup unneeded things */
        if (!LOAD_BIL)