parseBox<R extends Box> static method

R parseBox<R extends Box>(
  1. String text, {
  2. required CreateBox<R> to,
  3. Pattern? delimiter = ',',
  4. Coords? type,
})

Creates a bounding box of R from text.

Coordinate values in text are separated by delimiter.

A bounding box instance is created using the factory function to.

Supported coordinate value combinations by coordinate type:

Type Expected values
xy minX, minY, maxX, maxY
xyz minX, minY, minZ, maxX, maxY, maxZ
xym minX, minY, minM, maxX, maxY, maxM
xyzm minX, minY, minZ, minM, maxX, maxY, maxZ, maxM

Use an optional type to explicitely set the coordinate type. If not provided and text has 6 items, then xyz coordinates are assumed.

Throws FormatException if coordinates are invalid.

Implementation

static R parseBox<R extends Box>(
  String text, {
  required CreateBox<R> to,
  Pattern? delimiter = ',',
  Coords? type,
}) {
  final coords = parseNumValues(text, delimiter: delimiter);
  return buildBox(coords, to: to, type: type);
}