getStats method
Get statistics about the spatial index
Implementation
Map<String, dynamic> getStats() {
int totalItems = 0;
int maxItemsPerCell = 0;
for (final items in _grid.values) {
totalItems += items.length;
if (items.length > maxItemsPerCell) {
maxItemsPerCell = items.length;
}
}
return {
'totalCells': _grid.length,
'totalItems': totalItems,
'maxItemsPerCell': maxItemsPerCell,
'avgItemsPerCell': _grid.isEmpty ? 0.0 : totalItems / _grid.length,
};
}