Skip to content

Synchronization of MapDataStoreLabelStore.getVisibleItems() #1630

Closed

Description

@Sublimis

MapDataStoreLabelStore.getVisibleItems() has been synchronized since forever, but is there a reason for that?

@Override
public synchronized List<MapElementContainer> getVisibleItems(Tile upperLeft, Tile lowerRight) {
try {
RendererJob rendererJob = new RendererJob(upperLeft, this.standardRenderer.mapDataStore, this.renderThemeFuture, this.displayModel, this.textScale, true, true);
RenderContext renderContext = new RenderContext(rendererJob, standardRenderer.graphicFactory);
MapReadResult mapReadResult = standardRenderer.mapDataStore.readLabels(upperLeft, lowerRight);
if (mapReadResult == null) {
return new ArrayList<>();
}
for (PointOfInterest pointOfInterest : mapReadResult.pointOfInterests) {
renderContext.setDrawingLayer(pointOfInterest.layer);
renderContext.rendererJob.renderThemeFuture.get().matchNode(standardRenderer.getRenderCallback(), renderContext, pointOfInterest);
}
for (Way way : mapReadResult.ways) {
PolylineContainer polylineContainer = new PolylineContainer(way, upperLeft, lowerRight);
renderContext.setDrawingLayer(polylineContainer.getLayer());
if (polylineContainer.isClosedWay()) {
renderContext.renderTheme.matchClosedWay(standardRenderer.getRenderCallback(), renderContext, polylineContainer);
} else {
renderContext.renderTheme.matchLinearWay(standardRenderer.getRenderCallback(), renderContext, polylineContainer);
}
}
return renderContext.getLabels();
} catch (Exception e) {
return new ArrayList<>();
}
}

Activity

  1. devemux86 commented on Jan 18, 2025

    @devemux86
    Collaborator

    @Sublimis If tests show that we do not need the synchronized, we can remove it.

  2. devemux86 commented on Jan 18, 2025

    @devemux86
    Collaborator

    (@Sublimis testing the label layer for this report)

    LabelLayerUsingMapDataStoreMapViewer with MapDataStoreLabelStore shows less symbols than
    LabelLayerUsingLabelCacheMapViewer or without using a label layer in SimplestMapViewer:

  3. Sublimis commented on Jan 18, 2025

    @Sublimis
    ContributorAuthor

    Is this with/without synchronization? From the method code alone, there seems to be no reason for such behavior, so it could be that we have a similar situation as in #1599, i.e. synchronization should be done elsewhere...

  4. devemux86 commented on Jan 18, 2025

    @devemux86
    Collaborator

    Is this with/without synchronization?

    @Sublimis It is the same with and without the synchronized.

  5. Sublimis commented on Jan 18, 2025

    @Sublimis
    ContributorAuthor

    Is this with/without synchronization?

    @Sublimis It is the same with and without the synchronized.

    What is the meaning of the difference in the screenshots above? Is this an issue or expected behavior?

  6. devemux86 commented on Jan 18, 2025

    @devemux86
    Collaborator

    @Sublimis When we use the normal label layer (e.g. LabelLayerUsingLabelCacheMapViewer)
    or we do not use a label layer (e.g. SimplestMapViewer) we see the correct first 2 images.

    When we use the label layer implementation in LabelLayerUsingMapDataStoreMapViewer
    we see the wrong third image with much less symbols.

    I don't know if this was always the case
    or it is a result of the map label / symbol improvements in #1579 #1586 #1588 ?

  7. Sublimis commented on Jan 18, 2025

    @Sublimis
    ContributorAuthor

    Okay, so we're talking about something else, not the title of this issue, it wasn't clear from your comment. We'll look into that to find the cause. If you can pinpoint exactly when this started happening, that would be helpful.

  8. devemux86 commented on Jan 18, 2025

    @devemux86
    Collaborator
  9. added this to the 0.24.0 milestone on Jan 19, 2025
  10. added a commit that references this issue on Jan 19, 2025
    9934389
  11. added a commit that references this issue on Jan 19, 2025
    1eab44a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions