- Timestamp:
- 2016-06-15T10:30:37+02:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 264 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java
r9917 r10378 62 62 */ 63 63 public static boolean confirmLaunchMultiple(int numBrowsers) { 64 String msg 64 String msg = /* for correct i18n of plural forms - see #9110 */ trn( 65 65 "You are about to launch {0} browser window.<br>" 66 66 + "This may both clutter your screen with browser windows<br>" -
trunk/src/org/openstreetmap/josm/actions/AbstractSelectAction.java
r10369 r10378 19 19 public AbstractSelectAction() { 20 20 putValue(NAME, tr("Select")); 21 putValue(SHORT_DESCRIPTION, 21 putValue(SHORT_DESCRIPTION, tr("Set the selected elements on the map to the selected items in the list above.")); 22 22 new ImageProvider("dialogs", "select").getResource().attachImageIcon(this, true); 23 23 } -
trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
r10308 r10378 271 271 delta = pcLast.angle - pcFirst.angle; 272 272 if (delta < 0) // Assume each PolarCoor.angle is in range ]-pi; pi] 273 delta += 273 delta += 2*Math.PI; 274 274 delta /= j - i; 275 275 } -
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r10347 r10378 336 336 return lines.get(0).projectionCommand(node); 337 337 else if (lines.size() == 2) 338 return lines.get(0).intersectionCommand(node, 338 return lines.get(0).intersectionCommand(node, lines.get(1)); 339 339 throw new InvalidSelection(); 340 340 } -
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r10250 r10378 569 569 return null; 570 570 Stack<NodePair> path = new Stack<>(); 571 Stack<NodePair> nextPairs 571 Stack<NodePair> nextPairs = new Stack<>(); 572 572 nextPairs.addAll(getOutboundPairs(startNode)); 573 573 while (!nextPairs.isEmpty()) { -
trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java
r10043 r10378 166 166 if (nodes.size() == 2) { 167 167 // diameter: two single nodes needed or a way with two nodes 168 Node 168 Node n1 = nodes.get(0); 169 169 double x1 = n1.getEastNorth().east(); 170 170 double y1 = n1.getEastNorth().north(); 171 Node 171 Node n2 = nodes.get(1); 172 172 double x2 = n2.getEastNorth().east(); 173 173 double y2 = n2.getEastNorth().north(); -
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r10010 r10378 70 70 super(getName(update), /* ICON */ "multipoly_create", getName(update), 71 71 /* atleast three lines for each shortcut or the server extractor fails */ 72 update 72 update ? Shortcut.registerShortcut("tools:multipoly_update", 73 73 tr("Tool: {0}", getName(true)), 74 74 KeyEvent.VK_B, Shortcut.CTRL_SHIFT) 75 75 : Shortcut.registerShortcut("tools:multipoly_create", 76 76 tr("Tool: {0}", getName(false)), 77 77 KeyEvent.VK_B, Shortcut.CTRL), -
trunk/src/org/openstreetmap/josm/actions/HistoryInfoWebAction.java
r9136 r10378 31 31 32 32 @Override 33 protected 33 protected String createInfoUrl(Object infoObject) { 34 34 if (infoObject instanceof OsmPrimitive) { 35 35 OsmPrimitive primitive = (OsmPrimitive) infoObject; -
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r10308 r10378 291 291 * @return The next way. 292 292 */ 293 public 293 public WayInPolygon walk() { 294 294 Node headNode = getHeadNode(); 295 295 Node prevNode = getPrevNode(); … … 1217 1217 * @throws UserCancelException if user cancels the operation 1218 1218 */ 1219 private Multipolygon 1219 private Multipolygon joinPolygon(AssembledMultipolygon polygon) throws UserCancelException { 1220 1220 Multipolygon result = new Multipolygon(joinWays(polygon.outerWay.ways)); 1221 1221 … … 1440 1440 1441 1441 cmds.add(new ChangeCommand(r, newRel)); 1442 RelationRole saverel = 1442 RelationRole saverel = new RelationRole(r, rm.getRole()); 1443 1443 if (!result.contains(saverel)) { 1444 1444 result.add(saverel); -
trunk/src/org/openstreetmap/josm/actions/MoveAction.java
r9067 r10378 34 34 private static String calltosupermustbefirststatementinconstructortext(Direction dir) { 35 35 String directiontext; 36 if (dir == Direction.UP){36 if (dir == Direction.UP) { 37 37 directiontext = tr("up"); 38 } else if (dir == Direction.DOWN) 38 } else if (dir == Direction.DOWN) { 39 39 directiontext = tr("down"); 40 } else if (dir == Direction.LEFT) 40 } else if (dir == Direction.LEFT) { 41 41 directiontext = tr("left"); 42 42 } else { … … 49 49 private static Shortcut calltosupermustbefirststatementinconstructor(Direction dir) { 50 50 Shortcut sc; 51 if (dir == Direction.UP) { 52 sc = Shortcut.registerShortcut("core:moveup", tr("Move objects {0}", tr("up")), KeyEvent.VK_UP, Shortcut.SHIFT); 53 } else if (dir == Direction.DOWN) { 54 sc = Shortcut.registerShortcut("core:movedown", tr("Move objects {0}", tr("down")), KeyEvent.VK_DOWN, Shortcut.SHIFT); 55 } else if (dir == Direction.LEFT) { 56 sc = Shortcut.registerShortcut("core:moveleft", tr("Move objects {0}", tr("left")), KeyEvent.VK_LEFT, Shortcut.SHIFT); 51 // CHECKSTYLE.OFF: SingleSpaceSeparator 52 if (dir == Direction.UP) { 53 sc = Shortcut.registerShortcut("core:moveup", tr("Move objects {0}", tr("up")), KeyEvent.VK_UP, Shortcut.SHIFT); 54 } else if (dir == Direction.DOWN) { 55 sc = Shortcut.registerShortcut("core:movedown", tr("Move objects {0}", tr("down")), KeyEvent.VK_DOWN, Shortcut.SHIFT); 56 } else if (dir == Direction.LEFT) { 57 sc = Shortcut.registerShortcut("core:moveleft", tr("Move objects {0}", tr("left")), KeyEvent.VK_LEFT, Shortcut.SHIFT); 57 58 } else { //dir == Direction.RIGHT 58 59 sc = Shortcut.registerShortcut("core:moveright", tr("Move objects {0}", tr("right")), KeyEvent.VK_RIGHT, Shortcut.SHIFT); 59 60 } 61 // CHECKSTYLE.ON: SingleSpaceSeparator 60 62 return sc; 61 63 } … … 71 73 myDirection = dir; 72 74 putValue("help", ht("/Action/Move")); 73 if (dir == Direction.UP){75 if (dir == Direction.UP) { 74 76 putValue("toolbar", "action/move/up"); 75 } else if (dir == Direction.DOWN) 77 } else if (dir == Direction.DOWN) { 76 78 putValue("toolbar", "action/move/down"); 77 } else if (dir == Direction.LEFT) 79 } else if (dir == Direction.LEFT) { 78 80 putValue("toolbar", "action/move/left"); 79 81 } else { //dir == Direction.RIGHT -
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r10250 r10378 191 191 } else if (wayDataList.isEmpty()) { 192 192 throw new InvalidUserInputException("usage"); 193 } else 193 } else { 194 194 if (nodeList.size() == 2 || nodeList.isEmpty()) { 195 195 OrthogonalizeAction.rememberMovements.clear(); … … 401 401 EastNorth tmp = new EastNorth(nX.get(n), nY.get(n)); 402 402 tmp = EN.rotateCC(pivot, tmp, headingAll); 403 final double dx = tmp.east() 403 final double dx = tmp.east() - n.getEastNorth().east(); 404 404 final double dy = tmp.north() - n.getEastNorth().north(); 405 405 if (headingNodes.contains(n)) { // The heading nodes should not have changed … … 467 467 for (int i = 0; i < nSeg; ++i) { 468 468 EastNorth segment = EN.diff(en[i+1], en[i]); 469 if 469 if (segDirections[i] == Direction.RIGHT) { 470 470 h = EN.sum(h, segment); 471 471 } else if (segDirections[i] == Direction.UP) { … … 544 544 double x = en.east() - pivot.east(); 545 545 double y = en.north() - pivot.north(); 546 double nx = 547 double ny = 546 double nx = cosPhi * x - sinPhi * y + pivot.east(); 547 double ny = sinPhi * x + cosPhi * y + pivot.north(); 548 548 return new EastNorth(nx, ny); 549 549 } … … 558 558 559 559 public static double polar(EastNorth en1, EastNorth en2) { 560 return Math.atan2(en2.north() - en1.north(), en2.east() - 560 return Math.atan2(en2.north() - en1.north(), en2.east() - en1.east()); 561 561 } 562 562 } … … 572 572 private static int angleToDirectionChange(double a, double deltaMax) throws RejectedAngleException { 573 573 a = standard_angle_mPI_to_PI(a); 574 double d0 575 double d90 574 double d0 = Math.abs(a); 575 double d90 = Math.abs(a - Math.PI / 2); 576 576 double dm90 = Math.abs(a + Math.PI / 2); 577 577 int dirChange; 578 578 if (d0 < deltaMax) { 579 dirChange = 579 dirChange = 0; 580 580 } else if (d90 < deltaMax) { 581 dirChange = 581 dirChange = 1; 582 582 } else if (dm90 < deltaMax) { 583 583 dirChange = -1; -
trunk/src/org/openstreetmap/josm/actions/PasteAction.java
r10216 r10378 113 113 } 114 114 115 double offsetEast 115 double offsetEast = mPosition.east() - (maxEast + minEast)/2.0; 116 116 double offsetNorth = mPosition.north() - (maxNorth + minNorth)/2.0; 117 117 -
trunk/src/org/openstreetmap/josm/actions/PurgeAction.java
r9233 r10378 64 64 public PurgeAction() { 65 65 /* translator note: other expressions for "purge" might be "forget", "clean", "obliterate", "prune" */ 66 super(tr("Purge..."), "purge", 66 super(tr("Purge..."), "purge", tr("Forget objects but do not delete them on server when uploading."), 67 67 Shortcut.registerShortcut("system:purge", tr("Edit: {0}", tr("Purge")), 68 68 KeyEvent.VK_P, Shortcut.CTRL_SHIFT), … … 272 272 JButton addToSelection = new JButton(new AbstractAction() { 273 273 { 274 putValue(SHORT_DESCRIPTION, 274 putValue(SHORT_DESCRIPTION, tr("Add to selection")); 275 275 putValue(SMALL_ICON, ImageProvider.get("dialogs", "select")); 276 276 } -
trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r9972 r10378 137 137 */ 138 138 protected boolean isRequiredNode(Way way, Node node) { 139 boolean isRequired = 139 boolean isRequired = Collections.frequency(way.getNodes(), node) > 1; 140 140 if (!isRequired) { 141 141 List<OsmPrimitive> parents = new LinkedList<>(); -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r10254 r10378 139 139 if (tmpNodes.isEmpty()) { 140 140 if (selection.size() > 1) { 141 errMsg = 141 errMsg = tr("None of these nodes are glued to anything else."); 142 142 } else { 143 143 errMsg = tr("None of this way''s nodes are glued to anything else."); -
trunk/src/org/openstreetmap/josm/actions/ValidateAction.java
r9067 r10378 126 126 Collection<OsmPrimitive> formerValidatedPrimitives) { 127 127 super(tr("Validating"), false /*don't ignore exceptions */); 128 this.validatedPrimitives 128 this.validatedPrimitives = validatedPrimitives; 129 129 this.formerValidatedPrimitives = formerValidatedPrimitives; 130 130 this.tests = tests; … … 142 142 // update GUI on Swing EDT 143 143 // 144 GuiHelper.runInEDT(new Runnable() 144 GuiHelper.runInEDT(new Runnable() { 145 145 @Override 146 146 public void run() { -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetQueryTask.java
r10250 r10378 71 71 // thrown if user cancel the authentication dialog 72 72 setCanceled(true); 73 } 73 } catch (OsmTransferException e) { 74 74 if (isCanceled()) 75 75 return; -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmCompressedTask.java
r10001 r10378 19 19 public class DownloadOsmCompressedTask extends DownloadOsmTask { 20 20 21 private static final String PATTERN_COMPRESS = 21 private static final String PATTERN_COMPRESS = "https?://.*/.*\\.osm.(gz|bz2?|zip)"; 22 22 23 23 @Override -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r10371 r10378 37 37 public class DownloadOsmTask extends AbstractDownloadTask<DataSet> { 38 38 39 // CHECKSTYLE.OFF: SingleSpaceSeparator 39 40 protected static final String PATTERN_OSM_API_URL = "https?://.*/api/0.6/(map|nodes?|ways?|relations?|\\*).*"; 40 41 protected static final String PATTERN_OVERPASS_API_URL = "https?://.*/interpreter\\?data=.*"; 41 42 protected static final String PATTERN_OVERPASS_API_XAPI_URL = "https?://.*/xapi(\\?.*\\[@meta\\]|_meta\\?).*"; 42 43 protected static final String PATTERN_EXTERNAL_OSM_FILE = "https?://.*/.*\\.osm"; 44 // CHECKSTYLE.ON: SingleSpaceSeparator 43 45 44 46 protected Bounds currentBounds; -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadSessionTask.java
r9171 r10378 21 21 public class DownloadSessionTask extends AbstractDownloadTask<Object> { 22 22 23 private static final String PATTERN_SESSION = 23 private static final String PATTERN_SESSION = "https?://.*/.*\\.jo(s|z)"; 24 24 25 25 private Loader loader; -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r10308 r10378 691 691 int posn0 = selectedWay.getNodes().indexOf(currentNode); 692 692 if (posn0 != -1 && // n0 is part of way 693 (posn0 >= 1 && targetNode.equals(selectedWay.getNode(posn0-1))) || // previous node 694 (posn0 < selectedWay.getNodesCount()-1) && targetNode.equals(selectedWay.getNode(posn0+1))) { // next node 693 // CHECKSTYLE.OFF: SingleSpaceSeparator 694 (posn0 >= 1 && targetNode.equals(selectedWay.getNode(posn0-1))) || // previous node 695 (posn0 < selectedWay.getNodesCount()-1) && targetNode.equals(selectedWay.getNode(posn0+1))) { // next node 696 // CHECKSTYLE.ON: SingleSpaceSeparator 695 697 getCurrentDataSet().setSelected(targetNode); 696 698 lastUsedNode = targetNode; … … 845 847 * uses also lastUsedNode field 846 848 */ 847 private void determineCurrentBaseNodeAndPreviousNode(Collection<OsmPrimitive> 849 private void determineCurrentBaseNodeAndPreviousNode(Collection<OsmPrimitive> selection) { 848 850 Node selectedNode = null; 849 851 Way selectedWay = null; … … 1283 1285 n = (Node) p; // found one node 1284 1286 wayIsFinished = false; 1285 } 1287 } else { 1286 1288 // if more than 1 node were affected by previous command, 1287 1289 // we have no way to continue, so we forget about found node … … 1659 1661 } 1660 1662 if (enOpt != null) { 1661 projectionSource = 1663 projectionSource = enOpt; 1662 1664 } 1663 1665 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
r10308 r10378 822 822 initialN2en.getX() - en.getX(), 823 823 initialN2en.getY() - en.getY() 824 ), initialN2en, 824 ), initialN2en, en, false)); 825 825 } 826 826 } … … 835 835 possibleMoveDirections = new ArrayList<>(); 836 836 for (OsmPrimitive p: selectedNode.getReferrers()) { 837 if (p instanceof Way 837 if (p instanceof Way && p.isUsable()) { 838 838 for (Node neighbor: ((Way) p).getNeighbours(selectedNode)) { 839 839 EastNorth en = neighbor.getEastNorth(); … … 905 905 initialN2en.getX() - nextNodeEn.getX(), 906 906 initialN2en.getY() - nextNodeEn.getY() 907 ), initialN2en, 907 ), initialN2en, nextNodeEn, false); 908 908 } 909 909 … … 985 985 private int getNextNodeIndex(int index) { 986 986 int count = selectedSegment.way.getNodesCount(); 987 if (index < 987 if (index < count - 1) 988 988 return index + 1; 989 989 else if (selectedSegment.way.isClosed()) -
trunk/src/org/openstreetmap/josm/actions/mapmode/ModifiersSpec.java
r9970 r10378 25 25 char c = str.charAt(2); 26 26 // @formatter:off 27 // CHECKSTYLE.OFF: SingleSpaceSeparator 27 28 alt = a == '?' ? UNKNOWN : (a == 'A' ? ON : OFF); 28 29 shift = s == '?' ? UNKNOWN : (s == 'S' ? ON : OFF); 29 30 ctrl = c == '?' ? UNKNOWN : (c == 'C' ? ON : OFF); 31 // CHECKSTYLE.ON: SingleSpaceSeparator 30 32 // @formatter:on 31 33 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java
r10220 r10378 205 205 private void updateModeLocalPreferences() { 206 206 // @formatter:off 207 // CHECKSTYLE.OFF: SingleSpaceSeparator 207 208 snapThreshold = Main.pref.getDouble(prefKey("snap-threshold-percent"), 0.70); 208 209 snapDefault = Main.pref.getBoolean(prefKey("snap-default"), true); … … 219 220 toggleSelectedModifierCombo = new ModifiersSpec(getStringPref("toggle-selection-modifier-combo", "asC")); 220 221 setSelectedModifierCombo = new ModifiersSpec(getStringPref("set-selection-modifier-combo", "asc")); 222 // CHECKSTYLE.ON: SingleSpaceSeparator 221 223 // @formatter:on 222 224 } -
trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java
r9273 r10378 24 24 * @since 5793 25 25 */ 26 public class EditRelationAction extends AbstractRelationAction 26 public class EditRelationAction extends AbstractRelationAction { 27 27 28 28 /** -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r10308 r10378 68 68 private final boolean caseSensitive; 69 69 private final boolean regexSearch; 70 private static String 71 private static String 70 private static String rxErrorMsg = marktr("The regex \"{0}\" had a parse error at offset {1}, full error:\n\n{2}"); 71 private static String rxErrorMsgNoPos = marktr("The regex \"{0}\" had a parse error, full error:\n\n{1}"); 72 72 private final PushbackTokenizer tokenizer; 73 73 private static Map<String, SimpleMatchFactory> simpleMatchFactoryMap = new HashMap<>(); -
trunk/src/org/openstreetmap/josm/actions/upload/FixDataHook.java
r9067 r10378 36 36 */ 37 37 public FixDataHook() { 38 // CHECKSTYLE.OFF: SingleSpaceSeparator 38 39 deprecated.add(new FixDataSpace()); 39 40 deprecated.add(new FixDataKey("color", "colour")); … … 44 45 deprecated.add(new FixDataTag("oneway", "1", "oneway", "yes")); 45 46 deprecated.add(new FixDataTag("highway", "stile", "barrier", "stile")); 47 // CHECKSTYLE.ON: SingleSpaceSeparator 46 48 deprecated.add(new FixData() { 47 49 @Override -
trunk/src/org/openstreetmap/josm/command/MoveCommand.java
r10248 r10378 107 107 public MoveCommand(Collection<OsmPrimitive> objects, EastNorth start, EastNorth end) { 108 108 this(objects, end.getX()-start.getX(), end.getY()-start.getY()); 109 startEN = 109 startEN = start; 110 110 } 111 111 … … 118 118 public MoveCommand(OsmPrimitive p, EastNorth start, EastNorth end) { 119 119 this(Collections.singleton(p), end.getX()-start.getX(), end.getY()-start.getY()); 120 startEN = 120 startEN = start; 121 121 } 122 122 -
trunk/src/org/openstreetmap/josm/command/PurgeCommand.java
r9989 r10378 231 231 List<Relation> outR = new ArrayList<>(inR.size()); 232 232 while (!childlessR.isEmpty()) { 233 // Identify one childless Relation and 234 // let it virtually die. This makes other 235 // relations childless. 236 Iterator<Relation> it = childlessR.iterator(); 233 // Identify one childless Relation and let it virtually die. This makes other relations childless. 234 Iterator<Relation> it = childlessR.iterator(); 237 235 Relation next = it.next(); 238 236 it.remove(); -
trunk/src/org/openstreetmap/josm/command/RotateCommand.java
r9371 r10378 81 81 double x = oldEastNorth.east() - pivot.east(); 82 82 double y = oldEastNorth.north() - pivot.north(); 83 // CHECKSTYLE.OFF: SingleSpaceSeparator 83 84 double nx = cosPhi * x + sinPhi * y + pivot.east(); 84 85 double ny = -sinPhi * x + cosPhi * y + pivot.north(); 86 // CHECKSTYLE.ON: SingleSpaceSeparator 85 87 n.setEastNorth(new EastNorth(nx, ny)); 86 88 } -
trunk/src/org/openstreetmap/josm/command/ScaleCommand.java
r9371 r10378 44 44 // releases the button and presses it again with the same modifiers. 45 45 // The very first point of this operation is stored here. 46 startEN 46 startEN = currentEN; 47 47 48 48 handleEvent(currentEN); -
trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java
r10364 r10378 32 32 public ConflictAddCommand(OsmDataLayer layer, Conflict<? extends OsmPrimitive> conflict) { 33 33 super(layer); 34 this.conflict 34 this.conflict = conflict; 35 35 } 36 36 -
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r10216 r10378 344 344 private static boolean busy; 345 345 346 public static void pluginOperation(String install, String uninstall, String delete) 346 public static void pluginOperation(String install, String uninstall, String delete) { 347 347 final List<String> installList = new ArrayList<>(); 348 348 final List<String> removeList = new ArrayList<>(); … … 601 601 tmpPref.getAllSettings().size(), tmpPref.getAllSettings().keySet().toString()); 602 602 PreferencesUtils.appendPreferences(tmpPref, mainPrefs); 603 } 603 } else if ("delete-values".equals(oper)) { 604 604 PreferencesUtils.deletePreferenceValues(tmpPref, mainPrefs); 605 605 } … … 734 734 mr.appendReplacement(sb, result); 735 735 } catch (ScriptException ex) { 736 log("Error: Can not evaluate expression %s : %s", 736 log("Error: Can not evaluate expression %s : %s", mr.group(1), ex.getMessage()); 737 737 } 738 738 } … … 916 916 } 917 917 918 private static Collection<String> getCollection(Preferences mainpref, String key, boolean warnUnknownDefault) 918 private static Collection<String> getCollection(Preferences mainpref, String key, boolean warnUnknownDefault) { 919 919 ListSetting existing = Utils.cast(mainpref.settingsMap.get(key), ListSetting.class); 920 920 ListSetting defaults = Utils.cast(mainpref.defaultsMap.get(key), ListSetting.class); … … 929 929 } 930 930 931 private static Collection<Collection<String>> getArray(Preferences mainpref, String key, boolean warnUnknownDefault) 931 private static Collection<Collection<String>> getArray(Preferences mainpref, String key, boolean warnUnknownDefault) { 932 932 ListListSetting existing = Utils.cast(mainpref.settingsMap.get(key), ListListSetting.class); 933 933 ListListSetting defaults = Utils.cast(mainpref.defaultsMap.get(key), ListListSetting.class); … … 943 943 } 944 944 945 private static List<Map<String, String>> getListOfStructs(Preferences mainpref, String key, boolean warnUnknownDefault) 945 private static List<Map<String, String>> getListOfStructs(Preferences mainpref, String key, boolean warnUnknownDefault) { 946 946 MapListSetting existing = Utils.cast(mainpref.settingsMap.get(key), MapListSetting.class); 947 947 MapListSetting defaults = Utils.cast(mainpref.settingsMap.get(key), MapListSetting.class); … … 1031 1031 1032 1032 @SuppressWarnings("unchecked") 1033 Map<String, String> stringMap = 1033 Map<String, String> stringMap = (Map<String, String>) engine.get("stringMap"); 1034 1034 @SuppressWarnings("unchecked") 1035 1035 Map<String, List<String>> listMap = (SortedMap<String, List<String>>) engine.get("listMap"); … … 1073 1073 public static void loadPrefsToJS(ScriptEngine engine, Preferences tmpPref, String whereToPutInJS, boolean includeDefaults) 1074 1074 throws ScriptException { 1075 Map<String, String> stringMap = 1075 Map<String, String> stringMap = new TreeMap<>(); 1076 1076 Map<String, List<String>> listMap = new TreeMap<>(); 1077 1077 Map<String, List<List<String>>> listlistMap = new TreeMap<>(); -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r10322 r10378 1279 1279 continue; 1280 1280 } 1281 } else 1281 } else if (f.getType() == String.class) { 1282 1282 value = key_value.getValue(); 1283 1283 } else if (f.getType().isAssignableFrom(Map.class)) { -
trunk/src/org/openstreetmap/josm/data/Version.java
r10300 r10378 85 85 isLocalBuild = false; 86 86 value = properties.getProperty("Is-Local-Build"); 87 if (value != null && "true".equalsIgnoreCase(value.trim())) 87 if (value != null && "true".equalsIgnoreCase(value.trim())) { 88 88 isLocalBuild = true; 89 89 } … … 93 93 buildName = null; 94 94 value = properties.getProperty("Build-Name"); 95 if (value != null && !value.trim().isEmpty()) 95 if (value != null && !value.trim().isEmpty()) { 96 96 buildName = value.trim(); 97 97 } … … 130 130 */ 131 131 public String getVersionString() { 132 return 132 return version == 0 ? tr("UNKNOWN") : Integer.toString(version); 133 133 } 134 134 -
trunk/src/org/openstreetmap/josm/data/cache/CacheEntryAttributes.java
r9070 r10378 92 92 String val = attrs.get(key); 93 93 if (val == null) { 94 attrs.put(key, 94 attrs.put(key, "0"); 95 95 return 0; 96 96 } -
trunk/src/org/openstreetmap/josm/data/cache/HostLimitQueue.java
r9004 r10378 100 100 } 101 101 102 private 102 private Semaphore getSemaphore(JCSCachedTileLoaderJob<?, ?> job) { 103 103 String host; 104 104 try { -
trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java
r10323 r10378 42 42 43 43 private static volatile CompositeCacheManager cacheManager; 44 private static long maxObjectTTL 44 private static long maxObjectTTL = -1; 45 45 private static final String PREFERENCE_PREFIX = "jcs.cache"; 46 46 private static BooleanProperty USE_BLOCK_CACHE = new BooleanProperty(PREFERENCE_PREFIX + ".use_block_cache", true); … … 53 53 * default objects to be held in memory by JCS caches (per region) 54 54 */ 55 public static final IntegerProperty DEFAULT_MAX_OBJECTS_IN_MEMORY 55 public static final IntegerProperty DEFAULT_MAX_OBJECTS_IN_MEMORY = new IntegerProperty(PREFERENCE_PREFIX + ".max_objects_in_memory", 1000); 56 56 57 57 private JCSCacheManager() { … … 114 114 // these are default common to all cache regions 115 115 // use of auxiliary cache and sizing of the caches is done with giving proper geCache(...) params 116 // CHECKSTYLE.OFF: SingleSpaceSeparator 116 117 props.setProperty("jcs.default.cacheattributes", CompositeCacheAttributes.class.getCanonicalName()); 117 118 props.setProperty("jcs.default.cacheattributes.MaxObjects", DEFAULT_MAX_OBJECTS_IN_MEMORY.get().toString()); … … 123 124 props.setProperty("jcs.default.elementattributes.IdleTime", Long.toString(maxObjectTTL)); 124 125 props.setProperty("jcs.default.elementattributes.IsSpool", "true"); 126 // CHECKSTYLE.ON: SingleSpaceSeparator 125 127 CompositeCacheManager cm = CompositeCacheManager.getUnconfiguredInstance(); 126 128 cm.configure(props); -
trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
r10308 r10378 313 313 final HttpClient request = getRequest("GET", true); 314 314 315 if (isObjectLoadable() 315 if (isObjectLoadable() && 316 316 (now - attributes.getLastModification()) <= ABSOLUTE_EXPIRE_TIME_LIMIT) { 317 317 request.setIfModifiedSince(attributes.getLastModification()); … … 397 397 } catch (InterruptedException e) { 398 398 attributes.setErrorMessage(e.toString()); 399 log.log(Level.WARNING, "JCS - Exception during download {0}", 399 log.log(Level.WARNING, "JCS - Exception during download {0}", getUrlNoException()); 400 400 Main.warn(e); 401 401 } -
trunk/src/org/openstreetmap/josm/data/conflict/ConflictCollection.java
r9371 r10378 235 235 */ 236 236 public boolean hasConflictForTheir(OsmPrimitive their) { 237 return getConflictForTheir(their) 237 return getConflictForTheir(their) != null; 238 238 } 239 239 -
trunk/src/org/openstreetmap/josm/data/coor/EastNorth.java
r10334 r10378 162 162 double x = east() - pivot.east(); 163 163 double y = north() - pivot.north(); 164 // CHECKSTYLE.OFF: SingleSpaceSeparator 164 165 double nx = cosPhi * x + sinPhi * y + pivot.east(); 165 166 double ny = -sinPhi * x + cosPhi * y + pivot.north(); 167 // CHECKSTYLE.ON: SingleSpaceSeparator 166 168 return new EastNorth(nx, ny); 167 169 } -
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r10212 r10378 39 39 * @since 8168 40 40 */ 41 public class TMSCachedTileLoaderJob extends JCSCachedTileLoaderJob<String, BufferedImageCacheEntry> implements TileJob, ICachedLoaderListener 41 public class TMSCachedTileLoaderJob extends JCSCachedTileLoaderJob<String, BufferedImageCacheEntry> implements TileJob, ICachedLoaderListener { 42 42 private static final Logger LOG = FeatureAdapter.getLogger(TMSCachedTileLoaderJob.class.getCanonicalName()); 43 43 private static final LongProperty MAXIMUM_EXPIRES = new LongProperty("imagery.generic.maximum_expires", … … 124 124 byte[] content = cacheData.getContent(); 125 125 try { 126 return content != null 126 return content != null || cacheData.getImage() != null || isNoTileAtZoom(); 127 127 } catch (IOException e) { 128 128 LOG.log(Level.WARNING, "JCS TMS - error loading from cache for tile {0}: {1}", new Object[] {tile.getKey(), e.getMessage()}); -
trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java
r10181 r10378 46 46 private double[] degreesPerTile; 47 47 48 private static final Pattern PATTERN_HEADER = Pattern.compile("\\{header\\(([^,]+),([^}]+)\\)\\}"); 49 private static final Pattern PATTERN_PROJ = Pattern.compile("\\{proj\\}"); 50 private static final Pattern PATTERN_WKID = Pattern.compile("\\{wkid\\}"); 51 private static final Pattern PATTERN_BBOX = Pattern.compile("\\{bbox\\}"); 52 private static final Pattern PATTERN_W = Pattern.compile("\\{w\\}"); 53 private static final Pattern PATTERN_S = Pattern.compile("\\{s\\}"); 54 private static final Pattern PATTERN_E = Pattern.compile("\\{e\\}"); 55 private static final Pattern PATTERN_N = Pattern.compile("\\{n\\}"); 56 private static final Pattern PATTERN_WIDTH = Pattern.compile("\\{width\\}"); 57 private static final Pattern PATTERN_HEIGHT = Pattern.compile("\\{height\\}"); 58 private static final Pattern PATTERN_PARAM = Pattern.compile("\\{([^}]+)\\}"); 48 // CHECKSTYLE.OFF: SingleSpaceSeparator 49 private static final Pattern PATTERN_HEADER = Pattern.compile("\\{header\\(([^,]+),([^}]+)\\)\\}"); 50 private static final Pattern PATTERN_PROJ = Pattern.compile("\\{proj\\}"); 51 private static final Pattern PATTERN_WKID = Pattern.compile("\\{wkid\\}"); 52 private static final Pattern PATTERN_BBOX = Pattern.compile("\\{bbox\\}"); 53 private static final Pattern PATTERN_W = Pattern.compile("\\{w\\}"); 54 private static final Pattern PATTERN_S = Pattern.compile("\\{s\\}"); 55 private static final Pattern PATTERN_E = Pattern.compile("\\{e\\}"); 56 private static final Pattern PATTERN_N = Pattern.compile("\\{n\\}"); 57 private static final Pattern PATTERN_WIDTH = Pattern.compile("\\{width\\}"); 58 private static final Pattern PATTERN_HEIGHT = Pattern.compile("\\{height\\}"); 59 private static final Pattern PATTERN_PARAM = Pattern.compile("\\{([^}]+)\\}"); 60 // CHECKSTYLE.ON: SingleSpaceSeparator 59 61 60 62 private static final NumberFormat latLonFormat = new DecimalFormat("###0.0000000", new DecimalFormatSymbols(Locale.US)); … … 269 271 @Override 270 272 public TileXY latLonToTileXY(ICoordinate point, int zoom) { 271 return latLonToTileXY(point.getLat(), 273 return latLonToTileXY(point.getLat(), point.getLon(), zoom); 272 274 } 273 275 … … 297 299 EastNorth point = Main.getProjection().latlon2eastNorth(new LatLon(lat, lon)); 298 300 return new Point( 299 (int) Math.round((point.east() - anchorPosition.east()) 301 (int) Math.round((point.east() - anchorPosition.east()) / scale), 300 302 (int) Math.round((anchorPosition.north() - point.north()) / scale) 301 303 ); -
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r10212 r10378 61 61 */ 62 62 public class WMTSTileSource extends AbstractTMSTileSource implements TemplatedTileSource { 63 private static final String PATTERN_HEADER 63 private static final String PATTERN_HEADER = "\\{header\\(([^,]+),([^}]+)\\)\\}"; 64 64 65 65 private static final String URL_GET_ENCODING_PARAMS = "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER={layer}&STYLE={style}&" … … 812 812 @Override 813 813 public TileXY latLonToTileXY(ICoordinate point, int zoom) { 814 return latLonToTileXY(point.getLat(), 814 return latLonToTileXY(point.getLat(), point.getLon(), zoom); 815 815 } 816 816 … … 844 844 EastNorth point = Main.getProjection().latlon2eastNorth(new LatLon(lat, lon)); 845 845 return new Point( 846 (int) Math.round((point.east() - matrix.topLeftCorner.east()) 846 (int) Math.round((point.east() - matrix.topLeftCorner.east()) / scale), 847 847 (int) Math.round((matrix.topLeftCorner.north() - point.north()) / scale) 848 848 ); -
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r9656 r10378 60 60 * as deleted on the server. 61 61 */ 62 protected static final int FLAG_VISIBLE 62 protected static final int FLAG_VISIBLE = 1 << 1; 63 63 64 64 /** … … 69 69 * objects still referring to it. 70 70 */ 71 protected static final int FLAG_DELETED 71 protected static final int FLAG_DELETED = 1 << 2; 72 72 73 73 /** -
trunk/src/org/openstreetmap/josm/data/osm/BBox.java
r10336 r10378 53 53 } 54 54 55 public BBox(double ax, double ay, double bx, double by) 55 public BBox(double ax, double ay, double bx, double by) { 56 56 57 57 if (ax > bx) { … … 94 94 } 95 95 96 private void sanity() 96 private void sanity() { 97 97 if (xmin < -180.0) { 98 98 xmin = -180.0; 99 99 } 100 if (xmax > 101 xmax = 102 } 103 if (ymin < 104 ymin = 105 } 106 if (ymax > 107 ymax = 100 if (xmax > 180.0) { 101 xmax = 180.0; 102 } 103 if (ymin < -90.0) { 104 ymin = -90.0; 105 } 106 if (ymax > 90.0) { 107 ymax = 90.0; 108 108 } 109 109 } -
trunk/src/org/openstreetmap/josm/data/osm/Changeset.java
r9468 r10378 326 326 this.createdAt = other.createdAt; 327 327 this.closedAt = other.closedAt; 328 this.open 328 this.open = other.open; 329 329 this.min = other.min; 330 330 this.max = other.max; -
trunk/src/org/openstreetmap/josm/data/osm/ChangesetDataSet.java
r9067 r10378 144 144 */ 145 145 public HistoryOsmPrimitive getPrimitive(PrimitiveId id) { 146 if (id == null) 146 if (id == null) return null; 147 147 return primitives.get(id); 148 148 } -
trunk/src/org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java
r10212 r10378 141 141 } else if (dataSet.getPrimitiveById(primitive) == null) { 142 142 printError("REFERENCED BUT NOT IN DATA", "%s is referenced by %s but not found in dataset", primitive, parent); 143 } else 143 } else if (dataSet.getPrimitiveById(primitive) != primitive) { 144 144 printError("DIFFERENT INSTANCE", "%s is different instance that referred by %s", primitive, parent); 145 145 } -
trunk/src/org/openstreetmap/josm/data/osm/Filter.java
r9980 r10378 57 57 } else if ("remove".equals(e.mode)) { 58 58 mode = SearchMode.remove; 59 } else 59 } else if ("in_selection".equals(e.mode)) { 60 60 mode = SearchMode.in_selection; 61 61 } -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r9989 r10378 277 277 public String toString() { 278 278 String coorDesc = isLatLonKnown() ? "lat="+lat+",lon="+lon : ""; 279 return "{Node id=" + getUniqueId() + " version=" + getVersion() + ' ' + getFlagsAsString() + ' ' 279 return "{Node id=" + getUniqueId() + " version=" + getVersion() + ' ' + getFlagsAsString() + ' ' + coorDesc+'}'; 280 280 } 281 281 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r10040 r10378 634 634 } 635 635 super.setIncomplete(incomplete); 636 } 636 } finally { 637 637 writeUnlock(locked); 638 638 } … … 1266 1266 1267 1267 boolean hasEqualSemanticAttributes(final OsmPrimitive other, final boolean testInterestingTagsOnly) { 1268 if (!isNew() && 1268 if (!isNew() && id != other.id) 1269 1269 return false; 1270 1270 if (isIncomplete() ^ other.isIncomplete()) // exclusive or operator for performance (see #7159) … … 1291 1291 if (other == null) return false; 1292 1292 1293 return 1293 return isDeleted() == other.isDeleted() 1294 1294 && isModified() == other.isModified() 1295 1295 && timestamp == other.timestamp -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java
r9067 r10378 41 41 MapView.addLayerChangeListener(historyDataSet); 42 42 } 43 return 43 return historyDataSet; 44 44 } 45 45 -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java
r10006 r10378 89 89 this.visible = visible; 90 90 this.user = user; 91 this.changesetId 91 this.changesetId = changesetId; 92 92 this.timestamp = timestamp; 93 93 tags = new HashMap<>(); -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryRelation.java
r9067 r10378 111 111 * @throws IndexOutOfBoundsException if idx is out of bounds 112 112 */ 113 public RelationMemberData getRelationMember(int idx) throws IndexOutOfBoundsException 113 public RelationMemberData getRelationMember(int idx) throws IndexOutOfBoundsException { 114 114 if (idx < 0 || idx >= members.size()) 115 115 throw new IndexOutOfBoundsException( -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapRendererFactory.java
r9243 r10378 66 66 public Descriptor(Class<? extends AbstractMapRenderer> renderer, String displayName, String description) { 67 67 this.renderer = renderer; 68 this.displayName 68 this.displayName = displayName; 69 69 this.description = description; 70 70 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/PaintColors.java
r8840 r10378 21 21 CONNECTION(marktr("Node: connection"), Color.yellow), 22 22 TAGGED(marktr("Node: tagged"), new Color(204, 255, 255)), // light cyan 23 DEFAULT_WAY(marktr("way"), 23 DEFAULT_WAY(marktr("way"), new Color(0, 0, 128)), // dark blue 24 24 RELATION(marktr("relation"), new Color(0, 128, 128)), // teal 25 25 UNTAGGED_WAY(marktr("untagged way"), new Color(0, 128, 0)), // dark green -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r10312 r10378 295 295 */ 296 296 public static boolean isGlyphVectorDoubleTranslationBug(Font font) { 297 Boolean cached 297 Boolean cached = IS_GLYPH_VECTOR_DOUBLE_TRANSLATION_BUG.get(font); 298 298 if (cached != null) 299 299 return cached; … … 575 575 if (pb.width >= nb.getWidth() && pb.height >= nb.getHeight()) { 576 576 577 final double w = pb.width 577 final double w = pb.width - nb.getWidth(); 578 578 final double h = pb.height - nb.getHeight(); 579 579 … … 590 590 if (!labelOK) { 591 591 // if center position (C) is not inside osm shape, try naively some other positions as follows: 592 // CHECKSTYLE.OFF: SingleSpaceSeparator 592 593 final int x1 = pb.x + (int) (w/4.0); 593 594 final int x3 = pb.x + (int) (3*w/4.0); 594 595 final int y1 = pb.y + (int) (h/4.0); 595 596 final int y3 = pb.y + (int) (3*h/4.0); 597 // CHECKSTYLE.ON: SingleSpaceSeparator 596 598 // +-----------+ 597 599 // | 5 1 6 | … … 1481 1483 final double segmentLength = p1.distance(p2); 1482 1484 if (segmentLength != 0) { 1483 final double l = 1485 final double l = (10. + line.getLineWidth()) / segmentLength; 1484 1486 1485 1487 final double sx = l * (p1.x - p2.x); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java
r10303 r10378 427 427 428 428 if (showDirection) { 429 final double l = 429 final double l = 10. / p1.distance(p2); 430 430 431 431 final double sx = l * (p1.x - p2.x); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java
r10312 r10378 646 646 } 647 647 648 private void addInnerToOuters(List<PolyData> innerPolygons, List<PolyData> outerPolygons) 648 private void addInnerToOuters(List<PolyData> innerPolygons, List<PolyData> outerPolygons) { 649 649 if (innerPolygons.isEmpty()) { 650 650 combinedPolygons.addAll(outerPolygons); -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r10235 r10378 316 316 s = parameters.get(Param.axis.key); 317 317 if (s != null) { 318 this.axis 318 this.axis = s; 319 319 } 320 320 } … … 526 526 id = "tmerc"; 527 527 } 528 Proj proj = 528 Proj proj = Projections.getBaseProjection(id); 529 529 if (proj == null) throw new ProjectionConfigurationException(tr("Unknown projection identifier: ''{0}''", id)); 530 530 -
trunk/src/org/openstreetmap/josm/data/projection/proj/AbstractProj.java
r10250 r10378 92 92 // Compute constants for the mlfn 93 93 double t; 94 // CHECKSTYLE.OFF: SingleSpaceSeparator 94 95 en0 = C00 - e2 * (C02 + e2 * 95 96 (C04 + e2 * (C06 + e2 * C08))); … … 100 101 en3 = (t *= e2) * (C66 - e2 * C68); 101 102 en4 = t * e2 * C88; 103 // CHECKSTYLE.ON: SingleSpaceSeparator 102 104 } 103 105 … … 158 160 double phi = (Math.PI/2) - 2.0 * Math.atan(ts); 159 161 for (int i = 0; i < MAXIMUM_ITERATIONS; i++) { 160 final double con 162 final double con = e * Math.sin(phi); 161 163 final double dphi = (Math.PI/2) - 2.0*Math.atan(ts * Math.pow((1-con)/(1+con), eccnth)) - phi; 162 164 phi += dphi; -
trunk/src/org/openstreetmap/josm/data/projection/proj/AlbersEqualArea.java
r10235 r10378 98 98 throw new ProjectionConfigurationException(tr("standard parallels are opposite")); 99 99 } 100 double 101 double 102 double n= sinphi;100 double sinphi = Math.sin(phi1); 101 double cosphi = Math.cos(phi1); 102 double n = sinphi; 103 103 boolean secant = Math.abs(phi1 - phi2) >= EPSILON; 104 104 double m1 = msfn(sinphi, cosphi); 105 105 double q1 = qsfn(sinphi); 106 106 if (secant) { // secant cone 107 sinphi 108 cosphi 107 sinphi = Math.sin(phi2); 108 cosphi = Math.cos(phi2); 109 109 double m2 = msfn(sinphi, cosphi); 110 110 double q2 = qsfn(sinphi); … … 130 130 } 131 131 rho = Math.sqrt(rho) / n; 132 y = rho0 - rho * Math.cos(x); 133 x = rho * Math.sin(x); 132 // CHECKSTYLE.OFF: SingleSpaceSeparator 133 y = rho0 - rho * Math.cos(x); 134 x = rho * Math.sin(x); 135 // CHECKSTYLE.ON: SingleSpaceSeparator 134 136 return new double[] {x, y}; 135 137 } … … 142 144 if (n < 0.0) { 143 145 rho = -rho; 144 x 145 y 146 x = -x; 147 y = -y; 146 148 } 147 149 x = Math.atan2(x, y) / n; … … 175 177 final double sinpi = Math.sin(phi); 176 178 final double cospi = Math.cos(phi); 177 final double con 178 final double com 179 final double dphi 179 final double con = e * sinpi; 180 final double com = 1.0 - con*con; 181 final double dphi = 0.5 * com*com / cospi * 180 182 (qs/toneEs - sinpi / com + 0.5/e * Math.log((1. - con) / (1. + con))); 181 183 phi += dphi; -
trunk/src/org/openstreetmap/josm/data/projection/proj/LambertAzimuthalEqualArea.java
r9998 r10378 100 100 101 101 final double sinphi; 102 qp 103 rq 102 qp = qsfn(1); 103 rq = Math.sqrt(0.5 * qp); 104 104 sinphi = Math.sin(latitudeOfOrigin); 105 105 sinb1 = qsfn(sinphi) / qp; … … 107 107 switch (mode) { 108 108 case NORTH_POLE: // Fall through 109 case SOUTH_POLE: {110 dd 109 case SOUTH_POLE: 110 dd = 1.0; 111 111 xmf = ymf = rq; 112 112 break; 113 } 114 case EQUATORIAL: { 115 dd = 1.0 / rq; 113 case EQUATORIAL: 114 dd = 1.0 / rq; 116 115 xmf = 1.0; 117 116 ymf = 0.5 * qp; 118 117 break; 119 } 120 case OBLIQUE: { 121 dd = Math.cos(latitudeOfOrigin) / 122 (Math.sqrt(1.0 - e2 * sinphi * sinphi) * rq * cosb1); 118 case OBLIQUE: 119 dd = Math.cos(latitudeOfOrigin) / (Math.sqrt(1.0 - e2 * sinphi * sinphi) * rq * cosb1); 123 120 xmf = rq * dd; 124 121 ymf = rq / dd; 125 122 break; 126 } 127 default: { 123 default: 128 124 throw new AssertionError(mode); 129 }130 125 } 131 126 } … … 139 134 final double sinb, cosb, b, c, x, y; 140 135 switch (mode) { 141 case OBLIQUE: {136 case OBLIQUE: 142 137 sinb = q / qp; 143 138 cosb = Math.sqrt(1.0 - sinb * sinb); 144 c = 1.0 + sinb1 * sinb + cosb1 * cosb * coslam; 145 b = Math.sqrt(2.0 / c); 146 y = ymf * b * (cosb1 * sinb - sinb1 * cosb * coslam); 147 x = xmf * b * cosb * sinlam; 148 break; 149 } 150 case EQUATORIAL: { 139 c = 1.0 + sinb1 * sinb + cosb1 * cosb * coslam; 140 b = Math.sqrt(2.0 / c); 141 y = ymf * b * (cosb1 * sinb - sinb1 * cosb * coslam); 142 x = xmf * b * cosb * sinlam; 143 break; 144 case EQUATORIAL: 151 145 sinb = q / qp; 152 146 cosb = Math.sqrt(1.0 - sinb * sinb); 153 c = 1.0 + cosb * coslam; 154 b = Math.sqrt(2.0 / c); 155 y = ymf * b * sinb; 156 x = xmf * b * cosb * sinlam; 157 break; 158 } 159 case NORTH_POLE: { 147 c = 1.0 + cosb * coslam; 148 b = Math.sqrt(2.0 / c); 149 y = ymf * b * sinb; 150 x = xmf * b * cosb * sinlam; 151 break; 152 case NORTH_POLE: 160 153 c = (Math.PI / 2) + phi; 161 154 q = qp - q; … … 168 161 } 169 162 break; 170 } 171 case SOUTH_POLE: { 163 case SOUTH_POLE: 172 164 c = phi - (Math.PI / 2); 173 165 q = qp + q; … … 180 172 } 181 173 break; 182 } 183 default: { 174 default: 184 175 throw new AssertionError(mode); 185 }186 176 } 187 177 if (Math.abs(c) < EPSILON_LATITUDE) { … … 211 201 if (mode == Mode.OBLIQUE) { 212 202 ab = cCe * sinb1 + y * sCe * cosb1 / rho; 213 y 203 y = rho * cosb1 * cCe - y * sinb1 * sCe; 214 204 } else { 215 205 ab = y * sCe / rho; 216 y 206 y = rho * cCe; 217 207 } 218 208 lambda = Math.atan2(x, y); -
trunk/src/org/openstreetmap/josm/data/projection/proj/LambertConformalConic.java
r10001 r10378 105 105 final double tf = t(toRadians(lat0)); 106 106 107 n 108 f 107 n = (log(m1) - log(m2)) / (log(t1) - log(t2)); 108 f = m1 / (n * pow(t1, n)); 109 109 r0 = f * pow(tf, n); 110 110 } … … 123 123 124 124 n = sin(lat0rad); 125 f 125 f = m0 / (n * pow(t0, n)); 126 126 r0 = f * pow(t0, n); 127 127 } -
trunk/src/org/openstreetmap/josm/data/projection/proj/Mercator.java
r9577 r10378 72 72 if (spherical) { 73 73 scaleFactor *= Math.cos(standardParallel); 74 } 74 } else { 75 75 scaleFactor *= msfn(Math.sin(standardParallel), Math.cos(standardParallel)); 76 76 } -
trunk/src/org/openstreetmap/josm/data/projection/proj/ObliqueMercator.java
r10001 r10378 314 314 lonCenter = Math.toRadians(params.lonc); 315 315 azimuth = Math.toRadians(params.alpha); 316 // CHECKSTYLE.OFF: SingleSpaceSeparator 316 317 if ((azimuth > -1.5*Math.PI && azimuth < -0.5*Math.PI) || 317 318 (azimuth > 0.5*Math.PI && azimuth < 1.5*Math.PI)) { … … 319 320 tr("Illegal value for parameter ''{0}'': {1}", "alpha", Double.toString(params.alpha))); 320 321 } 322 // CHECKSTYLE.ON: SingleSpaceSeparator 321 323 if (params.gamma != null) { 322 324 rectifiedGridAngle = Math.toRadians(params.gamma); … … 341 343 singamma0 = Math.sin(gamma0); 342 344 cosgamma0 = Math.cos(gamma0); 343 sinrot 344 cosrot 345 arb 346 ab 347 bra 348 vPoleN 349 vPoleS 345 sinrot = Math.sin(rectifiedGridAngle); 346 cosrot = Math.cos(rectifiedGridAngle); 347 arb = a / b; 348 ab = a * b; 349 bra = b / a; 350 vPoleN = arb * Math.log(Math.tan(0.5 * (Math.PI/2.0 - gamma0))); 351 vPoleS = arb * Math.log(Math.tan(0.5 * (Math.PI/2.0 + gamma0))); 350 352 boolean hotine = params.no_off != null && params.no_off; 351 353 if (hotine) { -
trunk/src/org/openstreetmap/josm/data/projection/proj/PolarStereographic.java
r10235 r10378 135 135 } else { 136 136 final double rho = k0 * tsfn(y, sinlat); 137 x = 137 x = rho * sinlon; 138 138 y = -rho * coslon; 139 139 } -
trunk/src/org/openstreetmap/josm/data/validation/PaintVisitor.java
r10250 r10378 152 152 (int) (p2.y + sinT), (int) (p1.y + sinT)}; 153 153 g.fillPolygon(x, y, 4); 154 g.fillArc(p1.x - 5, p1.y - 5, 10, 10, deg, 154 g.fillArc(p1.x - 5, p1.y - 5, 10, 10, deg, 180); 155 155 g.fillArc(p2.x - 5, p2.y - 5, 10, 10, deg, -180); 156 156 } … … 160 160 g.drawLine((int) (p1.x - cosT), (int) (p1.y + sinT), 161 161 (int) (p2.x - cosT), (int) (p2.y + sinT)); 162 g.drawArc(p1.x - 5, p1.y - 5, 10, 10, deg, 162 g.drawArc(p1.x - 5, p1.y - 5, 10, 10, deg, 180); 163 163 g.drawArc(p2.x - 5, p2.y - 5, 10, 10, deg, -180); 164 164 } -
trunk/src/org/openstreetmap/josm/data/validation/Severity.java
r9929 r10378 11 11 /** The error severity */ 12 12 public enum Severity { 13 // CHECKSTYLE.OFF: SingleSpaceSeparator 13 14 /** Error messages */ 14 15 ERROR(tr("Errors"), /* ICON(data/) */"error", Main.pref.getColor(marktr("validation error"), Color.RED)), … … 17 18 /** Other messages */ 18 19 OTHER(tr("Other"), /* ICON(data/) */"other", Main.pref.getColor(marktr("validation other"), Color.CYAN)); 20 // CHECKSTYLE.ON: SingleSpaceSeparator 19 21 20 22 /** Description of the severity code */ -
trunk/src/org/openstreetmap/josm/data/validation/routines/RegexValidator.java
r10338 r10378 125 125 throw new IllegalArgumentException("Regular expression[" + i + "] is missing"); 126 126 } 127 patterns[i] = 127 patterns[i] = Pattern.compile(regexs[i], flags); 128 128 } 129 129 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
r10228 r10378 44 44 protected static final int HOUSE_NUMBER_TOO_FAR = 2605; 45 45 46 // CHECKSTYLE.OFF: SingleSpaceSeparator 46 47 protected static final String ADDR_HOUSE_NUMBER = "addr:housenumber"; 47 48 protected static final String ADDR_INTERPOLATION = "addr:interpolation"; … … 49 50 protected static final String ADDR_STREET = "addr:street"; 50 51 protected static final String ASSOCIATED_STREET = "associatedStreet"; 52 // CHECKSTYLE.ON: SingleSpaceSeparator 51 53 52 54 protected static class AddressError extends TestError { -
trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
r10228 r10378 47 47 */ 48 48 private static final List<String> CLASSIFIED_HIGHWAYS = Arrays.asList( 49 // CHECKSTYLE.OFF: SingleSpaceSeparator 49 50 "motorway", "motorway_link", 50 51 "trunk", "trunk_link", … … 55 56 "residential", 56 57 "living_street"); 58 // CHECKSTYLE.ON: SingleSpaceSeparator 57 59 58 60 private static final Set<String> KNOWN_SOURCE_MAXSPEED_CONTEXTS = new HashSet<>(Arrays.asList( -
trunk/src/org/openstreetmap/josm/data/validation/tests/LongSegment.java
r10080 r10378 20 20 21 21 /** Long segment error */ 22 protected static final int LONG_SEGMENT 22 protected static final int LONG_SEGMENT = 3501; 23 23 /** Maximum segment length for this test */ 24 24 protected int maxlength; -
trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java
r10043 r10378 62 62 63 63 @Override 64 public void startTest(ProgressMonitor monitor) 64 public void startTest(ProgressMonitor monitor) { 65 65 super.startTest(monitor); 66 66 nodePairs = new MultiMap<>(1000); -
trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java
r10308 r10378 36 36 public class RelationChecker extends Test { 37 37 38 // CHECKSTYLE.OFF: SingleSpaceSeparator 38 39 /** Role {0} unknown in templates {1} */ 39 public static final int ROLE_UNKNOWN 40 public static final int ROLE_UNKNOWN = 1701; 40 41 /** Empty role type found when expecting one of {0} */ 41 public static final int ROLE_EMPTY 42 public static final int ROLE_EMPTY = 1702; 42 43 /** Role member does not match expression {0} in template {1} */ 43 public static final int WRONG_TYPE 44 public static final int WRONG_TYPE = 1703; 44 45 /** Number of {0} roles too high ({1}) */ 45 public static final int HIGH_COUNT 46 public static final int HIGH_COUNT = 1704; 46 47 /** Number of {0} roles too low ({1}) */ 47 public static final int LOW_COUNT 48 public static final int LOW_COUNT = 1705; 48 49 /** Role {0} missing */ 49 public static final int ROLE_MISSING 50 public static final int ROLE_MISSING = 1706; 50 51 /** Relation type is unknown */ 51 public static final int RELATION_UNKNOWN 52 public static final int RELATION_UNKNOWN = 1707; 52 53 /** Relation is empty */ 53 public static final int RELATION_EMPTY = 1708; 54 public static final int RELATION_EMPTY = 1708; 55 // CHECKSTYLE.ON: SingleSpaceSeparator 54 56 55 57 /** -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r10224 r10378 115 115 protected JCheckBox prefCheckPaintBeforeUpload; 116 116 117 // CHECKSTYLE.OFF: SingleSpaceSeparator 117 118 protected static final int EMPTY_VALUES = 1200; 118 119 protected static final int INVALID_KEY = 1201; … … 129 130 protected static final int MISSPELLED_KEY = 1213; 130 131 protected static final int MULTIPLE_SPACES = 1214; 132 // CHECKSTYLE.ON: SingleSpaceSeparator 131 133 // 1250 and up is used by tagcheck 132 134 … … 707 709 private int code; 708 710 protected Severity severity; 709 protected static final int TAG_CHECK_ERROR = 1250; 710 protected static final int TAG_CHECK_WARN = 1260; 711 protected static final int TAG_CHECK_INFO = 1270; 711 // CHECKSTYLE.OFF: SingleSpaceSeparator 712 protected static final int TAG_CHECK_ERROR = 1250; 713 protected static final int TAG_CHECK_WARN = 1260; 714 protected static final int TAG_CHECK_INFO = 1270; 715 // CHECKSTYLE.ON: SingleSpaceSeparator 712 716 713 717 protected static class CheckerElement { -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnclosedWays.java
r10376 r10378 95 95 String value = w.get(key); 96 96 if (isValueErroneous(value)) { 97 // CHECKSTYLE.OFF: SingleSpaceSeparator 97 98 String type = engMessage.contains("{0}") ? tr(engMessage, tr(value)) : tr(engMessage); 98 99 String etype = engMessage.contains("{0}") ? MessageFormat.format(engMessage, value) : engMessage; 100 // CHECKSTYLE.ON: SingleSpaceSeparator 99 101 return new TestError(UnclosedWays.this, Severity.WARNING, tr("Unclosed way"), 100 102 type, etype, code, Arrays.asList(w), … … 136 138 137 139 private final UnclosedWaysCheck[] checks = { 140 // CHECKSTYLE.OFF: SingleSpaceSeparator 138 141 new UnclosedWaysCheck(1101, "natural", marktr("natural type {0}"), 139 142 new HashSet<>(Arrays.asList("cave", "coastline", "cliff", "tree_row", "ridge", "valley", "arete", "gorge"))), … … 152 155 new UnclosedWaysBooleanCheck(1120, "building", marktr("building")), 153 156 new UnclosedWaysBooleanCheck(1130, "area", marktr("area")), 157 // CHECKSTYLE.ON: SingleSpaceSeparator 154 158 }; 155 159 -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r10001 r10378 346 346 y2 = tmpy; 347 347 } 348 LatLon topLeft 348 LatLon topLeft = new LatLon(y2+fudge, x1-fudge); 349 349 LatLon botRight = new LatLon(y1-fudge, x2+fudge); 350 350 List<LatLon> ret = new ArrayList<>(2); … … 355 355 356 356 public Collection<Node> nearbyNodes(double dist) { 357 // If you're looking for nodes that are farther 358 // away that we looked for last time, the cached 359 // result is no good 357 // If you're looking for nodes that are farther away that we looked for last time, 358 // the cached result is no good 360 359 if (dist > nearbyNodeCacheDist) { 361 360 nearbyNodeCache = null; -
trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java
r9675 r10378 27 27 public class UntaggedWay extends Test { 28 28 29 // CHECKSTYLE.OFF: SingleSpaceSeparator 29 30 /** Empty way error */ 30 protected static final int EMPTY_WAY = 301;31 protected static final int EMPTY_WAY = 301; 31 32 /** Untagged way error */ 32 protected static final int UNTAGGED_WAY = 302;33 protected static final int UNTAGGED_WAY = 302; 33 34 /** Unnamed way error */ 34 protected static final int UNNAMED_WAY = 303;35 protected static final int UNNAMED_WAY = 303; 35 36 /** One node way error */ 36 protected static final int ONE_NODE_WAY = 304;37 protected static final int ONE_NODE_WAY = 304; 37 38 /** Unnamed junction error */ 38 protected static final int UNNAMED_JUNCTION 39 protected static final int UNNAMED_JUNCTION = 305; 39 40 /** Untagged, but commented way error */ 40 protected static final int COMMENTED_WAY = 306; 41 protected static final int COMMENTED_WAY = 306; 42 // CHECKSTYLE.ON: SingleSpaceSeparator 41 43 42 44 private Set<Way> waysUsedInRelations; -
trunk/src/org/openstreetmap/josm/data/validation/tests/WronglyOrderedWays.java
r8378 r10378 19 19 public class WronglyOrderedWays extends Test { 20 20 21 // CHECKSTYLE.OFF: SingleSpaceSeparator 21 22 protected static final int WRONGLY_ORDERED_COAST = 1001; 22 23 protected static final int WRONGLY_ORDERED_LAND = 1003; 24 // CHECKSTYLE.ON: SingleSpaceSeparator 23 25 24 26 /** -
trunk/src/org/openstreetmap/josm/data/validation/util/ValUtil.java
r8510 r10378 45 45 46 46 // First, round coordinates 47 // CHECKSTYLE.OFF: SingleSpaceSeparator 47 48 long x0 = Math.round(n1.getEastNorth().east() * OsmValidator.griddetail); 48 49 long y0 = Math.round(n1.getEastNorth().north() * OsmValidator.griddetail); 49 50 long x1 = Math.round(n2.getEastNorth().east() * OsmValidator.griddetail); 50 51 long y1 = Math.round(n2.getEastNorth().north() * OsmValidator.griddetail); 52 // CHECKSTYLE.ON: SingleSpaceSeparator 51 53 52 54 // Start of the way … … 73 75 74 76 // Then floor coordinates, in case the way is in the border of the cell. 77 // CHECKSTYLE.OFF: SingleSpaceSeparator 75 78 x0 = (long) Math.floor(n1.getEastNorth().east() * OsmValidator.griddetail); 76 79 y0 = (long) Math.floor(n1.getEastNorth().north() * OsmValidator.griddetail); 77 80 x1 = (long) Math.floor(n2.getEastNorth().east() * OsmValidator.griddetail); 78 81 y1 = (long) Math.floor(n2.getEastNorth().north() * OsmValidator.griddetail); 82 // CHECKSTYLE.ON: SingleSpaceSeparator 79 83 80 84 // Start of the way … … 147 151 } 148 152 149 double dx 150 double dy 153 double dx = x1 - x0; 154 double dy = y1 - y0; 151 155 long stepY = y0 <= y1 ? 1 : -1; 152 156 long gridX0 = (long) Math.floor(x0); -
trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java
r10308 r10378 161 161 /* I18n: house number, street as parameter, number should remain 162 162 before street for better visibility */ 163 n = 163 n = tr("House number {0} at {1}", s, t); 164 164 } else { 165 165 /* I18n: house number as parameter */ … … 253 253 /* I18n: house number, street as parameter, number should remain 254 254 before street for better visibility */ 255 n = 255 n = tr("House number {0} at {1}", s, t); 256 256 } else { 257 257 /* I18n: house number as parameter */ … … 405 405 } 406 406 if (name == null) { 407 String building 407 String building = relation.get("building"); 408 408 if (OsmUtils.isTrue(building)) { 409 409 name = tr("building"); -
trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
r10308 r10378 407 407 boolean limitedInHeight = d.height > x.height; 408 408 409 if (x.width > 0 && d.width> x.width) {410 d.width 409 if (x.width > 0 && d.width > x.width) { 410 d.width = x.width; 411 411 } 412 412 if (x.height > 0 && d.height > x.height) { -
trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java
r10122 r10378 214 214 */ 215 215 public static int showOptionDialog(Component parentComponent, Object msg, String title, int messageType, 216 Icon icon, final ButtonSpec[] options, final ButtonSpec defaultOption, final String helpTopic) 216 Icon icon, final ButtonSpec[] options, final ButtonSpec defaultOption, final String helpTopic) { 217 217 final List<JButton> buttons = createOptionButtons(options, helpTopic); 218 218 if (helpTopic != null) { … … 334 334 * @see #showOptionDialog(Component, Object, String, int, Icon, ButtonSpec[], ButtonSpec, String) 335 335 */ 336 public static int showOptionDialog(Component parentComponent, Object msg, String title, int messageType, String helpTopic) 336 public static int showOptionDialog(Component parentComponent, Object msg, String title, int messageType, String helpTopic) { 337 337 return showOptionDialog(parentComponent, msg, title, messageType, null, null, null, helpTopic); 338 338 } … … 352 352 */ 353 353 public static void showMessageDialogInEDT(final Component parentComponent, final Object msg, final String title, 354 final int messageType, final String helpTopic) 354 final int messageType, final String helpTopic) { 355 355 GuiHelper.runInEDT(new Runnable() { 356 356 @Override -
trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java
r10364 r10378 282 282 283 283 private void addDynamicSeparator() { 284 JPopupMenu.Separator s = 284 JPopupMenu.Separator s = new JPopupMenu.Separator(); 285 285 dynamicItems.add(s); 286 286 add(s); -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r10340 r10378 146 146 "\t--offline=<osm_api|josm_website|all> "+tr("Disable access to the given resource(s), separated by comma")+"\n\n"+ 147 147 tr("options provided as Java system properties")+":\n"+ 148 // CHECKSTYLE.OFF: SingleSpaceSeparator 148 149 "\t-Djosm.pref=" +tr("/PATH/TO/JOSM/PREF ")+tr("Set the preferences directory")+"\n\n"+ 149 150 "\t-Djosm.userdata="+tr("/PATH/TO/JOSM/USERDATA")+tr("Set the user data directory")+"\n\n"+ 150 151 "\t-Djosm.cache=" +tr("/PATH/TO/JOSM/CACHE ")+tr("Set the cache directory")+"\n\n"+ 151 152 "\t-Djosm.home=" +tr("/PATH/TO/JOSM/HOMEDIR ")+ 153 // CHECKSTYLE.ON: SingleSpaceSeparator 152 154 tr("Relocate all 3 directories to homedir. Cache directory will be in homedir/cache")+"\n\n"+ 153 155 tr("-Djosm.home has lower precedence, i.e. the specific setting overrides the general one")+"\n\n"+ -
trunk/src/org/openstreetmap/josm/gui/MapFrame.java
r10345 r10378 599 599 600 600 public void setButton(JButton button) { 601 this.button = 601 this.button = button; 602 602 final ImageIcon icon = ImageProvider.get("audio-fwd"); 603 603 putValue(SMALL_ICON, icon); -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r10375 r10378 1004 1004 } 1005 1005 1006 public void setHelpText(Object id, final String text) 1006 public void setHelpText(Object id, final String text) { 1007 1007 1008 1008 StatusTextHistory entry = new StatusTextHistory(id, text); -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r10375 r10378 564 564 public void rememberLastPositionOnScreen() { 565 565 oldSize = getSize(); 566 oldLoc 566 oldLoc = getLocationOnScreen(); 567 567 } 568 568 … … 949 949 // if the position was remembered, we need to adjust center once before repainting 950 950 if (oldLoc != null && oldSize != null) { 951 Point l1 951 Point l1 = getLocationOnScreen(); 952 952 final EastNorth newCenter = new EastNorth( 953 953 getCenter().getX()+ (l1.x-oldLoc.x - (oldSize.width-getWidth())/2.0)*getScale(), -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r10375 r10378 101 101 102 102 public static final String PROPNAME_CENTER = "center"; 103 public static final String PROPNAME_SCALE 103 public static final String PROPNAME_SCALE = "scale"; 104 104 105 105 /** -
trunk/src/org/openstreetmap/josm/gui/ScrollViewport.java
r10244 r10378 132 132 133 133 this.addComponentListener(new ComponentAdapter() { 134 @Override public void 134 @Override public void componentResized(ComponentEvent e) { 135 135 showOrHideButtons(); 136 136 } -
trunk/src/org/openstreetmap/josm/gui/SideButton.java
r10365 r10378 102 102 if (i instanceof ImageIcon && i.getIconHeight() != iconHeight) { 103 103 Image im = ((ImageIcon) i).getImage(); 104 int newWidth = im.getWidth(null) * 104 int newWidth = im.getWidth(null) * iconHeight / im.getHeight(null); 105 105 ImageIcon icon = new ImageIcon(im.getScaledInstance(newWidth, iconHeight, Image.SCALE_SMOOTH)); 106 106 setIcon(icon); -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r10212 r10378 137 137 headers.put("User-Agent", Version.getInstance().getFullAgentString()); 138 138 139 cachedLoader = AbstractCachedTileSourceLayer.getTileLoaderFactory("TMS", TMSCachedTileLoader.class).makeTileLoader(this, 139 cachedLoader = AbstractCachedTileSourceLayer.getTileLoaderFactory("TMS", TMSCachedTileLoader.class).makeTileLoader(this, headers); 140 140 141 141 uncachedLoader = new OsmTileLoader(this); … … 240 240 241 241 iSelectionRectStart = getPosition(pMin); 242 iSelectionRectEnd = 242 iSelectionRectEnd = getPosition(pMax); 243 243 244 244 Bounds b = new Bounds( -
trunk/src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java
r10212 r10378 183 183 */ 184 184 protected LatLon getNorthWestLatLonOfTile(Point tile, int zoom) { 185 double lon = 186 double lat = 185 double lon = tile.x / Math.pow(2.0, zoom) * 360.0 - 180; 186 double lat = Math.toDegrees(Math.atan(Math.sinh(Math.PI - (2.0 * Math.PI * tile.y) / Math.pow(2.0, zoom)))); 187 187 return new LatLon(lat, lon); 188 188 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairType.java
r9212 r10378 22 22 * compare my version of an {@link org.openstreetmap.josm.data.osm.OsmPrimitive} with the merged version 23 23 */ 24 MY_WITH_MERGED(tr("My with Merged"), 24 MY_WITH_MERGED(tr("My with Merged"), new ListRole[] {MY_ENTRIES, MERGED_ENTRIES}), 25 25 26 26 /** 27 27 * compare their version of an {@link org.openstreetmap.josm.data.osm.OsmPrimitive} with the merged veresion 28 28 */ 29 THEIR_WITH_MERGED(tr("Their with Merged"), 29 THEIR_WITH_MERGED(tr("Their with Merged"), new ListRole[] {THEIR_ENTRIES, MERGED_ENTRIES}); 30 30 31 31 /** the localized display name */ -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ConflictResolver.java
r9482 r10378 48 48 * 49 49 */ 50 public class ConflictResolver extends JPanel implements PropertyChangeListener 50 public class ConflictResolver extends JPanel implements PropertyChangeListener { 51 51 52 52 /* -------------------------------------------------------------------------------------- */ … … 320 320 this.resolvedCompletely = 321 321 tagMerger.getModel().isResolvedCompletely() 322 && 322 && propertiesMerger.getModel().isResolvedCompletely() 323 323 && nodeListMerger.getModel().isFrozen(); 324 } 324 } else if (my instanceof Relation) { 325 325 // resolve the version conflict if this is a relation, all tag 326 326 // conflicts and all conflicts in the member list … … 329 329 this.resolvedCompletely = 330 330 tagMerger.getModel().isResolvedCompletely() 331 && 331 && propertiesMerger.getModel().isResolvedCompletely() 332 332 && relationMemberMerger.getModel().isFrozen(); 333 333 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMergeModel.java
r10210 r10378 199 199 myEntriesSelectionModel = new EntriesSelectionModel(entries.get(MY_ENTRIES)); 200 200 theirEntriesSelectionModel = new EntriesSelectionModel(entries.get(THEIR_ENTRIES)); 201 mergedEntriesSelectionModel = 201 mergedEntriesSelectionModel = new EntriesSelectionModel(entries.get(MERGED_ENTRIES)); 202 202 203 203 listeners = new HashSet<>(); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ListMerger.java
r10364 r10378 783 783 * 784 784 */ 785 private final class FreezeAction extends AbstractAction implements ItemListener, FreezeActionProperties 785 private final class FreezeAction extends AbstractAction implements ItemListener, FreezeActionProperties { 786 786 787 787 private FreezeAction() { -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMerger.java
r10000 r10378 25 25 @Override 26 26 protected JScrollPane buildMyElementsTable() { 27 myEntriesTable 27 myEntriesTable = new NodeListTable( 28 28 "table.mynodes", 29 29 model, … … 36 36 @Override 37 37 protected JScrollPane buildMergedElementsTable() { 38 mergedEntriesTable 38 mergedEntriesTable = new NodeListTable( 39 39 "table.mergednodes", 40 40 model, … … 47 47 @Override 48 48 protected JScrollPane buildTheirElementsTable() { 49 theirEntriesTable 49 theirEntriesTable = new NodeListTable( 50 50 "table.theirnodes", 51 51 model, -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModel.java
r10210 r10378 137 137 } 138 138 139 myDeletedState = 139 myDeletedState = conflict.isMyDeleted() || my.isDeleted(); 140 140 theirDeletedState = their.isDeleted(); 141 141 … … 211 211 * @return The state of deleted flag 212 212 */ 213 public 213 public Boolean getTheirDeletedState() { 214 214 return theirDeletedState; 215 215 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberMerger.java
r10000 r10378 25 25 @Override 26 26 protected JScrollPane buildMyElementsTable() { 27 myEntriesTable 27 myEntriesTable = new RelationMemberTable( 28 28 "table.mymembers", 29 29 model, … … 36 36 @Override 37 37 protected JScrollPane buildMergedElementsTable() { 38 mergedEntriesTable 38 mergedEntriesTable = new RelationMemberTable( 39 39 "table.mergedmembers", 40 40 model, … … 48 48 @Override 49 49 protected JScrollPane buildTheirElementsTable() { 50 theirEntriesTable 50 theirEntriesTable = new RelationMemberTable( 51 51 "table.theirmembers", 52 52 model, -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellRenderer.java
r9078 r10378 22 22 * 23 23 */ 24 public 24 public class RelationMemberTableCellRenderer extends JLabel implements TableCellRenderer { 25 25 private final transient Border rowNumberBorder; 26 26 … … 101 101 * @param row the row index 102 102 */ 103 protected 103 protected void renderRowId(int row) { 104 104 setBorder(rowNumberBorder); 105 105 setText(Integer.toString(row+1)); -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeItem.java
r9078 r10378 32 32 public TagMergeItem(String key, String myTagValue, String theirTagValue) { 33 33 CheckParameterUtil.ensureParameterNotNull(key, "key"); 34 this.key 34 this.key = key; 35 35 this.myTagValue = myTagValue; 36 36 this.theirTagValue = theirTagValue; -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMerger.java
r10308 r10378 386 386 * 387 387 */ 388 class UndecideAction extends AbstractAction implements ListSelectionListener 388 class UndecideAction extends AbstractAction implements ListSelectionListener { 389 389 390 390 UndecideAction() { -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
r10369 r10378 43 43 import org.openstreetmap.josm.tools.WindowGeometry; 44 44 45 public class PasteTagsConflictResolverDialog extends JDialog 45 public class PasteTagsConflictResolverDialog extends JDialog implements PropertyChangeListener { 46 46 static final Map<OsmPrimitiveType, String> PANE_TITLES; 47 47 static { -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictDecision.java
r9371 r10378 27 27 tr("Position {0} is out of range. Current number of members is {1}.", pos, relation.getMembersCount())); 28 28 this.relation = relation; 29 this.pos 29 this.pos = pos; 30 30 this.originalPrimitive = member.getMember(); 31 31 this.role = member.hasRole() ? member.getRole() : ""; -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r10369 r10378 234 234 */ 235 235 public void refreshView() { 236 OsmDataLayer editLayer = 236 OsmDataLayer editLayer = Main.main.getEditLayer(); 237 237 conflicts = editLayer == null ? new ConflictCollection() : editLayer.getConflicts(); 238 238 GuiHelper.runInEDT(new Runnable() { … … 433 433 ResolveAction() { 434 434 putValue(NAME, tr("Resolve")); 435 putValue(SHORT_DESCRIPTION, 435 putValue(SHORT_DESCRIPTION, tr("Open a merge dialog of all selected items in the list above.")); 436 436 new ImageProvider("dialogs", "conflict").getResource().attachImageIcon(this, true); 437 437 putValue("help", ht("/Dialog/ConflictList#ResolveAction")); … … 480 480 this.type = type; 481 481 putValue(NAME, name); 482 putValue(SHORT_DESCRIPTION, 482 putValue(SHORT_DESCRIPTION, description); 483 483 } 484 484 -
trunk/src/org/openstreetmap/josm/gui/dialogs/DeleteFromRelationConfirmationDialog.java
r10308 r10378 162 162 if (visible) { 163 163 new WindowGeometry( 164 getClass().getName() 164 getClass().getName() + ".geometry", 165 165 WindowGeometry.centerInWindow( 166 166 Main.parent, -
trunk/src/org/openstreetmap/josm/gui/dialogs/FilterDialog.java
r10369 r10378 140 140 { 141 141 putValue(NAME, tr("Add")); 142 putValue(SHORT_DESCRIPTION, 142 putValue(SHORT_DESCRIPTION, tr("Add filter.")); 143 143 new ImageProvider("dialogs", "add").getResource().attachImageIcon(this, true); 144 144 } … … 410 410 } 411 411 412 private class EnableFilterAction extends AbstractFilterAction 412 private class EnableFilterAction extends AbstractFilterAction { 413 413 414 414 EnableFilterAction() { -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r10306 r10378 299 299 } 300 300 301 private JosmTextField 301 private JosmTextField setupFilter() { 302 302 final JosmTextField f = new DisableShortcutsOnFocusGainedTextField(); 303 303 f.setToolTipText(tr("Relation list filter")); … … 411 411 412 412 public void setRelations(Collection<Relation> relations) { 413 List<Relation> sel = 413 List<Relation> sel = getSelectedRelations(); 414 414 this.relations.clear(); 415 415 this.filteredRelations = null; -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r10369 r10378 88 88 * @since 8 89 89 */ 90 public class SelectionListDialog extends ToggleDialog 90 public class SelectionListDialog extends ToggleDialog { 91 91 private JList<OsmPrimitive> lstPrimitives; 92 92 private final DefaultListSelectionModel selectionModel = new DefaultListSelectionModel(); … … 298 298 SearchAction() { 299 299 putValue(NAME, tr("Search")); 300 putValue(SHORT_DESCRIPTION, 300 putValue(SHORT_DESCRIPTION, tr("Search for objects")); 301 301 new ImageProvider("dialogs", "search").getResource().attachImageIcon(this, true); 302 302 updateEnabledState(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r10358 r10378 163 163 protected JCheckBoxMenuItem windowMenuItem; 164 164 165 private final JRadioButtonMenuItem alwaysShown 165 private final JRadioButtonMenuItem alwaysShown = new JRadioButtonMenuItem(new AbstractAction(tr("Always shown")) { 166 166 @Override 167 167 public void actionPerformed(ActionEvent e) { … … 170 170 }); 171 171 172 private final JRadioButtonMenuItem dynamic 172 private final JRadioButtonMenuItem dynamic = new JRadioButtonMenuItem(new AbstractAction(tr("Dynamic")) { 173 173 @Override 174 174 public void actionPerformed(ActionEvent e) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/UserListDialog.java
r10369 r10378 316 316 if (primitives != null) { 317 317 for (Map.Entry<User, Integer> entry: statistics.entrySet()) { 318 data.add(new UserInfo(entry.getKey(), entry.getValue(), (double) entry.getValue() / 318 data.add(new UserInfo(entry.getKey(), entry.getValue(), (double) entry.getValue() / (double) primitives.size())); 319 319 } 320 320 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r10369 r10378 140 140 { 141 141 putValue(NAME, tr("Fix")); 142 putValue(SHORT_DESCRIPTION, 142 putValue(SHORT_DESCRIPTION, tr("Fix the selected issue.")); 143 143 new ImageProvider("dialogs", "fix").getResource().attachImageIcon(this, true); 144 144 } … … 155 155 { 156 156 putValue(NAME, tr("Ignore")); 157 putValue(SHORT_DESCRIPTION, 157 putValue(SHORT_DESCRIPTION, tr("Ignore the selected issue next time.")); 158 158 new ImageProvider("dialogs", "fix").getResource().attachImageIcon(this, true); 159 159 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManager.java
r10124 r10378 71 71 public class ChangesetCacheManager extends JFrame { 72 72 73 // CHECKSTYLE.OFF: SingleSpaceSeparator 73 74 /** The changeset download icon **/ 74 75 public static final ImageIcon DOWNLOAD_CONTENT_ICON = ImageProvider.get("dialogs/changeset", "downloadchangesetcontent"); 75 76 /** The changeset update icon **/ 76 77 public static final ImageIcon UPDATE_CONTENT_ICON = ImageProvider.get("dialogs/changeset", "updatechangesetcontent"); 78 // CHECKSTYLE.ON: SingleSpaceSeparator 77 79 78 80 /** the unique instance of the cache manager */ … … 164 166 protected JPanel buildChangesetDetailPanel() { 165 167 JPanel pnl = new JPanel(new BorderLayout()); 166 JTabbedPane tp = 168 JTabbedPane tp = new JTabbedPane(); 167 169 pnlChangesetDetailTabs = tp; 168 170 -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java
r10332 r10378 52 52 public class ChangesetDetailPanel extends JPanel implements PropertyChangeListener, ChangesetAware { 53 53 54 // CHECKSTYLE.OFF: SingleSpaceSeparator 54 55 private final JosmTextField tfID = new JosmTextField(10); 55 56 private final JosmTextArea taComment = new JosmTextArea(5, 40); … … 64 65 private final SelectInCurrentLayerAction actSelectInCurrentLayer = new SelectInCurrentLayerAction(); 65 66 private final ZoomInCurrentLayerAction actZoomInCurrentLayerAction = new ZoomInCurrentLayerAction(); 67 // CHECKSTYLE.ON: SingleSpaceSeparator 66 68 67 69 private transient Changeset currentChangeset; -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/SingleChangesetDownloadPanel.java
r10179 r10378 92 92 if (id == 0) 93 93 return; 94 ChangesetContentDownloadTask task = 94 ChangesetContentDownloadTask task = new ChangesetContentDownloadTask( 95 95 SingleChangesetDownloadPanel.this, 96 96 Collections.singleton(id) -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanel.java
r10179 r10378 66 66 protected JPanel buildQueryPanel() { 67 67 ItemListener stateChangeHandler = new RestrictionGroupStateChangeHandler(); 68 JPanel pnl 68 JPanel pnl = new VerticallyScrollablePanel(new GridBagLayout()); 69 69 pnl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); 70 70 GridBagConstraints gc = new GridBagConstraints(); … … 449 449 450 450 gc.gridx = 1; 451 gc.fill = 451 gc.fill = GridBagConstraints.HORIZONTAL; 452 452 gc.weightx = 1.0; 453 453 add(lblRestrictedToMyself, gc); … … 461 461 462 462 gc.gridx = 1; 463 gc.fill = 463 gc.fill = GridBagConstraints.HORIZONTAL; 464 464 gc.weightx = 1.0; 465 465 add(new JMultilineLabel(tr("Only changesets owned by the user with the following user ID")), gc); … … 467 467 gc.gridx = 1; 468 468 gc.gridy = 2; 469 gc.fill = 469 gc.fill = GridBagConstraints.HORIZONTAL; 470 470 gc.weightx = 1.0; 471 471 add(buildUidInputPanel(), gc); … … 530 530 tr("Cannot restrict changeset query to the current user because the current user is anonymous")); 531 531 } else if (rbRestrictToUid.isSelected()) { 532 int uid 532 int uid = valUid.getUid(); 533 533 if (uid > 0) { 534 534 query.forUser(uid); … … 985 985 @Override 986 986 public void validate() { 987 String value 987 String value = getComponent().getText(); 988 988 if (value == null || value.trim().isEmpty()) { 989 989 feedbackInvalid(""); … … 1004 1004 1005 1005 public int getUid() { 1006 String value 1006 String value = getComponent().getText(); 1007 1007 if (value == null || value.trim().isEmpty()) return 0; 1008 1008 try { … … 1043 1043 public String getStandardTooltipText() { 1044 1044 Date date = new Date(); 1045 return 1045 return tr( 1046 1046 "Please enter a date in the usual format for your locale.<br>" 1047 1047 + "Example: {0}<br>" -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/BasicChangesetQueryPanel.java
r10179 r10378 188 188 public void restoreFromPreferences() { 189 189 BasicQuery q; 190 String value = 190 String value = Main.pref.get("changeset-query.basic.query", null); 191 191 if (value == null) { 192 192 q = BasicQuery.MOST_RECENT_CHANGESETS; -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanel.java
r10294 r10378 46 46 gc.weightx = 0.0; 47 47 gc.fill = GridBagConstraints.HORIZONTAL; 48 gc.insets 48 gc.insets = new Insets(0, 0, 0, 5); 49 49 pnl.add(new JLabel(tr("URL: ")), gc); 50 50 -
trunk/src/org/openstreetmap/josm/gui/dialogs/layer/MergeAction.java
r10144 r10378 87 87 if (model.getSelectedLayers().isEmpty()) { 88 88 setEnabled(false); 89 } else 89 } else if (model.getSelectedLayers().size() > 1) { 90 90 setEnabled(supportLayers(model.getSelectedLayers())); 91 91 } else { -
trunk/src/org/openstreetmap/josm/gui/dialogs/layer/MoveUpAction.java
r10144 r10378 14 14 * The action to move up the currently selected entries in the list. 15 15 */ 16 public class MoveUpAction extends AbstractAction implements 16 public class MoveUpAction extends AbstractAction implements IEnabledStateUpdating { 17 17 private final LayerListModel model; 18 18 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r10352 r10378 383 383 @Override 384 384 public Component getListCellRendererComponent(JList<? extends AutoCompletionListItem> list, 385 AutoCompletionListItem value, int index, boolean isSelected, 385 AutoCompletionListItem value, int index, boolean isSelected, boolean cellHasFocus) { 386 386 Component c = def.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); 387 387 if (c instanceof JLabel) { … … 602 602 } 603 603 604 public void selectValuesCombobox() 604 public void selectValuesCombobox() { 605 605 selectACComboBoxSavingUnixBuffer(values); 606 606 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java
r10212 r10378 159 159 */ 160 160 protected Dialog getParentDialog() { 161 Component c 161 Component c = this; 162 162 while (c != null && !(c instanceof Dialog)) { 163 163 c = c.getParent(); … … 389 389 if (!visitor.getConflicts().isEmpty()) { 390 390 getLayer().getConflicts().add(visitor.getConflicts()); 391 conflictsCount += 391 conflictsCount += visitor.getConflicts().size(); 392 392 } 393 393 } … … 453 453 if (!visitor.getConflicts().isEmpty()) { 454 454 getLayer().getConflicts().add(visitor.getConflicts()); 455 conflictsCount += 455 conflictsCount += visitor.getConflicts().size(); 456 456 } 457 457 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r10217 r10378 106 106 * @since 343 107 107 */ 108 public class GenericRelationEditor extends RelationEditor 108 public class GenericRelationEditor extends RelationEditor { 109 109 /** the tag table and its model */ 110 110 private final TagEditorPanel tagEditorPanel; -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableLinkedCellRenderer.java
r10308 r10378 126 126 y1 = 7; 127 127 128 int[] xValues 129 int[] yValues 128 int[] xValues = {xoff - xowloop + 1, xoff - xowloop + 1, xoff}; 129 int[] yValues = {ymax, y1+1, 1}; 130 130 g.drawPolyline(xValues, yValues, 3); 131 131 unsetDotted(g); … … 137 137 y2 = ymax - 7; 138 138 139 int[] xValues 140 int[] yValues 139 int[] xValues = {xoff+1, xoff - xowloop + 1, xoff - xowloop + 1}; 140 int[] yValues = {ymax-1, y2, y1}; 141 141 g.drawPolyline(xValues, yValues, 3); 142 142 unsetDotted(g); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowser.java
r10179 r10378 180 180 @Override 181 181 public void mouseClicked(MouseEvent e) { 182 if (e.getClickCount() == 2) 182 if (e.getClickCount() == 2) { 183 183 editAction.run(); 184 184 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTree.java
r10212 r10378 88 88 @Override 89 89 public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException { 90 TreePath path 90 TreePath path = event.getPath(); 91 91 Relation parent = (Relation) event.getPath().getLastPathComponent(); 92 92 if (!parent.isIncomplete() || parent.isNew()) -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableColumnModel.java
r10089 r10378 12 12 * @since 1790 13 13 */ 14 public class SelectionTableColumnModel 14 public class SelectionTableColumnModel extends DefaultTableColumnModel { 15 15 16 16 /** -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableModel.java
r10345 r10378 74 74 @Override 75 75 public void activeOrEditLayerChanged(ActiveLayerChangeEvent e) { 76 if (e.getPreviousActiveLayer() 76 if (e.getPreviousActiveLayer() == layer) { 77 77 cache.clear(); 78 78 } -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
r10179 r10378 81 81 JPanel pnl = new JPanel(new GridBagLayout()); 82 82 83 GridBagConstraints 83 GridBagConstraints gc = new GridBagConstraints(); 84 84 gc.anchor = GridBagConstraints.NORTHWEST; 85 85 gc.insets = new Insets(5, 5, 5, 5); -
trunk/src/org/openstreetmap/josm/gui/download/BoundingBoxSelection.java
r9606 r10378 307 307 308 308 protected void refreshBounds() { 309 Bounds 309 Bounds b = build(); 310 310 parent.boundingBoxChanged(b, BoundingBoxSelection.this); 311 311 } -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r10212 r10378 54 54 * Dialog displayed to download OSM and/or GPS data from OSM server. 55 55 */ 56 public class DownloadDialog extends JDialog 56 public class DownloadDialog extends JDialog { 57 57 /** the unique instance of the download dialog */ 58 58 private static DownloadDialog instance; … … 169 169 pnl.add(cbStartup, GBC.std().anchor(GBC.WEST).insets(15, 5, 5, 5)); 170 170 171 pnl.add(sizeCheck, 171 pnl.add(sizeCheck, GBC.eol().anchor(GBC.EAST).insets(5, 5, 5, 2)); 172 172 173 173 if (!ExpertToggleAction.isExpert()) { 174 JLabel infoLabel 174 JLabel infoLabel = new JLabel( 175 175 tr("Use left click&drag to select area, arrows or right mouse button to scroll map, wheel or +/- to zoom.")); 176 176 pnl.add(infoLabel, GBC.eol().anchor(GBC.SOUTH).insets(0, 0, 0, 0)); -
trunk/src/org/openstreetmap/josm/gui/download/DownloadObjectDialog.java
r8061 r10378 24 24 public class DownloadObjectDialog extends OsmIdSelectionDialog { 25 25 26 // CHECKSTYLE.OFF: SingleSpaceSeparator 26 27 protected final JCheckBox referrers = new JCheckBox(tr("Download referrers (parent relations)")); 27 28 protected final JCheckBox fullRel = new JCheckBox(tr("Download relation members")); 28 29 protected final JCheckBox newLayer = new JCheckBox(tr("Separate Layer")); 30 // CHECKSTYLE.ON: SingleSpaceSeparator 29 31 30 32 /** -
trunk/src/org/openstreetmap/josm/gui/download/DownloadSelection.java
r9243 r10378 4 4 import org.openstreetmap.josm.data.Bounds; 5 5 6 public interface DownloadSelection 6 public interface DownloadSelection { 7 7 8 8 /** -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
r10345 r10378 306 306 if (reference.getId() != history.getId()) 307 307 throw new IllegalArgumentException( 308 tr("Failed to set reference. Reference ID {0} does not match history ID {1}.", reference.getId(), 308 tr("Failed to set reference. Reference ID {0} does not match history ID {1}.", reference.getId(), history.getId())); 309 309 HistoryOsmPrimitive primitive = history.getByVersion(reference.getVersion()); 310 310 if (primitive == null) … … 337 337 if (current.getId() != history.getId()) 338 338 throw new IllegalArgumentException( 339 tr("Failed to set reference. Reference ID {0} does not match history ID {1}.", current.getId(), 339 tr("Failed to set reference. Reference ID {0} does not match history ID {1}.", current.getId(), history.getId())); 340 340 HistoryOsmPrimitive primitive = history.getByVersion(current.getVersion()); 341 341 if (primitive == null) … … 374 374 * @throws IllegalArgumentException if type is null 375 375 */ 376 public HistoryOsmPrimitive getPointInTime(PointInTimeType type) 376 public HistoryOsmPrimitive getPointInTime(PointInTimeType type) { 377 377 CheckParameterUtil.ensureParameterNotNull(type, "type"); 378 378 if (type.equals(PointInTimeType.CURRENT_POINT_IN_TIME)) -
trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java
r10210 r10378 194 194 195 195 protected static String getUserUrl(String username) { 196 return Main.getBaseUserUrl() + '/' + 196 return Main.getBaseUserUrl() + '/' + Utils.encodeUrl(username).replaceAll("\\+", "%20"); 197 197 } 198 198 -
trunk/src/org/openstreetmap/josm/gui/io/AbstractUploadTask.java
r10217 r10378 115 115 String lbl; 116 116 switch(primitiveType) { 117 case NODE: lbl = tr("Synchronize node {0} only", id); break; 118 case WAY: lbl = tr("Synchronize way {0} only", id); break; 119 case RELATION: lbl = tr("Synchronize relation {0} only", id); break; 117 // CHECKSTYLE.OFF: SingleSpaceSeparator 118 case NODE: lbl = tr("Synchronize node {0} only", id); break; 119 case WAY: lbl = tr("Synchronize way {0} only", id); break; 120 case RELATION: lbl = tr("Synchronize relation {0} only", id); break; 121 // CHECKSTYLE.ON: SingleSpaceSeparator 120 122 default: throw new AssertionError(); 121 123 } … … 140 142 ) 141 143 }; 142 String msg = 144 String msg = tr("<html>Uploading <strong>failed</strong> because the server has a newer version of one<br>" 143 145 + "of your nodes, ways, or relations.<br>" 144 146 + "The conflict is caused by the <strong>{0}</strong> with id <strong>{1}</strong>,<br>" … … 188 190 ) 189 191 }; 190 String msg = 192 String msg = tr("<html>Uploading <strong>failed</strong> because the server has a newer version of one<br>" 191 193 + "of your nodes, ways, or relations.<br>" 192 194 + "<br>" … … 217 219 */ 218 220 protected void handleUploadConflictForClosedChangeset(long changesetId, Date d) { 219 String msg = 221 String msg = tr("<html>Uploading <strong>failed</strong> because you have been using<br>" 220 222 + "changeset {0} which was already closed at {1}.<br>" 221 223 + "Please upload again with a new or an existing open changeset.</html>", -
trunk/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java
r10217 r10378 184 184 */ 185 185 public void setSelectedChangesetForNextUpload(Changeset cs) { 186 int idx 186 int idx = model.getIndexOf(cs); 187 187 if (idx >= 0) { 188 188 rbExisting.setSelected(true); -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayerTask.java
r10212 r10378 41 41 monitor = NullProgressMonitor.INSTANCE; 42 42 } 43 this.layerInfo = 43 this.layerInfo = layerInfo; 44 44 this.parentMonitor = monitor; 45 45 } -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
r10212 r10378 324 324 } 325 325 326 class DiscardAndProceedAction extends AbstractAction 326 class DiscardAndProceedAction extends AbstractAction implements PropertyChangeListener { 327 327 DiscardAndProceedAction() { 328 328 initForDiscardAndExit(); … … 414 414 BufferedImage newIco = new BufferedImage(ICON_SIZE*3, ICON_SIZE, BufferedImage.TYPE_4BYTE_ABGR); 415 415 Graphics2D g = newIco.createGraphics(); 416 // CHECKSTYLE.OFF: SingleSpaceSeparator 416 417 g.drawImage(model.getLayersToUpload().isEmpty() ? upldDis : upld, ICON_SIZE*0, 0, ICON_SIZE, ICON_SIZE, null); 417 418 g.drawImage(model.getLayersToSave().isEmpty() ? saveDis : save, ICON_SIZE*1, 0, ICON_SIZE, ICON_SIZE, null); 418 419 g.drawImage(base, ICON_SIZE*2, 0, ICON_SIZE, ICON_SIZE, null); 420 // CHECKSTYLE.ON: SingleSpaceSeparator 419 421 putValue(SMALL_ICON, new ImageIcon(newIco)); 420 422 } -
trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java
r9986 r10378 220 220 // partially uploaded. Better run on EDT. 221 221 // 222 Runnable r 222 Runnable r = new Runnable() { 223 223 @Override 224 224 public void run() { -
trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java
r10369 r10378 154 154 155 155 public List<OsmPrimitive> getSelectedPrimitives() { 156 List<OsmPrimitive> ret 156 List<OsmPrimitive> ret = new ArrayList<>(); 157 157 ret.addAll(lstSelectedPrimitives.getOsmPrimitiveListModel().getPrimitives(lstSelectedPrimitives.getSelectedIndices())); 158 158 ret.addAll(lstDeletedPrimitives.getOsmPrimitiveListModel().getPrimitives(lstDeletedPrimitives.getSelectedIndices())); -
trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySpecification.java
r9841 r10378 15 15 * </ul> 16 16 */ 17 public class UploadStrategySpecification 17 public class UploadStrategySpecification { 18 18 /** indicates that the chunk size isn't specified */ 19 19 public static final int UNSPECIFIED_CHUNK_SIZE = -1; -
trunk/src/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanel.java
r8836 r10378 134 134 * @return the number of objects to upload 135 135 */ 136 public int 136 public int getNumObjectsToUpload() { 137 137 return lstAdd.getModel().getSize() 138 138 + lstUpdate.getModel().getSize() -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r10345 r10378 1529 1529 } 1530 1530 Tile t2 = tempCornerTile(missed); 1531 LatLon topLeft2 1531 LatLon topLeft2 = new LatLon(tileSource.tileXYToLatLon(missed)); 1532 1532 LatLon botRight2 = new LatLon(tileSource.tileXYToLatLon(t2)); 1533 1533 TileSet ts2 = new TileSet(topLeft2, botRight2, newzoom); … … 1622 1622 continue; 1623 1623 } 1624 clickedTile 1624 clickedTile = t1; 1625 1625 break; 1626 1626 } -
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r10304 r10378 338 338 private static float[] KERNEL_SHARPEN = new float[] { 339 339 -.5f, -1f, -.5f, 340 -1f, 7,-1f,340 -1f, 7, -1f, 341 341 -.5f, -1f, -.5f 342 342 }; … … 531 531 532 532 private byte mix(int color, double luminosity) { 533 int val = (int) (colorfulness * color + 533 int val = (int) (colorfulness * color + (1 - colorfulness) * luminosity); 534 534 if (val < 0) { 535 535 return 0; -
trunk/src/org/openstreetmap/josm/gui/layer/Layer.java
r10371 r10378 175 175 memoryBytesRequired += layer.estimateMemoryUsage(); 176 176 } 177 if (memoryBytesRequired > 177 if (memoryBytesRequired > Runtime.getRuntime().maxMemory()) { 178 178 throw new IllegalArgumentException( 179 179 tr("To add another layer you need to allocate at least {0,number,#}MB memory to JOSM using -Xmx{0,number,#}M " … … 336 336 public void setVisible(boolean visible) { 337 337 boolean oldValue = isVisible(); 338 this.visible 338 this.visible = visible; 339 339 if (visible && opacity == 0) { 340 340 setOpacity(1); -
trunk/src/org/openstreetmap/josm/gui/layer/NativeScaleLayer.java
r10306 r10378 80 80 * List of scales, may include intermediate steps between native resolutions 81 81 */ 82 class ScaleList 82 class ScaleList { 83 83 private final List<Scale> scales = new ArrayList<>(); 84 84 -
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r9983 r10378 36 36 */ 37 37 public class WMSLayer extends AbstractCachedTileSourceLayer<TemplatedWMSTileSource> { 38 private static final String PREFERENCE_PREFIX 38 private static final String PREFERENCE_PREFIX = "imagery.wms."; 39 39 40 40 /** default tile size for WMS Layer */ … … 108 108 return supportedProjections == null || supportedProjections.isEmpty() || supportedProjections.contains(proj.toCode()) || 109 109 (info.isEpsg4326To3857Supported() && supportedProjections.contains("EPSG:4326") 110 && 110 && "EPSG:3857".equals(Main.getProjection().toCode())); 111 111 } 112 112 … … 170 170 171 171 private boolean isReprojectionPossible() { 172 return supportedProjections.contains("EPSG:4326") && 172 return supportedProjections.contains("EPSG:4326") && "EPSG:3857".equals(Main.getProjection().toCode()); 173 173 } 174 174 } -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r10364 r10378 764 764 private final transient StatusBarUpdater statusBarUpdaterWithRepaint = new StatusBarUpdater(true); 765 765 766 private class StatusBarUpdater implements 766 private class StatusBarUpdater implements DocumentListener, ItemListener, ActionListener { 767 767 private final boolean doRepaint; 768 768 -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DateFilterPanel.java
r9243 r10378 25 25 private final DateEditorWithSlider dateFrom = new DateEditorWithSlider(tr("From")); 26 26 private final DateEditorWithSlider dateTo = new DateEditorWithSlider(tr("To")); 27 private final JCheckBox noTimestampCb 27 private final JCheckBox noTimestampCb = new JCheckBox(tr("No timestamp")); 28 28 private final transient GpxLayer layer; 29 29 … … 77 77 78 78 private final Timer t = new Timer(200, new ActionListener() { 79 @Override 79 @Override public void actionPerformed(ActionEvent e) { 80 80 applyFilter(); 81 81 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r10364 r10378 156 156 if (!mousePressedInButton) 157 157 return; 158 mousePressed 158 mousePressed = true; 159 159 if (isVisible()) { 160 160 invalidate(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r10308 r10378 197 197 for (OsmPrimitive referrer : osm.getReferrers()) { 198 198 Relation r = (Relation) referrer; 199 if (!drawMultipolygon || !r.isMultipolygon() 199 if (!drawMultipolygon || !r.isMultipolygon() || !r.isUsable()) { 200 200 continue; 201 201 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LineElement.java
r10374 r10378 91 91 BasicStroke myLine = line, myDashLine = dashesLine; 92 92 if (realWidth > 0 && paintSettings.isUseRealWidth() && !showOrientation) { 93 float myWidth = (int) (100 / 93 float myWidth = (int) (100 / (float) (painter.getCircum() / realWidth)); 94 94 if (myWidth < line.getLineWidth()) { 95 95 myWidth = line.getLineWidth(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java
r9371 r10378 211 211 212 212 private boolean mustRescale(Image image) { 213 return autoRescale && width 213 return autoRescale && width == -1 && image.getWidth(null) > MAX_SIZE 214 214 && height == -1 && image.getHeight(null) > MAX_SIZE; 215 215 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
r10305 r10378 60 60 return false; 61 61 final Symbol other = (Symbol) obj; 62 return 62 return symbol == other.symbol && 63 63 size == other.size && 64 64 Objects.equals(stroke, other.stroke) && -
trunk/src/org/openstreetmap/josm/gui/oauth/AbstractAuthorizationUI.java
r10189 r10378 90 90 * @return the retrieved Access Token 91 91 */ 92 public 92 public OAuthToken getAccessToken() { 93 93 return accessToken; 94 94 } -
trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java
r10369 r10378 128 128 129 129 // OAuth in a nutshell ... 130 gc.gridy 130 gc.gridy = 1; 131 131 gc.insets = new Insets(5, 0, 0, 5); 132 132 HtmlPanel pnlMessage = new HtmlPanel(); 133 133 pnlMessage.setText("<html><body>" 134 134 + tr("With OAuth you grant JOSM the right to upload map data and GPS tracks " 135 + "on your behalf (<a href=\"{0}\">more info...</a>).", 135 + "on your behalf (<a href=\"{0}\">more info...</a>).", "http://oauth.net/") 136 136 + "</body></html>" 137 137 ); … … 140 140 141 141 // the authorisation procedure 142 gc.gridy 142 gc.gridy = 2; 143 143 gc.gridwidth = 1; 144 144 gc.weightx = 0.0; -
trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
r10223 r10378 362 362 } catch (IOException e) { 363 363 throw new OsmOAuthAuthorizationException(e); 364 } 364 } finally { 365 365 synchronized (this) { 366 366 connection = null; -
trunk/src/org/openstreetmap/josm/gui/oauth/SemiAutomaticAuthorizationUI.java
r10369 r10378 400 400 ); 401 401 executor.execute(task); 402 Runnable r 402 Runnable r = new Runnable() { 403 403 @Override 404 404 public void run() { … … 437 437 ); 438 438 executor.execute(task); 439 Runnable r 439 Runnable r = new Runnable() { 440 440 @Override 441 441 public void run() { -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r10362 r10378 545 545 546 546 @SuppressWarnings("unchecked") 547 public <T> 547 public <T> T getSetting(Class<? extends T> clazz) { 548 548 for (PreferenceSetting setting:settings) { 549 549 if (clazz.isAssignableFrom(setting.getClass())) -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r10212 r10378 398 398 } 399 399 400 private class ToolbarPopupMenu extends JPopupMenu 400 private class ToolbarPopupMenu extends JPopupMenu { 401 401 private transient ActionDefinition act; 402 402 … … 1137 1137 long paramCode = 0; 1138 1138 if (action.hasParameters()) { 1139 paramCode = 1139 paramCode = action.parameters.hashCode(); 1140 1140 } 1141 1141 -
trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java
r10217 r10378 60 60 private final JRadioButton colorTypeTime = new JRadioButton(tr("Track date")); 61 61 private final JRadioButton colorTypeNone = new JRadioButton(tr("Single Color (can be customized for named layers)")); 62 private final JRadioButton colorTypeGlobal 62 private final JRadioButton colorTypeGlobal = new JRadioButton(tr("Use global settings")); 63 63 private final JosmComboBox<String> colorTypeVelocityTune = new JosmComboBox<>(new String[] {tr("Car"), tr("Bicycle"), tr("Foot")}); 64 64 private final JCheckBox makeAutoMarkers = new JCheckBox(tr("Create markers when reading GPX")); … … 359 359 int colorType = Main.pref.getInteger("draw.rawgps.colors", layerName, 0); 360 360 switch (colorType) { 361 case 0: colorTypeNone.setSelected(true); 362 case 1: colorTypeVelocity.setSelected(true); 363 case 2: colorTypeDilution.setSelected(true); 361 case 0: colorTypeNone.setSelected(true); break; 362 case 1: colorTypeVelocity.setSelected(true); break; 363 case 2: colorTypeDilution.setSelected(true); break; 364 364 case 3: colorTypeDirection.setSelected(true); break; 365 case 4: colorTypeTime.setSelected(true); 365 case 4: colorTypeTime.setSelected(true); break; 366 366 default: Main.warn("Unknown color type: " + colorType); 367 367 } … … 397 397 } else { 398 398 if (layerName == null || !locLayer) { 399 Main.pref.put("draw.rawgps.lines" + 399 Main.pref.put("draw.rawgps.lines" + layerNameDot, drawRawGpsLinesAll.isSelected()); 400 400 Main.pref.put("draw.rawgps.max-line-length" + layerNameDot, drawRawGpsMaxLineLength.getText()); 401 401 } -
trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java
r10114 r10378 101 101 errorMessage = tr("<html>Tagging preset source {0} can be loaded but it contains errors. " + 102 102 "Do you really want to use it?<br><br><table width=600>Error is: {1}</table></html>", 103 source, 103 source, e.getMessage()); 104 104 } else { 105 105 errorMessage = tr("<html>Unable to parse tagging preset source: {0}. " + … … 127 127 sources.removeSources(sourcesToRemove); 128 128 return true; 129 } 129 } else { 130 130 return true; 131 131 } -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
r10137 r10378 198 198 JPanel pnl = new JPanel(new BorderLayout()); 199 199 pnl.add(buildSearchFieldPanel(), BorderLayout.NORTH); 200 model 200 model = new PluginPreferencesModel(); 201 201 pnlPluginPreferences = new PluginListPanel(model); 202 202 spPluginPreferences = GuiHelper.embedInVerticalScrollPane(pnlPluginPreferences); -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java
r10179 r10378 147 147 } 148 148 model.fireContentsChanged(); 149 int idx = 149 int idx = filteredData.indexOf(lastCode); 150 150 if (idx == -1) { 151 151 selectionList.clearSelection(); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAccessTokenHolder.java
r8510 r10378 15 15 */ 16 16 public class OAuthAccessTokenHolder { 17 private 17 private static OAuthAccessTokenHolder instance; 18 18 19 19 /** -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
r10294 r10378 85 85 gc.weightx = 1.0; 86 86 gc.insets = new Insets(0, 0, 0, 0); 87 gc.gridwidth 87 gc.gridwidth = 4; 88 88 add(buildDefaultServerUrlPanel(), gc); 89 89 … … 124 124 */ 125 125 public void initFromPreferences() { 126 String url = 126 String url = OsmApi.getOsmApi().getServerUrl(); 127 127 tfOsmServerUrl.setPossibleItems(SERVER_URL_HISTORY.get()); 128 128 if (OsmApi.DEFAULT_API_URL.equals(url.trim())) { -
trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java
r10134 r10378 66 66 private static final String SHIFT = KeyEvent.getKeyModifiersText(KeyStroke.getKeyStroke(KeyEvent.VK_A, 67 67 KeyEvent.SHIFT_DOWN_MASK).getModifiers()); 68 private static final String CTRL 68 private static final String CTRL = KeyEvent.getKeyModifiersText(KeyStroke.getKeyStroke(KeyEvent.VK_A, 69 69 KeyEvent.CTRL_DOWN_MASK).getModifiers()); 70 private static final String ALT 70 private static final String ALT = KeyEvent.getKeyModifiersText(KeyStroke.getKeyStroke(KeyEvent.VK_A, 71 71 KeyEvent.ALT_DOWN_MASK).getModifiers()); 72 private static final String META 72 private static final String META = KeyEvent.getKeyModifiersText(KeyStroke.getKeyStroke(KeyEvent.VK_A, 73 73 KeyEvent.META_DOWN_MASK).getModifiers()); 74 74 … … 246 246 private JPanel buildFilterPanel() { 247 247 // copied from PluginPreference 248 JPanel pnl 248 JPanel pnl = new JPanel(new GridBagLayout()); 249 249 pnl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); 250 250 GridBagConstraints gc = new GridBagConstraints(); -
trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorTagCheckerRulesPreference.java
r9506 r10378 144 144 List<ExtendedSourceEntry> def = new ArrayList<>(); 145 145 146 // CHECKSTYLE.OFF: SingleSpaceSeparator 146 147 addDefault(def, "addresses", tr("Addresses"), tr("Checks for errors on addresses")); 147 148 addDefault(def, "combinations", tr("Tag combinations"), tr("Checks for missing tag or suspicious combinations")); … … 155 156 addDefault(def, "unnecessary", tr("Unnecessary tags"), tr("Checks for unnecessary tags")); 156 157 addDefault(def, "wikipedia", tr("Wikipedia"), tr("Checks for wrong wikipedia tags")); 158 // CHECKSTYLE.ON: SingleSpaceSeparator 157 159 158 160 return def; -
trunk/src/org/openstreetmap/josm/gui/tagging/TagCellRenderer.java
r9078 r10378 19 19 * 20 20 */ 21 public class TagCellRenderer extends JLabel implements TableCellRenderer 21 public class TagCellRenderer extends JLabel implements TableCellRenderer { 22 22 private final Font fontStandard; 23 23 private final Font fontItalic; … … 54 54 } else if (tag.getValueCount() == 1) { 55 55 setText(tag.getValues().get(0)); 56 } else if (tag.getValueCount() > 56 } else if (tag.getValueCount() > 1) { 57 57 setText(tr("multiple")); 58 58 setFont(fontItalic); -
trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java
r10369 r10378 49 49 * @since 1762 50 50 */ 51 public class TagTable extends JosmTable 51 public class TagTable extends JosmTable { 52 52 /** the table cell editor used by this table */ 53 53 private TagCellEditor editor; … … 70 70 * last cell in the table</li> 71 71 * </ul> 72 * 73 */ 74 class SelectNextColumnCellAction extends AbstractAction { 72 */ 73 class SelectNextColumnCellAction extends AbstractAction { 75 74 @Override 76 75 public void actionPerformed(ActionEvent e) { … … 116 115 * Action to be run when the user navigates to the previous cell in the table, 117 116 * for instance by pressing Shift-TAB 118 * 119 */ 120 class SelectPreviousColumnCellAction extends AbstractAction { 117 */ 118 class SelectPreviousColumnCellAction extends AbstractAction { 121 119 122 120 @Override -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionItemPriority.java
r10228 r10378 33 33 * Indicates that this is a value from a selected object. 34 34 */ 35 public static final AutoCompletionItemPriority IS_IN_SELECTION= new AutoCompletionItemPriority(false, false, true);35 public static final AutoCompletionItemPriority IS_IN_SELECTION = new AutoCompletionItemPriority(false, false, true); 36 36 37 37 /** Unknown priority. This is the lowest priority. */ -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionListItem.java
r8510 r10378 20 20 21 21 /** the pritority of this item */ 22 private 22 private AutoCompletionItemPriority priority; 23 23 /** the value of this item */ 24 24 private String value; -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java
r10254 r10378 357 357 public static Collection<TaggingPreset> readAll(Collection<String> sources, boolean validate, boolean displayErrMsg) { 358 358 HashSetWithLast<TaggingPreset> allPresets = new HashSetWithLast<>(); 359 for (String source : sources) 359 for (String source : sources) { 360 360 try { 361 361 readAll(source, validate, allPresets); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelector.java
r10300 r10378 62 62 63 63 private static final BooleanProperty SEARCH_IN_TAGS = new BooleanProperty("taggingpreset.dialog.search-in-tags", true); 64 private static final BooleanProperty ONLY_APPLICABLE 64 private static final BooleanProperty ONLY_APPLICABLE = new BooleanProperty("taggingpreset.dialog.only-applicable-to-selection", true); 65 65 66 66 private final JCheckBox ckOnlyApplicable; -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java
r9996 r10378 80 80 } 81 81 if (usage.unused()) { 82 if (auto_increment_selected != 0 82 if (auto_increment_selected != 0 && auto_increment != null) { 83 83 try { 84 84 textField.setText(Integer.toString(Integer.parseInt( -
trunk/src/org/openstreetmap/josm/gui/util/AdjustmentSynchronizer.java
r10217 r10378 115 115 * @throws IllegalArgumentException if adjustable is null 116 116 */ 117 public void adapt(final JCheckBox view, final Adjustable adjustable) 117 public void adapt(final JCheckBox view, final Adjustable adjustable) { 118 118 CheckParameterUtil.ensureParameterNotNull(adjustable, "adjustable"); 119 119 CheckParameterUtil.ensureParameterNotNull(view, "view"); -
trunk/src/org/openstreetmap/josm/gui/widgets/AbstractTextComponentValidator.java
r9231 r10378 34 34 public abstract class AbstractTextComponentValidator implements ActionListener, FocusListener, DocumentListener, PropertyChangeListener { 35 35 private static final Border ERROR_BORDER = BorderFactory.createLineBorder(Color.RED, 1); 36 private static final Color ERROR_BACKGROUND = 36 private static final Color ERROR_BACKGROUND = new Color(255, 224, 224); 37 37 38 38 private JTextComponent tc; -
trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java
r10308 r10378 399 399 400 400 if (!splitChildren.hasNext()) { 401 double newWidth = 401 double newWidth = Math.max(minSplitChildWidth, bounds.getMaxX() - x); 402 402 Rectangle newSplitChildBounds = boundsWithXandWidth(bounds, x, newWidth); 403 403 layout2(splitChild, newSplitChildBounds); … … 446 446 if (!splitChildren.hasNext()) { 447 447 double oldHeight = splitChildBounds.getHeight(); 448 double newHeight = 448 double newHeight = Math.max(minSplitChildHeight, bounds.getMaxY() - y); 449 449 Rectangle newSplitChildBounds = boundsWithYandHeight(bounds, y, newHeight); 450 450 layout2(splitChild, newSplitChildBounds); -
trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitPane.java
r10173 r10378 241 241 dragOffsetX = mx - initialDividerBounds.x; 242 242 dragOffsetY = my - initialDividerBounds.y; 243 dragDivider 243 dragDivider = divider; 244 244 Rectangle prevNodeBounds = prevNode.getBounds(); 245 245 Rectangle nextNodeBounds = nextNode.getBounds(); … … 336 336 MultiSplitLayout.Divider divider = getMultiSplitLayout().dividerAt(x, y); 337 337 if (divider != null) { 338 cursorID 338 cursorID = divider.isVertical() ? 339 339 Cursor.E_RESIZE_CURSOR : 340 340 Cursor.N_RESIZE_CURSOR; -
trunk/src/org/openstreetmap/josm/gui/widgets/TextContextualPopupMenu.java
r10358 r10378 174 174 } 175 175 176 protected void addMenuEntry(JTextComponent component, 176 protected void addMenuEntry(JTextComponent component, String label, String actionName, String iconName) { 177 177 Action action = component.getActionMap().get(actionName); 178 178 if (action != null) { -
trunk/src/org/openstreetmap/josm/io/Capabilities.java
r8510 r10378 131 131 } 132 132 } else { 133 if (!capabilities.containsKey(element)) 133 if (!capabilities.containsKey(element)) { 134 134 Map<String, String> h = new HashMap<>(); 135 135 capabilities.put(element, h); -
trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java
r10300 r10378 157 157 CheckParameterUtil.ensureParameterNotNull(min, "min"); 158 158 CheckParameterUtil.ensureParameterNotNull(max, "max"); 159 this.bounds 159 this.bounds = new Bounds(min, max); 160 160 return this; 161 161 } … … 215 215 */ 216 216 public ChangesetQuery beingOpen(boolean isOpen) { 217 this.open = 217 this.open = isOpen; 218 218 return this; 219 219 } … … 474 474 475 475 protected Map<String, String> createMapFromQueryString(String query) { 476 Map<String, String> queryParams 476 Map<String, String> queryParams = new HashMap<>(); 477 477 String[] keyValuePairs = query.split("&"); 478 478 for (String keyValuePair: keyValuePairs) { -
trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java
r9078 r10378 97 97 return 0; 98 98 } 99 if (port <= 0 || port > 99 if (port <= 0 || port > 65535) { 100 100 Main.error(tr("Illegal port number in preference ''{0}''. Got {1}.", property, port)); 101 101 Main.error(tr("The proxy will not be used.")); -
trunk/src/org/openstreetmap/josm/io/DiffResultProcessor.java
r9078 r10378 32 32 import org.xml.sax.helpers.DefaultHandler; 33 33 34 public class DiffResultProcessor 34 public class DiffResultProcessor { 35 35 36 36 private static class DiffResultEntry { … … 76 76 * 77 77 */ 78 public 78 public void parse(String diffUploadResponse, ProgressMonitor progressMonitor) throws XmlParsingException { 79 79 if (progressMonitor == null) { 80 80 progressMonitor = NullProgressMonitor.INSTANCE; … … 168 168 case "way": 169 169 case "relation": 170 PrimitiveId id 170 PrimitiveId id = new SimplePrimitiveId( 171 171 Long.parseLong(atts.getValue("old_id")), 172 172 OsmPrimitiveType.fromApiTypeName(qName) -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r10216 r10378 504 504 505 505 @Override 506 public void endDocument() throws SAXException 506 public void endDocument() throws SAXException { 507 507 if (!states.empty()) 508 508 throw new SAXException(tr("Parse error: invalid document structure for GPX document.")); -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r10217 r10378 314 314 final String baseUrl = getBaseUrl(); 315 315 switch (type) { 316 // CHECKSTYLE.OFF: SingleSpaceSeparator 316 317 case NODE: msg = tr("Fetching a package of nodes from ''{0}''", baseUrl); break; 317 318 case WAY: msg = tr("Fetching a package of ways from ''{0}''", baseUrl); break; 318 319 case RELATION: msg = tr("Fetching a package of relations from ''{0}''", baseUrl); break; 320 // CHECKSTYLE.ON: SingleSpaceSeparator 319 321 default: throw new AssertionError(); 320 322 } … … 584 586 String msg; 585 587 switch (type) { 588 // CHECKSTYLE.OFF: SingleSpaceSeparator 586 589 case NODE: msg = tr("Fetching node with id {0} from ''{1}''", id, baseUrl); break; 587 590 case WAY: msg = tr("Fetching way with id {0} from ''{1}''", id, baseUrl); break; 588 591 case RELATION: msg = tr("Fetching relation with id {0} from ''{1}''", id, baseUrl); break; 592 // CHECKSTYLE.ON: SingleSpaceSeparator 589 593 default: throw new AssertionError(); 590 594 } -
trunk/src/org/openstreetmap/josm/io/NoteReader.java
r10216 r10378 194 194 195 195 @Override 196 public void endDocument() throws SAXException 196 public void endDocument() throws SAXException { 197 197 parsedNotes = notes; 198 198 } -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r10373 r10378 133 133 * @throws IllegalArgumentException if serverUrl is null 134 134 */ 135 protected OsmApi(String serverUrl) 135 protected OsmApi(String serverUrl) { 136 136 CheckParameterUtil.ensureParameterNotNull(serverUrl, "serverUrl"); 137 137 this.serverUrl = serverUrl; -
trunk/src/org/openstreetmap/josm/io/OsmChangeImporter.java
r8895 r10378 44 44 } 45 45 46 protected void importData(InputStream in, final File associatedFile, ProgressMonitor 46 protected void importData(InputStream in, final File associatedFile, ProgressMonitor progressMonitor) throws IllegalDataException { 47 47 final DataSet dataSet = OsmChangeReader.parseDataSet(in, progressMonitor); 48 48 final OsmDataLayer layer = new OsmDataLayer(dataSet, associatedFile.getName(), associatedFile); -
trunk/src/org/openstreetmap/josm/io/OsmServerBackreferenceReader.java
r10212 r10378 98 98 * @throws IllegalArgumentException if type is null 99 99 */ 100 public OsmServerBackreferenceReader(long id, OsmPrimitiveType type, boolean readFull) 100 public OsmServerBackreferenceReader(long id, OsmPrimitiveType type, boolean readFull) { 101 101 this(id, type); 102 102 this.readFull = readFull; … … 202 202 } 203 203 if (isReadFull()) { 204 Collection<Relation> relationsToCheck 204 Collection<Relation> relationsToCheck = new ArrayList<>(ds.getRelations()); 205 205 for (Relation relation: relationsToCheck) { 206 206 if (!relation.isNew() && relation.hasIncompleteMembers()) { -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r10212 r10378 41 41 * @throws OsmTransferException if data transfer errors occur 42 42 */ 43 protected InputStream getInputStream(String urlStr, ProgressMonitor progressMonitor) throws OsmTransferException 43 protected InputStream getInputStream(String urlStr, ProgressMonitor progressMonitor) throws OsmTransferException { 44 44 return getInputStream(urlStr, progressMonitor, null); 45 45 } … … 55 55 * @throws OsmTransferException if data transfer errors occur 56 56 */ 57 protected InputStream getInputStream(String urlStr, ProgressMonitor progressMonitor, String reason) throws OsmTransferException 57 protected InputStream getInputStream(String urlStr, ProgressMonitor progressMonitor, String reason) throws OsmTransferException { 58 58 try { 59 59 api.initialize(progressMonitor); -
trunk/src/org/openstreetmap/josm/io/auth/AbstractCredentialsAgent.java
r10308 r10378 20 20 if (requestorType == null) 21 21 return null; 22 PasswordAuthentication credentials = 22 PasswordAuthentication credentials = lookup(requestorType, host); 23 23 final String username = (credentials == null || credentials.getUserName() == null) ? "" : credentials.getUserName(); 24 24 final String password = (credentials == null || credentials.getPassword() == null) ? "" : String.valueOf(credentials.getPassword()); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java
r10308 r10378 150 150 ExistingValues old = new ExistingValues(key); 151 151 for (OsmPrimitive osm : sel) { 152 oldValue 152 oldValue = osm.get(key); 153 153 if (oldValue != null) { 154 154 old.addValue(oldValue); … … 209 209 propertyTable.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.SHIFT_MASK), "shiftenter"); 210 210 propertyTable.getActionMap().put("shiftenter", new AbstractAction() { 211 @Override 211 @Override public void actionPerformed(ActionEvent e) { 212 212 buttonAction(1, e); // add all tags on Shift-Enter 213 213 } … … 242 242 protected void buttonAction(int buttonIndex, ActionEvent evt) { 243 243 // if layer all layers were closed, ignore all actions 244 if (Main.main.getCurrentDataSet() != null 244 if (Main.main.getCurrentDataSet() != null && buttonIndex != 2) { 245 245 TableModel tm = propertyTable.getModel(); 246 246 for (int i = 0; i < tm.getRowCount(); i++) { -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r10300 r10378 368 368 + "</html>"; 369 369 togglePreferenceKey = "pluginmanager.version-based-update.policy"; 370 } 370 } else { 371 371 long tim = System.currentTimeMillis(); 372 372 long last = Main.pref.getLong("pluginmanager.lastupdate", 0); … … 725 725 + "Delete from preferences?</html>", plugin.name, plugin.className); 726 726 } 727 } 727 } catch (RuntimeException e) { 728 728 pluginLoadingExceptions.put(plugin.name, e); 729 729 Main.error(e); -
trunk/src/org/openstreetmap/josm/tools/ColorScale.java
r9796 r10378 37 37 public static ColorScale createCyclicScale(int count) { 38 38 ColorScale sc = new ColorScale(); 39 // red yellow green blue red 40 int[] h = new int[] {0, 59, 127, 244, 360}; 39 // CHECKSTYLE.OFF: SingleSpaceSeparator 40 // red yellow green blue red 41 int[] h = new int[] {0, 59, 127, 244, 360}; 41 42 int[] s = new int[] {100, 84, 99, 100}; 42 43 int[] b = new int[] {90, 93, 74, 83}; 44 // CHECKSTYLE.ON: SingleSpaceSeparator 43 45 44 46 sc.colors = new Color[count]; … … 166 168 for (int i = 0; i <= intervalCount; i++) { 167 169 g.setColor(colors[(int) (1.0*i*n/intervalCount-1e-10)]); 168 final double val = 170 final double val = min+i*(max-min)/intervalCount; 169 171 final String txt = String.format("%.3f", val*valueScale); 170 172 if (w < h) { -
trunk/src/org/openstreetmap/josm/tools/Diff.java
r10308 r10378 327 327 static class ReverseScript implements ScriptBuilder { 328 328 @Override 329 public 329 public Change build_script( 330 330 final boolean[] changed0, int len0, 331 331 final boolean[] changed1, int len1) { … … 828 828 private final int bufferedLines; 829 829 830 /** Vector, indexed by line number, containing an equivalence code for 831 each line. It is this vector that is actually compared with that 832 of another file to generate differences. */ 833 private final int[] equivs; 834 835 /** Vector, like the previous one except that 836 the elements for discarded lines have been squeezed out. */ 837 private final int[] undiscarded; 838 839 /** Vector mapping virtual line numbers (not counting discarded lines) 840 to real ones (counting those lines). Both are origin-0. */ 841 private final int[] realindexes; 830 /** Vector, indexed by line number, containing an equivalence code for each line. 831 * It is this vector that is actually compared with that of another file to generate differences. */ 832 private final int[] equivs; 833 834 /** Vector, like the previous one except that the elements for discarded lines have been squeezed out. */ 835 private final int[] undiscarded; 836 837 /** Vector mapping virtual line numbers (not counting discarded lines) to real ones (counting those lines). 838 * Both are origin-0. */ 839 private final int[] realindexes; 842 840 843 841 /** Total number of nondiscarded lines. */ 844 private int nondiscardedLines; 845 846 /** Array, indexed by real origin-1 line number, 847 containing true for a line that is an insertion or a deletion. 848 The results of comparison are stored here. */ 849 private boolean[] changedFlag; 842 private int nondiscardedLines; 843 844 /** Array, indexed by real origin-1 line number, containing true for a line that is an insertion or a deletion. 845 The results of comparison are stored here. */ 846 private boolean[] changedFlag; 850 847 } 851 848 } -
trunk/src/org/openstreetmap/josm/tools/ExifReader.java
r10212 r10378 179 179 } 180 180 181 private static double readAxis(GpsDirectory dirGps, int gpsTag, int gpsTagRef, char cRef) throws MetadataException 181 private static double readAxis(GpsDirectory dirGps, int gpsTag, int gpsTagRef, char cRef) throws MetadataException { 182 182 double value; 183 183 Rational[] components = dirGps.getRationalArray(gpsTag); … … 205 205 * Returns a Transform that fixes the image orientation. 206 206 * 207 * Only orientation 1, 3, 6 and 8 are supported. Everything else is treated 208 * as 1. 207 * Only orientation 1, 3, 6 and 8 are supported. Everything else is treated as 1. 209 208 * @param orientation the exif-orientation of the image 210 209 * @param width the original width of the image -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r9952 r10378 789 789 790 790 BigDecimal d = new BigDecimal(3, MathContext.DECIMAL128); // 1/2 * 6 = 3 791 area 791 area = area.multiply(d, MathContext.DECIMAL128); 792 792 if (area.compareTo(BigDecimal.ZERO) != 0) { 793 793 north = north.divide(area, MathContext.DECIMAL128); -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r10362 r10378 102 102 public class ImageProvider { 103 103 104 // CHECKSTYLE.OFF: SingleSpaceSeparator 104 105 private static final String HTTP_PROTOCOL = "http://"; 105 106 private static final String HTTPS_PROTOCOL = "https://"; 106 107 private static final String WIKI_PROTOCOL = "wiki://"; 108 // CHECKSTYLE.ON: SingleSpaceSeparator 107 109 108 110 /** -
trunk/src/org/openstreetmap/josm/tools/MultikeyShortcutAction.java
r8674 r10378 27 27 return '0'; 28 28 else 29 return (char) ('A' + 29 return (char) ('A' + index - 10); 30 30 } 31 31 -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r10308 r10378 232 232 public static String getPackageDetails(String ... packageNames) { 233 233 try { 234 // CHECKSTYLE.OFF: SingleSpaceSeparator 234 235 boolean dpkg = Files.exists(Paths.get("/usr/bin/dpkg-query")); 235 236 boolean eque = Files.exists(Paths.get("/usr/bin/equery")); 236 237 boolean rpm = Files.exists(Paths.get("/bin/rpm")); 238 // CHECKSTYLE.ON: SingleSpaceSeparator 237 239 if (dpkg || rpm || eque) { 238 240 for (String packageName : packageNames) { -
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r10337 r10378 79 79 (byte) 0xfc, (byte) 0xf1, 0x7f, 0x73, (byte) 0xa7, (byte) 0x9d, (byte) 0xde, (byte) 0xc7, (byte) 0x88, 0x57, 0x51, 80 80 (byte) 0x84, (byte) 0xed, (byte) 0x96, (byte) 0xfb, (byte) 0xe1, 0x38, (byte) 0xef, 0x08, 0x2b, (byte) 0xf3, 81 (byte) 0xc7, (byte) 0xc3, 81 (byte) 0xc7, (byte) 0xc3, 0x5d, (byte) 0xfe, (byte) 0xf9, 0x51, (byte) 0xe6, 0x29, (byte) 0xfc, (byte) 0xe5, 0x0d, 82 82 (byte) 0xa1, 0x0d, (byte) 0xa8, (byte) 0xb4, (byte) 0xae, 0x26, 0x18, 0x19, 0x4d, 0x6c, 0x0c, 0x3b, 0x12, (byte) 0xba, 83 83 (byte) 0xbc, 0x5f, 0x32, (byte) 0xb3, (byte) 0xbe, (byte) 0x9d, 0x17, 0x0d, 0x4d, 0x2f, 0x1a, 0x48, (byte) 0xb7, -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r10339 r10378 221 221 */ 222 222 public void setMnemonic(AbstractButton button) { 223 if (assignedModifier == getGroupModifier(MNEMONIC) 223 if (assignedModifier == getGroupModifier(MNEMONIC) && getKeyStroke() != null && KeyEvent.getKeyText(assignedKey).length() == 1) { 224 224 button.setMnemonic(KeyEvent.getKeyText(assignedKey).charAt(0)); //getKeyStroke().getKeyChar() seems not to work here 225 225 } … … 231 231 */ 232 232 public void setFocusAccelerator(JTextComponent component) { 233 if (assignedModifier == getGroupModifier(MNEMONIC) 233 if (assignedModifier == getGroupModifier(MNEMONIC) && getKeyStroke() != null && KeyEvent.getKeyText(assignedKey).length() == 1) { 234 234 component.setFocusAccelerator(KeyEvent.getKeyText(assignedKey).charAt(0)); 235 235 } -
trunk/src/org/openstreetmap/josm/tools/TextTagParser.java
r10308 r10378 125 125 while (pos < n) { 126 126 c = data.charAt(pos); 127 if (c == '\t' || c == '\n' 127 if (c == '\t' || c == '\n' || c == ' ') { 128 128 pos++; 129 129 } else if (c == '=') { … … 177 177 String k; 178 178 String v; 179 for (String 179 for (String line: lines) { 180 180 if (line.trim().isEmpty()) continue; // skip empty lines 181 181 Matcher m = p.matcher(line); … … 195 195 if (!tags.isEmpty()) { 196 196 return tags; 197 } 197 } else { 198 198 return null; 199 199 } -
trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
r10242 r10378 58 58 * @param window the window 59 59 */ 60 public WindowGeometry(Window window) 60 public WindowGeometry(Window window) { 61 61 this(window.getLocationOnScreen(), window.getSize()); 62 62 } … … 165 165 * @param window the window 166 166 */ 167 public void fixScreen(Window window) 167 public void fixScreen(Window window) { 168 168 Rectangle oldScreen = getScreenInfo(getRectangle()); 169 169 Rectangle newScreen = getScreenInfo(new Rectangle(window.getLocationOnScreen(), window.getSize())); … … 402 402 Rectangle bounds = gc.getBounds(); 403 403 Insets insets = component.getToolkit().getScreenInsets(gc); 404 result.width = bounds.width- insets.left - insets.right;404 result.width = bounds.width - insets.left - insets.right; 405 405 result.height = bounds.height - insets.top - insets.bottom; 406 406 } -
trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
r10212 r10378 106 106 } else if (mapping.containsKey(qname) && characters != null && !current.isEmpty()) { 107 107 setValue(mapping.get(qname), qname, characters.toString().trim()); 108 characters 108 characters = new StringBuilder(64); 109 109 } 110 110 } … … 117 117 private void report() { 118 118 queue.add(current.pop()); 119 characters 119 characters = new StringBuilder(64); 120 120 } 121 121 -
trunk/src/org/openstreetmap/josm/tools/template_engine/TemplateParser.java
r8926 r10378 108 108 109 109 Token token = tokenizer.lookAhead(); 110 if (token.getType() 110 if (token.getType() == TokenType.END) { 111 111 tokenizer.nextToken(); 112 112 return result; -
trunk/test/functional/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergerTestFT.java
r9546 r10378 32 32 33 33 public static void main(String[] args) { 34 TagMergerTestFT test 34 TagMergerTestFT test = new TagMergerTestFT(); 35 35 test.setSize(600, 600); 36 36 test.setVisible(true); -
trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
r10222 r10378 138 138 ds.adjustRelationUploadOrder(); 139 139 OsmServerWriter writer = new OsmServerWriter(); 140 Changeset cs 140 Changeset cs = new Changeset(); 141 141 writer.uploadOsm( 142 142 new UploadStrategySpecification().setStrategy(UploadStrategy.SINGLE_REQUEST_STRATEGY), -
trunk/test/functional/org/openstreetmap/josm/io/UploadStrategySelectionPanelTest.java
r10222 r10378 22 22 protected UploadStrategySelectionPanel uploadStrategySelectionPanel; 23 23 24 protected void build() 24 protected void build() { 25 25 getContentPane().setLayout(new BorderLayout()); 26 26 uploadStrategySelectionPanel = new UploadStrategySelectionPanel(); -
trunk/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java
r10052 r10378 96 96 void verifyRectangleClockwise(final Way way) { 97 97 for (int i = 1; i < way.getNodesCount() - 1; i++) { 98 assertEquals(-Math.PI / 2, 98 assertEquals(-Math.PI / 2, Geometry.getCornerAngle( 99 99 way.getNode(i - 1).getEastNorth(), way.getNode(i).getEastNorth(), way.getNode(i + 1).getEastNorth()), 1e-6); 100 100 } -
trunk/test/unit/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJobTest.java
r10222 r10378 79 79 */ 80 80 @Test 81 public void testStatusCodes() throws IOException, InterruptedException 81 public void testStatusCodes() throws IOException, InterruptedException { 82 82 doTestStatusCode(200); 83 83 // can't test for 3xx, as httpstat.us redirects finally to 200 page -
trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java
r10334 r10378 33 33 @SuppressFBWarnings(value = "MS_PKGPROTECT") 34 34 public static final double[] SAMPLE_VALUES = new double[]{ 35 // CHECKSTYLE.OFF: SingleSpaceSeparator 35 36 -180.0, -179.9, -179.6, -179.5, -179.4, -179.1, -179.0, -100.0, -99.9, -10.0, -9.9, -1.0, -0.1, 36 180.0, 179.9, 179.6, 179.5, 179.4, 179.1, 179.0, 100.0, 99.9, 10.0, 9.9, 1.0, 0.1,37 180.0, 179.9, 179.6, 179.5, 179.4, 179.1, 179.0, 100.0, 99.9, 10.0, 9.9, 1.0, 0.1, 37 38 0.12, 0.123, 0.1234, 0.12345, 0.123456, 0.1234567, 38 39 1.12, 1.123, 1.1234, 1.12345, 1.123456, 1.1234567, 39 40 10.12, 10.123, 10.1234, 10.12345, 10.123456, 10.1234567, 40 41 100.12, 100.123, 100.1234, 100.12345, 100.123456, 100.1234567 42 // CHECKSTYLE.ON: SingleSpaceSeparator 41 43 }; 42 44 … … 54 56 assertEquals(LatLon.roundToOsmPrecision(-0.0), 0.0, 0); 55 57 58 // CHECKSTYLE.OFF: SingleSpaceSeparator 56 59 assertEquals(LatLon.roundToOsmPrecision(0.12345678), 0.1234568, 0); 57 60 assertEquals(LatLon.roundToOsmPrecision(0.123456789), 0.1234568, 0); … … 65 68 assertEquals(LatLon.roundToOsmPrecision(100.12345678), 100.1234568, 0); 66 69 assertEquals(LatLon.roundToOsmPrecision(100.123456789), 100.1234568, 0); 70 // CHECKSTYLE.ON: SingleSpaceSeparator 67 71 68 assertEquals(LatLon.roundToOsmPrecision(100.00000001), 69 assertEquals(LatLon.roundToOsmPrecision(100.000000001), 70 assertEquals(LatLon.roundToOsmPrecision(100.0000000001), 71 assertEquals(LatLon.roundToOsmPrecision(100.00000000001), 72 assertEquals(LatLon.roundToOsmPrecision(100.000000000001), 73 assertEquals(LatLon.roundToOsmPrecision(100.0000000000001), 74 assertEquals(LatLon.roundToOsmPrecision(100.00000000000001), 75 assertEquals(LatLon.roundToOsmPrecision(100.000000000000001), 76 assertEquals(LatLon.roundToOsmPrecision(100.0000000000000001), 77 assertEquals(LatLon.roundToOsmPrecision(100.00000000000000001), 78 assertEquals(LatLon.roundToOsmPrecision(100.000000000000000001), 79 assertEquals(LatLon.roundToOsmPrecision(100.0000000000000000001), 80 assertEquals(LatLon.roundToOsmPrecision(100.00000000000000000001), 72 assertEquals(LatLon.roundToOsmPrecision(100.00000001), 100.0000000, 0); 73 assertEquals(LatLon.roundToOsmPrecision(100.000000001), 100.0000000, 0); 74 assertEquals(LatLon.roundToOsmPrecision(100.0000000001), 100.0000000, 0); 75 assertEquals(LatLon.roundToOsmPrecision(100.00000000001), 100.0000000, 0); 76 assertEquals(LatLon.roundToOsmPrecision(100.000000000001), 100.0000000, 0); 77 assertEquals(LatLon.roundToOsmPrecision(100.0000000000001), 100.0000000, 0); 78 assertEquals(LatLon.roundToOsmPrecision(100.00000000000001), 100.0000000, 0); 79 assertEquals(LatLon.roundToOsmPrecision(100.000000000000001), 100.0000000, 0); 80 assertEquals(LatLon.roundToOsmPrecision(100.0000000000000001), 100.0000000, 0); 81 assertEquals(LatLon.roundToOsmPrecision(100.00000000000000001), 100.0000000, 0); 82 assertEquals(LatLon.roundToOsmPrecision(100.000000000000000001), 100.0000000, 0); 83 assertEquals(LatLon.roundToOsmPrecision(100.0000000000000000001), 100.0000000, 0); 84 assertEquals(LatLon.roundToOsmPrecision(100.00000000000000000001), 100.0000000, 0); 81 85 82 assertEquals(LatLon.roundToOsmPrecision(99.999999999999999999999), 83 assertEquals(LatLon.roundToOsmPrecision(99.99999999999999999999), 84 assertEquals(LatLon.roundToOsmPrecision(99.9999999999999999999), 85 assertEquals(LatLon.roundToOsmPrecision(99.999999999999999999), 86 assertEquals(LatLon.roundToOsmPrecision(99.99999999999999999), 87 assertEquals(LatLon.roundToOsmPrecision(99.9999999999999999), 88 assertEquals(LatLon.roundToOsmPrecision(99.999999999999999), 89 assertEquals(LatLon.roundToOsmPrecision(99.99999999999999), 90 assertEquals(LatLon.roundToOsmPrecision(99.9999999999999), 91 assertEquals(LatLon.roundToOsmPrecision(99.999999999999), 92 assertEquals(LatLon.roundToOsmPrecision(99.99999999999), 93 assertEquals(LatLon.roundToOsmPrecision(99.9999999999), 94 assertEquals(LatLon.roundToOsmPrecision(99.999999999), 95 assertEquals(LatLon.roundToOsmPrecision(99.99999999), 96 assertEquals(LatLon.roundToOsmPrecision(99.9999999), 86 assertEquals(LatLon.roundToOsmPrecision(99.999999999999999999999), 100.0000000, 0); 87 assertEquals(LatLon.roundToOsmPrecision(99.99999999999999999999), 100.0000000, 0); 88 assertEquals(LatLon.roundToOsmPrecision(99.9999999999999999999), 100.0000000, 0); 89 assertEquals(LatLon.roundToOsmPrecision(99.999999999999999999), 100.0000000, 0); 90 assertEquals(LatLon.roundToOsmPrecision(99.99999999999999999), 100.0000000, 0); 91 assertEquals(LatLon.roundToOsmPrecision(99.9999999999999999), 100.0000000, 0); 92 assertEquals(LatLon.roundToOsmPrecision(99.999999999999999), 100.0000000, 0); 93 assertEquals(LatLon.roundToOsmPrecision(99.99999999999999), 100.0000000, 0); 94 assertEquals(LatLon.roundToOsmPrecision(99.9999999999999), 100.0000000, 0); 95 assertEquals(LatLon.roundToOsmPrecision(99.999999999999), 100.0000000, 0); 96 assertEquals(LatLon.roundToOsmPrecision(99.99999999999), 100.0000000, 0); 97 assertEquals(LatLon.roundToOsmPrecision(99.9999999999), 100.0000000, 0); 98 assertEquals(LatLon.roundToOsmPrecision(99.999999999), 100.0000000, 0); 99 assertEquals(LatLon.roundToOsmPrecision(99.99999999), 100.0000000, 0); 100 assertEquals(LatLon.roundToOsmPrecision(99.9999999), 99.9999999, 0); 97 101 } 98 102 -
trunk/test/unit/org/openstreetmap/josm/data/imagery/ImageryInfoTest.java
r10221 r10378 36 36 @Test 37 37 public void testGetExtendedUrl() { 38 ImageryInfo testImageryTMS = 38 ImageryInfo testImageryTMS = new ImageryInfo("test imagery", "http://localhost", "tms", null, null); 39 39 testImageryTMS.setDefaultMinZoom(16); 40 40 testImageryTMS.setDefaultMaxZoom(23); -
trunk/test/unit/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSourceTest.java
r10221 r10378 23 23 public class TemplatedWMSTileSourceTest { 24 24 25 private ImageryInfo testImageryWMS = 26 private ImageryInfo testImageryTMS = 25 private ImageryInfo testImageryWMS = new ImageryInfo("test imagery", "http://localhost", "wms", null, null); 26 private ImageryInfo testImageryTMS = new ImageryInfo("test imagery", "http://localhost", "tms", null, null); 27 27 28 28 /** … … 190 190 private static boolean isWithin(EastNorth point, EastNorth topLeft, EastNorth bottomRight) { 191 191 return Math.min(topLeft.east(), bottomRight.east()) <= point.east() && 192 point.east() <= Math.max(topLeft.east(), bottomRight.east()) 192 point.east() <= Math.max(topLeft.east(), bottomRight.east()) && 193 193 Math.min(topLeft.north(), bottomRight.north()) <= point.north() && 194 194 point.north() <= Math.max(topLeft.north(), bottomRight.north()); -
trunk/test/unit/org/openstreetmap/josm/data/imagery/WMTSTileSourceTest.java
r10221 r10378 25 25 public class WMTSTileSourceTest { 26 26 27 private ImageryInfo testImageryTMS = 27 private ImageryInfo testImageryTMS = new ImageryInfo("test imagery", "http://localhost", "tms", null, null); 28 28 private ImageryInfo testImageryPSEUDO_MERCATOR = getImagery(TestUtils.getTestDataRoot() + "wmts/getcapabilities-pseudo-mercator.xml"); 29 29 private ImageryInfo testImageryTOPO_PL = getImagery(TestUtils.getTestDataRoot() + "wmts/getcapabilities-TOPO.xml"); … … 192 192 + "VERSION=1.0.0&LAYER=MAPA TOPOGRAFICZNA&STYLE=default&FORMAT=image/jpeg&tileMatrixSet=EPSG:4326&" 193 193 + "tileMatrix=EPSG:4326:0&tileRow=1&tileCol=1", 194 testSource.getTileUrl(0, 1,1));194 testSource.getTileUrl(0, 1, 1)); 195 195 } 196 196 … … 221 221 assertEquals( 222 222 "http://www.ngi.be/cartoweb/1.0.0/topo/default/3857/7/1/1.png", 223 testSource.getTileUrl(0, 1,1));223 testSource.getTileUrl(0, 1, 1)); 224 224 } 225 225 … … 232 232 verifyTile(new LatLon(45.4105023, -75.7153702), testSource, 303751, 375502, 12); 233 233 verifyTile(new LatLon(45.4601306, -75.7617187), testSource, 1186, 1466, 4); 234 235 234 } 236 235 -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r9979 r10378 8 8 import static org.junit.Assert.assertSame; 9 9 import static org.junit.Assert.assertTrue; 10 import static org.junit.Assert.fail; 10 11 11 12 import java.io.StringWriter; … … 53 54 } 54 55 55 private void runConsistencyTests(DataSet ds) throws Exception{56 private void runConsistencyTests(DataSet ds) { 56 57 StringWriter writer = new StringWriter(); 57 DatasetConsistencyTest test = 58 DatasetConsistencyTest test = new DatasetConsistencyTest(ds, writer); 58 59 test.checkReferrers(); 59 60 test.checkCompleteWaysWithIncompleteNodes(); … … 63 64 test.checkZeroNodesWays(); 64 65 String result = writer.toString(); 65 if ( result.length() > 0)66 throw new RuntimeException(result);66 if (!result.isEmpty()) 67 fail(result); 67 68 } 68 69 69 70 @After 70 public void checkDatasets() throws Exception{71 public void checkDatasets() { 71 72 runConsistencyTests(my); 72 73 runConsistencyTests(their); -
trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryRelationTest.java
r9666 r10378 80 80 rel2.addMember(new RelationMemberData(null, OsmPrimitiveType.NODE, 2)); 81 81 82 // CHECKSTYLE.OFF: SingleSpaceSeparator 82 83 assertEquals("relation (1, 0 members)", rel0.getDisplayName(hnf)); 83 84 assertEquals("relation (1, 1 member)", rel1.getDisplayName(hnf)); … … 94 95 assertEquals("relation (\"RelName\", 1 member)", rel1.getDisplayName(hnf)); 95 96 assertEquals("relation (\"RelName\", 2 members)", rel2.getDisplayName(hnf)); 97 // CHECKSTYLE.ON: SingleSpaceSeparator 96 98 } 97 99 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java
r9203 r10378 122 122 way2.addNode(2); 123 123 124 // CHECKSTYLE.OFF: SingleSpaceSeparator 124 125 assertEquals("1 (0 nodes)", way0.getDisplayName(hnf)); 125 126 assertEquals("1 (1 node)", way1.getDisplayName(hnf)); … … 136 137 assertEquals("WayName (1 node)", way1.getDisplayName(hnf)); 137 138 assertEquals("WayName (2 nodes)", way2.getDisplayName(hnf)); 139 // CHECKSTYLE.ON: SingleSpaceSeparator 138 140 } 139 141 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java
r10202 r10378 169 169 r1.addMember(new RelationMember("node-20", n20)); 170 170 Way w30 = new Way(30, 1); 171 Node n21 171 Node n21 = new Node(21); 172 172 w30.addNode(n21); 173 173 Node n22 = new Node(22); -
trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java
r8836 r10378 25 25 26 26 // CHECKSTYLE.OFF: LineLength 27 // CHECKSTYLE.OFF: SingleSpaceSeparator 27 28 28 29 /** … … 30 31 */ 31 32 ProjData[] data = { 32 new ProjData("Zimmerwald", d(7, 27, 54.983506), d(46, 52, 37.540562), 947.149, 602030.680, 191775.030, 897.915), 33 new ProjData("Chrischona", d(7, 40, 6.983077), d(47, 34, 1.385301), 504.935, 617306.300, 268507.300, 456.064), 34 new ProjData("Pfaender", d(9, 47, 3.697723), d(47, 30, 55.172797), 1089.372, 776668.105, 265372.681, 1042.624), 35 new ProjData("La Givrine", d(6, 6, 7.326361), d(46, 27, 14.690021), 1258.274, 497313.292, 145625.438, 1207.434), 36 new ProjData("Monte Generoso", d(9, 1, 16.389053), d(45, 55, 45.438020), 1685.027, 722758.810, 87649.670, 1636.600) }; 37 33 new ProjData("Zimmerwald", d(7, 27, 54.983506), d(46, 52, 37.540562), 947.149, 602030.680, 191775.030, 897.915), 34 new ProjData("Chrischona", d(7, 40, 6.983077), d(47, 34, 1.385301), 504.935, 617306.300, 268507.300, 456.064), 35 new ProjData("Pfaender", d(9, 47, 3.697723), d(47, 30, 55.172797), 1089.372, 776668.105, 265372.681, 1042.624), 36 new ProjData("La Givrine", d(6, 6, 7.326361), d(46, 27, 14.690021), 1258.274, 497313.292, 145625.438, 1207.434), 37 new ProjData("Monte Generoso", d(9, 1, 16.389053), d(45, 55, 45.438020), 1685.027, 722758.810, 87649.670, 1636.600) }; 38 39 // CHECKSTYLE.ON: SingleSpaceSeparator 38 40 // CHECKSTYLE.ON: LineLength 39 41 -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/EmailValidatorTest.java
r10338 r10378 58 58 */ 59 59 @Test 60 public void testEmail() 60 public void testEmail() { 61 61 assertTrue(validator.isValid("jsmith@apache.org")); 62 62 assertFalse(validator.isValid(null)); … … 67 67 */ 68 68 @Test 69 public void testEmailWithNumericAddress() 69 public void testEmailWithNumericAddress() { 70 70 assertTrue(validator.isValid("someone@[216.109.118.76]")); 71 71 assertTrue(validator.isValid("someone@yahoo.com")); … … 76 76 */ 77 77 @Test 78 public void testEmailExtension() 78 public void testEmailExtension() { 79 79 assertTrue(validator.isValid("jsmith@apache.org")); 80 80 … … 99 99 */ 100 100 @Test 101 public void testEmailWithDash() 101 public void testEmailWithDash() { 102 102 assertTrue(validator.isValid("andy.noble@data-workshop.com")); 103 103 … … 114 114 */ 115 115 @Test 116 public void testEmailWithDotEnd() 116 public void testEmailWithDotEnd() { 117 117 assertFalse(validator.isValid("andy.noble@data-workshop.com.")); 118 118 } … … 123 123 */ 124 124 @Test 125 public void testEmailWithBogusCharacter() 125 public void testEmailWithBogusCharacter() { 126 126 127 127 assertFalse(validator.isValid("andy.noble@\u008fdata-workshop.com")); … … 184 184 */ 185 185 @Test 186 public void testEmailWithCommas() 186 public void testEmailWithCommas() { 187 187 assertFalse(validator.isValid("joeblow@apa,che.org")); 188 188 … … 196 196 */ 197 197 @Test 198 public void testEmailWithSpaces() 198 public void testEmailWithSpaces() { 199 199 assertFalse(validator.isValid("joeblow @apache.org")); // TODO - this should be valid? 200 200 … … 215 215 */ 216 216 @Test 217 public void testEmailWithControlChars() 217 public void testEmailWithControlChars() { 218 218 for (char c = 0; c < 32; c++) { 219 219 assertFalse("Test control char " + ((int) c), validator.isValid("foo" + c + "bar@domain.com")); … … 278 278 */ 279 279 @Test 280 public void testEmailUserName() 280 public void testEmailUserName() { 281 281 282 282 assertTrue(validator.isValid("joe1blow@apache.org")); … … 492 492 @Ignore("This test fails so disable it for 1.1.4 release. The real solution is to fix the email parsing") 493 493 @Test 494 public void testEmailFromPerl() 494 public void testEmailFromPerl() { 495 495 for (int index = 0; index < testEmailFromPerl.length; index++) { 496 496 String item = testEmailFromPerl[index].item; -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/InetAddressValidatorTest.java
r10338 r10378 47 47 @Test 48 48 public void testInetAddressesFromTheWild() { 49 assertTrue("www.apache.org IP should be valid", validator.isValid("140.211.11.130")); 50 assertTrue("www.l.google.com IP should be valid", validator.isValid("72.14.253.103")); 51 assertTrue("fsf.org IP should be valid", validator.isValid("199.232.41.5")); 52 assertTrue("appscs.ign.com IP should be valid", validator.isValid("216.35.123.87")); 49 // CHECKSTYLE.OFF: SingleSpaceSeparator 50 assertTrue("www.apache.org IP should be valid", validator.isValid("140.211.11.130")); 51 assertTrue("www.l.google.com IP should be valid", validator.isValid("72.14.253.103")); 52 assertTrue("fsf.org IP should be valid", validator.isValid("199.232.41.5")); 53 assertTrue("appscs.ign.com IP should be valid", validator.isValid("216.35.123.87")); 54 // CHECKSTYLE.ON: SingleSpaceSeparator 53 55 } 54 56 … … 67 69 @Test 68 70 public void testInetAddressesByClass() { 69 assertTrue("class A IP should be valid", validator.isValid("24.25.231.12")); 70 assertFalse("illegal class A IP should be invalid", validator.isValid("2.41.32.324")); 71 72 assertTrue("class B IP should be valid", validator.isValid("135.14.44.12")); 73 assertFalse("illegal class B IP should be invalid", validator.isValid("154.123.441.123")); 74 75 assertTrue("class C IP should be valid", validator.isValid("213.25.224.32")); 76 assertFalse("illegal class C IP should be invalid", validator.isValid("201.543.23.11")); 77 78 assertTrue("class D IP should be valid", validator.isValid("229.35.159.6")); 79 assertFalse("illegal class D IP should be invalid", validator.isValid("231.54.11.987")); 80 81 assertTrue("class E IP should be valid", validator.isValid("248.85.24.92")); 82 assertFalse("illegal class E IP should be invalid", validator.isValid("250.21.323.48")); 71 // CHECKSTYLE.OFF: SingleSpaceSeparator 72 assertTrue("class A IP should be valid", validator.isValid("24.25.231.12")); 73 assertFalse("illegal class A IP should be invalid", validator.isValid("2.41.32.324")); 74 75 assertTrue("class B IP should be valid", validator.isValid("135.14.44.12")); 76 assertFalse("illegal class B IP should be invalid", validator.isValid("154.123.441.123")); 77 78 assertTrue("class C IP should be valid", validator.isValid("213.25.224.32")); 79 assertFalse("illegal class C IP should be invalid", validator.isValid("201.543.23.11")); 80 81 assertTrue("class D IP should be valid", validator.isValid("229.35.159.6")); 82 assertFalse("illegal class D IP should be invalid", validator.isValid("231.54.11.987")); 83 84 assertTrue("class E IP should be valid", validator.isValid("248.85.24.92")); 85 assertFalse("illegal class E IP should be invalid", validator.isValid("250.21.323.48")); 86 // CHECKSTYLE.ON: SingleSpaceSeparator 83 87 } 84 88 … … 88 92 @Test 89 93 public void testReservedInetAddresses() { 90 assertTrue("localhost IP should be valid", 91 assertTrue("broadcast IP should be valid", 94 assertTrue("l