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) {
  Projection projection = MercatorProjection.fromZoomlevel(tile.zoomLevel);
  List<PointOfInterest> poiResults = pointOfInterests
      .where((poi) =>
          tile.getBoundingBox(projection).containsLatLong(poi.position))
      .toList();
  List<Way> wayResults = [];
  for (Way way in ways) {
    if (tile.getBoundingBox(projection).intersectsArea(way.latLongs)) {
      wayResults.add(way);
    }
  }
  return Future.value(
      DatastoreReadResult(pointOfInterests: poiResults, ways: wayResults));
}