Package org.opentrafficsim.core.geometry
Class Ots2dSet.QuadTreeNode
java.lang.Object
org.opentrafficsim.core.geometry.Ots2dSet.QuadTreeNode
- All Implemented Interfaces:
Serializable
- Enclosing class:
- Ots2dSet
Spatial-aware storage for a set of OtsShape objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Add an OtsShape to this QuadTreeNode.void
clear()
Remove all OtsShapes from this QuadTreeNode and cut off all leaves.intersectingShapes
(Rectangle2D rectangle) Return a Set containing all OtsShapes in this QuadTreeNode that intersect a rectangular area.boolean
intersects
(OtsShape shape) Test if the area of this QuadTree intersects an OtsShape.boolean
Remove an OtsShape from this QuadTreeNode.final String
toString()
(package private) final String
toString
(int recursionDepth) Recursively print this QuadTreeNode.final String
toStringGraphic
(int recursionDepth) Return a String depicting this QuadTreeNode.
-
Constructor Details
-
QuadTreeNode
QuadTreeNode(Rectangle2D boundingBox) Construct a new QuadTreeNode.- Parameters:
boundingBox
- Rectangle2D; the bounding box of the area of the new QuadTreeNode
-
-
Method Details
-
intersectingShapes
Return a Set containing all OtsShapes in this QuadTreeNode that intersect a rectangular area.- Parameters:
rectangle
- Rectangle2D; the area- Returns:
- Set<OtsShape>; the set
-
clear
public void clear()Remove all OtsShapes from this QuadTreeNode and cut off all leaves. -
remove
Remove an OtsShape from this QuadTreeNode.- Parameters:
shape
- OtsShape; the shape that must be removed.- Returns:
- boolean; true if this node (or a sub-node) was altered; false otherwise
-
intersects
Test if the area of this QuadTree intersects an OtsShape.- Parameters:
shape
- OtsShape; the shape- Returns:
- boolean; true if the area of this QuadTree intersects the shape; false otherwise
-
add
Add an OtsShape to this QuadTreeNode.- Parameters:
shape
- OtsShape; the shape- Returns:
- boolean; true if this QuadTreeNode changed as a result of this operation
-
toString
Recursively print this QuadTreeNode.- Parameters:
recursionDepth
- int; maximum depth to recurse- Returns:
- String
-
toString
-
toStringGraphic
Return a String depicting this QuadTreeNode.- Parameters:
recursionDepth
- int; levels to recurse- Returns:
- String
-