Class OTS2DSet

  • All Implemented Interfaces:
    Serializable, Iterable<OTSShape>, Collection<OTSShape>, Set<OTSShape>

    public class OTS2DSet
    extends Object
    implements Set<OTSShape>, Serializable
    Set of OTSShape objects and provides methods for fast selection of those objects that intersect an OTSShape.
    An OTS2DSet internally stores the OTSShapes in a quad tree. At time of construction the minimum cell size is defined. Node expansion is never performed on nodes that are smaller than this limit.
    Each node (even the non-leaf nodes) store a set of OTSShape. Non-leaf nodes locally store those shapes that completely cover the rectangular area of the node. Such shapes are not also stored in leaf nodes below that node. OTSShapes that partially cover a non-leaf node are stored in each of the leaf nodes below that node that those OTSShapes (partially) cover. Leaf nodes that cannot be expanded (because they are too small) also store all OTSShapes that partially cover the area of the node.
    If removal of an OTSShape objects results in a leaf becoming empty, that leaf is removed from its parent (which may then itself become empty and removed in turn).

    Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    Version:
    $Revision$, $LastChangedDate$, by $Author$, initial version Jun 20, 2016
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    See Also:
    Serialized Form