calculateBounds method

  1. @override
Box? calculateBounds({
  1. PositionScheme scheme = Position.scheme,
})
override

Calculate a bounding box for this object.

This method calculates a value regardless whether bounds is populated or not.

Use scheme to set the position scheme:

  • Position.scheme for generic position data (geographic, projected or any other), this is also the default
  • Projected.scheme for projected position data
  • Geographic.scheme for geographic position data

May return null if bounds cannot be calculated (for example in the case of an empty geometry).

Implementation

@override
Box? calculateBounds({PositionScheme scheme = Position.scheme}) => positions
    .map(
      (p) => scheme.box.call(
        minX: p.x,
        minY: p.y,
        minZ: p.optZ,
        minM: p.optM,
        maxX: p.x,
        maxY: p.y,
        maxZ: p.optZ,
        maxM: p.optM,
      ),
    )
    .merge();