Changeset 2573 in josm for trunk/src/org/openstreetmap/josm/corrector
- Timestamp:
- 2009-12-04T18:34:31+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java
r2381 r2573 69 69 }; 70 70 71 public static boolean isReversible(Way way) { 72 ArrayList<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>(); 73 primitives.add(way); 74 primitives.addAll(way.getNodes()); 75 76 for (OsmPrimitive primitive : primitives) { 77 for (String key : primitive.keySet()) { 78 if (key.equals("oneway")) return false; 79 for (PrefixSuffixSwitcher prefixSuffixSwitcher : prefixSuffixSwitchers) { 80 if (!key.equals(prefixSuffixSwitcher.apply(key))) return false; 81 } 82 } 83 } 84 85 return true; 86 } 87 88 public static List<Way> irreversibleWays(List<Way> ways) { 89 List<Way> newWays = new ArrayList<Way>(ways); 90 for (Way way : ways) { 91 if (isReversible(way)) { 92 newWays.remove(way); 93 } 94 } 95 return newWays; 96 } 97 71 98 @Override 72 99 public Collection<Command> execute(Way oldway, Way way) throws UserCancelException { 73 100 Map<OsmPrimitive, List<TagCorrection>> tagCorrectionsMap = 74 101 new HashMap<OsmPrimitive, List<TagCorrection>>(); 75 102 76 103 ArrayList<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>(); … … 87 114 88 115 if (key.equals("oneway")) { 89 if ( value.equals("-1")) {116 if (OsmUtils.isReversed(value)) { 90 117 newValue = OsmUtils.trueval; 91 118 } else { 92 119 Boolean boolValue = OsmUtils.getOsmBoolean(value); 93 120 if (boolValue != null && boolValue.booleanValue()) { 94 newValue = "-1";121 newValue = OsmUtils.reverseval; 95 122 } 96 123 } … … 112 139 113 140 Map<OsmPrimitive, List<RoleCorrection>> roleCorrectionMap = 114 141 new HashMap<OsmPrimitive, List<RoleCorrection>>(); 115 142 roleCorrectionMap.put(way, new ArrayList<RoleCorrection>()); 116 143
Note:
See TracChangeset
for help on using the changeset viewer.