Class SpatialRTree<T,NT>
- java.lang.Object
-
- org.jungrapht.visualization.spatial.AbstractSpatial<T,NT>
-
- org.jungrapht.visualization.spatial.SpatialRTree<T,NT>
-
- Type Parameters:
T- The Type for the elements managed by the RTree, Vertices or EdgesNT- The Type for the Vertices of the graph. May be the same as T
- All Implemented Interfaces:
LayoutStateChange.Listener,LayoutVertexPositionChange.Listener<NT>,Spatial<T,NT>
- Direct Known Subclasses:
SpatialRTree.Edges,SpatialRTree.Vertices
public abstract class SpatialRTree<T,NT> extends AbstractSpatial<T,NT> implements Spatial<T,NT>
- Author:
- Tom Nelson
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpatialRTree.Builder<T,NT>static classSpatialRTree.Edges<E,V>static classSpatialRTree.Vertices<V>-
Nested classes/interfaces inherited from interface org.jungrapht.visualization.spatial.Spatial
Spatial.NoOp<T,NT>
-
-
Field Summary
Fields Modifier and Type Field Description protected BoundingRectangleCollector<T>boundingRectangleCollectorgathers the bounding rectangles of the elements managed by the RTree.protected booleanreinsertprotected RTree<T>rtreethe RTree to use.protected SplitterContext<T>splitterContexta container for the splitter functions to use, quadratic or R*Tree-
Fields inherited from class org.jungrapht.visualization.spatial.AbstractSpatial
gridCache, layoutModel, pickShapes, rectangle
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSpatialRTree(LayoutModel<NT> layoutModel, SplitterContext<T> splitterContext, boolean reinsert)create a new instance with the a LayoutModel and a style of splitter to use
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidbulkInsert(Collection<T> elements)voidclear()destroy the current spatial structureprotected abstract List<Shape>collectGrids(List<Shape> list, RTree<T> tree)gather the RTree nodes into a list for display as PaintablesLeafNode<T>getContainingLeaf(Object element)Set<LeafNode<T>>getContainingLeafs(double x, double y)Set<LeafNode<T>>getContainingLeafs(Point2D p)List<Shape>getGrid()Rectangle2DgetLayoutArea()booleanisReinsert()protected voidrecalculate(Collection<T> elements)voidsetBounds(Rectangle2D bounds)voidsetReinsert(boolean reinsert)StringtoString()-
Methods inherited from class org.jungrapht.visualization.spatial.AbstractSpatial
getClosest, getLayoutModel, getPickShapes, isActive, layoutStateChanged, setActive
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jungrapht.visualization.layout.event.LayoutStateChange.Listener
layoutStateChanged
-
Methods inherited from interface org.jungrapht.visualization.layout.event.LayoutVertexPositionChange.Listener
layoutVertexPositionChanged, layoutVertexPositionChanged
-
Methods inherited from interface org.jungrapht.visualization.spatial.Spatial
getClosestElement, getClosestElement, getLayoutModel, getPickShapes, getUnion, getUnion, getVisibleElements, isActive, recalculate, setActive, update
-
-
-
-
Field Detail
-
splitterContext
protected SplitterContext<T> splitterContext
a container for the splitter functions to use, quadratic or R*Tree
-
rtree
protected RTree<T> rtree
the RTree to use. Add/Remove methods may change this to a new immutable RTree reference
-
boundingRectangleCollector
protected BoundingRectangleCollector<T> boundingRectangleCollector
gathers the bounding rectangles of the elements managed by the RTree. Node or Edge shapes
-
reinsert
protected boolean reinsert
-
-
Constructor Detail
-
SpatialRTree
protected SpatialRTree(LayoutModel<NT> layoutModel, SplitterContext<T> splitterContext, boolean reinsert)
create a new instance with the a LayoutModel and a style of splitter to use- Parameters:
layoutModel-splitterContext-
-
-
Method Detail
-
isReinsert
public boolean isReinsert()
-
setReinsert
public void setReinsert(boolean reinsert)
-
collectGrids
protected abstract List<Shape> collectGrids(List<Shape> list, RTree<T> tree)
gather the RTree nodes into a list for display as Paintables- Parameters:
list-tree-- Returns:
-
getLayoutArea
public Rectangle2D getLayoutArea()
- Specified by:
getLayoutAreain interfaceSpatial<T,NT>- Returns:
- the 2 dimensional area of interest for this class
-
setBounds
public void setBounds(Rectangle2D bounds)
-
clear
public void clear()
Description copied from interface:Spatialdestroy the current spatial structure
-
getContainingLeafs
public Set<LeafNode<T>> getContainingLeafs(double x, double y)
- Specified by:
getContainingLeafsin interfaceSpatial<T,NT>- Parameters:
x- a point to search in the spatial structurey- a point to search in the spatial structure- Returns:
- a collection of the RTree LeafVertices that would contain the passed point
-
getContainingLeafs
public Set<LeafNode<T>> getContainingLeafs(Point2D p)
- Specified by:
getContainingLeafsin interfaceSpatial<T,NT>- Parameters:
p- a point to search in the spatial structure- Returns:
- all leaf nodes that contain the passed point
-
getContainingLeaf
public LeafNode<T> getContainingLeaf(Object element)
- Specified by:
getContainingLeafin interfaceSpatial<T,NT>- Parameters:
element- element to search for- Returns:
- the leaf node that currently contains the element (not a spatial search)
-
recalculate
protected void recalculate(Collection<T> elements)
-
bulkInsert
protected void bulkInsert(Collection<T> elements)
-
-