removeDatastore method

Future<void> removeDatastore(
  1. double minLatitude,
  2. double minLongitude,
  3. double maxLatitude,
  4. double maxLongitude,
)

Implementation

Future<void> removeDatastore(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude) async {
  BoundingBox toRemove = BoundingBox(minLatitude, minLongitude, maxLatitude, maxLongitude);
  _boundingBox = null;
  for (Datastore datastore in List.from(datastores)) {
    BoundingBox? datastoreBoundary = _datastoreBoundaries[datastore];
    datastoreBoundary ??= await datastore.getBoundingBox();

    if (toRemove.intersects(datastoreBoundary)) {
      datastores.remove(datastore);
      _datastoreBoundaries.remove(datastore);
    } else {
      if (null == _boundingBox) {
        _boundingBox = datastoreBoundary;
      } else {
        _boundingBox = _boundingBox!.extendBoundingBox(datastoreBoundary);
      }
    }
  }
}