getZoomlevelRangeNode method

ZoomlevelRange? getZoomlevelRangeNode(
  1. PointOfInterest pointOfInterest
)

Returns the widest possible zoomrange which may accept the given argument. Returns null if if the argument will never accepted.

Implementation

ZoomlevelRange? getZoomlevelRangeNode(PointOfInterest pointOfInterest) {
  // tag not accepted by this rule.
  if (!matchesTags(pointOfInterest.tags)) return null;
  if (renderinstructionNodes.isNotEmpty) {
    // this rule supports the argument. Returns this zoomlevel range which is
    // the widest possible range.
    return zoomlevelRange;
  }

  ZoomlevelRange? result;
  for (var rule in subRules) {
    ZoomlevelRange? range = rule.getZoomlevelRangeNode(pointOfInterest);
    if (range != null) {
      result = result?.widenTo(range) ?? range;
    }
  }
  return result;
}