- Timestamp:
- 2013-12-31T13:18:44+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r6246 r6579 603 603 } 604 604 605 /** 606 * Returns true if the {@code key} corresponds to an OSM true value. 607 * @see {@link OsmUtils#isTrue(String) } 608 */ 609 public final boolean isKeyTrue(String key) { 610 return OsmUtils.isTrue(get(key)); 611 } 612 613 /** 614 * Returns true if the {@code key} corresponds to an OSM false value. 615 * @see {@link OsmUtils#isFalse(String) } 616 */ 617 public final boolean isKeyFalse(String key) { 618 return OsmUtils.isFalse(get(key)); 619 } 620 605 621 public final String getIgnoreCase(String key) { 606 622 String[] keys = this.keys; -
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r6457 r6579 15 15 16 16 import org.openstreetmap.josm.data.osm.Node; 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 17 18 import org.openstreetmap.josm.data.osm.Way; 18 19 import org.openstreetmap.josm.data.osm.WaySegment; … … 61 62 errorSegments = null; 62 63 seenWays = null; 64 } 65 66 private String getLayer(OsmPrimitive w) { 67 String layer1 = w.get("layer"); 68 if ("0".equals(layer1)) { 69 layer1 = null; // 0 is default value for layer. 70 } else if (layer1 == null && w.isKeyTrue("bridge")) { 71 /* see #4280. 72 In order to avoid a test error for simple settings (such as one way is a bridge, the other one isn't), 73 set layer to a marker value <bridge>. Then, two crossing bridges w/o a layer set are still detected. 74 */ 75 layer1 = "<bridge>"; 76 } else if (layer1 == null && w.isKeyTrue("tunnel")) { 77 /* likewise for tunnels */ 78 layer1 = "<tunnel>"; 79 } 80 return layer1; 63 81 } 64 82 … … 84 102 85 103 String level1 = w.get("level"); 86 String layer1 = w.get("layer"); 87 if ("0".equals(layer1)) { 88 layer1 = null; // 0 is default value for layer. Don't assume the same for levels 89 } 104 String layer1 = getLayer(w); 90 105 91 106 int nodesSize = w.getNodesCount(); -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r6556 r6579 130 130 || en.hasTag("amenity", "parking_entrance") 131 131 || en.hasTag("railway", "buffer_stop") 132 || OsmUtils.isTrue(en.get("noexit"))132 || en.isKeyTrue("noexit") 133 133 || en.hasKey("entrance") 134 134 || en.hasKey("barrier")) { … … 235 235 String railway = w.get("railway"); 236 236 String highway = w.get("highway"); 237 this.isAbandoned = "abandoned".equals(railway) || OsmUtils.isTrue(w.get("disused"));237 this.isAbandoned = "abandoned".equals(railway) || w.isKeyTrue("disused"); 238 238 this.highway = (highway != null || railway != null) && !isAbandoned; 239 239 this.isBoundary = !this.highway && "administrative".equals(w.get("boundary")); … … 252 252 if (w.containsNode(n)) 253 253 return false; 254 if ( OsmUtils.isTrue(n.get("noexit")))254 if (n.isKeyTrue("noexit")) 255 255 return false; 256 256 EastNorth coord = n.getEastNorth(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java
r6560 r6579 255 255 case PRIMITIVE: 256 256 if (KeyMatchType.TRUE.equals(matchType)) 257 return OsmUtils.isTrue(e.osm.get(label)) ^ negateResult;257 return e.osm.isKeyTrue(label) ^ negateResult; 258 258 else if (KeyMatchType.FALSE.equals(matchType)) 259 return OsmUtils.isFalse(e.osm.get(label)) ^ negateResult;259 return e.osm.isKeyFalse(label) ^ negateResult; 260 260 else if (KeyMatchType.REGEX.equals(matchType)) 261 261 return Utils.exists(e.osm.keySet(), Predicates.stringContainsPattern(Pattern.compile(label))) ^ negateResult; -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
r6316 r6579 177 177 String lineIdx = null; 178 178 HashMap<String, LinemodPrototype> overlayMap = new HashMap<String, LinemodPrototype>(); 179 boolean isNotArea = OsmUtils.isFalse(primitive.get("area"));179 boolean isNotArea = primitive.isKeyFalse("area"); 180 180 for (String key : primitive.keySet()) { 181 181 String val = primitive.get(key);
Note:
See TracChangeset
for help on using the changeset viewer.