[libgis] Use GisBounds for height_func instead of GisTile



commit 2be8bbde8f465947d364b28c5e156631caed6d25
Author: Andy Spencer <andy753421 gmail com>
Date:   Sun Oct 24 11:50:15 2010 +0000

    Use GisBounds for height_func instead of GisTile

 src/gis-opengl.c   |   11 +++++------
 src/gis-test.c     |    4 ++--
 src/gis-viewer.c   |    8 ++++----
 src/gis-viewer.h   |    5 ++---
 src/plugins/elev.c |    2 +-
 5 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/src/gis-opengl.c b/src/gis-opengl.c
index ecbf47a..8b71142 100644
--- a/src/gis-opengl.c
+++ b/src/gis-opengl.c
@@ -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]);
diff --git a/src/gis-test.c b/src/gis-test.c
index 3423af5..153cbda 100644
--- a/src/gis-test.c
+++ b/src/gis-test.c
@@ -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));
diff --git a/src/gis-viewer.c b/src/gis-viewer.c
index 8679ff9..38c8207 100644
--- a/src/gis-viewer.c
+++ b/src/gis-viewer.c
@@ -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);
 }
 
 /**
diff --git a/src/gis-viewer.h b/src/gis-viewer.h
index 76a2d11..8482068 100644
--- a/src/gis-viewer.h
+++ b/src/gis-viewer.h
@@ -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);
 
diff --git a/src/plugins/elev.c b/src/plugins/elev.c
index a6589ff..0ee96db 100644
--- a/src/plugins/elev.c
+++ b/src/plugins/elev.c
@@ -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)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]