Class Ots2dSet.QuadTreeNode

java.lang.Object
org.opentrafficsim.core.geometry.Ots2dSet.QuadTreeNode
All Implemented Interfaces:
Serializable
Enclosing class:
Ots2dSet

class Ots2dSet.QuadTreeNode extends Object implements Serializable
Spatial-aware storage for a set of OtsShape objects.
  • 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

      public Set<OtsShape> intersectingShapes(Rectangle2D rectangle)
      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

      public boolean remove(OtsShape shape)
      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

      public boolean intersects(OtsShape shape)
      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

      public final boolean add(OtsShape shape)
      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

      final String toString(int recursionDepth)
      Recursively print this QuadTreeNode.
      Parameters:
      recursionDepth - int; maximum depth to recurse
      Returns:
      String
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • toStringGraphic

      public final String toStringGraphic(int recursionDepth)
      Return a String depicting this QuadTreeNode.
      Parameters:
      recursionDepth - int; levels to recurse
      Returns:
      String