Changeset 8345 in josm
- Timestamp:
- 2015-05-11T10:52:33+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 68 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r8342 r8345 963 963 964 964 geometry = WindowGeometry.mainWindow("gui.geometry", 965 (args.containsKey(Option.GEOMETRY) ? args.get(Option.GEOMETRY).iterator().next() : null),965 args.containsKey(Option.GEOMETRY) ? args.get(Option.GEOMETRY).iterator().next() : null, 966 966 !args.containsKey(Option.NO_MAXIMIZE) && Main.pref.getBoolean("gui.maximized", false)); 967 967 } -
trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
r8342 r8345 95 95 protected ImageryInfo getWMSLayerInfo() { 96 96 try { 97 assert (ImageryType.WMS_ENDPOINT.equals(info.getImageryType()));97 assert ImageryType.WMS_ENDPOINT.equals(info.getImageryType()); 98 98 final WMSImagery wms = new WMSImagery(); 99 99 wms.attemptGetCapabilities(info.getUrl()); -
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r8338 r8345 249 249 JOptionPane.showMessageDialog( 250 250 Main.parent, 251 ("selection".equals(mode) ? tr("Nothing selected to zoom to.") : tr("No conflicts to zoom to")),251 "selection".equals(mode) ? tr("Nothing selected to zoom to.") : tr("No conflicts to zoom to"), 252 252 tr("Information"), 253 253 JOptionPane.INFORMATION_MESSAGE); -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r8248 r8345 194 194 dialog.setButtonIcons(new String[] {"save_as", "cancel"}); 195 195 dialog.showDialog(); 196 return (dialog.getValue() == 1);196 return dialog.getValue() == 1; 197 197 } 198 198 return true; -
trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
r8342 r8345 1125 1125 1126 1126 double cx = center.getX(), cy = center.getY(); 1127 double k = (mirror ? -1 : 1);1127 double k = mirror ? -1 : 1; 1128 1128 Point2D ra1 = new Point2D.Double(cx + raoffsetx, cy + raoffsety); 1129 1129 Point2D ra3 = new Point2D.Double(cx - raoffsety*k, cy + raoffsetx*k); -
trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java
r8318 r8345 412 412 for (Pair<Node, Node> wpp : wpps) { 413 413 ++i; 414 if ((wpp.a.equals(candidateSegment.getFirstNode()) 415 && wpp.b.equals(candidateSegment.getSecondNode()) || (wpp.b.equals(candidateSegment.getFirstNode()) && wpp.a.equals(candidateSegment.getSecondNode())))) { 414 boolean ab = wpp.a.equals(candidateSegment.getFirstNode()) 415 && wpp.b.equals(candidateSegment.getSecondNode()); 416 boolean ba = wpp.b.equals(candidateSegment.getFirstNode()) 417 && wpp.a.equals(candidateSegment.getSecondNode()); 418 if (ab || ba) { 416 419 virtualSegments.add(new WaySegment(w, i)); 417 420 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/ModifiersSpec.java
r6889 r8345 20 20 */ 21 21 public ModifiersSpec(String str) { 22 assert (str.length() == 3);22 assert str.length() == 3; 23 23 char a = str.charAt(0); 24 24 char s = str.charAt(1); … … 46 46 47 47 private boolean match(final int a, final int knownValue) { 48 assert (knownValue == ON | knownValue == OFF);48 assert knownValue == ON | knownValue == OFF; 49 49 return a == knownValue || a == UNKNOWN; 50 50 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java
r8308 r8345 245 245 boolean oldAlt = alt, oldShift = shift, oldCtrl = ctrl; 246 246 updateKeyModifiers(modifiers); 247 return (oldAlt != alt || oldShift != shift || oldCtrl != ctrl);247 return oldAlt != alt || oldShift != shift || oldCtrl != ctrl; 248 248 } 249 249 … … 288 288 ((Boolean) this.getValue("active")); 289 289 // @formatter:on 290 assert (areWeSane); // mad == bad290 assert areWeSane; // mad == bad 291 291 return areWeSane; 292 292 } … … 498 498 //// We keep the source ways and the selection in sync so the user can see the source way's tags 499 499 private void addSourceWay(Way w) { 500 assert (sourceWays != null);500 assert sourceWays != null; 501 501 getCurrentDataSet().addSelected(w); 502 502 w.setHighlighted(true); … … 505 505 506 506 private void removeSourceWay(Way w) { 507 assert (sourceWays != null);507 assert sourceWays != null; 508 508 getCurrentDataSet().clearSelection(w); 509 509 w.setHighlighted(false); … … 512 512 513 513 private void clearSourceWays() { 514 assert (sourceWays != null);514 assert sourceWays != null; 515 515 getCurrentDataSet().clearSelection(sourceWays); 516 516 for (Way w : sourceWays) { -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r8343 r8345 953 953 else if (mode == Mode.MOVE && (System.currentTimeMillis() - mouseDownTime >= initialMoveDelay)) { 954 954 final boolean canMerge = getCurrentDataSet()!=null && !getCurrentDataSet().getSelectedNodes().isEmpty(); 955 final String mergeHelp = canMerge ? (" " + tr("Ctrl to merge with nearest node.")) : "";955 final String mergeHelp = canMerge ? " " + tr("Ctrl to merge with nearest node.") : ""; 956 956 return tr("Release the mouse button to stop moving.") + mergeHelp; 957 957 } else if (mode == Mode.ROTATE) -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r8338 r8345 601 601 /*case sensitive*/ trc("search", "CS") : 602 602 /*case insensitive*/ trc("search", "CI"); 603 String rx = regexSearch ? (", " +604 /*regex search*/ trc("search", "RX") ): "";605 String all = allElements ? (", " +606 /*all elements*/ trc("search", "A") ): "";603 String rx = regexSearch ? ", " + 604 /*regex search*/ trc("search", "RX") : ""; 605 String all = allElements ? ", " + 606 /*all elements*/ trc("search", "A") : ""; 607 607 return "\"" + text + "\" (" + cs + rx + all + ", " + mode + ")"; 608 608 } … … 613 613 return false; 614 614 SearchSetting o = (SearchSetting) other; 615 return (o.caseSensitive == this.caseSensitive615 return o.caseSensitive == this.caseSensitive 616 616 && o.regexSearch == this.regexSearch 617 617 && o.allElements == this.allElements 618 618 && o.mode.equals(this.mode) 619 && o.text.equals(this.text) );619 && o.text.equals(this.text); 620 620 } 621 621 -
trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java
r8318 r8345 52 52 File cacheDir = new File(Main.pref.getCacheDirectory(), "jcs"); 53 53 54 if ( (!cacheDir.exists() && !cacheDir.mkdirs()))54 if (!cacheDir.exists() && !cacheDir.mkdirs()) 55 55 throw new IOException("Cannot access cache directory"); 56 56 -
trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
r8344 r8345 439 439 urlConn.setRequestMethod("HEAD"); 440 440 long lastModified = urlConn.getLastModified(); 441 return ( 442 (attributes.getEtag() != null && attributes.getEtag().equals(urlConn.getRequestProperty("ETag"))) || 443 (lastModified != 0 && lastModified <= attributes.getLastModification()) 444 ); 441 return (attributes.getEtag() != null && attributes.getEtag().equals(urlConn.getRequestProperty("ETag"))) || 442 (lastModified != 0 && lastModified <= attributes.getLastModification()); 445 443 } 446 444 -
trunk/src/org/openstreetmap/josm/data/coor/EastNorth.java
r8308 r8345 132 132 */ 133 133 public boolean equalsEpsilon(EastNorth other, double e) { 134 return (Math.abs(x - other.x) < e && Math.abs(y - other.y) < e);134 return Math.abs(x - other.x) < e && Math.abs(y - other.y) < e; 135 135 } 136 136 } -
trunk/src/org/openstreetmap/josm/data/coor/QuadTiling.java
r7509 r8345 9 9 10 10 public static final int NR_LEVELS = 24; 11 public static final double WORLD_PARTS = (1 << NR_LEVELS);11 public static final double WORLD_PARTS = 1 << NR_LEVELS; 12 12 13 13 public static final int TILES_PER_LEVEL_SHIFT = 2; // Has to be 2. Other parts of QuadBuckets code rely on it … … 53 53 for (i = NR_LEVELS-1; i >= 0; i--) 54 54 { 55 long xbit = ( (x >> i) & 1);56 long ybit = ( (y >> i) & 1);55 long xbit = (x >> i) & 1; 56 long ybit = (y >> i) & 1; 57 57 tile <<= 2; 58 58 // Note that x is the MSB -
trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java
r8308 r8345 360 360 public synchronized boolean hasExactMatch(Projection projection, double pixelPerDegree, double east, double north) { 361 361 ProjectionEntries projectionEntries = getProjectionEntries(projection); 362 CacheEntry entry = findEntry(projectionEntries, pixelPerDegree, east, north); 363 return (entry != null); 362 return findEntry(projectionEntries, pixelPerDegree, east, north) != null; 364 363 } 365 364 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r8338 r8345 519 519 */ 520 520 public boolean isDisabledAndHidden() { 521 return (( (flags & FLAG_DISABLED) != 0) && ((flags & FLAG_HIDE_IF_DISABLED) != 0));521 return ((flags & FLAG_DISABLED) != 0) && ((flags & FLAG_HIDE_IF_DISABLED) != 0); 522 522 } 523 523 -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r8338 r8345 363 363 boolean locked = writeLock(); 364 364 try { 365 boolean closed = (lastNode() == n && firstNode() == n);365 boolean closed = lastNode() == n && firstNode() == n; 366 366 int i; 367 367 List<Node> copy = getNodes(); … … 391 391 boolean locked = writeLock(); 392 392 try { 393 boolean closed = (lastNode() == firstNode() && selection.contains(lastNode()));393 boolean closed = lastNode() == firstNode() && selection.contains(lastNode()); 394 394 List<Node> copy = new ArrayList<>(); 395 395 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java
r8291 r8345 184 184 double xd = Math.abs(p1.getX()-p2.getX()); 185 185 double yd = Math.abs(p1.getY()-p2.getY()); 186 return (xd+yd > space);186 return xd + yd > space; 187 187 } 188 188 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r8342 r8345 866 866 return; 867 867 g.setColor(highlightColorTransparent); 868 float w = (line.getLineWidth() + highlightLineWidth);868 float w = line.getLineWidth() + highlightLineWidth; 869 869 if (useWiderHighlight) w+=widerHighlight; 870 870 while(w >= line.getLineWidth()) { … … 995 995 */ 996 996 double distanceFromVia=14; 997 double dx = (pFrom.x >= pVia.x) ? (pFrom.x - pVia.x) : (pVia.x - pFrom.x);998 double dy = (pFrom.y >= pVia.y) ? (pFrom.y - pVia.y) : (pVia.y - pFrom.y);997 double dx = pFrom.x >= pVia.x ? pFrom.x - pVia.x : pVia.x - pFrom.x; 998 double dy = pFrom.y >= pVia.y ? pFrom.y - pVia.y : pVia.y - pFrom.y; 999 999 1000 1000 double fromAngle; -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java
r8325 r8345 264 264 } 265 265 266 final int size = max( (ds.isSelected(n) ? selectedNodeSize : 0),267 (isNodeTagged(n) ? taggedNodeSize : 0),268 (n.isConnectionNode() ? connectionNodeSize : 0),266 final int size = max(ds.isSelected(n) ? selectedNodeSize : 0, 267 isNodeTagged(n) ? taggedNodeSize : 0, 268 n.isConnectionNode() ? connectionNodeSize : 0, 269 269 unselectedNodeSize); 270 270 -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java
r8332 r8345 276 276 277 277 public boolean isLoaded() { 278 return (topLevelSubGrid != null);278 return topLevelSubGrid != null; 279 279 } 280 280 -
trunk/src/org/openstreetmap/josm/data/projection/proj/LambertConformalConic.java
r6883 r8345 129 129 protected double t(double lat_rad) { 130 130 return tan(PI/4 - lat_rad / 2.0) 131 / pow(( (1.0 - e * sin(lat_rad)) / (1.0 + e * sin(lat_rad))), e/2);131 / pow((1.0 - e * sin(lat_rad)) / (1.0 + e * sin(lat_rad)), e/2); 132 132 } 133 133 -
trunk/src/org/openstreetmap/josm/data/projection/proj/TransverseMercator.java
r6362 r8345 229 229 230 230 /* Precalculate epsilon */ 231 double epsilon = (315.0 * pow(n, 4.0) / 512.0);231 double epsilon = 315.0 * pow(n, 4.0) / 512.0; 232 232 233 233 /* Now calculate the sum of the series and return */ … … 276 276 277 277 /* Precalculate epsilon_ (Eq. 10.22) */ 278 double epsilon_ = (1097.0 * pow(n, 4.0) / 512.0);278 double epsilon_ = 1097.0 * pow(n, 4.0) / 512.0; 279 279 280 280 /* Now calculate the sum of the series (Eq. 10.21) */ … … 284 284 + (epsilon_ * sin(8.0 * y_)); 285 285 } 286 287 286 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/DomainValidator.java
r8290 r8345 170 170 */ 171 171 public boolean isValidInfrastructureTld(String iTld) { 172 return Arrays.binarySearch(INFRASTRUCTURE_TLDS, (chompLeadingDot(iTld.toLowerCase()))) >= 0;172 return Arrays.binarySearch(INFRASTRUCTURE_TLDS, chompLeadingDot(iTld.toLowerCase())) >= 0; 173 173 } 174 174 -
trunk/src/org/openstreetmap/josm/data/validation/routines/RegexValidator.java
r7937 r8345 107 107 } 108 108 patterns = new Pattern[regexs.length]; 109 int flags = (caseSensitive ? 0: Pattern.CASE_INSENSITIVE);109 int flags = caseSensitive ? 0: Pattern.CASE_INSENSITIVE; 110 110 for (int i = 0; i < regexs.length; i++) { 111 111 if (regexs[i] == null || regexs[i].length() == 0) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java
r8342 r8345 237 237 public boolean isFixable(TestError testError) { 238 238 if (testError.getTester() instanceof Coastlines) 239 return (testError.getCode() == REVERSED_COASTLINE);239 return testError.getCode() == REVERSED_COASTLINE; 240 240 241 241 return false; -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java
r8338 r8345 309 309 } 310 310 } 311 return (relationsWithRelations <= 1);311 return relationsWithRelations <= 1; 312 312 } 313 313 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java
r8338 r8345 323 323 } 324 324 } 325 return (waysWithRelations <= 1);325 return waysWithRelations <= 1; 326 326 } 327 327 } -
trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java
r7005 r8345 162 162 MessagePanel pnl = new MessagePanel(message, isInBulkOperation(preferenceKey)); 163 163 ret = JOptionPane.showConfirmDialog(parent, pnl, title, optionType, messageType); 164 if ( (isYesOrNo(ret))) {164 if (isYesOrNo(ret)) { 165 165 pnl.getNotShowAgain().store(preferenceKey, ret); 166 166 } -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r8342 r8345 1292 1292 public static double perDist(Point2D pt, Point2D a, Point2D b) { 1293 1293 if (pt != null && a != null && b != null) { 1294 double pd = (1294 double pd = 1295 1295 (a.getX()-pt.getX())*(b.getX()-a.getX()) - 1296 (a.getY()-pt.getY())*(b.getY()-a.getY()) );1296 (a.getY()-pt.getY())*(b.getY()-a.getY()); 1297 1297 return Math.abs(pd) / a.distance(b); 1298 1298 } … … 1310 1310 public static Point2D project(Point2D pt, Point2D a, Point2D b) { 1311 1311 if (pt != null && a != null && b != null) { 1312 double r = ( (1312 double r = ( 1313 1313 (pt.getX()-a.getX())*(b.getX()-a.getX()) + 1314 1314 (pt.getY()-a.getY())*(b.getY()-a.getY()) ) 1315 / a.distanceSq(b) );1315 / a.distanceSq(b); 1316 1316 return project(r, a, b); 1317 1317 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
r8342 r8345 157 157 final int ph = dlg.getPreferredHeight(); 158 158 final int ah = dlg.getSize().height; 159 dlg.setPreferredSize(new Dimension(Integer.MAX_VALUE, (ah < 20 ? ph : ah)));159 dlg.setPreferredSize(new Dimension(Integer.MAX_VALUE, ah < 20 ? ph : ah)); 160 160 } 161 161 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r8308 r8345 147 147 for(int i=0; i < 10; i++) { 148 148 visibilityToggleShortcuts[i] = Shortcut.registerShortcut("subwindow:layers:toggleLayer" + (i+1), 149 tr("Toggle visibility of layer: {0}", (i+1)), k[i], Shortcut.ALT);149 tr("Toggle visibility of layer: {0}", i+1), k[i], Shortcut.ALT); 150 150 visibilityToggleActions[i] = new ToggleLayerIndexVisibility(i); 151 151 Main.registerActionShortcut(visibilityToggleActions[i], visibilityToggleShortcuts[i]); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r8342 r8345 325 325 return this; 326 326 Component c = super.getTableCellRendererComponent(table, value, isSelected, false, row, column); 327 boolean isDisabledAndHidden = (( (Relation)table.getValueAt(row, 0))).isDisabledAndHidden();327 boolean isDisabledAndHidden = ((Relation)table.getValueAt(row, 0)).isDisabledAndHidden(); 328 328 if (c instanceof JLabel) { 329 329 JLabel label = (JLabel) c; … … 341 341 boolean isSelected, boolean hasFocus, int row, int column) { 342 342 Component c = super.getTableCellRendererComponent(table, value, isSelected, false, row, column); 343 boolean isDisabledAndHidden = (( (Relation)table.getValueAt(row, 0))).isDisabledAndHidden();343 boolean isDisabledAndHidden = ((Relation)table.getValueAt(row, 0)).isDisabledAndHidden(); 344 344 if (c instanceof JLabel) { 345 345 JLabel label = (JLabel)c; … … 795 795 int row = tagTable.rowAtPoint(e.getPoint()); 796 796 if (row > -1) { 797 boolean focusOnKey = (tagTable.columnAtPoint(e.getPoint()) == 0);797 boolean focusOnKey = tagTable.columnAtPoint(e.getPoint()) == 0; 798 798 editHelper.editTag(row, focusOnKey); 799 799 } else { … … 942 942 int rowCount = membershipTable.getRowCount(); 943 943 if (rowCount > 1) { 944 nextRelation = (Relation)membershipData.getValueAt( (row + 1 < rowCount ? row + 1 : row - 1), 0);944 nextRelation = (Relation)membershipData.getValueAt(row + 1 < rowCount ? row + 1 : row - 1, 0); 945 945 } 946 946 -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableLinkedCellRenderer.java
r8342 r8345 186 186 } 187 187 188 if ( (arrow != null)) {188 if (arrow != null) { 189 189 g.drawImage(arrow, xoff+xowloop-3, (y1 + y2) / 2 - 2, null); 190 190 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationNodeMap.java
r8338 r8345 86 86 87 87 Way w = m.getWay(); 88 if ( (RelationSortUtils.roundaboutType(w) != NONE)) {88 if (RelationSortUtils.roundaboutType(w) != NONE) { 89 89 for (Node nd : w.getNodes()) { 90 90 addPair(nd, i); -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java
r8332 r8345 226 226 else 227 227 // reload if the history object of the selected object is not in the cache yet 228 return (!p.isNew() && h.getByVersion(p.getUniqueId()) == null);228 return !p.isNew() && h.getByVersion(p.getUniqueId()) == null; 229 229 } 230 230 }; -
trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java
r8264 r8345 149 149 for (int x = 0; x < 2; x++) { 150 150 Dimension d = toolTip.getUI().getPreferredSize(toolTip); 151 d.width = Math.min(d.width, (mv.getWidth() / 2));151 d.width = Math.min(d.width, mv.getWidth() / 2); 152 152 if (d.width > 0 && d.height > 0) { 153 153 toolTip.setSize(d); -
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r8344 r8345 310 310 try { 311 311 String xml = attributionLoader.updateIfRequiredString(); 312 return parseAttributionText(new InputSource(new StringReader( (xml))));312 return parseAttributionText(new InputSource(new StringReader(xml))); 313 313 } catch (IOException ex) { 314 314 Main.warn("Could not connect to Bing API. Will retry in " + waitTimeSec + " seconds."); … … 749 749 */ 750 750 Tile getTile(int x, int y, int zoom) { 751 int max = (1 << zoom);751 int max = 1 << zoom; 752 752 if (x < 0 || x >= max || y < 0 || y >= max) 753 753 return null; … … 794 794 @Override 795 795 public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { 796 boolean done = ( (infoflags & (ERROR | FRAMEBITS | ALLBITS)) != 0);796 boolean done = (infoflags & (ERROR | FRAMEBITS | ALLBITS)) != 0; 797 797 needRedraw = true; 798 798 if (Main.isDebugEnabled()) { -
trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java
r7005 r8345 73 73 Object tn = errorMessages.nextElement().getUserObject(); 74 74 if (tn instanceof TestError) { 75 paintVisitor.visit(( (TestError) tn));75 paintVisitor.visit((TestError) tn); 76 76 } 77 77 } -
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r8308 r8345 394 394 */ 395 395 public int getBaseImageWidth() { 396 int overlap = PROP_OVERLAP.get() ? (PROP_OVERLAP_EAST.get() * imageSize / 100): 0;396 int overlap = PROP_OVERLAP.get() ? PROP_OVERLAP_EAST.get() * imageSize / 100 : 0; 397 397 return imageSize + overlap; 398 398 } … … 403 403 */ 404 404 public int getBaseImageHeight() { 405 int overlap = PROP_OVERLAP.get() ? (PROP_OVERLAP_NORTH.get() * imageSize / 100): 0;405 int overlap = PROP_OVERLAP.get() ? PROP_OVERLAP_NORTH.get() * imageSize / 100 : 0; 406 406 return imageSize + overlap; 407 407 } … … 1081 1081 @Override 1082 1082 public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { 1083 boolean done = ( (infoflags & (ERROR | FRAMEBITS | ALLBITS)) != 0);1083 boolean done = (infoflags & (ERROR | FRAMEBITS | ALLBITS)) != 0; 1084 1084 Main.map.repaint(done ? 0 : 100); 1085 1085 return !done; -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r8318 r8345 144 144 FileFilter filter = new FileFilter(){ 145 145 @Override public boolean accept(File f) { 146 return (f.isDirectory()146 return f.isDirectory() 147 147 || f .getName().toLowerCase().endsWith(".gpx") 148 || f.getName().toLowerCase().endsWith(".gpx.gz") );148 || f.getName().toLowerCase().endsWith(".gpx.gz"); 149 149 } 150 150 @Override public String getDescription() { … … 1180 1180 // Time between the track point and the previous one, 5 sec if first point, i.e. photos take 1181 1181 // 5 sec before the first track point can be assumed to be take at the starting position 1182 long interval = prevWpTime > 0 ? (Math.abs(curWpTime - prevWpTime)) : 5*1000;1182 long interval = prevWpTime > 0 ? Math.abs(curWpTime - prevWpTime) : 5*1000; 1183 1183 int ret = 0; 1184 1184 -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java
r8308 r8345 324 324 checkPointInVisibleRect(p, visibleRect); 325 325 Rectangle rect = new Rectangle( 326 (p.x < mousePointInImg.x ? p.x : mousePointInImg.x),327 (p.y < mousePointInImg.y ? p.y : mousePointInImg.y),328 (p.x < mousePointInImg.x ? mousePointInImg.x - p.x : p.x - mousePointInImg.x),329 (p.y < mousePointInImg.y ? mousePointInImg.y - p.y : p.y - mousePointInImg.y));326 p.x < mousePointInImg.x ? p.x : mousePointInImg.x, 327 p.y < mousePointInImg.y ? p.y : mousePointInImg.y, 328 p.x < mousePointInImg.x ? mousePointInImg.x - p.x : p.x - mousePointInImg.x, 329 p.y < mousePointInImg.y ? mousePointInImg.y - p.y : p.y - mousePointInImg.y); 330 330 checkVisibleRectSize(image, rect); 331 331 checkVisibleRectPos(image, rect); -
trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java
r8260 r8345 83 83 public String toString() { 84 84 return "symbol=" + symbol + " size=" + size + 85 (stroke != null ? (" stroke=" + stroke + " strokeColor=" + strokeColor): "") +86 (fillColor != null ? (" fillColor=" + fillColor): "");85 (stroke != null ? " stroke=" + stroke + " strokeColor=" + strokeColor : "") + 86 (fillColor != null ? " fillColor=" + fillColor : ""); 87 87 } 88 88 } … … 325 325 } 326 326 327 final int size = Utils.max( (selected ? settings.getSelectedNodeSize() : 0),328 (n.isTagged() ? settings.getTaggedNodeSize() : 0),329 (isConnection ? settings.getConnectionNodeSize() : 0),327 final int size = Utils.max(selected ? settings.getSelectedNodeSize() : 0, 328 n.isTagged() ? settings.getTaggedNodeSize() : 0, 329 isConnection ? settings.getConnectionNodeSize() : 0, 330 330 settings.getUnselectedNodeSize()); 331 331 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r8338 r8345 536 536 537 537 for (MapCSSRule r : rules) { 538 if ( (r.selector instanceof GeneralSelector)) {538 if (r.selector instanceof GeneralSelector) { 539 539 GeneralSelector gs = (GeneralSelector) r.selector; 540 540 if (gs.getBase().equals("setting")) { … … 578 578 579 579 for (MapCSSRule r : rules) { 580 if ( (r.selector instanceof GeneralSelector)) {580 if (r.selector instanceof GeneralSelector) { 581 581 GeneralSelector gs = (GeneralSelector) r.selector; 582 582 if (gs.getBase().equals(type)) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
r8342 r8345 651 651 @Override 652 652 public String toString() { 653 return base + (Range.ZERO_TO_INFINITY.equals(range) ? "" : range) + Utils.join("", conds) + (subpart != null ? ("::" + subpart) : ""); 653 return base + (Range.ZERO_TO_INFINITY.equals(range) ? "" : range) + Utils.join("", conds) 654 + (subpart != null ? "::" + subpart : ""); 654 655 } 655 656 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
r8342 r8345 303 303 304 304 if (osm instanceof Node || (osm instanceof Relation && "restriction".equals(osm.get("type")))) { 305 IconPrototype icon = getNode(osm, (useMinMaxScale ? scale : null), mc);305 IconPrototype icon = getNode(osm, useMinMaxScale ? scale : null, mc); 306 306 if (icon != null) { 307 307 def.put(ICON_IMAGE, icon.icon); … … 318 318 } else if (osm instanceof Way || (osm instanceof Relation && ((Relation)osm).isMultipolygon())) { 319 319 WayPrototypesRecord p = new WayPrototypesRecord(); 320 get(osm, pretendWayIsClosed || !(osm instanceof Way) || ((Way) osm).isClosed(), p, (useMinMaxScale ? scale : null), mc);320 get(osm, pretendWayIsClosed || !(osm instanceof Way) || ((Way) osm).isClosed(), p, useMinMaxScale ? scale : null, mc); 321 321 if (p.line != null) { 322 322 def.put(WIDTH, new Float(p.line.getWidth())); -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r8342 r8345 322 322 @Override 323 323 public int getRowCount() { 324 int adaptable = ( (currentAction.getAction() instanceof AdaptableAction) ? 2 : 0);324 int adaptable = (currentAction.getAction() instanceof AdaptableAction) ? 2 : 0; 325 325 if (currentAction.isSeparator() || !(currentAction.getAction() instanceof ParameterizedAction)) 326 326 return adaptable; … … 903 903 for (MenuElement item : menuElement.getSubElements()) { 904 904 if (item instanceof JMenuItem) { 905 JMenuItem menuItem = ( (JMenuItem)item);905 JMenuItem menuItem = (JMenuItem)item; 906 906 if (menuItem.getAction() != null) { 907 907 Action action = menuItem.getAction(); -
trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java
r8308 r8345 361 361 try { 362 362 final TableRowSorter<? extends TableModel> sorter = 363 ( (TableRowSorter<? extends TableModel> )shortcutTable.getRowSorter());363 (TableRowSorter<? extends TableModel> )shortcutTable.getRowSorter(); 364 364 if (expr == null) { 365 365 sorter.setRowFilter(null); -
trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorPanel.java
r8308 r8345 183 183 AutoCompletionList acList = new AutoCompletionList(); 184 184 185 TagCellEditor editor = ( (TagCellEditor) tagTable.getColumnModel().getColumn(0).getCellEditor());185 TagCellEditor editor = (TagCellEditor) tagTable.getColumnModel().getColumn(0).getCellEditor(); 186 186 editor.setAutoCompletionManager(autocomplete); 187 187 editor.setAutoCompletionList(acList); -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java
r8338 r8345 108 108 putValue(Action.NAME, getName()); 109 109 putValue("toolbar", "tagging_" + getRawName()); 110 putValue(OPTIONAL_TOOLTIP_TEXT, (group != null ?110 putValue(OPTIONAL_TOOLTIP_TEXT, group != null ? 111 111 tr("Use preset ''{0}'' of group ''{1}''", getLocaleName(), group.getName()) : 112 tr("Use preset ''{0}''", getLocaleName())) );112 tr("Use preset ''{0}''", getLocaleName())); 113 113 } 114 114 -
trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetMenu.java
r7119 r8345 42 42 putValue(Action.NAME, getName()); 43 43 /** Tooltips should be shown for the toolbar buttons, but not in the menu. */ 44 putValue(OPTIONAL_TOOLTIP_TEXT, (group != null ?44 putValue(OPTIONAL_TOOLTIP_TEXT, group != null ? 45 45 tr("Preset group {1} / {0}", getLocaleName(), group.getName()) : 46 tr("Preset group {0}", getLocaleName())) );46 tr("Preset group {0}", getLocaleName())); 47 47 putValue("toolbar", "tagginggroup_" + getRawName()); 48 48 } -
trunk/src/org/openstreetmap/josm/gui/util/AdvancedKeyPressDetector.java
r8338 r8345 126 126 if (timer.isRunning()) { 127 127 timer.stop(); 128 } else if (set.add( (e.getKeyCode())) && enabled) {128 } else if (set.add(e.getKeyCode()) && enabled) { 129 129 synchronized (this) { 130 130 if (isFocusInMainWindow()) { -
trunk/src/org/openstreetmap/josm/gui/widgets/FileChooserManager.java
r7937 r8345 72 72 this.lastDirProperty = lastDirProperty == null || lastDirProperty.isEmpty() ? "lastDirectory" : lastDirProperty; 73 73 this.curDir = Main.pref.get(this.lastDirProperty).isEmpty() ? 74 (defaultDir == null || defaultDir.isEmpty() ? "." : defaultDir)74 defaultDir == null || defaultDir.isEmpty() ? "." : defaultDir 75 75 : Main.pref.get(this.lastDirProperty); 76 76 } -
trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java
r8342 r8345 560 560 Split split = (Split)root; 561 561 boolean grow = split.isRowLayout() 562 ? (split.getBounds().width <= bounds.width)562 ? split.getBounds().width <= bounds.width 563 563 : (split.getBounds().height <= bounds.height); 564 564 if (grow) { … … 1122 1122 1123 1123 private static void parseAttribute(String name, StreamTokenizer st, Node node) throws Exception { 1124 if ( (st.nextToken() != '=')) {1124 if (st.nextToken() != '=') { 1125 1125 throwParseException(st, "expected '=' after " + name); 1126 1126 } -
trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r8319 r8345 50 50 String url = "trackpoints?bbox="+b.getMinLon()+","+b.getMinLat()+","+b.getMaxLon()+","+b.getMaxLat()+"&page="; 51 51 for (int i = 0;!done;++i) { 52 progressMonitor.subTask(tr("Downloading points {0} to {1}...", i * 5000, ( (i + 1) * 5000)));52 progressMonitor.subTask(tr("Downloading points {0} to {1}...", i * 5000, (i + 1) * 5000)); 53 53 try (InputStream in = getInputStream(url+i, progressMonitor.createSubTaskMonitor(1, true))) { 54 54 if (in == null) { -
trunk/src/org/openstreetmap/josm/io/CacheFiles.java
r8338 r8345 375 375 if(CacheFiles.EXPIRE_NEVER == this.expire) 376 376 return false; 377 return (file.lastModified() < (System.currentTimeMillis() - expire*1000));377 return file.lastModified() < (System.currentTimeMillis() - expire*1000); 378 378 } 379 379 } -
trunk/src/org/openstreetmap/josm/io/Capabilities.java
r8338 r8345 73 73 Map<String, String> e = capabilities.get(element); 74 74 if (e == null) return false; 75 return (e.get(attribute) != null);75 return e.get(attribute) != null; 76 76 } 77 77 -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r8287 r8345 551 551 String message = e.getMessage(); 552 552 if (e instanceof SAXParseException) { 553 SAXParseException spe = ( (SAXParseException)e);553 SAXParseException spe = (SAXParseException)e; 554 554 message += " " + tr("(at line {0}, column {1})", spe.getLineNumber(), spe.getColumnNumber()); 555 555 } -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r8304 r8345 420 420 CheckParameterUtil.ensureParameterNotNull(changeset, "changeset"); 421 421 try { 422 progressMonitor.beginTask( (tr("Creating changeset...")));422 progressMonitor.beginTask(tr("Creating changeset...")); 423 423 initialize(progressMonitor); 424 424 String ret = ""; … … 430 430 throw new OsmTransferException(tr("Unexpected format of ID replied by the server. Got ''{0}''.", ret)); 431 431 } 432 progressMonitor.setCustomText( (tr("Successfully opened changeset {0}",changeset.getId())));432 progressMonitor.setCustomText(tr("Successfully opened changeset {0}",changeset.getId())); 433 433 } finally { 434 434 progressMonitor.finishTask(); -
trunk/src/org/openstreetmap/josm/io/OsmWriter.java
r7575 r8345 90 90 protected static final Comparator<OsmPrimitive> byIdComparator = new Comparator<OsmPrimitive>() { 91 91 @Override public int compare(OsmPrimitive o1, OsmPrimitive o2) { 92 return (o1.getUniqueId()<o2.getUniqueId() ? -1 : (o1.getUniqueId()==o2.getUniqueId() ? 0 : 1));92 return o1.getUniqueId()<o2.getUniqueId() ? -1 : (o1.getUniqueId()==o2.getUniqueId() ? 0 : 1); 93 93 } 94 94 }; -
trunk/src/org/openstreetmap/josm/io/UTFInputStreamReader.java
r7509 r8345 54 54 55 55 if (unread > 0) { 56 pushbackStream.unread(bom, (n - unread), unread);56 pushbackStream.unread(bom, n - unread, unread); 57 57 } else if (unread < -1) { 58 58 pushbackStream.unread(bom, 0, 0); -
trunk/src/org/openstreetmap/josm/io/imagery/WMSGrabber.java
r7659 r8345 247 247 } 248 248 249 if ( (!request.isReal() && !layer.hasAutoDownload())){249 if (!request.isReal() && !layer.hasAutoDownload()){ 250 250 request.finish(State.NOT_IN_CACHE, null, null); 251 251 return true; -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r8338 r8345 1367 1367 }), GBC.eol()); 1368 1368 1369 JosmTextArea description = new JosmTextArea( (info.description == null ? tr("no description available")1370 : info.description) );1369 JosmTextArea description = new JosmTextArea(info.description == null ? tr("no description available") 1370 : info.description); 1371 1371 description.setEditable(false); 1372 1372 description.setFont(new JLabel().getFont().deriveFont(Font.ITALIC)); -
trunk/src/org/openstreetmap/josm/tools/ColorHelper.java
r6830 r8345 32 32 Integer.parseInt(html.substring(2,4),16), 33 33 Integer.parseInt(html.substring(4,6),16), 34 (html.length() == 8 ? Integer.parseInt(html.substring(6,8),16) : 255));34 html.length() == 8 ? Integer.parseInt(html.substring(6,8),16) : 255); 35 35 } catch (NumberFormatException e) { 36 36 return null; -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r8342 r8345 449 449 CheckParameterUtil.ensureValidCoordinates(secondNode, "secondNode"); 450 450 451 double dy1 = (firstNode.getY() - commonNode.getY());452 double dy2 = (secondNode.getY() - commonNode.getY());453 double dx1 = (firstNode.getX() - commonNode.getX());454 double dx2 = (secondNode.getX() - commonNode.getX());451 double dy1 = firstNode.getY() - commonNode.getY(); 452 double dy2 = secondNode.getY() - commonNode.getY(); 453 double dx1 = firstNode.getX() - commonNode.getX(); 454 double dx2 = secondNode.getX() - commonNode.getX(); 455 455 456 456 return dy1 * dx2 - dx1 * dy2 > 0; … … 651 651 dlat = lat2 - lat1; 652 652 653 double a = (Math.pow(Math.sin(dlat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2), 2));653 double a = Math.pow(Math.sin(dlat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2), 2); 654 654 double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 655 655 return 6367000 * c; … … 668 668 dlat = lat2 - lat1; 669 669 670 double a = (Math.pow(Math.sin(dlat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2), 2));670 double a = Math.pow(Math.sin(dlat/2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin(dlon/2), 2); 671 671 double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 672 672 return 6367000 * c; -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r8292 r8345 694 694 switch(pluralMode) { 695 695 case MODE_NOTONE: /* bg, da, de, el, en, en_GB, es, et, eu, fi, gl, is, it, iw_IL, nb, nl, sv */ 696 return ( (n != 1) ? 1 : 0);696 return (n != 1) ? 1 : 0; 697 697 case MODE_NONE: /* id, ja, km, tr, zh_CN, zh_TW */ 698 698 return 0; 699 699 case MODE_GREATERONE: /* fr, pt_BR */ 700 return ( (n > 1) ? 1 : 0);700 return (n > 1) ? 1 : 0; 701 701 case MODE_CS: 702 return ( (n == 1) ? 0 : (((n >= 2) && (n <= 4)) ? 1 : 2));702 return (n == 1) ? 0 : (((n >= 2) && (n <= 4)) ? 1 : 2); 703 703 //case MODE_AR: 704 704 // return ((n == 0) ? 0 : ((n == 1) ? 1 : ((n == 2) ? 2 : ((((n % 100) >= 3) 705 705 // && ((n % 100) <= 10)) ? 3 : ((((n % 100) >= 11) && ((n % 100) <= 99)) ? 4 : 5))))); 706 706 case MODE_PL: 707 return ( (n == 1) ? 0 : (((((n % 10) >= 2) && ((n % 10) <= 4))708 && (((n % 100) < 10) || ((n % 100) >= 20))) ? 1 : 2) );707 return (n == 1) ? 0 : (((((n % 10) >= 2) && ((n % 10) <= 4)) 708 && (((n % 100) < 10) || ((n % 100) >= 20))) ? 1 : 2); 709 709 //case MODE_RO: 710 710 // return ((n == 1) ? 0 : ((((n % 100) > 19) || (((n % 100) == 0) && (n != 0))) ? 2 : 1)); 711 711 case MODE_LT: 712 return (( (n % 10) == 1) && ((n % 100) != 11) ? 0 : (((n % 10) >= 2)713 && (((n % 100) < 10) || ((n % 100) >= 20)) ? 1 : 2) );712 return ((n % 10) == 1) && ((n % 100) != 11) ? 0 : (((n % 10) >= 2) 713 && (((n % 100) < 10) || ((n % 100) >= 20)) ? 1 : 2); 714 714 case MODE_RU: 715 return ((( (n % 10) == 1) && ((n % 100) != 11)) ? 0 : (((((n % 10) >= 2)716 && ((n % 10) <= 4)) && (((n % 100) < 10) || ((n % 100) >= 20))) ? 1 : 2) );715 return (((n % 10) == 1) && ((n % 100) != 11)) ? 0 : (((((n % 10) >= 2) 716 && ((n % 10) <= 4)) && (((n % 100) < 10) || ((n % 100) >= 20))) ? 1 : 2); 717 717 case MODE_SK: 718 return ( (n == 1) ? 1 : (((n >= 2) && (n <= 4)) ? 2 : 0));718 return (n == 1) ? 1 : (((n >= 2) && (n <= 4)) ? 2 : 0); 719 719 //case MODE_SL: 720 720 // return (((n % 100) == 1) ? 1 : (((n % 100) == 2) ? 2 : ((((n % 100) == 3) -
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r8338 r8345 291 291 public static String getURL(double dlat, double dlon, int zoom) { 292 292 // Truncate lat and lon to something more sensible 293 int decimals = (int) Math.pow(10, (zoom / 3));294 double lat = (Math.round(dlat * decimals));293 int decimals = (int) Math.pow(10, zoom / 3); 294 double lat = Math.round(dlat * decimals); 295 295 lat /= decimals; 296 double lon = (Math.round(dlon * decimals));296 double lon = Math.round(dlon * decimals); 297 297 lon /= decimals; 298 298 return Main.getOSMWebsite() + "/#map="+zoom+"/"+lat+"/"+lon; -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r8338 r8345 148 148 // create a shortcut object from an string as saved in the preferences 149 149 private Shortcut(String prefString) { 150 List<String> s = (new ArrayList<>(Main.pref.getCollection(prefString)));150 List<String> s = new ArrayList<>(Main.pref.getCollection(prefString)); 151 151 this.shortText = prefString.substring(15); 152 152 this.longText = s.get(0);
Note:
See TracChangeset
for help on using the changeset viewer.