Box class abstract

A base interface for axis-aligned bounding boxes with min & max coordinates.

This interface defines min and max coordinate values only for the m axis. Sub classes define min and max coordinate values for other axes (x, y and z in projected coordinate systems, and longitude, latitude and elevation in geographic coordinate systems).

The known sub classes are ProjBox (with minX, minY, minZ, minM, maxX, maxY, maxZ and maxM coordinates) and GeoBox (with west, south, minElev, minM, east, north, maxElev and maxM coordinates).

Supported coordinate value combinations by coordinate type:

Type Bounding box 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

For geographic bounding boxes:

Type Bounding box values
xy west, south, east, north
xyz west, south, minElev, east, north, maxElev
xym west, south, minM, east, north, maxM
xyzm west, south, minElev, minM, east, north, maxElev, maxM

Sub classes containing coordinate values mentioned above, should implement equality and hashCode methods as:

@override
bool operator ==(Object other) =>
     other is Box && Box.testEquals(this, other);

@override
int get hashCode => Box.hash(this);
Implementers

Constructors

Box()
Default const constructor to allow extending this abstract class.
const

Properties

coordinateDimension int
The number of coordinate values (2, 3 or 4).
no setterinherited
corners2D Iterable<Position>
Returns all distinct (in 2D) corners for this axis aligned bounding box.
no setter
hashCode int
The hash code for this object.
no setterinherited
is3D bool
True for 3D positions (with z or elevation coordinate).
no setterinherited
isMeasured bool
True if a measure value is available (or the m coordinate for a position).
no setterinherited
max Position
The maximum position (or east-north) of this bounding box.
no setter
maxM num?
The maximum m coordinate optionally. Returns null if not available.
no setter
maxX num
The maximum x (or east) coordinate.
no setter
maxY num
The maximum y (or north) coordinate.
no setter
maxZ num?
The maximum z coordinate optionally. Returns null if not available.
no setter
min Position
The minimum position (or west-south) of this bounding box.
no setter
minM num?
The minimum m coordinate optionally. Returns null if not available.
no setter
minX num
The minimum x (or west) coordinate.
no setter
minY num
The minimum y (or south) coordinate.
no setter
minZ num?
The minimum z coordinate optionally. Returns null if not available.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
spatialDimension int
The number of spatial coordinate values (2 for 2D or 3 for 3D).
no setterinherited
type Coords
The coordinate type.
no setterinherited

Methods

copyTo<R extends Box>(CreateBox<R> factory) → R
Copies this box to a new box created by the factory.
equals2D(Box other, {num? toleranceHoriz}) bool
True if this box equals with other by testing 2D coordinates only.
equals3D(Box other, {num? toleranceHoriz, num? toleranceVert}) bool
True if this box equals with other by testing 3D coordinates only.
intersects(Box other) bool
Returns true if this bounding box intesects with other box.
intersects2D(Box other) bool
Returns true if this bounding box intersects with other box in 2D.
intersectsPoint(Position point) bool
Returns true if this bounding box intesects with point.
intersectsPoint2D(Position point) bool
Returns true if this bounding box intesects with point in 2D.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

buildBox<R extends Box>(Iterable<num> coords, {required CreateBox<R> to, int offset = 0, Coords? type}) → R
Builds a bounding box of R from coords starting from offset.
createBoxFrom<R extends Box>(Iterable<Position> positions, CreateBox<R> factory) → R
A minimum bounding box created by factory, calculated from positions.
createCorners2D<R extends Position>(Box box, CreatePosition<R> factory) Iterable<R>
Returns all distinct (in 2D) corners for this axis aligned bounding box.
createFromObject<R extends Box>(Object box, {required CreateBox<R> to, Coords? type}) → R
Creates a bounding box of R from box (of R or Iterable<num>).
getDoubleList(Box box) List<double>
Coordinate values of box as a double list of 4, 6 or 8 items.
getDoubleListFrom({required num minX, required num minY, num? minZ, num? minM, required num maxX, required num maxY, num? maxZ, num? maxM}) List<double>
Coordinate values of Box as a double list of 4, 6 or 8 items.
hash(Box box) int
The hash code for box.
override
parseBox<R extends Box>(String text, {required CreateBox<R> to, Pattern? delimiter = ',', Coords? type}) → R
Creates a bounding box of R from text.
testEquals(Box box1, Box box2) bool
True if box1 and box2 equals by testing all coordinate values.
testEquals2D(Box box1, Box box2, {num? toleranceHoriz}) bool
True if positions box1 and box2 equals by testing 2D coordinates only.
testEquals3D(Box box1, Box box2, {num? toleranceHoriz, num? toleranceVert}) bool
True if positions box1 and box2 equals by testing 3D coordinates only.
testIntersects(Box box1, Box box2) bool
Returns true if box1 and box2 intersects.
testIntersects2D(Box box1, Box box2) bool
Returns true if box1 and box2 intersects in 2D.
testIntersectsPoint(Box box, Position point) bool
Returns true if box intesects with point.
testIntersectsPoint2D(Box box, Position point) bool
Returns true if box intesects with point in 2D.