#24678 closed enhancement (fixed)
[PATCH] Possibility to specify custom MapPaintSettings for MapCSS rendering.
| Reported by: | zkir | Owned by: | team |
|---|---|---|---|
| Priority: | normal | Milestone: | 26.03 |
| Component: | Core | Version: | |
| Keywords: | MapCSS, MapPaintSettings, StyledMapRenderer, UrbanEye3D | Cc: |
Description (last modified by )
Problem
The UrbanEye3D plugin provides a 3D rendering of OSM data. To display the ground, it uses JOSM's RenderingHelper and StyledMapRenderer to render a 2D map image(s) with a custom MapCSS style.
The problem is, that the global JOSM preferences from OSM Data tab (e.g. "Draw oneway arrows", "DrawSegment numbers", mappaint.shownames ), are affecting rendering in 3D window also.
This is not a desired behaviour, and it looks quite surprising. Style for the groundplane in 3D window was designed to look "realistic", and all titles and arrows were excluded from it.
However, they reappear if the settings in question are activated. (see screenshots).
Proposed Solution
The proposed solution introduces a mechanism to create and use a "neutral" set of MapPaintSettings for the rendering process, ensuring it is independent of global user preferences.
The patch is composed of three main changes:
- In
MapPaintSettings.java:- A new static factory method,
createNeutralSettings(), is introduced. This method returns a settings object specifically configured to be non-intrusive for realistic rendering. It disables settings that add symbolic cartographic elements (e.g.,showDirectionArrow=false,showOnewayArrow=false,showNamesDistance=0), while inheriting other defaults (like colors and node sizes) from the globalINSTANCE.
- A new static factory method,
- In
StyledMapRenderer.java:- A new constructor is added that accepts a
MapPaintSettingsobject. - The
getSettings()method is updated to use these custom settings if they are provided. If no custom settings are passed, it falls back to the globalMapPaintSettings.INSTANCEto maintain existing behavior.
- A new constructor is added that accepts a
- In
RenderingHelper.java:- The class is updated to take advantage of the new mechanism. It now instantiates
StyledMapRendererwith the neutral settings provided byMapPaintSettings.createNeutralSettings().
- The class is updated to take advantage of the new mechanism. It now instantiates
Performance and memory impact
- No negative performance impact. No addtional operations or activites are added.
- Additional instance of MapPaintSettings is created, but only if RenderingHelper is used. In normal scenario there is no additional memory consumption.
Attachments (3)
Change History (13)
by , 2 weeks ago
| Attachment: | patch-24678.diff added |
|---|
by , 2 weeks ago
| Attachment: | 24678-pic.png added |
|---|
comment:1 by , 13 days ago
comment:2 by , 13 days ago
BTW: That function will break all the time and thus is not a good interface for a plugin.
comment:3 by , 13 days ago
OK, it was not the best idea.
How about this variant?
It is much shorter and more close to the point: non relevant settings are overridden.
If you approve creation of setters for only fields in question (7 out of 27, which is strange a bit for me), I will do that and move the fabric method directly to the RenderingHelper class.
If I am missing something obvious, please advise.
comment:4 by , 13 days ago
I'm not totally sure what you're asking, but if you ask if creating setXXX()-functions is ok, then yes. I don't very much like them, as they clutter the code, but it is the Java way and where needed we should add them.
If not needed, the current patch looks fine to me. No issue with that. Additional functions can always be added in future :-)
comment:5 by , 13 days ago
| Milestone: | → 26.03 |
|---|
comment:6 by , 12 days ago
OK, if this version is fine with you, it's also OK with me.
Let's keep it.
comment:7 by , 12 days ago
| Description: | modified (diff) |
|---|
comment:8 by , 12 days ago
Notes for next time:
- Please no patches in UCS-16. Patch command does like these and I usually don't know out of my head how to convert it.
- Please add @since xxx to Javadoc for new functions. We have a script to replace these with correct revision
comment:10 by , 12 days ago
@stoecker, thank you very much.
I will respect those rules next time (I still hope I will finally figure out how TMS cache works :) ).



Whoa. Is there no better way than creating a function with a zillion arguments? setXXX() instead?