public class RTNode<T extends RTBounds> extends AbstractFixpRectangle
R-trees are height-balanced trees in which all leaves are at the same depth and contain RTBounds objects (generally Geometric objects NodeInst and ArcInst). Entries higher in the tree store boundary information that tightly encloses the leaves below. All nodes hold from M to 2M entries, where M is 4. The bounding boxes of two entries may overlap, which allows arbitrary structures to be represented. A search for a point or an area is a simple recursive walk through the tree to collect appropriate leaf nodes. Insertion and deletion, however, are more complex operations. The figure below illustrates how R-Trees work:
Modifier and Type | Class and Description |
---|---|
static class |
RTNode.Search<T extends RTBounds>
Class to search a given area of a Cell.
|
Constructor and Description |
---|
RTNode() |
Modifier and Type | Method and Description |
---|---|
void |
checkRTree(int level,
java.lang.Object env)
Method to check the validity of an RTree node.
|
AbstractFixpRectangle |
createFixp(long fixpMinX,
long fixpMinY,
long fixpMaxX,
long fixpMaxY) |
void |
displayRTree(Cell cell)
Debugging method to display this R-Tree.
|
java.lang.Object |
getChild(int index)
Method to get the number of children of this RTNode.
|
T |
getChildLeaf(int index) |
RTNode<T> |
getChildTree(int index) |
long |
getFixpMaxX() |
long |
getFixpMaxY() |
long |
getFixpMinX() |
long |
getFixpMinY() |
boolean |
getFlag()
Method to get the leaf/branch flag of this RTNode.
|
int |
getTotal()
Method to get the number of children of this RTNode.
|
static <T extends RTBounds> |
linkGeom(java.lang.Object env,
RTNode<T> root,
T geom)
Method to link this RTBounds into the R-tree of its parent Cell.
|
static <T extends RTBounds> |
makeTopLevel()
Method to create the top-level R-Tree structure for a new Cell.
|
void |
printRTree(int indent)
Debugging method to print this R-Tree.
|
void |
setFixp(long fixpMinX,
long fixpMinY,
long fixpMaxX,
long fixpMaxY) |
int |
tallyRTree()
Method to return the number of leaf entries in this RTree.
|
static <T extends RTBounds> |
unLinkGeom(java.lang.Object env,
RTNode<T> root,
T geom)
Method to remove this geometry from the R-tree its parent cell.
|
static <T extends RTBounds> |
unLinkGeom(java.lang.Object env,
RTNode<T> root,
T geom,
boolean verbose)
Method to remove this geometry from the R-tree its parent cell.
|
add, createIntersection, createUnion, getCenterX, getCenterY, getCoordCenterX, getCoordCenterY, getCoordHeight, getCoordMaxX, getCoordMaxY, getCoordMinX, getCoordMinY, getCoordWidth, getFixpCenterX, getFixpCenterY, getFixpHeight, getFixpWidth, getFixpX, getFixpY, getHeight, getLambdaCenterX, getLambdaCenterY, getLambdaHeight, getLambdaMaxX, getLambdaMaxY, getLambdaMinX, getLambdaMinY, getLambdaWidth, getLambdaX, getLambdaY, getMaxX, getMaxY, getMinX, getMinY, getWidth, getX, getY, isEmpty, outcode, setRect, setRect, toString
add, add, contains, contains, equals, getBounds2D, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
public long getFixpMinX()
getFixpMinX
in class AbstractFixpRectangle
public long getFixpMinY()
getFixpMinY
in class AbstractFixpRectangle
public long getFixpMaxX()
getFixpMaxX
in class AbstractFixpRectangle
public long getFixpMaxY()
getFixpMaxY
in class AbstractFixpRectangle
public void setFixp(long fixpMinX, long fixpMinY, long fixpMaxX, long fixpMaxY)
setFixp
in class AbstractFixpRectangle
public AbstractFixpRectangle createFixp(long fixpMinX, long fixpMinY, long fixpMaxX, long fixpMaxY)
createFixp
in class AbstractFixpRectangle
public int getTotal()
public java.lang.Object getChild(int index)
public T getChildLeaf(int index)
public boolean getFlag()
public static <T extends RTBounds> RTNode<T> makeTopLevel()
public static <T extends RTBounds> RTNode<T> linkGeom(java.lang.Object env, RTNode<T> root, T geom)
env
- the environment of this operation (for messages).root
- root of the RTree.geom
- RTBounds to link.public static <T extends RTBounds> RTNode<T> unLinkGeom(java.lang.Object env, RTNode<T> root, T geom)
env
- the environment of this operation (for messages).root
- root of the RTree.geom
- RTBounds to unlink.public static <T extends RTBounds> RTNode<T> unLinkGeom(java.lang.Object env, RTNode<T> root, T geom, boolean verbose)
env
- the environment of this operation (for messages).root
- root of the RTree.geom
- RTBounds to unlink.verbose
- true to print warnings if the geometry is not foundpublic void printRTree(int indent)
indent
- the level of the tree, for proper indentation.public void displayRTree(Cell cell)
cell
- the Cell in which to show the R-Tree.public int tallyRTree()
public void checkRTree(int level, java.lang.Object env)
level
- the level of the node in the tree (for error reporting purposes).env
- the environment in which this node resides.