diff --git a/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintSettings.java b/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintSettings.java
index a5111b2b24..955695ccf1 100644
|
a
|
b
|
public final class MapPaintSettings implements PreferenceChangedListener {
|
| 71 | 71 | Config.getPref().addPreferenceChangeListener(this); |
| 72 | 72 | } |
| 73 | 73 | |
| | 74 | |
| | 75 | /** |
| | 76 | * Creates MapPaintSettings with most neutral settings, that do not override MapCSS. |
| | 77 | * Useful for MapCSS CLI/Plugin rendering, via {@link org.openstreetmap.josm.gui.mappaint.RenderingHelper} |
| | 78 | * @return a new MapPaintSettings instance with neutral values. |
| | 79 | */ |
| | 80 | public static MapPaintSettings createNeutralSettings() { |
| | 81 | MapPaintSettings neutralSettings = new MapPaintSettings(); |
| | 82 | neutralSettings.useRealWidth = false; // Real width is not used (at least currently) |
| | 83 | neutralSettings.showDirectionArrow = false; // Direction arrows are turned off |
| | 84 | neutralSettings.showOnewayArrow = false; // One way arrows are disabled |
| | 85 | neutralSettings.showNamesDistance = 0; // Forced labels are turned off |
| | 86 | neutralSettings.showOrderNumber = false; |
| | 87 | neutralSettings.showOrderNumberOnSelectedWay = false; |
| | 88 | neutralSettings.outlineOnly = false; |
| | 89 | return neutralSettings; |
| | 90 | } |
| | 91 | |
| 74 | 92 | private void load() { |
| 75 | 93 | showDirectionArrow = Config.getPref().getBoolean("draw.segment.direction", false); |
| 76 | 94 | showOnewayArrow = Config.getPref().getBoolean("draw.oneway", true); |
diff --git a/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java b/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
index f49eb1e332..47909742c1 100644
|
a
|
b
|
public class StyledMapRenderer extends AbstractMapRenderer {
|
| 382 | 382 | this.styles = MapPaintStyles.getStyles(); |
| 383 | 383 | } |
| 384 | 384 | |
| | 385 | /** |
| | 386 | * Constructs a new {@code StyledMapRenderer} with custom map paint settings. |
| | 387 | * |
| | 388 | * @param g the graphics context. Must not be null. |
| | 389 | * @param nc the map viewport. Must not be null. |
| | 390 | * @param isInactiveMode if true, the paint visitor shall render OSM objects such that they |
| | 391 | * look inactive. Example: rendering of data in an inactive layer using light gray as color only. |
| | 392 | * @param paintSettings the map paint settings to use. Must not be null. |
| | 393 | * @throws IllegalArgumentException if {@code g} is null |
| | 394 | * @throws IllegalArgumentException if {@code nc} is null |
| | 395 | * @throws IllegalArgumentException if {@code paintSettings} is null |
| | 396 | */ |
| | 397 | public StyledMapRenderer(Graphics2D g, NavigatableComponent nc, boolean isInactiveMode, MapPaintSettings paintSettings) { |
| | 398 | this(g, nc, isInactiveMode); |
| | 399 | this.paintSettings = paintSettings; |
| | 400 | } |
| | 401 | |
| 385 | 402 | /** |
| 386 | 403 | * Set the {@link ElemStyles} instance to use for this renderer. |
| 387 | 404 | * @param styles the {@code ElemStyles} instance to use |
| … |
… |
public class StyledMapRenderer extends AbstractMapRenderer {
|
| 1410 | 1427 | @Override |
| 1411 | 1428 | public void getSettings(boolean virtual) { |
| 1412 | 1429 | super.getSettings(virtual); |
| 1413 | | paintSettings = MapPaintSettings.INSTANCE; |
| | 1430 | if (paintSettings == null) { |
| | 1431 | paintSettings = MapPaintSettings.INSTANCE; |
| | 1432 | } |
| 1414 | 1433 | |
| 1415 | 1434 | circum = nc.getDist100Pixel(); |
| 1416 | 1435 | scale = nc.getScale(); |
diff --git a/src/org/openstreetmap/josm/gui/mappaint/RenderingHelper.java b/src/org/openstreetmap/josm/gui/mappaint/RenderingHelper.java
index 93f524a944..c8fab26cae 100644
|
a
|
b
|
import org.openstreetmap.josm.data.projection.ProjectionRegistry;
|
| 26 | 26 | import org.openstreetmap.josm.gui.NavigatableComponent; |
| 27 | 27 | import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; |
| 28 | 28 | import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement; |
| | 29 | import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings; |
| 29 | 30 | import org.openstreetmap.josm.io.IllegalDataException; |
| 30 | 31 | import org.openstreetmap.josm.tools.CheckParameterUtil; |
| 31 | 32 | import org.openstreetmap.josm.tools.Logging; |
| … |
… |
public class RenderingHelper {
|
| 183 | 184 | g.setColor(Optional.ofNullable(backgroundColor).orElse(elemStyles.getBackgroundColor())); |
| 184 | 185 | g.fillRect(0, 0, imgDimPx.width, imgDimPx.height); |
| 185 | 186 | } |
| 186 | | StyledMapRenderer smr = new StyledMapRenderer(g, nc, false); |
| | 187 | StyledMapRenderer smr = new StyledMapRenderer(g, nc, false, MapPaintSettings.createNeutralSettings()); |
| 187 | 188 | smr.setStyles(elemStyles); |
| 188 | 189 | smr.render(ds, false, bounds); |
| 189 | 190 | |