computeBounds method

Object computeBounds()
override

Returns a representation of space that encloses this Boundable, preferably not much bigger than this Boundable's boundary yet fast to test for intersection with the bounds of other Boundables. The class of object returned depends on the subclass of AbstractSTRtree.

@return an Envelope (for STRtrees), an Interval (for SIRtrees), or other object (for other subclasses of AbstractSTRtree) @see AbstractSTRtree.IntersectsOp

Implementation

Object computeBounds() {
  Envelope? bounds = null;
  for (Iterator i = getChildBoundables().iterator; i.moveNext();) {
    Boundable childBoundable = i.current as Boundable;
    if (bounds == null) {
      bounds =
          new Envelope.fromEnvelope(childBoundable.getBounds() as Envelope);
    } else {
      bounds.expandToIncludeEnvelope(childBoundable.getBounds() as Envelope);
    }
  }
  return bounds!;
}