preOrderTraverse method

void preOrderTraverse(
  1. PreOrderCallback callback
)

Visits each node in the quadtree in pre-order traversal invoking the specified callback.

If the callback returns true for a given node, then the children of that node are not visited; otherwise, all child nodes are visited.

Implementation

void preOrderTraverse(PreOrderCallback callback) {
  final List<Quadtree<O>> quadtrees = [this];
  while (quadtrees.isNotEmpty) {
    final quad = quadtrees.removeLast();
    if (!callback(quad.bounds)) {
      quadtrees.addAll(quad.nodes.values);
    }
  }
}