readMapDataSingle method

  1. @override
Future<DatastoreReadResult?> readMapDataSingle(
  1. Tile tile
)
override

Reads data for tile.

@param tile tile for which data is requested. @return map data for the tile.

Implementation

@override
Future<DatastoreReadResult?> readMapDataSingle(Tile tile) async {
  switch (this.dataPolicy) {
    case DataPolicy.RETURN_FIRST:
      Projection projection =
          MercatorProjection.fromZoomlevel(tile.zoomLevel);
      for (MapDataStore mdb in mapDatabases) {
        if (mdb.supportsTile(tile, projection)) {
          return mdb.readMapDataSingle(tile);
        }
      }
      return null;
    case DataPolicy.RETURN_ALL:
      return _readMapData(tile, false);
    case DataPolicy.DEDUPLICATE:
      return _readMapData(tile, true);
  }
  //throw new Exception("Invalid data policy for multi map database");
}