project method

  1. @override
MultiPolygon project(
  1. Projection projection
)
override

Returns an object of the same subtype as this with all position data projected using projection and non-positional properties left intact.

If bounds object is available on this, then it's not projected and the returned object has it set null.

Examples:

// just project, the returned object has not bounds populated
someBoundedObject.project(someProjection);

// project and populate, the returned object has bounds populated
someBoundedObject.project(someProjection).populated(onBounds: true);

Implementation

@override
MultiPolygon project(Projection projection) {
  final projected = _polygons
      .map<List<PositionSeries>>(
        (rings) => rings
            .map<PositionSeries>((ring) => ring.project(projection))
            .toList(growable: false),
      )
      .toList(growable: false);

  return MultiPolygon(projected);
}