[GRASS-SVN] r51801 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 26 11:22:01 EDT 2012


Author: mmetz
Date: 2012-05-26 08:22:00 -0700 (Sat, 26 May 2012)
New Revision: 51801

Modified:
   grass/trunk/lib/vector/Vlib/select.c
Log:
adjust Vlib to changed rtree

Modified: grass/trunk/lib/vector/Vlib/select.c
===================================================================
--- grass/trunk/lib/vector/Vlib/select.c	2012-05-26 15:21:35 UTC (rev 51800)
+++ grass/trunk/lib/vector/Vlib/select.c	2012-05-26 15:22:00 UTC (rev 51801)
@@ -62,8 +62,14 @@
 void Vect_spatial_index_add_item(struct spatial_index * si, int id,
 				 const struct bound_box * box)
 {
-    struct RTree_Rect rect;
+    static struct RTree_Rect rect;
+    static int rect_init = 0;
 
+    if (!rect_init) {
+	rect.boundary = G_malloc(si->si_tree->nsides_alloc * sizeof(RectReal));
+	rect_init = si->si_tree->nsides_alloc;
+    }
+
     G_debug(3, "Vect_spatial_index_add_item(): id = %d", id);
 
     rect.boundary[0] = box->W;
@@ -87,8 +93,14 @@
 				 const struct bound_box * box)
 {
     int ret;
-    struct RTree_Rect rect;
+    static struct RTree_Rect rect;
+    static int rect_init = 0;
 
+    if (!rect_init) {
+	rect.boundary = G_malloc(si->si_tree->nsides_alloc * sizeof(RectReal));
+	rect_init = si->si_tree->nsides_alloc;
+    }
+
     G_debug(3, "Vect_spatial_index_del_item(): id = %d", id);
 
     rect.boundary[0] = box->W;
@@ -125,8 +137,14 @@
 Vect_spatial_index_select(const struct spatial_index * si, const struct bound_box * box,
 			  struct ilist *list)
 {
-    struct RTree_Rect rect;
+    static struct RTree_Rect rect;
+    static int rect_init = 0;
 
+    if (!rect_init) {
+	rect.boundary = G_malloc(si->si_tree->nsides_alloc * sizeof(RectReal));
+	rect_init = si->si_tree->nsides_alloc;
+    }
+
     G_debug(3, "Vect_spatial_index_select()");
 
     Vect_reset_list(list);



More information about the grass-commit mailing list