- Timestamp:
- 2017-04-15T01:38:46+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java
r11713 r11913 57 57 SelectionChangedListener, ModifierListener { 58 58 59 private static final String CROSSHAIR = "crosshair"; 60 59 61 private enum State { 60 62 SELECTING, IMPROVING … … 76 78 private final Cursor cursorSelect = ImageProvider.getCursor("normal", "mode"); 77 79 private final Cursor cursorSelectHover = ImageProvider.getCursor("hand", "mode"); 78 private final Cursor cursorImprove = ImageProvider.getCursor( "crosshair", null);79 private final Cursor cursorImproveAdd = ImageProvider.getCursor( "crosshair", "addnode");80 private final Cursor cursorImproveDelete = ImageProvider.getCursor( "crosshair", "delete_node");81 private final Cursor cursorImproveAddLock = ImageProvider.getCursor( "crosshair", "add_node_lock");82 private final Cursor cursorImproveLock = ImageProvider.getCursor( "crosshair", "lock");80 private final Cursor cursorImprove = ImageProvider.getCursor(CROSSHAIR, null); 81 private final Cursor cursorImproveAdd = ImageProvider.getCursor(CROSSHAIR, "addnode"); 82 private final Cursor cursorImproveDelete = ImageProvider.getCursor(CROSSHAIR, "delete_node"); 83 private final Cursor cursorImproveAddLock = ImageProvider.getCursor(CROSSHAIR, "add_node_lock"); 84 private final Cursor cursorImproveLock = ImageProvider.getCursor(CROSSHAIR, "lock"); 83 85 84 86 private Color guideColor; -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r11713 r11913 68 68 public class SelectAction extends MapMode implements ModifierListener, KeyPressReleaseListener, SelectionEnded { 69 69 70 private static final String NORMAL = "normal"; 71 70 72 /** 71 73 * Select action mode. … … 85 87 // contains all possible cases the cursor can be in the SelectAction 86 88 private enum SelectActionCursor { 87 rect("normal", /* ICON(cursor/modifier/) */ "selection"), 88 rect_add("normal", /* ICON(cursor/modifier/) */ "select_add"), 89 rect_rm("normal", /* ICON(cursor/modifier/) */ "select_remove"), 90 way("normal", /* ICON(cursor/modifier/) */ "select_way"), 91 way_add("normal", /* ICON(cursor/modifier/) */ "select_way_add"), 92 way_rm("normal", /* ICON(cursor/modifier/) */ "select_way_remove"), 93 node("normal", /* ICON(cursor/modifier/) */ "select_node"), 94 node_add("normal", /* ICON(cursor/modifier/) */ "select_node_add"), 95 node_rm("normal", /* ICON(cursor/modifier/) */ "select_node_remove"), 96 virtual_node("normal", /* ICON(cursor/modifier/) */ "addnode"), 97 scale(/* ICON(cursor/) */ "scale", null), 98 rotate(/* ICON(cursor/) */ "rotate", null), 99 merge(/* ICON(cursor/) */ "crosshair", null), 100 lasso("normal", /* ICON(cursor/modifier/) */ "rope"), 101 merge_to_node("crosshair", /* ICON(cursor/modifier/) */ "joinnode"), 89 90 rect(NORMAL, "selection"), 91 rect_add(NORMAL, "select_add"), 92 rect_rm(NORMAL, "select_remove"), 93 way(NORMAL, "select_way"), 94 way_add(NORMAL, "select_way_add"), 95 way_rm(NORMAL, "select_way_remove"), 96 node(NORMAL, "select_node"), 97 node_add(NORMAL, "select_node_add"), 98 node_rm(NORMAL, "select_node_remove"), 99 virtual_node(NORMAL, "addnode"), 100 scale("scale", null), 101 rotate("rotate", null), 102 merge("crosshair", null), 103 lasso(NORMAL, "rope"), 104 merge_to_node("crosshair", "joinnode"), 102 105 move(Cursor.MOVE_CURSOR); 103 106 -
trunk/src/org/openstreetmap/josm/actions/upload/FixDataHook.java
r10601 r11913 27 27 public class FixDataHook implements UploadHook { 28 28 29 private static final String ONEWAY = "oneway"; 30 29 31 /** 30 32 * List of checks to run on data … … 40 42 deprecated.add(new FixDataKey("color", "colour")); 41 43 deprecated.add(new FixDataTag("highway", "ford", "ford", "yes")); 42 deprecated.add(new FixDataTag( "oneway","false","oneway","no"));43 deprecated.add(new FixDataTag( "oneway","0","oneway","no"));44 deprecated.add(new FixDataTag( "oneway","true","oneway","yes"));45 deprecated.add(new FixDataTag( "oneway","1","oneway","yes"));44 deprecated.add(new FixDataTag(ONEWAY, "false", ONEWAY, "no")); 45 deprecated.add(new FixDataTag(ONEWAY, "0", ONEWAY, "no")); 46 deprecated.add(new FixDataTag(ONEWAY, "true", ONEWAY, "yes")); 47 deprecated.add(new FixDataTag(ONEWAY, "1", ONEWAY, "yes")); 46 48 deprecated.add(new FixDataTag("highway", "stile", "barrier", "stile")); 47 49 // CHECKSTYLE.ON: SingleSpaceSeparator -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r11746 r11913 106 106 public class Preferences { 107 107 108 private static final String COLOR_PREFIX = "color."; 109 108 110 private static final String[] OBSOLETE_PREF_KEYS = { 109 111 "hdop.factor", /* remove entry after April 2017 */ … … 501 503 final Map<String, String> all = new TreeMap<>(); 502 504 for (final Entry<String, Setting<?>> e : defaultsMap.entrySet()) { 503 if (e.getKey().startsWith( "color.") && e.getValue() instanceof StringSetting) {505 if (e.getKey().startsWith(COLOR_PREFIX) && e.getValue() instanceof StringSetting) { 504 506 StringSetting d = (StringSetting) e.getValue(); 505 507 if (d.getValue() != null) { … … 509 511 } 510 512 for (final Entry<String, Setting<?>> e : settingsMap.entrySet()) { 511 if (e.getKey().startsWith( "color.") && (e.getValue() instanceof StringSetting)) {513 if (e.getKey().startsWith(COLOR_PREFIX) && (e.getValue() instanceof StringSetting)) { 512 514 all.put(e.getKey().substring(6), ((StringSetting) e.getValue()).getValue()); 513 515 } … … 864 866 String colKey = ColorProperty.getColorKey(colName); 865 867 registerColor(colKey, colName); 866 String colStr = specName != null ? get( "color."+specName) : "";868 String colStr = specName != null ? get(COLOR_PREFIX+specName) : ""; 867 869 if (colStr.isEmpty()) { 868 870 colStr = get(colKey, ColorHelper.color2html(def, true)); … … 888 890 889 891 public synchronized Color getDefaultColor(String colKey) { 890 StringSetting col = Utils.cast(defaultsMap.get( "color."+colKey), StringSetting.class);892 StringSetting col = Utils.cast(defaultsMap.get(COLOR_PREFIX+colKey), StringSetting.class); 891 893 String colStr = col == null ? null : col.getValue(); 892 894 return colStr == null || colStr.isEmpty() ? null : ColorHelper.html2color(colStr); … … 894 896 895 897 public synchronized boolean putColor(String colKey, Color val) { 896 return put( "color."+colKey, val != null ? ColorHelper.color2html(val, true) : null);898 return put(COLOR_PREFIX+colKey, val != null ? ColorHelper.color2html(val, true) : null); 897 899 } 898 900 … … 1532 1534 private void migrateOldColorKeys() { 1533 1535 settingsMap.keySet().stream() 1534 .filter(key -> key.startsWith( "color."))1536 .filter(key -> key.startsWith(COLOR_PREFIX)) 1535 1537 .flatMap(key -> { 1536 final String newKey = ColorProperty.getColorKey(key.substring( "color.".length()));1538 final String newKey = ColorProperty.getColorKey(key.substring(COLOR_PREFIX.length())); 1537 1539 return key.equals(newKey) || settingsMap.containsKey(newKey) 1538 1540 ? Stream.empty() -
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r11893 r11913 32 32 protected static final int CROSSING_WAYS = 601; 33 33 34 privatestatic final String HIGHWAY = "highway";35 privatestatic final String RAILWAY = "railway";36 privatestatic final String WATERWAY = "waterway";34 static final String HIGHWAY = "highway"; 35 static final String RAILWAY = "railway"; 36 static final String WATERWAY = "waterway"; 37 37 38 38 /** All way segments, grouped by cells */ -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r11893 r11913 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.openstreetmap.josm.data.validation.tests.CrossingWays.HIGHWAY; 5 import static org.openstreetmap.josm.data.validation.tests.CrossingWays.RAILWAY; 6 import static org.openstreetmap.josm.data.validation.tests.CrossingWays.WATERWAY; 4 7 import static org.openstreetmap.josm.tools.I18n.tr; 5 8 … … 99 102 100 103 private static final String[] TYPES = { 101 "none", "highway", "railway", "waterway", "boundary", "power", "natural", "landuse", "building"};104 "none", HIGHWAY, RAILWAY, WATERWAY, "boundary", "power", "natural", "landuse", "building"}; 102 105 103 106 /** The map of potential duplicates. … … 210 213 .primitives(primitives) 211 214 .build()); 212 } else if (typeMap.get( "highway")) {215 } else if (typeMap.get(HIGHWAY)) { 213 216 errors.add(TestError.builder(parentTest, Severity.ERROR, DUPLICATE_NODE_HIGHWAY) 214 217 .message(tr("Highway duplicated nodes")) 215 218 .primitives(primitives) 216 219 .build()); 217 } else if (typeMap.get( "railway")) {220 } else if (typeMap.get(RAILWAY)) { 218 221 errors.add(TestError.builder(parentTest, Severity.ERROR, DUPLICATE_NODE_RAILWAY) 219 222 .message(tr("Railway duplicated nodes")) 220 223 .primitives(primitives) 221 224 .build()); 222 } else if (typeMap.get( "waterway")) {225 } else if (typeMap.get(WATERWAY)) { 223 226 errors.add(TestError.builder(parentTest, Severity.ERROR, DUPLICATE_NODE_WATERWAY) 224 227 .message(tr("Waterway duplicated nodes")) -
trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
r11807 r11913 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.openstreetmap.josm.data.validation.tests.CrossingWays.HIGHWAY; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 … … 77 78 if (n.isUsable()) { 78 79 if (!n.hasTag("crossing", "no") 79 && !(n.hasKey("crossing") && (n.hasTag("highway", "crossing") || n.hasTag("highway", "traffic_signals"))) 80 && !(n.hasKey("crossing") && (n.hasTag(HIGHWAY, "crossing") 81 || n.hasTag(HIGHWAY, "traffic_signals"))) 80 82 && n.isReferredByWays(2)) { 81 83 testMissingPedestrianCrossing(n); … … 92 94 public void visit(Way w) { 93 95 if (w.isUsable()) { 94 if (w.isClosed() && w.hasTag( "highway", CLASSIFIED_HIGHWAYS) && w.hasTag("junction", "roundabout")) {96 if (w.isClosed() && w.hasTag(HIGHWAY, CLASSIFIED_HIGHWAYS) && w.hasTag("junction", "roundabout")) { 95 97 // TODO: find out how to handle splitted roundabouts (see #12841) 96 98 testWrongRoundabout(w); … … 110 112 for (Node n : new HashSet<>(w.getNodes())) { 111 113 for (Way h : Utils.filteredCollection(n.getReferrers(), Way.class)) { 112 String value = h.get( "highway");114 String value = h.get(HIGHWAY); 113 115 if (h != w && value != null && !value.endsWith("_link")) { 114 116 List<Way> list = map.get(value); … … 130 132 if (list.size() > 2 || oneway1 == null || oneway2 == null || !oneway1 || !oneway2) { 131 133 // Error when the highway tags do not match 132 String value = w.get( "highway");134 String value = w.get(HIGHWAY); 133 135 if (!value.equals(s)) { 134 136 errors.add(TestError.builder(this, Severity.WARNING, WRONG_ROUNDABOUT_HIGHWAY) 135 137 .message(tr("Incorrect roundabout (highway: {0} instead of {1})", value, s)) 136 138 .primitives(w) 137 .fix(() -> new ChangePropertyCommand(w, "highway", s))139 .fix(() -> new ChangePropertyCommand(w, HIGHWAY, s)) 138 140 .build()); 139 141 } … … 145 147 146 148 public static boolean isHighwayLinkOkay(final Way way) { 147 final String highway = way.get( "highway");149 final String highway = way.get(HIGHWAY); 148 150 if (highway == null || !highway.endsWith("_link") 149 151 || !IN_DOWNLOADED_AREA.test(way.getNode(0)) || !IN_DOWNLOADED_AREA.test(way.getNode(way.getNodesCount()-1))) { … … 164 166 165 167 return Utils.filteredCollection(referrers, Way.class).stream().anyMatch( 166 otherWay -> !way.equals(otherWay) && otherWay.hasTag( "highway", highway, highway.replaceAll("_link$", "")));168 otherWay -> !way.equals(otherWay) && otherWay.hasTag(HIGHWAY, highway, highway.replaceAll("_link$", ""))); 167 169 } 168 170 … … 185 187 186 188 for (Way w : OsmPrimitive.getFilteredList(n.getReferrers(), Way.class)) { 187 String highway = w.get( "highway");189 String highway = w.get(HIGHWAY); 188 190 if (highway != null) { 189 191 if ("footway".equals(highway) || "path".equals(highway)) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java
r11608 r11913 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.openstreetmap.josm.data.validation.tests.CrossingWays.HIGHWAY; 5 import static org.openstreetmap.josm.data.validation.tests.CrossingWays.RAILWAY; 4 6 import static org.openstreetmap.josm.tools.I18n.tr; 5 7 … … 90 92 91 93 for (WaySegment ws : duplicated) { 92 if (ws.way.hasKey( "highway")) {94 if (ws.way.hasKey(HIGHWAY)) { 93 95 highway++; 94 } else if (ws.way.hasKey( "railway")) {96 } else if (ws.way.hasKey(RAILWAY)) { 95 97 railway++; 96 98 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r11621 r11913 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.openstreetmap.josm.data.validation.tests.CrossingWays.HIGHWAY; 5 import static org.openstreetmap.josm.data.validation.tests.CrossingWays.RAILWAY; 4 6 import static org.openstreetmap.josm.tools.I18n.tr; 5 7 … … 57 59 @Override 58 60 public boolean isPrimitiveUsable(OsmPrimitive p) { 59 return super.isPrimitiveUsable(p) && p.hasKey( "highway");61 return super.isPrimitiveUsable(p) && p.hasKey(HIGHWAY); 60 62 } 61 63 } … … 181 183 continue; 182 184 } 183 if (en.hasTag( "highway", "turning_circle", "bus_stop")185 if (en.hasTag(HIGHWAY, "turning_circle", "bus_stop") 184 186 || en.hasTag("amenity", "parking_entrance") 185 || en.hasTag( "railway", "buffer_stop")187 || en.hasTag(RAILWAY, "buffer_stop") 186 188 || en.isKeyTrue("noexit") 187 189 || en.hasKey("entrance", "barrier")) { … … 302 304 MyWaySegment(Way w, Node n1, Node n2) { 303 305 this.w = w; 304 String railway = w.get( "railway");305 String highway = w.get( "highway");306 String railway = w.get(RAILWAY); 307 String highway = w.get(HIGHWAY); 306 308 this.isAbandoned = "abandoned".equals(railway) || w.isKeyTrue("disused"); 307 309 this.highway = (highway != null || railway != null) && !isAbandoned; … … 449 451 && !w.hasKey("addr:interpolation") 450 452 // similarly for public transport platforms 451 && !w.hasTag( "highway", "platform") && !w.hasTag("railway", "platform")453 && !w.hasTag(HIGHWAY, "platform") && !w.hasTag(RAILWAY, "platform") 452 454 ) { 453 455 ways.addAll(getWaySegments(w)); 454 456 QuadBuckets<Node> set = endnodes; 455 if (w.hasKey( "highway", "railway")) {457 if (w.hasKey(HIGHWAY, RAILWAY)) { 456 458 set = endnodesHighway; 457 459 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java
r11384 r11913 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.openstreetmap.josm.data.validation.tests.CrossingWays.HIGHWAY; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 … … 81 82 Map<String, String> tags = w.getKeys(); 82 83 if (!tags.isEmpty()) { 83 String highway = tags.get( "highway");84 String highway = tags.get(HIGHWAY); 84 85 if (highway != null && NAMED_WAYS.contains(highway) && !tags.containsKey("name") && !tags.containsKey("ref") 85 86 && !"yes".equals(tags.get("noname"))) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/WayConnectedToArea.java
r11587 r11913 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.openstreetmap.josm.data.validation.tests.CrossingWays.HIGHWAY; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 … … 30 31 @Override 31 32 public void visit(Way w) { 32 if (!w.isUsable() || w.isClosed() || !w.hasKey( "highway")) {33 if (!w.isUsable() || w.isClosed() || !w.hasKey(HIGHWAY)) { 33 34 return; 34 35 } … … 37 38 List<OsmPrimitive> r = w.firstNode().getReferrers(); 38 39 for (OsmPrimitive p : r) { 39 if (p != w && p.hasKey( "highway")) {40 if (p != w && p.hasKey(HIGHWAY)) { 40 41 hasway = true; 41 42 break; … … 50 51 r = w.lastNode().getReferrers(); 51 52 for (OsmPrimitive p : r) { 52 if (p != w && p.hasKey( "highway")) {53 if (p != w && p.hasKey(HIGHWAY)) { 53 54 hasway = true; 54 55 break; … … 86 87 private void addPossibleError(Way w, Node wayNode, OsmPrimitive p, OsmPrimitive area) { 87 88 // Avoid "legal" cases (see #10655) 88 if (w.hasKey( "highway") && wayNode.hasTag("leisure", "slipway") && area.hasTag("natural", "water")) {89 if (w.hasKey(HIGHWAY) && wayNode.hasTag("leisure", "slipway") && area.hasTag("natural", "water")) { 89 90 return; 90 91 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityAction.java
r11510 r11913 40 40 */ 41 41 public final class LayerVisibilityAction extends AbstractAction implements IEnabledStateUpdating, LayerAction { 42 private static final String DIALOGS_LAYERLIST = "dialogs/layerlist"; 42 43 private static final int SLIDER_STEPS = 100; 43 44 /** … … 70 71 content.setLayout(new GridBagLayout()); 71 72 72 new ImageProvider( "dialogs/layerlist", "visibility").getResource().attachImageIcon(this, true);73 new ImageProvider(DIALOGS_LAYERLIST, "visibility").getResource().attachImageIcon(this, true); 73 74 putValue(SHORT_DESCRIPTION, tr("Change visibility of the selected layer.")); 74 75 … … 317 318 @Override 318 319 public ImageIcon getIcon() { 319 return ImageProvider.get( "dialogs/layerlist", "transparency");320 return ImageProvider.get(DIALOGS_LAYERLIST, "transparency"); 320 321 } 321 322 … … 355 356 @Override 356 357 public ImageIcon getIcon() { 357 return ImageProvider.get( "dialogs/layerlist", "gamma");358 return ImageProvider.get(DIALOGS_LAYERLIST, "gamma"); 358 359 } 359 360 … … 413 414 @Override 414 415 public ImageIcon getIcon() { 415 return ImageProvider.get( "dialogs/layerlist", "sharpness");416 return ImageProvider.get(DIALOGS_LAYERLIST, "sharpness"); 416 417 } 417 418 … … 450 451 @Override 451 452 public ImageIcon getIcon() { 452 return ImageProvider.get( "dialogs/layerlist", "colorfulness");453 return ImageProvider.get(DIALOGS_LAYERLIST, "colorfulness"); 453 454 } 454 455 -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r11884 r11913 98 98 99 99 private static class Parser extends DefaultHandler { 100 private static final String MAX_ZOOM = "max-zoom"; 101 private static final String MIN_ZOOM = "min-zoom"; 102 private static final String TILE_SIZE = "tile-size"; 103 private static final String TRUE = "true"; 104 100 105 private StringBuilder accumulator = new StringBuilder(); 101 106 … … 155 160 metadataHeaders = new HashMap<>(); 156 161 String best = atts.getValue("eli-best"); 157 if ( "true".equals(best)) {162 if (TRUE.equals(best)) { 158 163 entry.setBestMarked(true); 159 164 } … … 164 169 "type", 165 170 "url", 166 "min-zoom",167 "max-zoom",168 "tile-size",171 MIN_ZOOM, 172 MAX_ZOOM, 173 TILE_SIZE, 169 174 }).contains(qName)) { 170 175 newState = State.MIRROR_ATTRIBUTE; … … 184 189 "url", 185 190 "eula", 186 "min-zoom",187 "max-zoom",191 MIN_ZOOM, 192 MAX_ZOOM, 188 193 "attribution-text", 189 194 "attribution-url", … … 195 200 "icon", 196 201 "date", 197 "tile-size",202 TILE_SIZE, 198 203 "valid-georeference", 199 204 }).contains(qName)) { … … 264 269 } 265 270 states.push(newState); 266 if (newState == State.UNKNOWN && "true".equals(atts.getValue("mandatory"))) {271 if (newState == State.UNKNOWN && TRUE.equals(atts.getValue("mandatory"))) { 267 272 skipEntry = true; 268 273 } … … 319 324 mirrorEntry.setUrl(accumulator.toString()); 320 325 break; 321 case "min-zoom":322 case "max-zoom":326 case MIN_ZOOM: 327 case MAX_ZOOM: 323 328 Integer val = null; 324 329 try { … … 330 335 mirrorEntry = null; 331 336 } else { 332 if ( "min-zoom".equals(qName)) {337 if (MIN_ZOOM.equals(qName)) { 333 338 mirrorEntry.setDefaultMinZoom(val); 334 339 } else { … … 337 342 } 338 343 break; 339 case "tile-size":344 case TILE_SIZE: 340 345 Integer tileSize = null; 341 346 try { … … 383 388 case "default": 384 389 switch (accumulator.toString()) { 385 case "true":390 case TRUE: 386 391 entry.setDefaultEntry(true); 387 392 break; … … 399 404 entry.setEulaAcceptanceRequired(accumulator.toString()); 400 405 break; 401 case "min-zoom":402 case "max-zoom":406 case MIN_ZOOM: 407 case MAX_ZOOM: 403 408 Integer val = null; 404 409 try { … … 410 415 skipEntry = true; 411 416 } else { 412 if ( "min-zoom".equals(qName)) {417 if (MIN_ZOOM.equals(qName)) { 413 418 entry.setDefaultMinZoom(val); 414 419 } else { … … 441 446 entry.setIcon(accumulator.toString()); 442 447 break; 443 case "tile-size":448 case TILE_SIZE: 444 449 Integer tileSize = null; 445 450 try {
Note:
See TracChangeset
for help on using the changeset viewer.