MultiPolygon constructor

const MultiPolygon(
  1. List<List<PositionSeries>> polygons, {
  2. Box? bounds,
})

A multi polygon with an array of polygons (each with an array of rings).

An optional bounds can used set a minimum bounding box for a geometry.

Each polygon is represented by a List<PositionSeries> instance containing one exterior and 0 to N interior rings. The first element is the exterior ring, and any other rings are interior rings (or holes). All rings must be closed linear rings. As specified by GeoJSON, they should "follow the right-hand rule with respect to the area it bounds, i.e., exterior rings are counterclockwise, and holes are clockwise".

Examples:

// a multi polygon with one polygon from 2D positions
MultiPolygon(
  [
    // polygon
    [
      // an exterior ring with values of five (x, y) positions
      [
        10.0, 20.0,
        12.5, 22.5,
        15.0, 25.0,
        11.5, 27.5,
        10.0, 20.0,
      ].positions(Coords.xy),
    ],
  ],
);

// a multi polygon with one polygon from 3D positions
MultiPolygon(
  [
    // polygon
    [
      // an exterior ring with values of five (x, y, z) positions
      [
        10.0, 20.0, 30.0,
        12.5, 22.5, 32.5,
        15.0, 25.0, 35.0,
        11.5, 27.5, 37.5,
        10.0, 20.0, 30.0,
      ].positions(Coords.xyz),
    ],
  ],
);

Implementation

const MultiPolygon(List<List<PositionSeries>> polygons, {super.bounds})
    : _polygons = polygons;