Changeset 8087 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
- Timestamp:
- 2015-02-19T15:22:49+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r8086 r8087 9 9 import java.io.IOException; 10 10 import java.io.InputStream; 11 import java.lang.reflect.Field; 11 12 import java.nio.charset.StandardCharsets; 12 13 import java.text.MessageFormat; … … 33 34 import org.openstreetmap.josm.gui.mappaint.Cascade; 34 35 import org.openstreetmap.josm.gui.mappaint.Environment; 36 import org.openstreetmap.josm.gui.mappaint.LineElemStyle; 35 37 import org.openstreetmap.josm.gui.mappaint.MultiCascade; 36 38 import org.openstreetmap.josm.gui.mappaint.Range; 39 import org.openstreetmap.josm.gui.mappaint.StyleKeys; 37 40 import org.openstreetmap.josm.gui.mappaint.StyleSetting; 38 41 import org.openstreetmap.josm.gui.mappaint.StyleSetting.BooleanStyleSetting; … … 81 84 */ 82 85 public final static ReadWriteLock STYLE_SOURCE_LOCK = new ReentrantReadWriteLock(); 86 87 /** 88 * Set of all supported MapCSS keys. 89 */ 90 public static final Set<String> SUPPORTED_KEYS = new HashSet<>(); 91 static { 92 Field[] declaredFields = StyleKeys.class.getDeclaredFields(); 93 for (Field f : declaredFields) { 94 try { 95 SUPPORTED_KEYS.add((String) f.get(null)); 96 if (!f.getName().toLowerCase().replace("_", "-").equals(f.get(null))) { 97 throw new RuntimeException(f.getName()); 98 } 99 } catch (IllegalArgumentException | IllegalAccessException ex) { 100 throw new RuntimeException(ex); 101 } 102 } 103 for (LineElemStyle.LineType lt : LineElemStyle.LineType.values()) { 104 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.COLOR); 105 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.DASHES); 106 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.DASHES_BACKGROUND_COLOR); 107 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.DASHES_BACKGROUND_OPACITY); 108 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.DASHES_OFFSET); 109 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.LINECAP); 110 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.LINEJOIN); 111 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.MITERLIMIT); 112 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.OFFSET); 113 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.OPACITY); 114 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.REAL_WIDTH); 115 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.WIDTH); 116 } 117 } 83 118 84 119 /** … … 484 519 } 485 520 486 public boolean eval MediaExpression(String feature, Object val) {521 public boolean evalSupportsDeclCondition(String feature, Object val) { 487 522 if (feature == null) return false; 523 if (SUPPORTED_KEYS.contains(feature)) return true; 488 524 switch (feature) { 489 525 case "user-agent":
Note:
See TracChangeset
for help on using the changeset viewer.