remove2 method

bool remove2(
  1. B searchBounds,
  2. AbstractNode<B> node,
  3. T item
)

Implementation

bool remove2(B searchBounds, AbstractNode<B> node, T item) {
  bool found = removeItem(node, item);
  if (found) {
    return true;
  }

  AbstractNode<B>? childToPrune;
  for (var childBoundable in node.getChildBoundables()) {
    if (!getIntersectsOp().intersects(childBoundable.getBounds(), searchBounds)) {
      continue;
    }
    if (childBoundable is AbstractNode<B>) {
      found = remove2(searchBounds, childBoundable, item);
      if (found) {
        childToPrune = childBoundable;
        break;
      }
    }
  }

  if (childToPrune != null) {
    if (childToPrune.getChildBoundables().isEmpty) {
      node.getChildBoundables().remove(childToPrune);
    }
  }
  return found;
}