newFrom method
Creates a new Geometry instance of a type compatible with this object.
Values for a new geometry are given by coords
containing num
values
(that is double
or int
). By default 0 is used as an offset and length
of coords
as length specifying values. If both offset
and length
parameters are given, then those are specifying a segment of values from
coords
to be used for setting values on a new geometry.
Implementation
@override
GeoBounds<T> newFrom(Iterable<num> coords, {int? offset, int? length}) {
CoordinateFactory.checkCoords(4, coords, offset: offset, length: length);
final start = offset ?? 0;
final len = length ?? coords.length;
final pointLen = len ~/ 2;
return GeoBounds<T>.of(
min: min.newFrom(
coords,
offset: start,
length: pointLen,
) as T,
max: max.newFrom(
coords,
offset: start + pointLen,
length: pointLen,
) as T,
);
}