Class InnerNode<T>
- java.lang.Object
-
- org.jungrapht.visualization.spatial.rtree.RTreeNode<T>
-
- org.jungrapht.visualization.spatial.rtree.InnerNode<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Node<T>
add(SplitterContext<T> splitterContext, T element, Rectangle2D bounds)
String
asString(String margin)
Point2D
centerOfGravity()
Collection<Shape>
collectGrids(Collection<Shape> list)
gather the RTree Node rectangles into a Collectionint
count()
descend into the tree and count all childrenstatic <T> InnerNode<T>
create(Collection<Node<T>> nodes)
create a new InnerVertex with the passed nodes as childrenstatic <T> InnerNode<T>
create(InnerNode<T> node)
create a new InnerVertex with one childstatic <T> InnerNode<T>
create(Node<T> node)
create a new InnerVertex with one childNode<T>
get(int i)
return the ith child nodeRectangle2D
getBounds()
return the Rectangle of the bounding boxList<Node<T>>
getChildren()
LeafNode<T>
getContainingLeaf(T element)
Set<LeafNode<T>>
getContainingLeafs(Set<LeafNode<T>> containingLeafs, double x, double y)
Set<LeafNode<T>>
getContainingLeafs(Set<LeafNode<T>> containingLeafs, Point2D p)
T
getPickedObject(Point2D p)
Set<T>
getVisibleElements(Set<T> visibleElements, Shape shape)
boolean
isLeafChildren()
true if the children are LeafVerticesNode<T>
recalculateBounds()
recompute the bounding box for this InnerVertex, then the recompute for parent node Climbs the tree to the root as it recalcultes.Node<T>
remove(T element)
remove the passed element.int
size()
String
toString()
-
Methods inherited from class org.jungrapht.visualization.spatial.rtree.RTreeNode
getParent, setParent
-
-
-
-
Method Detail
-
create
public static <T> InnerNode<T> create(Node<T> node)
create a new InnerVertex with one child- Type Parameters:
T
- the type of the node and children- Parameters:
node
- the first child for the created Node- Returns:
- the newly created InnerVertex
-
create
public static <T> InnerNode<T> create(InnerNode<T> node)
create a new InnerVertex with one child- Type Parameters:
T
- the type of the Node- Parameters:
node
- the first child of the created node- Returns:
- the newly created InnerVertex
-
create
public static <T> InnerNode<T> create(Collection<Node<T>> nodes)
create a new InnerVertex with the passed nodes as children- Type Parameters:
T
- the type of the Node- Parameters:
nodes
- the children for the new InnerVertex- Returns:
- the newly created InnerVertex
-
isLeafChildren
public boolean isLeafChildren()
true if the children are LeafVertices- Specified by:
isLeafChildren
in interfaceNode<T>
- Returns:
- whether this node's children are
LeafNode
s
-
get
public Node<T> get(int i)
return the ith child node- Parameters:
i
- the index of the child to return- Returns:
- the ith child
-
getChildren
public List<Node<T>> getChildren()
- Specified by:
getChildren
in interfaceTreeNode
- Returns:
- an immutable collection of the child nodes
-
getBounds
public Rectangle2D getBounds()
Description copied from interface:Bounded
return the Rectangle of the bounding box
-
centerOfGravity
public Point2D centerOfGravity()
- Specified by:
centerOfGravity
in interfaceNode<T>
-
recalculateBounds
public Node<T> recalculateBounds()
recompute the bounding box for this InnerVertex, then the recompute for parent node Climbs the tree to the root as it recalcultes. This i required when a leaf node is removed.- Specified by:
recalculateBounds
in interfaceNode<T>
- Returns:
- the Node with new bounds
-
getPickedObject
public T getPickedObject(Point2D p)
- Specified by:
getPickedObject
in interfaceNode<T>
- Parameters:
p
- the point to search- Returns:
- the element in the Leaf node that is contained by p
-
getContainingLeaf
public LeafNode<T> getContainingLeaf(T element)
- Specified by:
getContainingLeaf
in interfaceNode<T>
- Parameters:
element
- the element to look for- Returns:
- the LeafVertex that contains the element
-
getContainingLeafs
public Set<LeafNode<T>> getContainingLeafs(Set<LeafNode<T>> containingLeafs, Point2D p)
- Specified by:
getContainingLeafs
in interfaceNode<T>
- Parameters:
p
- the point to look for- Returns:
- Collection of the LeafVertices that would contain the passed point
-
getContainingLeafs
public Set<LeafNode<T>> getContainingLeafs(Set<LeafNode<T>> containingLeafs, double x, double y)
- Specified by:
getContainingLeafs
in interfaceNode<T>
- Parameters:
x
- coordinate of a point to look fory
- coordinate of a point to look for- Returns:
- Collection of the LeafVertices that would contain the passed coordinates
-
collectGrids
public Collection<Shape> collectGrids(Collection<Shape> list)
gather the RTree Node rectangles into a Collection- Specified by:
collectGrids
in interfaceNode<T>
- Parameters:
list
- an ordered collection of shapes- Returns:
-
add
public Node<T> add(SplitterContext<T> splitterContext, T element, Rectangle2D bounds)
-
remove
public Node<T> remove(T element)
remove the passed element. Find the LeafVertex that contains the element, remove the element from the LeafVertex map
-
getVisibleElements
public Set<T> getVisibleElements(Set<T> visibleElements, Shape shape)
- Specified by:
getVisibleElements
in interfaceNode<T>
- Parameters:
shape
- the shape to filter the visible elements- Returns:
- a collection of all elements that intersect with the passed shape
-
count
public int count()
descend into the tree and count all children
-
-