unpopulated method
Returns a geometry of the same subtype as this with certain data members unpopulated (or cleared).
If nothing is unpopulated then this
is returned.
If onBounds
is true (as by default):
- The
bounds
in a returned geometry object is ensured to be unpopulated (expect whenbounds
is always available). - If
traverse
> 0, then also bounding boxes of child geometry objects of this geometry are unpopulated for child levels indicated bytraverse
(0: no childs, 1: only direct childs, 2: direct childs and childs of them, ..).
See also populated.
Implementation
@override
GeometryCollection unpopulated({
int traverse = 0,
bool onBounds = true,
}) {
if (onBounds) {
// unpopulate geometries when traversing is asked
final coll = traverse > 0 && geometries.isNotEmpty
? geometries
.map<E>(
(f) => f.unpopulated(traverse: traverse - 1, onBounds: onBounds)
as E,
)
.toList(growable: false)
: geometries;
// create a new collection if geometries changed or bounds was populated
if (coll != geometries || bounds != null) {
return GeometryCollection<E>._(coll, coordType);
}
}
return this;
}