X-Git-Url: http://pileus.org/git/?p=grits;a=blobdiff_plain;f=src%2Fplugins%2Fmap.c;h=7a2d66d373f91d7d6d6daeb0a6e6ef101767bef7;hp=0dbb79f38931333092fa91274610d77dabed7945;hb=cbbad9dcf6bd2b27eca13aa61ab666035859932e;hpb=b87064909e6d20e1ee2995adae0c1ce5cb692d7e
diff --git a/src/plugins/map.c b/src/plugins/map.c
index 0dbb79f..7a2d66d 100644
--- a/src/plugins/map.c
+++ b/src/plugins/map.c
@@ -15,6 +15,14 @@
* along with this program. If not, see .
*/
+/**
+ * SECTION:map
+ * @short_description: Map plugin
+ *
+ * #GisPluginMap provides map overlays. Much of this data is obtained from the
+ * OpenStreetMap project.
+ */
+
#include
#include
#include
@@ -80,8 +88,8 @@ static gboolean _load_tile_cb(gpointer _data)
(alpha ? GL_RGBA : GL_RGB), GL_UNSIGNED_BYTE, pixels);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glFlush();
tile->data = tex;
@@ -126,7 +134,8 @@ static gpointer _update_tiles(gpointer _map)
{
g_debug("GisPluginMap: _update_tiles");
GisPluginMap *map = _map;
- g_mutex_lock(map->mutex);
+ if (!g_mutex_trylock(map->mutex))
+ return NULL;
gdouble lat, lon, elev;
gis_viewer_get_location(map->viewer, &lat, &lon, &elev);
gis_tile_update(map->tiles,
@@ -148,9 +157,24 @@ static void _on_location_changed(GisViewer *viewer,
g_thread_create(_update_tiles, map, FALSE, NULL);
}
+static gpointer _threaded_init(GisPluginMap *map)
+{
+ _load_tile(map->tiles, map);
+ _update_tiles(map);
+ return NULL;
+}
+
/***********
* Methods *
***********/
+/**
+ * gis_plugin_map_new:
+ * @viewer: the #GisViewer to use for drawing
+ *
+ * Create a new instance of the map plugin.
+ *
+ * Returns: the new #GisPluginMap
+ */
GisPluginMap *gis_plugin_map_new(GisViewer *viewer)
{
g_debug("GisPluginMap: new");
@@ -158,8 +182,7 @@ GisPluginMap *gis_plugin_map_new(GisViewer *viewer)
map->viewer = g_object_ref(viewer);
/* Load initial tiles */
- _load_tile(map->tiles, map);
- g_thread_create(_update_tiles, map, FALSE, NULL);
+ g_thread_create((GThreadFunc)_threaded_init, map, FALSE, NULL);
/* Connect signals */
map->sigid = g_signal_connect(map->viewer, "location-changed",