retrieveLabels method

  1. @override
Future<JobResult> retrieveLabels(
  1. JobRequest job
)
override

Retrieves labels for separate rendering to support map rotation.

For rotation-enabled maps, labels are rendered separately from the base map to prevent text distortion. This method extracts label information that can be rendered dynamically with proper orientation.

jobRequest Request containing tile coordinates and rendering parameters Returns JobResult with label rendering instructions

Implementation

@override
Future<JobResult> retrieveLabels(JobRequest job) async {
  var session = PerformanceProfiler().startSession(category: "DatastoreRenderer.retrieveLabels");
  // current performance measurements for isolates indicates that isolates are too slow so it makes no sense to use them currently. Seems
  // we need something like 600ms to start an isolate whereas the whole read-process just needs about 200ms
  RenderthemeZoomlevel renderthemeLevel = rendertheme.prepareZoomlevel(job.tile.zoomLevel);

  _datastoreReader ??= await IsolateDatastoreReader.create(datastore);

  LayerContainerCollection? layerContainerCollection = await _datastoreReader!.readLabels(job.tile, job.rightLower ?? job.tile, renderthemeLevel);

  if (layerContainerCollection == null) {
    return JobResult.unsupported();
  }

  // it already collision-free
  //layerContainerCollection.labels.collisionFreeOrdered();
  await PainterFactory().initDrawingLayers(layerContainerCollection.labels);
  session.complete();
  return JobResult.normalLabels(layerContainerCollection.labels);
}