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 booleanAdd an OtsShape to this QuadTreeNode.voidclear()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.booleanintersects(OtsShape shape) Test if the area of this QuadTree intersects an OtsShape.booleanRemove an OtsShape from this QuadTreeNode.final StringtoString()(package private) final StringtoString(int recursionDepth) Recursively print this QuadTreeNode.final StringtoStringGraphic(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
-