calculatePath method

UiPath calculatePath(
  1. List<List<Mappoint>> coordinatesAbsolute,
  2. Mappoint reference,
  3. double dy
)
inherited

Calculates a UiPath from a list of absolute geo-coordinates.

The coordinates are converted to pixel coordinates relative to the given reference point. The path's fill rule is set to EVEN_ODD to correctly handle polygons with holes.

Implementation

UiPath calculatePath(List<List<Mappoint>> coordinatesAbsolute, Mappoint reference, double dy) {
  UiPath path = UiPath();
  // omit holes in the area. Without this the hole is also drawn.
  path.setFillRule(MapFillRule.EVEN_ODD);
  for (var outerList in coordinatesAbsolute) {
    if (_isOutside(outerList, 5000)) continue;
    outerList.forEachIndexed((int idx, Mappoint point) {
      if (idx == 0) {
        path.moveToMappoint(point.offset(reference).offset(0, dy));
      } else {
        path.lineToMappoint(point.offset(reference).offset(0, dy));
      }
    });
  }
  return path;
}