Repository navigation
Closed
Labels
Milestone
Description
MapDataStoreLabelStore.getVisibleItems() has been synchronized since forever, but is there a reason for that?
mapsforge/mapsforge-map/src/main/java/org/mapsforge/map/layer/labels/MapDataStoreLabelStore.java
Lines 65 to 98 in a1e2606
| @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
devemux86 commentedon Jan 18, 2025
@Sublimis If tests show that we do not need the
synchronized, we can remove it.devemux86 commentedon Jan 18, 2025
(@Sublimis testing the label layer for this report)
LabelLayerUsingMapDataStoreMapViewerwithMapDataStoreLabelStoreshows less symbols thanLabelLayerUsingLabelCacheMapVieweror without using a label layer inSimplestMapViewer:Sublimis commentedon Jan 18, 2025
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...
devemux86 commentedon Jan 18, 2025
@Sublimis It is the same with and without the
synchronized.Sublimis commentedon Jan 18, 2025
What is the meaning of the difference in the screenshots above? Is this an issue or expected behavior?
devemux86 commentedon Jan 18, 2025
@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
LabelLayerUsingMapDataStoreMapViewerwe 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 ?
Sublimis commentedon Jan 18, 2025
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.
devemux86 commentedon Jan 18, 2025
@Sublimis I created a separate issue:
MapDataStoreLabelStore.getVisibleItems remove synchronized, fix #1630
MapDataStoreLabelStore.getVisibleItems remove synchronized, fix mapsf…