HiVecMap_code/src/VPQTreeNode.cpp
// Build to the VPQ-tree node of the MBR containing a single point or line object
Build to the VPQ-tree node of the MBR containing a single point or line object
Build to the VPQ - tree node of the MBR containing a single point or line object
VPQTreeNode * VPQTreeNode::buildMBNode(float obj_x_min, float obj_y_min, float obj_x_max, float obj_y_max){
    if (IsContain(x, y+width/2, width/2, obj_x_min, obj_y_min, obj_x_max, obj_y_max) && (level+1 <= tqTree_level)){
        if (!upLeftNode){
            upLeftNode = new VPQTreeNode(x, y+width/2, width/2, level+1, UP_LEFT, this);
        }
        VPQTreeNode *seek = upLeftNode->buildMBNode(obj_x_min, obj_y_min, obj_x_max, obj_y_max);
        return seek;
    }
    else if (IsContain(x+width/2, y+width/2, width/2, obj_x_min, obj_y_min, obj_x_max, obj_y_max) && (level+1 <= tqTree_level)){
        if (!upRightNode){
            upRightNode = new VPQTreeNode(x+width/2, y+width/2, width/2, level+1, UP_RIGHT, this);
        }
        VPQTreeNode *seek = upRightNode->buildMBNode(obj_x_min, obj_y_min, obj_x_max, obj_y_max);
        return seek;
    }
    else if (IsContain(x, y, width/2, obj_x_min, obj_y_min, obj_x_max, obj_y_max) && (level+1 <= tqTree_level)){
        if (!bottomLeftNode){
            bottomLeftNode = new VPQTreeNode(x, y, width/2, level+1, BOTTOM_LEFT, this);
        }
        VPQTreeNode *seek = bottomLeftNode->buildMBNode(obj_x_min, obj_y_min, obj_x_max, obj_y_max);
        return seek;
    }
    else if (IsContain(x+width/2, y, width/2, obj_x_min, obj_y_min, obj_x_max, obj_y_max) && (level+1 <= tqTree_level)){
        if (!bottomRightNode){
            bottomRightNode = new VPQTreeNode(x+width/2, y, width/2, level+1, BOTTOM_RIGHT, this);
        }
        VPQTreeNode *seek = bottomRightNode->buildMBNode(obj_x_min, obj_y_min, obj_x_max, obj_y_max);
        return seek;
    }
    else {
        return this;
    }
}
VPQTreeNode * VPQTreeNode :: buildMBNode ( float obj_x_min , float obj_y_min , float obj_x_max , float obj_y_max ) { if ( IsContain ( x , y + width / 2 , width / 2 , obj_x_min , obj_y_min , obj_x_max , obj_y_max ) && ( level + 1 <= tqTree_level ) ) { if ( ! upLeftNode ) { upLeftNode = new VPQTreeNode ( x , y + width / 2 , width / 2 , level + 1 , UP_LEFT , this ) ; } VPQTreeNode * seek = upLeftNode -> buildMBNode ( obj_x_min , obj_y_min , obj_x_max , obj_y_max ) ; return seek ; } else if ( IsContain ( x + width / 2 , y + width / 2 , width / 2 , obj_x_min , obj_y_min , obj_x_max , obj_y_max ) && ( level + 1 <= tqTree_level ) ) { if ( ! upRightNode ) { upRightNode = new VPQTreeNode ( x + width / 2 , y + width / 2 , width / 2 , level + 1 , UP_RIGHT , this ) ; } VPQTreeNode * seek = upRightNode -> buildMBNode ( obj_x_min , obj_y_min , obj_x_max , obj_y_max ) ; return seek ; } else if ( IsContain ( x , y , width / 2 , obj_x_min , obj_y_min , obj_x_max , obj_y_max ) && ( level + 1 <= tqTree_level ) ) { if ( ! bottomLeftNode ) { bottomLeftNode = new VPQTreeNode ( x , y , width / 2 , level + 1 , BOTTOM_LEFT , this ) ; } VPQTreeNode * seek = bottomLeftNode -> buildMBNode ( obj_x_min , obj_y_min , obj_x_max , obj_y_max ) ; return seek ; } else if ( IsContain ( x + width / 2 , y , width / 2 , obj_x_min , obj_y_min , obj_x_max , obj_y_max ) && ( level + 1 <= tqTree_level ) ) { if ( ! bottomRightNode ) { bottomRightNode = new VPQTreeNode ( x + width / 2 , y , width / 2 , level + 1 , BOTTOM_RIGHT , this ) ; } VPQTreeNode * seek = bottomRightNode -> buildMBNode ( obj_x_min , obj_y_min , obj_x_max , obj_y_max ) ; return seek ; } else { return this ; } }
Build to the VPQ-tree node of the MBR containing a single point or line object
Build to the VPQ - tree node of the MBR containing a single point or line object
// UP_LEFT // UP_RIGHT // BOTTOM_LEFT // BOTTOM_RIGHT