Class OTS2DSet.QuadTreeNode

    • Constructor Detail

      • QuadTreeNode

        QuadTreeNode​(Rectangle2D boundingBox)
        Construct a new QuadTreeNode.
        Parameters:
        boundingBox - Rectangle2D; the bounding box of the area of the new QuadTreeNode
    • Method Detail

      • 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
      • toStringGraphic

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