Jelajahi Sumber

remove bounding boxes from vector topology (Radim's TODO): update rtree

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@46899 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 14 tahun lalu
induk
melakukan
2089ff60ef

+ 2 - 0
lib/vector/rtree/index.c

@@ -132,6 +132,8 @@ void RTreeFreeIndex(struct RTree *t)
 	RTreeDestroyNode(t->root, t->root->level ? t->nodecard : t->leafcard);
 
     free(t);
+    
+    return;
 }
 
 /*

+ 3 - 3
lib/vector/rtree/index.h

@@ -46,10 +46,10 @@ typedef double RectReal;
  * this is LFS dependent, not good
  * on 32 bit without LFS this is 9.69
  * on 32 bit with LFS and on 64 bit this is 9 */
-#define MAXCARD 18
+#define MAXCARD 9
 
 /* R*-tree: number of branches to be force-reinserted when adding a branch */
-#define FORCECARD 2
+#define FORCECARD 3
 
 /* maximum no of levels = tree depth */
 #define MAXLEVEL 20        /* 8^MAXLEVEL items are guaranteed to fit into the tree */
@@ -90,7 +90,7 @@ struct Node             /* node for spatial index */
  * It can terminate the search early by returning 0 in which case
  * the search will return the number of hits found up to that point.
  */
-typedef int SearchHitCallback(int id, void *arg);
+typedef int SearchHitCallback(int id, struct Rect rect, void *arg);
 
 struct RTree;
 

+ 2 - 1
lib/vector/rtree/indexf.c

@@ -91,7 +91,8 @@ int RTreeSearchF(struct RTree *t, struct Rect *r,
 		    RTreeOverlap(r, &(s[top].sn.branch[i].rect), t)) {
 		    hitCount++;
 		    if (shcb) {	/* call the user-provided callback */
-			if (!shcb(s[top].sn.branch[i].child.id, cbarg)) {
+			if (!shcb(s[top].sn.branch[i].child.id,
+			          s[top].sn.branch[i].rect, cbarg)) {
 			    /* callback wants to terminate search early */
 			    return hitCount;
 			}

+ 2 - 1
lib/vector/rtree/indexm.c

@@ -83,7 +83,8 @@ int RTreeSearchM(struct RTree *t, struct Rect *r,
 		    RTreeOverlap(r, &(s[top].sn->branch[i].rect), t)) {
 		    hitCount++;
 		    if (shcb) {	/* call the user-provided callback */
-			if (!shcb(s[top].sn->branch[i].child.id, cbarg)) {
+			if (!shcb(s[top].sn->branch[i].child.id,
+			          s[top].sn->branch[i].rect, cbarg)) {
 			    /* callback wants to terminate search early */
 			    return hitCount;
 			}

+ 2 - 0
lib/vector/rtree/node.c

@@ -263,6 +263,8 @@ void RTreeDestroyNode(struct Node *n, int nodes)
 
     /* Free this node */
     RTreeFreeNode(n);
+    
+    return;
 }
 
 /****************************************************************