getDataTimestamp method

  1. @override
int? getDataTimestamp(
  1. Tile tile
)
override

Returns the timestamp of the data used to render a specific tile.

If the tile uses data from multiple data stores, the most recent timestamp is returned.

@param tile A tile. @return the timestamp of the data used to render the tile

Implementation

@override
int? getDataTimestamp(Tile tile) {
  Projection projection = MercatorProjection.fromZoomlevel(tile.zoomLevel);
  switch (this.dataPolicy) {
    case DataPolicy.RETURN_FIRST:
      for (MapDataStore mdb in mapDatabases) {
        if (mdb.supportsTile(tile, projection)) {
          return mdb.getDataTimestamp(tile);
        }
      }
      return 0;
    case DataPolicy.RETURN_ALL:
    case DataPolicy.DEDUPLICATE:
      int result = 0;
      for (MapDataStore mdb in mapDatabases) {
        if (mdb.supportsTile(tile, projection)) {
          result = max(result, mdb.getDataTimestamp(tile)!);
        }
      }
      return result;
  }
  //throw new Exception("Invalid data policy for multi map database");
}