Ignore:
Timestamp:
2017-10-09T17:14:50+02:00 (2 years ago)
Author:
bastiK
Message:

use RenderingHelper in MapCSSRendererTest; move getBackgroundColor() from PaintColors to ElemStyles (no longer global) (see #15273)

Location:
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/PaintColors.java

    r12537 r12966  
    55
    66import java.awt.Color;
    7 import java.util.List;
    8 import java.util.Optional;
    97
    108import org.openstreetmap.josm.data.preferences.CachingProperty;
    119import org.openstreetmap.josm.data.preferences.ColorProperty;
    1210import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
    13 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.MapPaintSylesUpdateListener;
    14 import org.openstreetmap.josm.gui.mappaint.StyleSource;
    1511
    1612/**
     
    9187    private final CachingProperty<Color> property;
    9288
    93     private static volatile Color backgroundColorCache;
    94 
    95     private static final MapPaintSylesUpdateListener STYLE_OVERRIDE_LISTENER = new MapPaintSylesUpdateListener() {
    96         //TODO: Listen to wireframe map mode changes.
    97         @Override
    98         public void mapPaintStylesUpdated() {
    99             backgroundColorCache = null;
    100         }
    101 
    102         @Override
    103         public void mapPaintStyleEntryUpdated(int idx) {
    104             mapPaintStylesUpdated();
    105         }
    106     };
    107 
    108     static {
    109         MapPaintStyles.addMapPaintSylesUpdateListener(STYLE_OVERRIDE_LISTENER);
    110     }
    111 
    11289    PaintColors(String name, Color defaultColor) {
    11390        baseProperty = new ColorProperty(name, defaultColor);
     
    138115     */
    139116    public static Color getBackgroundColor() {
    140         if (backgroundColorCache != null)
    141             return backgroundColorCache;
    142         List<StyleSource> sources = MapPaintStyles.getStyles().getStyleSources();
    143         for (StyleSource s : sources) {
    144             if (!s.active) {
    145                 continue;
    146             }
    147             Color backgroundColorOverride = s.getBackgroundColorOverride();
    148             if (backgroundColorOverride != null) {
    149                 backgroundColorCache = backgroundColorOverride;
    150             }
    151         }
    152         return Optional.ofNullable(backgroundColorCache).orElseGet(BACKGROUND::get);
     117        return MapPaintStyles.getStyles().getBackgroundColor();
    153118    }
    154119
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r12964 r12966  
    13721372        super.getColors();
    13731373        this.highlightColorTransparent = new Color(highlightColor.getRed(), highlightColor.getGreen(), highlightColor.getBlue(), 100);
    1374         this.backgroundColor = PaintColors.getBackgroundColor();
     1374        this.backgroundColor = styles.getBackgroundColor();
    13751375    }
    13761376
Note: See TracChangeset for help on using the changeset viewer.