Changeset 12966 in josm for trunk/src/org/openstreetmap/josm/data/osm/visitor/paint
- Timestamp:
- 2017-10-09T17:14:50+02:00 (6 years ago)
- 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 5 5 6 6 import java.awt.Color; 7 import java.util.List;8 import java.util.Optional;9 7 10 8 import org.openstreetmap.josm.data.preferences.CachingProperty; 11 9 import org.openstreetmap.josm.data.preferences.ColorProperty; 12 10 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 13 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.MapPaintSylesUpdateListener;14 import org.openstreetmap.josm.gui.mappaint.StyleSource;15 11 16 12 /** … … 91 87 private final CachingProperty<Color> property; 92 88 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 @Override98 public void mapPaintStylesUpdated() {99 backgroundColorCache = null;100 }101 102 @Override103 public void mapPaintStyleEntryUpdated(int idx) {104 mapPaintStylesUpdated();105 }106 };107 108 static {109 MapPaintStyles.addMapPaintSylesUpdateListener(STYLE_OVERRIDE_LISTENER);110 }111 112 89 PaintColors(String name, Color defaultColor) { 113 90 baseProperty = new ColorProperty(name, defaultColor); … … 138 115 */ 139 116 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(); 153 118 } 154 119 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r12964 r12966 1372 1372 super.getColors(); 1373 1373 this.highlightColorTransparent = new Color(highlightColor.getRed(), highlightColor.getGreen(), highlightColor.getBlue(), 100); 1374 this.backgroundColor = PaintColors.getBackgroundColor();1374 this.backgroundColor = styles.getBackgroundColor(); 1375 1375 } 1376 1376
Note:
See TracChangeset
for help on using the changeset viewer.