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 (!matchesForZoomlevelRange(pointOfInterest.tags)) return null;

  bool supported = instructions.hasInstructionsNodes();
  // this rule supports the argument. Returns this zoomlevel range which is
  // the widest possible range.
  if (supported) return zoomlevelRange;
  ZoomlevelRange? result;
  subRules.forEach((element) {
    ZoomlevelRange? range = element.getZoomlevelRangeNode(pointOfInterest);
    if (range != null) {
      if (result == null) {
        result = range;
      } else {
        result = result!.widenTo(range);
      }
    }
  });
  return result;
}