]> Pileus Git - grits/blobdiff - src/plugins/map.c
Miscellaneous bug fixes
[grits] / src / plugins / map.c
index 7a2d66d373f91d7d6d6daeb0a6e6ef101767bef7..4be4607a1964e298152b8de168cd39ee78c4ed34 100644 (file)
@@ -127,7 +127,8 @@ static void _free_tile(GisTile *tile, gpointer _map)
 {
        GisPluginMap *map = _map;
        g_debug("GisPluginMap: _free_tile: %p", tile->data);
-       g_idle_add_full(G_PRIORITY_LOW, _free_tile_cb, tile->data, NULL);
+       if (tile->data)
+               g_idle_add_full(G_PRIORITY_LOW, _free_tile_cb, tile->data, NULL);
 }
 
 static gpointer _update_tiles(gpointer _map)
@@ -136,11 +137,10 @@ static gpointer _update_tiles(gpointer _map)
        GisPluginMap *map = _map;
        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,
+       GisPoint eye;
+       gis_viewer_get_location(map->viewer, &eye.lat, &eye.lon, &eye.elev);
+       gis_tile_update(map->tiles, &eye,
                        MAX_RESOLUTION, TILE_WIDTH, TILE_WIDTH,
-                       lat, lon, elev,
                        _load_tile, map);
        gis_tile_gc(map->tiles, time(NULL)-10,
                        _free_tile, map);
@@ -189,7 +189,7 @@ GisPluginMap *gis_plugin_map_new(GisViewer *viewer)
                        G_CALLBACK(_on_location_changed), map);
 
        /* Add renderers */
-       gis_viewer_add(viewer, GIS_OBJECT(map->tiles), GIS_LEVEL_OVERLAY, 0);
+       gis_viewer_add(viewer, GIS_OBJECT(map->tiles), GIS_LEVEL_OVERLAY-1, 0);
 
        return map;
 }