processPOIs method

List<PointOfInterest> processPOIs(
  1. double tileLatitude,
  2. double tileLongitude,
  3. int numberOfPois,
  4. BoundingBox boundingBox,
  5. bool filterRequired,
  6. Readbuffer readBuffer,
  7. MapDatastore mapDataStore,
)

Processes all points of interest (POIs) from a data block in the given readBuffer.

This method iterates numberOfPois times, calling read1Poi for each POI. It filters out POIs that are outside the requested boundingBox if filterRequired is true.

Implementation

List<PointOfInterest> processPOIs(
  double tileLatitude,
  double tileLongitude,
  int numberOfPois,
  BoundingBox boundingBox,
  bool filterRequired,
  Readbuffer readBuffer,
  MapDatastore mapDataStore,
) {
  List<PointOfInterest> pois = [];
  List<Tag> poiTags = _mapFileHeader.getMapHeaderInfo().poiTags;

  for (int elementCounter = numberOfPois; elementCounter != 0; --elementCounter) {
    try {
      PointOfInterest pointOfInterest = read1Poi(readBuffer, tileLatitude, tileLongitude, mapDataStore, poiTags);

      // depending on the zoom level configuration the poi can lie outside
      // the tile requested, we filter them out here
      if (!filterRequired || boundingBox.containsLatLong(pointOfInterest.position)) {
        pois.add(pointOfInterest);
      }
    } catch (error, stacktrace) {
      print(error);
      print(stacktrace);
    }
  }
  return pois;
}