- Timestamp:
- 2014-02-07T00:18:58+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r6629 r6821 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.osm; 3 4 import org.openstreetmap.josm.tools.Utils; 3 5 4 6 import static org.openstreetmap.josm.tools.I18n.tr; … … 701 703 @Override 702 704 public String getLocalName() { 703 String key = "name:" + Locale.getDefault().toString(); 704 if (get(key) != null) 705 return get(key); 706 key = "name:" + Locale.getDefault().getLanguage() + "_" + Locale.getDefault().getCountry(); 707 if (get(key) != null) 708 return get(key); 709 key = "name:" + Locale.getDefault().getLanguage(); 710 if (get(key) != null) 711 return get(key); 705 final Locale locale = Locale.getDefault(); 706 String key = "name:" + locale.toString(); 707 String val = get(key); 708 if (val != null) 709 return val; 710 711 final String language = locale.getLanguage(); 712 key = "name:" + language + "_" + locale.getCountry(); 713 val = get(key); 714 if (val != null) 715 return val; 716 717 key = "name:" + language; 718 val = get(key); 719 if (val != null) 720 return val; 721 712 722 return getName(); 723 } 724 725 /** 726 * Tests whether this primitive contains a tag consisting of {@code key} and {@code values}. 727 * @param key the key forming the tag. 728 * @param value value forming the tag. 729 * @return true iff primitive contains a tag consisting of {@code key} and {@code value}. 730 */ 731 public boolean hasTag(String key, String value) { 732 return Utils.equal(value, get(key)); 713 733 } 714 734 -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/Prototype.java
r3836 r6821 25 25 public String getCode() { 26 26 if(code == null) { 27 code = ""; 28 if (conditions != null) { 27 if (conditions == null || conditions.isEmpty()) { 28 code = ""; 29 } else { 30 final StringBuilder sb = new StringBuilder(); 29 31 for(XmlCondition r: conditions) { 30 code += r.toCode();32 r.appendCode(sb); 31 33 } 34 code = sb.toString(); 32 35 } 33 36 } … … 42 45 { 43 46 String k = primitive.get(r.key); 47 48 if (k == null || (r.value != null && !k.equals(r.value))) 49 return false; 50 44 51 String bv = OsmUtils.getNamedOsmBoolean(r.boolValue); 45 if(k == null || (r.value != null && !k.equals(r.value)) 46 || (bv != null && !bv.equals(OsmUtils.getNamedOsmBoolean(k))))52 53 if (bv != null && !bv.equals(OsmUtils.getNamedOsmBoolean(k))) 47 54 return false; 48 55 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlCondition.java
r3805 r6821 38 38 return "Rule["+key+","+(boolValue != null ? "b="+boolValue:"v="+value)+"]"; 39 39 } 40 public String toCode() 40 41 public void appendCode(StringBuilder sb) 41 42 { 42 return "[k="+key+(boolValue != null ? ",b="+boolValue:",v="+value)+"]"; 43 sb.append("[k=").append(key); 44 45 if (boolValue != null) 46 sb.append(",b=").append(boolValue); 47 else 48 sb.append(",v=").append(value); 49 50 sb.append("]"); 43 51 } 44 52 }
Note:
See TracChangeset
for help on using the changeset viewer.