Changeset 5464 in josm for trunk/src/org/openstreetmap/josm/gui/layer
- Timestamp:
- 2012-08-20T23:06:41+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/layer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r5462 r5464 35 35 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; 36 36 import org.openstreetmap.josm.data.imagery.OffsetBookmark; 37 import org.openstreetmap.josm.data.preferences.ColorProperty; 37 38 import org.openstreetmap.josm.data.preferences.IntegerProperty; 38 39 import org.openstreetmap.josm.gui.MenuScroller; … … 43 44 public abstract class ImageryLayer extends Layer { 44 45 46 public static final ColorProperty PROP_FADE_COLOR = new ColorProperty(marktr("Imagery fade"), Color.white); 45 47 public static final IntegerProperty PROP_FADE_AMOUNT = new IntegerProperty("imagery.fade_amount", 0); 46 48 public static final IntegerProperty PROP_SHARPEN_LEVEL = new IntegerProperty("imagery.sharpen_level", 0); 47 49 48 50 public static Color getFadeColor() { 49 return Main.pref.getColor(marktr("Imagery fade"), Color.white);51 return PROP_FADE_COLOR.get(); 50 52 } 51 53 52 54 public static Color getFadeColorWithAlpha() { 53 Color c = getFadeColor();55 Color c = PROP_FADE_COLOR.get(); 54 56 return new Color(c.getRed(),c.getGreen(),c.getBlue(),PROP_FADE_AMOUNT.get()*255/100); 55 }56 57 public static void setFadeColor(Color color) {58 Main.pref.putColor("imagery.fade", color);59 57 } 60 58 -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
r4869 r5464 102 102 TemplateEntryProperty result = cache.get(key); 103 103 if (result == null) { 104 String defaultValue = layerName == null?getDefaultLabelPattern():""; 105 TemplateEntryProperty parent = layerName == null?null:forMarker(null); 106 result = new TemplateEntryProperty(key, defaultValue, parent); 107 cache.put(key, result); 104 String defaultValue = layerName == null ? getDefaultLabelPattern():""; 105 TemplateEntryProperty parent = layerName == null ? null : forMarker(null); 106 try { 107 result = new TemplateEntryProperty(key, defaultValue, parent); 108 cache.put(key, result); 109 } catch (ParseError e) { 110 System.out.println(String.format("Unable to parse template engine pattern '%s' for property %s", defaultValue, key)); 111 } 108 112 } 109 113 return result; … … 118 122 if (result == null) { 119 123 String defaultValue = layerName == null?"?{ '{name}' | '{desc}' | '{" + Marker.MARKER_FORMATTED_OFFSET + "}' }":""; 120 TemplateEntryProperty parent = layerName == null?null:forAudioMarker(null); 121 result = new TemplateEntryProperty(key, defaultValue, parent); 122 cache.put(key, result); 124 TemplateEntryProperty parent = layerName == null ? null : forAudioMarker(null); 125 try { 126 result = new TemplateEntryProperty(key, defaultValue, parent); 127 cache.put(key, result); 128 } catch (ParseError e) { 129 System.out.println(String.format("Unable to parse template engine pattern '%s' for property %s", defaultValue, key)); 130 } 123 131 } 124 132 return result; … … 128 136 129 137 130 private TemplateEntryProperty(String key, String defaultValue, TemplateEntryProperty parent) {131 super(key, defaultValue);138 private TemplateEntryProperty(String key, String defaultValue, TemplateEntryProperty parent) throws ParseError { 139 super(key, new TemplateParser(defaultValue).parse(), defaultValue); 132 140 this.parent = parent; 133 141 updateValue(); // Needs to be called because parent wasn't know in super constructor … … 140 148 } catch (ParseError e) { 141 149 System.out.println(String.format("Unable to parse template engine pattern '%s' for property %s. Using default ('%s') instead", 142 s, getKey(), defaultValue));150 s, getKey(), super.getDefaultValueAsString())); 143 151 return getDefaultValue(); 144 152 }
Note:
See TracChangeset
for help on using the changeset viewer.