MapLineString constructor
Implementation
factory MapLineString(List<MapPoint> points) {
//TODO exception for insufficient number of points?
MapPoint first = points.first;
double left = first.dx;
double right = first.dx;
double top = first.dy;
double bottom = first.dy;
for (int i = 1; i < points.length; i++) {
MapPoint point = points[i];
left = math.min(point.dx, left);
right = math.max(point.dx, right);
bottom = math.max(point.dy, bottom);
top = math.min(point.dy, top);
}
Rect bounds = Rect.fromLTRB(left, top, right, bottom);
return MapLineString._(UnmodifiableListView<MapPoint>(points), bounds);
}