prepareWays method

  1. @override
Future<List<Wayholder>> prepareWays(
  1. IWayholderCollection wayholderCollection
)
override

Prepares a list of ways by filtering and simplifying them.

Implementation

@override
Future<List<Wayholder>> prepareWays(IWayholderCollection wayholderCollection) async {
  List<Wayholder> result = [];
  await wayholderCollection.forEach((wayholder) {
    Wayholder? res = sizeFilter.filter(wayholder);
    if (res == null) return;

    res.moveInnerToOuter();

    // crop everything outside of the mapfile's bounding box
    res = wayCropper.cropOutsideWay(res, boundingBox);
    if (res == null) return;

    res.moveInnerToOuter();

    // size is big enough, now simplify the way
    res = simplifyFilter.reduce(res);
    // if the object was so tiny that we can simplify it away, do not store it
    if (res == null) return;

    res.moveInnerToOuter();

    result.add(res);
  });
  //print("SubfileFiller $subfileZoomlevelRange after prepareWays ${wayholderCollection.length} ${result.length}");
  return result;
}