37 int hitCount = 0, notfound;
54 for (i = s[top].
branch_id; i <
t->nodecard; i++) {
72 for (i = 0; i <
t->leafcard; i++) {
109 int top = 0, down = 0;
118 while (s[top].
sn->
level > level) {
147 else if (result == 2) {
151 else if (result == 1) {
198 result = RTreeInsertRect2M(
r,
child, level, &newnode,
t, &reInsertList,
205 newroot->
level =
t->rootlevel;
208 b->child.ptr =
t->root;
212 b->child.ptr = newnode;
222 while (reInsertList) {
225 level = reInsertList->
level;
227 reInsertList = reInsertList->
next;
230 result = RTreeInsertRect2M(&(
b->rect),
b->child, level, &newnode,
t,
231 &reInsertList, overflow);
237 newroot->
level =
t->rootlevel;
240 b->child.ptr =
t->root;
244 b->child.ptr = newnode;
267 int top = 0, down = 0;
278 while (notfound && top >= 0) {
282 for (i = s[top].
branch_id; i <
t->nodecard; i++) {
303 for (i = 0; i <
t->leafcard; i++) {
305 s[top].sn->branch[i].child.id ==
329 minfill = (s[down].
sn->
level ?
t->min_node_fill :
t->min_leaf_fill);
330 if (s[down].
sn->
count >= minfill) {
360 if (!RTreeDeleteRect2M(
r, child,
t, &reInsertList)) {
364 while (reInsertList) {
366 n = reInsertList->
node;
368 for (i = 0; i <
t->nodecard; i++) {
376 for (i = 0; i <
t->leafcard; i++) {
384 reInsertList = reInsertList->
next;
393 for (i = 0; i <
t->nodecard; i++) {
int RTreeAddBranch(struct RTree_Branch *, struct RTree_Node *, struct RTree_Node **, struct RTree_ListBranch **, struct RTree_Rect *, char *, struct RTree *)
void RTreeDisconnectBranch(struct RTree_Node *, int, struct RTree *)
void RTreeNodeCover(struct RTree_Node *, struct RTree_Rect *, struct RTree *)
void RTreeCopyBranch(struct RTree_Branch *, struct RTree_Branch *, struct RTree *)
int RTreePickBranch(struct RTree_Rect *, struct RTree_Node *, struct RTree *)
int RTreeExpandRect(struct RTree_Rect *, struct RTree_Rect *, struct RTree *)
#define RTreeCopyRect(r1, r2, t)
int RTreeDeleteRectM(struct RTree_Rect *r, union RTree_Child child, struct RTree *t)
int RTreeSearchM(struct RTree *t, struct RTree_Rect *r, SearchHitCallback *shcb, void *cbarg)
int RTreeValidChildM(union RTree_Child *child)
int RTreeInsertRectM(struct RTree_Rect *r, union RTree_Child child, int level, struct RTree *t)
#define assert(condition)
void RTreeFreeNode(struct RTree_Node *n)
struct RTree_Node * RTreeAllocNode(struct RTree *t, int level)
int RTreeOverlap(struct RTree_Rect *r, struct RTree_Rect *s, struct RTree *t)
int SearchHitCallback(int id, const struct RTree_Rect *rect, void *arg)
struct RTree_ListBranch * next
struct RTree_ListNode * next
struct RTree_Branch * branch
void RTreeFreeListNode(struct RTree_ListNode *p)
void RTreeReInsertNode(struct RTree_Node *n, struct RTree_ListNode **ee)
void RTreeFreeListBranch(struct RTree_ListBranch *p)
#define MAXLEVEL
Maximum verbosity level.