calculatePath method
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 (outerList.length < 2) continue;
if (_isOutside(outerList, 5000)) continue;
List<Mappoint> c = outerList;
if (dy.abs() >= 2) {
c = MapPathHelper.parallelPath(outerList, dy);
}
c.forEachIndexed((int idx, Mappoint point) {
if (idx == 0) {
path.moveToMappoint(point.offset(reference));
} else {
path.lineToMappoint(point.offset(reference));
}
});
}
return path;
}