- Timestamp:
- 2015-05-17T15:52:24+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 45 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
r8378 r8384 232 232 // center. This method is ok as long as distances are short 233 233 // relative to the distance from the N or S poles. 234 if ( radius== 0) {234 if (Double.doubleToRawLongBits(radius) == 0) { 235 235 for (Node n : nodes) { 236 236 radius += distance(center, n.getEastNorth()); -
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r8357 r8384 363 363 b = xM - xB; 364 364 double norm = Math.sqrt(a*a + b*b); 365 if ( norm== 0)365 if (Double.doubleToRawLongBits(norm) == 0) 366 366 // Nodes have same coordinates ! 367 367 throw new InvalidSelection(); -
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r8357 r8384 46 46 import org.openstreetmap.josm.tools.Pair; 47 47 import org.openstreetmap.josm.tools.Shortcut; 48 import org.openstreetmap.josm.tools.Utils; 48 49 49 50 /** … … 357 358 double candidateAngle = getAngle(headNode, candidatePrevNode, prevNode); 358 359 359 if(mostLeft == null || candidateAngle < angle || (candidateAngle == angle&& !candidateComingToHead)) {360 if(mostLeft == null || candidateAngle < angle || (Utils.equalsEpsilon(candidateAngle, angle) && !candidateComingToHead)) { 360 361 // Candidate is most left 361 362 mostLeft = candidateWay; -
trunk/src/org/openstreetmap/josm/actions/SelectByInternalPointAction.java
r8338 r8384 61 61 EastNorth en2 = Main.map.mapView.getProjection().latlon2eastNorth(bBox.getBottomRight()); 62 62 double s = Math.abs((en1.east() - en2.east()) * (en1.north() - en2.north())); 63 if (s == 0) s = 1e8; 63 if (Double.doubleToRawLongBits(s) == 0) { 64 s = 1e8; 65 } 64 66 found.put(s, r); 65 67 } -
trunk/src/org/openstreetmap/josm/actions/audio/AudioPlayPauseAction.java
r6830 r8384 14 14 import org.openstreetmap.josm.tools.AudioPlayer; 15 15 import org.openstreetmap.josm.tools.Shortcut; 16 import org.openstreetmap.josm.tools.Utils; 16 17 17 18 /** … … 38 39 AudioPlayer.play(url); 39 40 } else if (AudioPlayer.playing()){ 40 if (AudioPlayer.speed() != 1.0)41 if (!Utils.equalsEpsilon(AudioPlayer.speed(), 1.0)) 41 42 AudioPlayer.play(url, AudioPlayer.position()); 42 43 else -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r8378 r8384 1005 1005 // In practice this will probably only happen when a way has been duplicated 1006 1006 1007 if ( u== 0)1007 if (Double.doubleToRawLongBits(u) == 0) 1008 1008 return; 1009 1009 -
trunk/src/org/openstreetmap/josm/actions/mapmode/PlayHeadDragMode.java
r8308 r8384 60 60 dragging = true; 61 61 } 62 if (p.distance(mousePos) == 0) return; 62 if (Double.doubleToRawLongBits(p.distance(mousePos)) == 0) return; 63 63 playHeadMarker.drag(Main.map.mapView.getEastNorth(ev.getX(), ev.getY())); 64 64 mousePos = p; -
trunk/src/org/openstreetmap/josm/data/ProjectionBounds.java
r7816 r8384 3 3 4 4 import org.openstreetmap.josm.data.coor.EastNorth; 5 import org.openstreetmap.josm.tools.Utils; 5 6 6 7 /** … … 25 26 this.maxNorth = max.north(); 26 27 } 28 27 29 public ProjectionBounds(EastNorth p) { 28 30 this.minEast = this.maxEast = p.east(); 29 31 this.minNorth = this.maxNorth = p.north(); 30 32 } 33 31 34 public ProjectionBounds(EastNorth center, double east, double north) { 32 35 this.minEast = center.east()-east/2.0; … … 35 38 this.maxNorth = center.north()+north/2.0; 36 39 } 40 37 41 public ProjectionBounds(double minEast, double minNorth, double maxEast, double maxNorth) { 38 42 this.minEast = minEast; … … 41 45 this.maxNorth = maxNorth; 42 46 } 43 public void extend(EastNorth e) 44 { 47 48 public void extend(EastNorth e) { 45 49 if (e.east() < minEast) { 46 50 minEast = e.east(); … … 56 60 } 57 61 } 58 public EastNorth getCenter() 59 { 62 63 public EastNorth getCenter() { 60 64 return new EastNorth((minEast + maxEast) / 2.0, (minNorth + maxNorth) / 2.0); 61 65 } 62 66 63 @Override public String toString() { 67 @Override 68 public String toString() { 64 69 return "ProjectionBounds["+minEast+","+minNorth+","+maxEast+","+maxNorth+"]"; 65 70 } … … 85 90 86 91 public boolean hasExtend() { 87 return minEast !=maxEast||minNorth!=maxNorth;92 return !Utils.equalsEpsilon(minEast, maxEast) || !Utils.equalsEpsilon(minNorth, maxNorth); 88 93 } 89 94 } -
trunk/src/org/openstreetmap/josm/data/coor/QuadTiling.java
r8345 r8384 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.coor; 3 4 import org.openstreetmap.josm.tools.Utils; 3 5 4 6 public final class QuadTiling { … … 68 70 static long lon2x(double lon) { 69 71 long ret = (long)((lon + 180.0) * WORLD_PARTS / 360.0); 70 if ( ret ==WORLD_PARTS) {72 if (Utils.equalsEpsilon(ret, WORLD_PARTS)) { 71 73 ret--; 72 74 } … … 76 78 static long lat2y(double lat) { 77 79 long ret = (long)((lat + 90.0) * WORLD_PARTS / 180.0); 78 if ( ret ==WORLD_PARTS) {80 if (Utils.equalsEpsilon(ret, WORLD_PARTS)) { 79 81 ret--; 80 82 } -
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r8373 r8384 18 18 import org.openstreetmap.josm.data.DataSource; 19 19 import org.openstreetmap.josm.data.coor.EastNorth; 20 import org.openstreetmap.josm.tools.Utils; 20 21 21 22 /** … … 211 212 */ 212 213 public Date[] getMinMaxTimeForAllTracks() { 213 double min=1e100, max=-1e100, t; 214 double min=1e100; 215 double max=-1e100; 214 216 double now = System.currentTimeMillis()/1000.0; 215 217 for (GpxTrack trk: tracks) { 216 218 for (GpxTrackSegment seg : trk.getSegments()) { 217 219 for (WayPoint pnt : seg.getWayPoints()) { 218 t = pnt.time; 220 double t = pnt.time; 219 221 if (t>0 && t<=now) { 220 222 if (t>max) max=t; … … 224 226 } 225 227 } 226 if ( min==1e100 || max==-1e100) return null;227 return new Date[]{new Date((long) (min * 1000)), new Date((long) (max * 1000)) ,};228 if (Utils.equalsEpsilon(min,1e100) || Utils.equalsEpsilon(max,-1e100)) return new Date[0]; 229 return new Date[]{new Date((long) (min * 1000)), new Date((long) (max * 1000))}; 228 230 } 229 231 … … 293 295 double C = -A * rx - B * ry; 294 296 double RSsq = A * A + B * B; 295 if ( RSsq == 0.0) {297 if (Double.doubleToRawLongBits(RSsq) == 0) { 296 298 continue; 297 299 } -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r8365 r8384 948 948 public String getToolbarName() { 949 949 String res = name; 950 if(pixelPerDegree != 0.0) {950 if (Double.doubleToRawLongBits(pixelPerDegree) != 0) { 951 951 res += "#PPD="+pixelPerDegree; 952 952 } … … 956 956 public String getMenuName() { 957 957 String res = name; 958 if(pixelPerDegree != 0.0) {958 if (Double.doubleToRawLongBits(pixelPerDegree) != 0) { 959 959 res += " ("+pixelPerDegree+")"; 960 960 } -
trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java
r8338 r8384 71 71 res.add(String.valueOf(dx)); 72 72 res.add(String.valueOf(dy)); 73 if ( this.centerX != 0 ||this.centerY != 0) {73 if (Double.doubleToRawLongBits(centerX) != 0 || Double.doubleToRawLongBits(centerY) != 0) { 74 74 res.add(String.valueOf(centerX)); 75 75 res.add(String.valueOf(centerY)); -
trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java
r8357 r8384 354 354 private CacheEntry findEntry(ProjectionEntries projectionEntries, double pixelPerDegree, double east, double north) { 355 355 for (CacheEntry entry: projectionEntries.entries) { 356 if (entry.pixelPerDegree == pixelPerDegree && entry.east == east && entry.north == north) 356 if (Utils.equalsEpsilon(entry.pixelPerDegree, pixelPerDegree) 357 && Utils.equalsEpsilon(entry.east, east) && Utils.equalsEpsilon(entry.north, north)) 357 358 return entry; 358 359 } -
trunk/src/org/openstreetmap/josm/data/osm/BBox.java
r7509 r8384 274 274 if (o instanceof BBox) { 275 275 BBox b = (BBox)o; 276 return b.xmax == xmax && b.ymax == ymax && b.xmin == xmin && b.ymin == ymin; 276 return Utils.equalsEpsilon(b.xmax, xmax) && Utils.equalsEpsilon(b.ymax, ymax) 277 && Utils.equalsEpsilon(b.xmin, xmin) && Utils.equalsEpsilon(b.ymin, ymin); 277 278 } else 278 279 return false; … … 281 282 @Override 282 283 public String toString() { 283 return "[ x: " + xmin + " -> " + xmax + 284 ", y: " + ymin + " -> " + ymax + " ]"; 284 return "[ x: " + xmin + " -> " + xmax + ", y: " + ymin + " -> " + ymax + " ]"; 285 285 } 286 286 -
trunk/src/org/openstreetmap/josm/data/osm/NodePositionComparator.java
r8308 r8384 26 26 return -1; 27 27 double dLon = n1.getCoor().lon() - n2.getCoor().lon(); 28 if ( dLon== 0)28 if (Double.doubleToRawLongBits(dLon) == 0) 29 29 return 0; 30 30 return dLon > 0 ? 1 : -1; -
trunk/src/org/openstreetmap/josm/data/osm/Storage.java
r8290 r8384 90 90 private int size; 91 91 private volatile int modCount = 0; 92 private floatloadFactor = 0.6f;92 private double loadFactor = 0.6d; 93 93 private static final int DEFAULT_CAPACITY = 16; 94 94 private final boolean safeIterator; -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r8377 r8384 99 99 private class OffsetIterator implements Iterator<Point> { 100 100 101 private List<Node> nodes; 102 private f loatoffset;101 private final List<Node> nodes; 102 private final double offset; 103 103 private int idx; 104 104 … … 110 110 private int xPrev0, yPrev0; 111 111 112 public OffsetIterator(List<Node> nodes, floatoffset) {112 public OffsetIterator(List<Node> nodes, double offset) { 113 113 this.nodes = nodes; 114 114 this.offset = offset; … … 123 123 @Override 124 124 public Point next() { 125 if (Math.abs(offset) < 0.1 f) return nc.getPoint(nodes.get(idx++));125 if (Math.abs(offset) < 0.1d) return nc.getPoint(nodes.get(idx++)); 126 126 127 127 Point current = nc.getPoint(nodes.get(idx)); … … 138 138 Point next = nc.getPoint(nodes.get(idx+1)); 139 139 140 int dx _next = next.x - current.x;141 int dy _next = next.y - current.y;142 double len _next = Math.sqrt(dx_next*dx_next + dy_next*dy_next);143 144 if ( len_next== 0) {145 len _next = 1; // value does not matter, because dy_next and dx_next is 0146 } 147 148 int x _current0 = current.x + (int) Math.round(offset * dy_next / len_next);149 int y _current0 = current.y - (int) Math.round(offset * dx_next / len_next);140 int dxNext = next.x - current.x; 141 int dyNext = next.y - current.y; 142 double lenNext = Math.sqrt(dxNext*dxNext + dyNext*dyNext); 143 144 if (Double.doubleToRawLongBits(lenNext) == 0) { 145 lenNext = 1; // value does not matter, because dy_next and dx_next is 0 146 } 147 148 int xCurrent0 = current.x + (int) Math.round(offset * dyNext / lenNext); 149 int yCurrent0 = current.y - (int) Math.round(offset * dxNext / lenNext); 150 150 151 151 if (idx==0) { 152 152 ++idx; 153 153 prev = current; 154 xPrev0 = x _current0;155 yPrev0 = y _current0;156 return new Point(x _current0, y_current0);154 xPrev0 = xCurrent0; 155 yPrev0 = yCurrent0; 156 return new Point(xCurrent0, yCurrent0); 157 157 } else { 158 int dx_prev = current.x - prev.x; 159 int dy_prev = current.y - prev.y; 160 161 // determine intersection of the lines parallel to the two 162 // segments 163 int det = dx_next*dy_prev - dx_prev*dy_next; 158 int dxPrev = current.x - prev.x; 159 int dyPrev = current.y - prev.y; 160 161 // determine intersection of the lines parallel to the two segments 162 int det = dxNext*dyPrev - dxPrev*dyNext; 164 163 165 164 if (det == 0) { 166 165 ++idx; 167 166 prev = current; 168 xPrev0 = x _current0;169 yPrev0 = y _current0;170 return new Point(x _current0, y_current0);171 } 172 173 int m = dx _next*(y_current0 - yPrev0) - dy_next*(x_current0 - xPrev0);174 175 int cx _= xPrev0 + Math.round((float)m * dx_prev / det);176 int cy _= yPrev0 + Math.round((float)m * dy_prev / det);167 xPrev0 = xCurrent0; 168 yPrev0 = yCurrent0; 169 return new Point(xCurrent0, yCurrent0); 170 } 171 172 int m = dxNext*(yCurrent0 - yPrev0) - dyNext*(xCurrent0 - xPrev0); 173 174 int cx = xPrev0 + (int) Math.round((double)m * dxPrev / det); 175 int cy = yPrev0 + (int) Math.round((double)m * dyPrev / det); 177 176 ++idx; 178 177 prev = current; 179 xPrev0 = x _current0;180 yPrev0 = y _current0;181 return new Point(cx _, cy_);178 xPrev0 = xCurrent0; 179 yPrev0 = yCurrent0; 180 return new Point(cx, cy); 182 181 } 183 182 } … … 452 451 g.setPaint(texture); 453 452 Float alpha = fillImage.getAlphaFloat(); 454 if ( alpha != 1f) {453 if (!Utils.equalsEpsilon(alpha, 1f)) { 455 454 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); 456 455 } … … 602 601 LineMetrics metrics = text.font.getLineMetrics(s, frc); 603 602 if (bs.vAlign == VerticalTextAlignment.ABOVE) { 604 y -= - 603 y -= -box.y + metrics.getDescent(); 605 604 } else if (bs.vAlign == VerticalTextAlignment.TOP) { 606 y -= - 605 y -= -box.y - metrics.getAscent(); 607 606 } else if (bs.vAlign == VerticalTextAlignment.CENTER) { 608 607 y += (metrics.getAscent() - metrics.getDescent()) / 2; … … 623 622 * @param spacing spacing between two images 624 623 * @param phase initial spacing 625 * @param align alignment of the image. The top, center or bottom edge 626 * can be aligned with the way. 624 * @param align alignment of the image. The top, center or bottom edge can be aligned with the way. 627 625 */ 628 public void drawRepeatImage(Way way, MapImage pattern, boolean disabled, float offset, float spacing, float phase, LineImageAlignment align) { 626 public void drawRepeatImage(Way way, MapImage pattern, boolean disabled, double offset, double spacing, double phase, 627 LineImageAlignment align) { 629 628 final int imgWidth = pattern.getWidth(); 630 629 final double repeat = imgWidth + spacing; … … 744 743 float alpha = img.getAlphaFloat(); 745 744 746 if ( alpha != 1f) {745 if (!Utils.equalsEpsilon(alpha, 1f)) { 747 746 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); 748 747 } … … 999 998 1000 999 double fromAngle; 1001 if (dx == 0.0) {1000 if (Double.doubleToRawLongBits(dx) == 0) { 1002 1001 fromAngle = Math.PI/2; 1003 1002 } else { … … 1157 1156 double end = longHalfSegmentEnd.get(i); 1158 1157 double dist = Math.abs(0.5 * (end + start) - 0.5 * pathLength); 1159 if (longHalfsegmentQuality.get(i) > bestQuality || (dist < bestDistanceToCenter && longHalfsegmentQuality.get(i) == bestQuality)) { 1158 if (longHalfsegmentQuality.get(i) > bestQuality 1159 || (dist < bestDistanceToCenter && Utils.equalsEpsilon(longHalfsegmentQuality.get(i), bestQuality))) { 1160 1160 bestStart = start; 1161 1161 bestEnd = end; … … 1315 1315 if (showHeadArrowOnly ? !it.hasNext() : showOrientation) { 1316 1316 final double segmentLength = p1.distance(p2); 1317 if (segmentLength != 0.0) {1317 if (Double.doubleToRawLongBits(segmentLength) != 0) { 1318 1318 final double l = (10. + line.getLineWidth()) / segmentLength; 1319 1319 … … 1328 1328 if (showOneway) { 1329 1329 final double segmentLength = p1.distance(p2); 1330 if (segmentLength != 0.0) {1330 if (Double.doubleToRawLongBits(segmentLength) != 0) { 1331 1331 final double nx = (p2.x - p1.x) / segmentLength; 1332 1332 final double ny = (p2.y - p1.y) / segmentLength; -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r8346 r8384 342 342 boolean isCentric = true; 343 343 for (Double param : towgs84Param) { 344 if ( param != 0.0) {344 if (Double.doubleToRawLongBits(param) != 0) { 345 345 isCentric = false; 346 346 break; … … 351 351 boolean is3Param = true; 352 352 for (int i = 3; i<towgs84Param.size(); i++) { 353 if (towgs84Param.get(i) != 0.0) {353 if (Double.doubleToRawLongBits(towgs84Param.get(i)) != 0) { 354 354 is3Param = false; 355 355 break; -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r8378 r8384 59 59 if (coor == null) 60 60 return null; 61 if (precision ==0)61 if (Double.doubleToRawLongBits(precision) == 0) 62 62 return coor.getRoundedToOsmPrecision(); 63 63 return roundCoord(coor); … … 66 66 if (coor == null) 67 67 return null; 68 if (precision ==0)68 if (Double.doubleToRawLongBits(precision) == 0) 69 69 return coor.getRoundedToOsmPrecision(); 70 70 return roundCoord(coor); -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r8378 r8384 461 461 } 462 462 463 if (!newCenter.equals(center) || (scale !=newScale)) {463 if (!newCenter.equals(center) || !Utils.equalsEpsilon(scale, newScale)) { 464 464 if (!initial) { 465 465 pushZoomUndo(center, scale); … … 484 484 } 485 485 } 486 if ( scale !=newScale) {486 if (!Utils.equalsEpsilon(scale, newScale)) { 487 487 double oldScale = scale; 488 488 scale = newScale; … … 843 843 // the selected node if multiple nodes have the same 844 844 // coordinates (e.g. after unglue) 845 useNtsel |= (distSq ==minDistSq);845 useNtsel |= Utils.equalsEpsilon(distSq, minDistSq); 846 846 } 847 if (ntref == null && preferredRefs != null && distSq ==minDistSq) {847 if (ntref == null && preferredRefs != null && Utils.equalsEpsilon(distSq, minDistSq)) { 848 848 List<OsmPrimitive> ndRefs = nd.getReferrers(); 849 849 for (OsmPrimitive ref: preferredRefs) { -
trunk/src/org/openstreetmap/josm/gui/NotificationManager.java
r8346 r8384 357 357 g.setColor(getBackground()); 358 358 float lineWidth = 1.4f; 359 Shape rect = new RoundRectangle2D. Float(360 lineWidth/2 + getInsets().left, 361 lineWidth/2 + getInsets().top, 362 getWidth() - lineWidth/2 - getInsets().left - getInsets().right, 363 getHeight() - lineWidth/2 - getInsets().top - getInsets().bottom, 359 Shape rect = new RoundRectangle2D.Double( 360 lineWidth/2d + getInsets().left, 361 lineWidth/2d + getInsets().top, 362 getWidth() - lineWidth/2d - getInsets().left - getInsets().right, 363 getHeight() - lineWidth/2d - getInsets().top - getInsets().bottom, 364 364 20, 20); 365 365 -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r8378 r8384 296 296 @Override 297 297 public void setBoundingBox(Bounds bbox) { 298 if (bbox == null || (bbox.getMinLat() == 0.0 &&bbox.getMinLon()== 0.0299 && bbox.getMaxLat() == 0.0 &&bbox.getMaxLon()== 0.0)) {298 if (bbox == null || (Double.doubleToRawLongBits(bbox.getMinLat()) == 0 && Double.doubleToRawLongBits(bbox.getMinLon()) == 0 299 && Double.doubleToRawLongBits(bbox.getMaxLat()) == 0 && Double.doubleToRawLongBits(bbox.getMaxLon()) == 0)) { 300 300 this.bbox = null; 301 301 iSelectionRectStart = null; -
trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java
r8372 r8384 269 269 270 270 // display the coordinates 271 //272 271 lblLat.setText(coord != null ? coord.latToString(CoordinateFormat.DECIMAL_DEGREES) : tr("(none)")); 273 272 lblLon.setText(coord != null ? coord.lonToString(CoordinateFormat.DECIMAL_DEGREES) : tr("(none)")); 274 273 275 274 // update background color to reflect differences in the coordinates 276 //277 275 if (coord == oppositeCoord || 278 276 (coord != null && oppositeCoord != null && coord.lat() == oppositeCoord.lat())) { -
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r8308 r8384 49 49 import org.openstreetmap.josm.tools.GBC; 50 50 import org.openstreetmap.josm.tools.ImageProvider; 51 import org.openstreetmap.josm.tools.Utils; 51 52 52 53 public abstract class ImageryLayer extends Layer { … … 143 144 panel.add(new UrlLabel(url), GBC.eol().insets(2, 5, 10, 0)); 144 145 } 145 if ( dx != 0.0 || dy != 0.0) {146 if (Double.doubleToRawLongBits(dx) != 0 || Double.doubleToRawLongBits(dy) != 0) { 146 147 panel.add(new JLabel(tr("Offset: ") + dx + ";" + dy), GBC.eol().insets(0, 5, 10, 0)); 147 148 } … … 208 209 } 209 210 JCheckBoxMenuItem item = new JCheckBoxMenuItem(new ApplyOffsetAction(b)); 210 if ( b.dx == dx && b.dy == dy) {211 if (Utils.equalsEpsilon(b.dx, dx) && Utils.equalsEpsilon(b.dy, dy)) { 211 212 item.setSelected(true); 212 213 } -
trunk/src/org/openstreetmap/josm/gui/layer/Layer.java
r8378 r8384 31 31 import org.openstreetmap.josm.tools.Destroyable; 32 32 import org.openstreetmap.josm.tools.ImageProvider; 33 import org.openstreetmap.josm.tools.Utils; 33 34 34 35 /** … … 269 270 boolean oldValue = isVisible(); 270 271 this.visible = visible; 271 if (visible && opacity== 0) {272 if (visible && Double.doubleToRawLongBits(opacity) == 0) { 272 273 setOpacity(1); 273 274 } else if (oldValue != isVisible()) { … … 281 282 */ 282 283 public boolean isVisible() { 283 return visible && opacity!= 0;284 return visible && Double.doubleToRawLongBits(opacity) != 0; 284 285 } 285 286 … … 294 295 boolean oldVisible = isVisible(); 295 296 this.opacity = opacity; 296 if (oldOpacity !=getOpacity()) {297 if (!Utils.equalsEpsilon(oldOpacity, getOpacity())) { 297 298 fireOpacityChanged(oldOpacity, getOpacity()); 298 299 } -
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r8349 r8384 419 419 int screenPixels = mv.getWidth()*mv.getHeight(); 420 420 double tilePixels = Math.abs((y2-y1)*(x2-x1)*tileSource.getTileSize()*tileSource.getTileSize()); 421 if (screenPixels == 0 || tilePixels == 0) return 1; 421 if (screenPixels == 0 || Double.doubleToRawLongBits(tilePixels) == 0) return 1; 422 422 return screenPixels/tilePixels; 423 423 } … … 1261 1261 EastNorth botRight = mv.getEastNorth(mv.getWidth(), mv.getHeight()); 1262 1262 1263 if (botRight.east() == 0.0 ||botRight.north() == 0) {1263 if (Double.doubleToRawLongBits(botRight.east()) == 0 || Double.doubleToRawLongBits(botRight.north()) == 0) { 1264 1264 /*Main.debug("still initializing??");*/ 1265 1265 // probably still initializing -
trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
r8345 r8384 67 67 import org.openstreetmap.josm.io.imagery.WMSRequest; 68 68 import org.openstreetmap.josm.tools.ImageProvider; 69 import org.openstreetmap.josm.tools.Utils; 69 70 70 71 /** … … 327 328 } 328 329 329 @Override public void paint(Graphics2D g, final MapView mv, Bounds b) { 330 @Override 331 public void paint(Graphics2D g, final MapView mv, Bounds b) { 330 332 if(info.getUrl() == null || (usesInvalidUrl && !isInvalidUrlConfirmed)) return; 331 333 332 if (autoResolutionEnabled && getBestZoom() !=mv.getDist100Pixel()) {334 if (autoResolutionEnabled && !Utils.equalsEpsilon(getBestZoom(), mv.getDist100Pixel())) { 333 335 changeResolution(this, true); 334 336 } … … 533 535 */ 534 536 private int getRequestPriority(WMSRequest request) { 535 if (request.getPixelPerDegree() !=info.getPixelPerDegree())537 if (!Utils.equalsEpsilon(request.getPixelPerDegree(), info.getPixelPerDegree())) 536 538 return -1; 537 539 if (bminx > request.getXIndex() -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r8378 r8384 907 907 // parse slider position into real timezone 908 908 double tz = Math.abs(sldTimezone.getValue()); 909 String zone = tz % 2== 0909 String zone = Double.doubleToRawLongBits(tz % 2) == 0 910 910 ? (int)Math.floor(tz/2) + ":00" 911 911 : (int)Math.floor(tz/2) + ":30"; -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DateFilterPanel.java
r8378 r8384 48 48 final Date startTime, endTime; 49 49 Date[] bounds = layer.data.getMinMaxTimeForAllTracks(); 50 startTime = (bounds ==null) ? new GregorianCalendar(2000, 1, 1).getTime():bounds[0];51 endTime = (bounds ==null) ? new Date() : bounds[1];50 startTime = (bounds.length == 0) ? new GregorianCalendar(2000, 1, 1).getTime():bounds[0]; 51 endTime = (bounds.length == 0) ? new Date() : bounds[1]; 52 52 53 53 dateFrom.setDate(startTime); -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r8378 r8384 280 280 if (colored == ColorMode.TIME) { 281 281 Date[] bounds = data.getMinMaxTimeForAllTracks(); 282 if (bounds !=null) {282 if (bounds.length >= 2) { 283 283 minval = bounds[0].getTime()/1000.0; 284 284 maxval = bounds[1].getTime()/1000.0; 285 285 } else { 286 minval = 0; maxval=now; 286 minval = 0; 287 maxval = now; 287 288 } 288 289 dateScale.setRange(minval, maxval); … … 457 458 g.setColor(customColoringTransparent); 458 459 // hdop cirles 459 int hdopp = mv.getPoint(new LatLon(trkPnt.getCoor().lat(), trkPnt.getCoor().lon() + 2*6*hdop*360/40000000)).x - screen.x; 460 int hdopp = mv.getPoint(new LatLon( 461 trkPnt.getCoor().lat(), 462 trkPnt.getCoor().lon() + 2*6*hdop*360/40000000d)).x - screen.x; 460 463 g.drawArc(screen.x-hdopp/2, screen.y-hdopp/2, hdopp, hdopp, 0, 360); 461 464 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarker.java
r8056 r8384 79 79 int h = img.getHeight(null); 80 80 if (w>h) { 81 h = Math.round(maxSize*(( float)h/w));81 h = (int) Math.round(maxSize*((double)h/w)); 82 82 w = maxSize; 83 83 } else { 84 w = Math.round(maxSize*(( float)w/h));84 w = (int) Math.round(maxSize*((double)w/h)); 85 85 h = maxSize; 86 86 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/Cascade.java
r8376 r8384 147 147 return !(s.isEmpty() || "false".equals(s) || "no".equals(s) || "0".equals(s) || "0.0".equals(s)); 148 148 if (o instanceof Number) 149 return ((Number) o).floatValue() != 0.0f;149 return Float.floatToRawIntBits(((Number) o).floatValue()) != 0; 150 150 if (o instanceof List) 151 151 return !((List) o).isEmpty(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java
r8377 r8384 11 11 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 12 12 import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction.RelativeFloat; 13 import org.openstreetmap.josm.tools.Utils; 13 14 14 15 public abstract class ElemStyle implements StyleKeys { … … 208 209 return false; 209 210 ElemStyle s = (ElemStyle) o; 210 return majorZIndex == s.majorZIndex&&211 zIndex == s.zIndex&&212 objectZIndex == s.objectZIndex&&213 isModifier == s.isModifier;211 return isModifier == s.isModifier && 212 Utils.equalsEpsilon(majorZIndex, s.majorZIndex) && 213 Utils.equalsEpsilon(zIndex, s.zIndex) && 214 Utils.equalsEpsilon(objectZIndex, s.objectZIndex); 214 215 } 215 216 -
trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java
r8346 r8384 335 335 Objects.equals(dashesLine, other.dashesLine) && 336 336 Objects.equals(dashesBackground, other.dashesBackground) && 337 offset ==other.offset &&338 realWidth ==other.realWidth;337 Utils.equalsEpsilon(offset, other.offset) && 338 Utils.equalsEpsilon(realWidth, other.realWidth); 339 339 } 340 340 … … 356 356 " realWidth=" + realWidth + " color=" + Utils.toString(color) + 357 357 " dashed=" + Arrays.toString(line.getDashArray()) + 358 (line.getDashPhase() == 0f? "" : " dashesOffses=" + line.getDashPhase()) +358 (Float.floatToRawIntBits(line.getDashPhase()) == 0 ? "" : " dashesOffses=" + line.getDashPhase()) + 359 359 " dashedColor=" + Utils.toString(dashesBackground) + 360 360 " linejoin=" + linejoinToString(line.getLineJoin()) + 361 361 " linecap=" + linecapToString(line.getEndCap()) + 362 ( offset== 0 ? "" : " offset=" + offset) +362 (Float.floatToRawIntBits(offset) == 0 ? "" : " offset=" + offset) + 363 363 '}'; 364 364 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/RepeatImageElemStyle.java
r8085 r8384 7 7 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 8 8 import org.openstreetmap.josm.tools.CheckParameterUtil; 9 import org.openstreetmap.josm.tools.Utils; 9 10 10 11 public class RepeatImageElemStyle extends ElemStyle implements StyleKeys { … … 69 70 final RepeatImageElemStyle other = (RepeatImageElemStyle) obj; 70 71 if (!this.pattern.equals(other.pattern)) return false; 71 if (this.offset !=other.offset) return false;72 if (this.spacing !=other.spacing) return false;73 if (this.phase !=other.phase) return false;72 if (!Utils.equalsEpsilon(this.offset, other.offset)) return false; 73 if (!Utils.equalsEpsilon(this.spacing, other.spacing)) return false; 74 if (!Utils.equalsEpsilon(this.phase, other.phase)) return false; 74 75 if (this.align != other.align) return false; 75 76 return true; -
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
r8342 r8384 11 11 import org.openstreetmap.josm.data.osm.Storage; 12 12 import org.openstreetmap.josm.tools.Pair; 13 import org.openstreetmap.josm.tools.Utils; 13 14 14 15 /** … … 164 165 ++i; 165 166 } 166 if (bd.get(i) == lower) {167 if (Utils.equalsEpsilon(bd.get(i), lower)) { 167 168 if (upper > bd.get(i+1)) 168 169 throw new RangeViolatedError(); … … 170 171 throw new AssertionError("the new range must be within a subrange that has no data"); 171 172 172 if (bd.get(i+1) == upper) {173 if (Utils.equalsEpsilon(bd.get(i+1), upper)) { 173 174 // --|-------|--------|-- 174 175 // i-1 i i+1 … … 212 213 if (bd.size() != data.size() + 1) throw new AssertionError(); 213 214 if (bd.get(0) != 0) throw new AssertionError(); 214 if (bd.get(bd.size() - 1) !=Double.POSITIVE_INFINITY) throw new AssertionError();215 if (!Utils.equalsEpsilon(bd.get(bd.size() - 1), Double.POSITIVE_INFINITY)) throw new AssertionError(); 215 216 for (int i=0; i<data.size() - 1; ++i) { 216 217 if (bd.get(i) >= bd.get(i + 1)) throw new AssertionError(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java
r8377 r8384 177 177 float res = args[0]; 178 178 for (int i = 1; i < args.length; ++i) { 179 if (args[i] == 0.0F) {179 if (Float.floatToRawIntBits(args[i]) == 0) { 180 180 return null; 181 181 } -
trunk/src/org/openstreetmap/josm/io/NmeaReader.java
r8378 r8384 270 270 } 271 271 272 if ((latLon .lat()==0.0) && (latLon.lon()==0.0)) {272 if (LatLon.ZERO.equals(latLon)) { 273 273 ps.zeroCoord++; 274 274 return false; … … 384 384 e[GPRMC.LENGTH_EAST.position] 385 385 ); 386 if(latLon .lat()==0.0 && latLon.lon()==0.0) {386 if (LatLon.ZERO.equals(latLon)) { 387 387 ps.zeroCoord++; 388 388 return false; -
trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
r8375 r8384 65 65 elapsed = 1; 66 66 } 67 floatuploads_per_ms = (float)progress / elapsed;68 floatuploads_left = list_size - progress;69 intms_left = (int)(uploads_left / uploads_per_ms);70 intminutes_left = ms_left / MSECS_PER_MINUTE;71 intseconds_left = (ms_left / MSECS_PER_SECOND) % SECONDS_PER_MINUTE ;72 String time_left_str = Integer.toString(minutes_left) + ":";67 double uploads_per_ms = (double)progress / elapsed; 68 double uploads_left = list_size - progress; 69 long ms_left = (long)(uploads_left / uploads_per_ms); 70 long minutes_left = ms_left / MSECS_PER_MINUTE; 71 long seconds_left = (ms_left / MSECS_PER_SECOND) % SECONDS_PER_MINUTE ; 72 String time_left_str = Long.toString(minutes_left) + ":"; 73 73 if (seconds_left < 10) { 74 74 time_left_str += "0"; 75 75 } 76 return time_left_str + Integer.toString(seconds_left);76 return time_left_str + Long.toString(seconds_left); 77 77 } 78 78 -
trunk/src/org/openstreetmap/josm/io/session/SessionWriter.java
r7089 r8384 204 204 el.setAttribute("name", layer.getName()); 205 205 el.setAttribute("visible", Boolean.toString(layer.isVisible())); 206 if (layer.getOpacity() != 1.0) {206 if (!Utils.equalsEpsilon(layer.getOpacity(), 1.0)) { 207 207 el.setAttribute("opacity", Double.toString(layer.getOpacity())); 208 208 } -
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r8126 r8384 277 277 if (playingUrl != command.url() || 278 278 stateChange != State.PAUSED || 279 offset != 0.0)279 Double.doubleToRawLongBits(offset) != 0) 280 280 { 281 281 if (audioInputStream != null) { -
trunk/src/org/openstreetmap/josm/tools/GeoPropertyIndex.java
r7596 r8384 164 164 boolean isInside(LatLon ll) { 165 165 return bbox.getTopLeftLon() <= ll.lon() && 166 (ll.lon() < bbox.getBottomRightLon() || (ll.lon() == 180.0 && bbox.getBottomRightLon() == 180.0)) && 166 (ll.lon() < bbox.getBottomRightLon() || 167 (Utils.equalsEpsilon(ll.lon(), 180.0) && Utils.equalsEpsilon(bbox.getBottomRightLon(), 180.0))) && 167 168 bbox.getBottomRightLat() <= ll.lat() && 168 (ll.lat() < bbox.getTopLeftLat() || (ll.lat() == 90.0 && bbox.getTopLeftLat() == 90.0)); 169 (ll.lat() < bbox.getTopLeftLat() || 170 (Utils.equalsEpsilon(ll.lat(), 90.0) && Utils.equalsEpsilon(bbox.getTopLeftLat(), 90.0))); 169 171 } 170 172 -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r8345 r8384 352 352 // Solve the equations 353 353 double det = a1 * b2 - a2 * b1; 354 if ( det== 0)354 if (Double.doubleToRawLongBits(det) == 0) 355 355 return null; // Lines are parallel 356 356 … … 387 387 double ldy = p2.getY() - p1.getY(); 388 388 389 if (ldx == 0 && ldy == 0) //segment zero length 389 //segment zero length 390 if (Double.doubleToRawLongBits(ldx) == 0 && Double.doubleToRawLongBits(ldy) == 0) 390 391 return p1; 391 392 … … 829 830 b[i] = pt1.north() - pt2.north(); 830 831 double d = Math.sqrt(a[i]*a[i] + b[i]*b[i]); 831 if (d== 0) return null;832 if (Double.doubleToRawLongBits(d) == 0) return null; 832 833 a[i] /= d; 833 834 b[i] /= d; -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r8324 r8384 1180 1180 // convert rotatedAngle to an integer value from 0 to 360 1181 1181 Long originalAngle = Math.round(rotatedAngle % 360); 1182 if (rotatedAngle != 0 && originalAngle == 0) { 1182 if (Double.doubleToRawLongBits(rotatedAngle) != 0 && originalAngle == 0) { 1183 1183 originalAngle = 360L; 1184 1184 } … … 1197 1197 // convert originalAngle to a value from 0 to 90 1198 1198 double angle = originalAngle % 90; 1199 if (originalAngle != 0 .0 && angle == 0.0) {1199 if (originalAngle != 0 && Double.doubleToRawLongBits(angle) == 0) { 1200 1200 angle = 90.0; 1201 1201 } -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r8376 r8384 973 973 // Is it less than 1 minute ? 974 974 if (elapsedTime < MILLIS_OF_MINUTE) { 975 return String.format("%.1 f%s", elapsedTime / (float) MILLIS_OF_SECOND, tr("s"));975 return String.format("%.1d %s", elapsedTime / (double) MILLIS_OF_SECOND, tr("s")); 976 976 } 977 977 // Is it less than 1 hour ?
Note:
See TracChangeset
for help on using the changeset viewer.