bbox property

  1. @override
BoundingBox get bbox
override

Returns the BoundingBox of the Polygon.

Example:

Polygon polygon = Polygon([
  LinearRing([
    Coordinate(0, 0),
    Coordinate(0, 1),
    Coordinate(1, 1),
    Coordinate(1, 0),
    Coordinate(0, 0),
  ]),
]);
print(polygon.bbox); // [0, 0, 1, 1]

Implementation

@override
BoundingBox get bbox {
  List<Point> points = explode();
  if (points.length < 2) {
    return BoundingBox.empty();
  }
  return BoundingBox.fromPoints(points);
}