unpopulated method
Returns a feature object 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 feature object is ensured to be unpopulated (expect whenbounds
is always available). - If
traverse
> 0, then also bounding boxes of child feature or geometry objects of this feature object 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
Feature unpopulated({
int traverse = 0,
bool onBounds = true,
}) {
if (onBounds) {
// unpopulate a geometry when traversing is asked
final geom = traverse > 0
? geometry?.unpopulated(traverse: traverse - 1, onBounds: onBounds)
: geometry;
// create a new feature if geometry changed or bounds was populated
if (geom != geometry || bounds != null) {
return Feature(
id: id,
geometry: geom,
properties: properties,
custom: custom,
);
}
}
return this;
}