Changeset 12725 in josm for trunk/src/org
- Timestamp:
- 2017-09-04T20:19:23+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/coor/ILatLon.java
r12171 r12725 44 44 * 45 45 * @return the east north coordinates or {@code null} if #is 46 * @deprecated use {@link #getEastNorth(org.openstreetmap.josm.data.projection.Projecting)} 46 47 */ 48 @Deprecated 47 49 default EastNorth getEastNorth() { 48 50 return getEastNorth(Main.getProjection()); -
trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r12669 r12725 308 308 case DEGREES_MINUTES_SECONDS: return degreesMinutesSeconds(y) + ((y < 0) ? SOUTH : NORTH); 309 309 case NAUTICAL: return degreesMinutes(y) + ((y < 0) ? SOUTH : NORTH); 310 case EAST_NORTH: return cDdFormatter.format(this.getEastNorth( ).north());310 case EAST_NORTH: return cDdFormatter.format(this.getEastNorth(Main.getProjection()).north()); 311 311 default: return "ERR"; 312 312 } … … 328 328 case DEGREES_MINUTES_SECONDS: return degreesMinutesSeconds(x) + ((x < 0) ? WEST : EAST); 329 329 case NAUTICAL: return degreesMinutes(x) + ((x < 0) ? WEST : EAST); 330 case EAST_NORTH: return cDdFormatter.format(this.getEastNorth( ).east());330 case EAST_NORTH: return cDdFormatter.format(this.getEastNorth(Main.getProjection()).east()); 331 331 default: return "ERR"; 332 332 } -
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r12275 r12725 417 417 for (GpxTrackSegment seg : track.getSegments()) { 418 418 WayPoint r = null; 419 for (WayPoint S: seg.getWayPoints()) {420 EastNorth en = S.getEastNorth();419 for (WayPoint wpSeg : seg.getWayPoints()) { 420 EastNorth en = wpSeg.getEastNorth(Main.getProjection()); 421 421 if (r == null) { 422 r = S;422 r = wpSeg; 423 423 rx = en.east(); 424 424 ry = en.north(); … … 455 455 double ny = ry + rnoverRS * a; 456 456 bestEN = new EastNorth(nx, ny); 457 bestTime = r.time + rnoverRS * ( S.time - r.time);457 bestTime = r.time + rnoverRS * (wpSeg.time - r.time); 458 458 pnminsq = pnsq; 459 459 } 460 460 } 461 r = S;461 r = wpSeg; 462 462 rx = sx; 463 463 ry = sy; … … 465 465 } 466 466 if (r != null) { 467 EastNorth c = r.getEastNorth( );467 EastNorth c = r.getEastNorth(Main.getProjection()); 468 468 /* if there is only one point in the seg, it will do this twice, but no matter */ 469 469 rx = c.east(); -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r12167 r12725 98 98 public double lon() { 99 99 return lon; 100 } 101 102 /** 103 * Replies the projected east/north coordinates. 104 * <p> 105 * Uses the {@link Main#getProjection() global projection} to project the lan/lon-coordinates. 106 * @return the east north coordinates or {@code null} if #is 107 */ 108 public EastNorth getEastNorth() { 109 return getEastNorth(Main.getProjection()); 100 110 } 101 111 -
trunk/src/org/openstreetmap/josm/data/osm/NodeData.java
r12190 r12725 76 76 77 77 @Override 78 @Deprecated 78 79 public EastNorth getEastNorth() { 79 80 // No internal caching of projected coordinates needed. In contrast to getEastNorth() -
trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java
r12630 r12725 74 74 * Visiting call for lat/lon. 75 75 * @param latlon lat/lon 76 * @since 12725 (public for ILatLon parameter) 77 */ 78 public void visit(ILatLon latlon) { 79 if (latlon != null) { 80 visit(latlon.getEastNorth(Main.getProjection())); 81 } 82 } 83 84 /** 85 * Visiting call for lat/lon. 86 * @param latlon lat/lon 76 87 */ 77 88 public void visit(LatLon latlon) { 78 if (latlon != null) { 79 visit((ILatLon) latlon); 80 } 81 } 82 83 private void visit(ILatLon latlon) { 84 visit(latlon.getEastNorth()); 89 visit((ILatLon) latlon); 85 90 } 86 91 … … 138 143 bounds = new ProjectionBounds(new LatLon( 139 144 Math.max(-90, minLatlon.lat() - enlargeDegree), 140 Math.max(-180, minLatlon.lon() - enlargeDegree)).getEastNorth( ),145 Math.max(-180, minLatlon.lon() - enlargeDegree)).getEastNorth(Main.getProjection()), 141 146 new LatLon( 142 147 Math.min(90, maxLatlon.lat() + enlargeDegree), 143 Math.min(180, maxLatlon.lon() + enlargeDegree)).getEastNorth( ));148 Math.min(180, maxLatlon.lon() + enlargeDegree)).getEastNorth(Main.getProjection())); 144 149 } 145 150 -
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r12620 r12725 19 19 import org.openstreetmap.josm.Main; 20 20 import org.openstreetmap.josm.data.coor.EastNorth; 21 import org.openstreetmap.josm.data.coor.ILatLon; 21 22 import org.openstreetmap.josm.data.coor.LatLon; 22 23 import org.openstreetmap.josm.data.projection.datum.Datum; … … 192 193 * @param ll the geographical point to convert (in WGS84 lat/lon) 193 194 * @return the corresponding east/north coordinates 194 */ 195 public static EastNorth project(LatLon ll) { 195 * @since 12725 196 */ 197 public static EastNorth project(ILatLon ll) { 196 198 if (ll == null) return null; 197 199 return Main.getProjection().latlon2eastNorth(ll); 200 } 201 202 /** 203 * Convert from lat/lon to easting/northing using the current projection. 204 * 205 * @param ll the geographical point to convert (in WGS84 lat/lon) 206 * @return the corresponding east/north coordinates 207 */ 208 public static EastNorth project(LatLon ll) { 209 return project((ILatLon) ll); 198 210 } 199 211 -
trunk/src/org/openstreetmap/josm/gui/MapViewState.java
r12505 r12725 395 395 Bounds b = Optional.ofNullable(DownloadDialog.getSavedDownloadBounds()).orElseGet( 396 396 () -> Main.getProjection().getWorldBoundsLatLon()); 397 return b.getCenter().getEastNorth( );397 return b.getCenter().getEastNorth(Main.getProjection()); 398 398 } 399 399 -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r12636 r12725 516 516 * @return The point on screen where "point" would be drawn, relative to the own top/left. 517 517 */ 518 public Point2D getPoint2D( LatLon latlon) {518 public Point2D getPoint2D(ILatLon latlon) { 519 519 if (latlon == null) { 520 520 return new Point(); 521 521 } else { 522 return getPoint2D(latlon.getEastNorth()); 523 } 522 return getPoint2D(latlon.getEastNorth(Main.getProjection())); 523 } 524 } 525 526 /** 527 * Return the point on the screen where this Coordinate would be. 528 * 529 * Alternative: {@link #getState()}, then {@link MapViewState#getPointFor(ILatLon)} 530 * @param latlon The point, where this geopoint would be drawn. 531 * @return The point on screen where "point" would be drawn, relative to the own top/left. 532 */ 533 public Point2D getPoint2D(LatLon latlon) { 534 return getPoint2D((ILatLon) latlon); 524 535 } 525 536 … … 551 562 * @return point 552 563 * @see #getPoint2D(LatLon) 553 */ 554 public Point getPoint(LatLon latlon) { 564 * @since 12725 565 */ 566 public Point getPoint(ILatLon latlon) { 555 567 Point2D d = getPoint2D(latlon); 556 568 return new Point((int) d.getX(), (int) d.getY()); 569 } 570 571 /** 572 * looses precision, may overflow (depends on p and current scale) 573 * @param latlon lat/lon 574 * @return point 575 * @see #getPoint2D(LatLon) 576 */ 577 public Point getPoint(LatLon latlon) { 578 return getPoint((ILatLon) latlon); 557 579 } 558 580 … … 690 712 * Zoom to given lat/lon. 691 713 * @param newCenter new center coordinates 714 * @since 12725 715 */ 716 public void zoomTo(ILatLon newCenter) { 717 zoomTo(Projections.project(newCenter)); 718 } 719 720 /** 721 * Zoom to given lat/lon. 722 * @param newCenter new center coordinates 692 723 */ 693 724 public void zoomTo(LatLon newCenter) { 694 zoomTo( Projections.project(newCenter));725 zoomTo((ILatLon) newCenter); 695 726 } 696 727 -
trunk/src/org/openstreetmap/josm/gui/datatransfer/data/PrimitiveTransferData.java
r11038 r12725 132 132 for (PrimitiveData pd : getAll()) { 133 133 if (pd instanceof NodeData && !pd.isIncomplete()) { 134 visitor.visit(((NodeData) pd) .getEastNorth());134 visitor.visit(((NodeData) pd)); 135 135 } 136 136 } -
trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java
r12718 r12725 73 73 if (data instanceof NodeData) { 74 74 NodeData nodeData = (NodeData) data; 75 nodeData.setEastNorth(nodeData.getEastNorth( ).add(offset));75 nodeData.setEastNorth(nodeData.getEastNorth(Main.getProjection()).add(offset)); 76 76 } else if (data instanceof WayData) { 77 77 updateNodes(newIds.get(OsmPrimitiveType.NODE), data); -
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDataText.java
r12672 r12725 191 191 if (bbox != null) { 192 192 add(tr("Bounding box: "), bbox.toStringCSV(", ")); 193 EastNorth bottomRigth = bbox.getBottomRight().getEastNorth( );194 EastNorth topLeft = bbox.getTopLeft().getEastNorth( );193 EastNorth bottomRigth = bbox.getBottomRight().getEastNorth(Main.getProjection()); 194 EastNorth topLeft = bbox.getTopLeft().getEastNorth(Main.getProjection()); 195 195 add(tr("Bounding box (projected): "), 196 196 Double.toString(topLeft.east()), ", ", -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r12620 r12725 651 651 continue; 652 652 } 653 Point screen = mv.getPoint(trkPnt .getEastNorth());653 Point screen = mv.getPoint(trkPnt); 654 654 // skip points that are on the same screenposition 655 655 if (trkPnt.drawLine && old != null && ((old.x != screen.x) || (old.y != screen.y))) { … … 681 681 } 682 682 if (trkPnt.drawLine) { 683 Point screen = mv.getPoint(trkPnt .getEastNorth());683 Point screen = mv.getPoint(trkPnt); 684 684 // skip points that are on the same screenposition 685 685 if (old != null … … 711 711 } 712 712 if (trkPnt.drawLine) { 713 Point screen = mv.getPoint(trkPnt .getEastNorth());713 Point screen = mv.getPoint(trkPnt); 714 714 // skip points that are on the same screenposition 715 715 if (old != null … … 746 746 continue; 747 747 } 748 Point screen = mv.getPoint(trkPnt .getEastNorth());748 Point screen = mv.getPoint(trkPnt); 749 749 750 750 if (hdopCircle && trkPnt.get(GpxConstants.PT_HDOP) != null) { … … 787 787 } 788 788 if (!trkPnt.drawLine) { 789 Point screen = mv.getPoint(trkPnt .getEastNorth());789 Point screen = mv.getPoint(trkPnt); 790 790 g.drawRect(screen.x, screen.y, 0, 0); 791 791 } … … 803 803 continue; 804 804 } 805 Point screen = mv.getPoint(trkPnt .getEastNorth());805 Point screen = mv.getPoint(trkPnt); 806 806 g.setColor(trkPnt.customColoring); 807 807 g.drawRect(screen.x, screen.y, 0, 0); … … 853 853 854 854 // transform coordinates 855 final Point paintPnt = mv.getPoint(trkPnt .getEastNorth());855 final Point paintPnt = mv.getPoint(trkPnt); 856 856 857 857 // skip single points … … 1112 1112 1113 1113 // get transformed coordinates 1114 final Point paintPnt = mv.getPoint(trkPnt .getEastNorth());1114 final Point paintPnt = mv.getPoint(trkPnt); 1115 1115 1116 1116 // end of line segment or end of list reached … … 1362 1362 1363 1363 // get transformed coordinates 1364 final Point paintPnt = mv.getPoint(trkPnt .getEastNorth());1364 final Point paintPnt = mv.getPoint(trkPnt); 1365 1365 1366 1366 // end of line segment or end of list reached -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
r12636 r12725 187 187 continue; 188 188 } 189 WayPoint wNear = layer.data.nearestPointOnTrack(w.getEastNorth( ), snapDistance);189 WayPoint wNear = layer.data.nearestPointOnTrack(w.getEastNorth(Main.getProjection()), snapDistance); 190 190 if (wNear != null) { 191 191 WayPoint wc = new WayPoint(w.getCoor()); -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/ButtonMarker.java
r12630 r12725 39 39 40 40 @Override public boolean containsPoint(Point p) { 41 Point screen = MainApplication.getMap().mapView.getPoint( getEastNorth());41 Point screen = MainApplication.getMap().mapView.getPoint(this); 42 42 buttonRectangle.setLocation(screen.x+4, screen.y+2); 43 43 return buttonRectangle.contains(p); … … 49 49 return; 50 50 } 51 Point screen = mv.getPoint( getEastNorth());51 Point screen = mv.getPoint(this); 52 52 buttonRectangle.setLocation(screen.x+4, screen.y+2); 53 53 paintIcon(mv, g, screen.x+4, screen.y+2); -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
r12656 r12725 23 23 import javax.swing.ImageIcon; 24 24 25 import org.openstreetmap.josm.Main; 25 26 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; 26 27 import org.openstreetmap.josm.data.coor.CachedLatLon; 27 28 import org.openstreetmap.josm.data.coor.EastNorth; 29 import org.openstreetmap.josm.data.coor.ILatLon; 28 30 import org.openstreetmap.josm.data.coor.LatLon; 29 31 import org.openstreetmap.josm.data.gpx.GpxConstants; … … 75 77 * @author Frederik Ramm 76 78 */ 77 public class Marker implements TemplateEngineDataProvider {79 public class Marker implements TemplateEngineDataProvider, ILatLon { 78 80 79 81 public static final class TemplateEntryProperty extends CachedProperty<TemplateEntry> { … … 318 320 319 321 /** 322 * @since 12725 323 */ 324 @Override 325 public double lon() { 326 return coor == null ? Double.NaN : coor.lon(); 327 } 328 329 /** 330 * @since 12725 331 */ 332 @Override 333 public double lat() { 334 return coor == null ? Double.NaN : coor.lat(); 335 } 336 337 /** 320 338 * Returns the marker's projected coordinates. 321 339 * @return The marker's projected coordinates (easting/northing) 322 */ 340 * @deprecated use {@link #getEastNorth(org.openstreetmap.josm.data.projection.Projecting)} 341 */ 342 @Deprecated 323 343 public final EastNorth getEastNorth() { 324 return coor.getEastNorth( );344 return coor.getEastNorth(Main.getProjection()); 325 345 } 326 346 … … 354 374 */ 355 375 public void paint(Graphics g, MapView mv, boolean mousePressed, boolean showTextOrIcon) { 356 Point screen = mv.getPoint( getEastNorth());376 Point screen = mv.getPoint(this); 357 377 if (symbol != null && showTextOrIcon) { 358 378 paintIcon(mv, g, screen.x-symbol.getIconWidth()/2, screen.y-symbol.getIconHeight()/2); -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r12636 r12725 211 211 @Override public void visitBoundingBox(BoundingXYVisitor v) { 212 212 for (Marker mkr : data) { 213 v.visit(mkr .getEastNorth());213 v.visit(mkr); 214 214 } 215 215 } … … 352 352 } 353 353 } 354 MainApplication.getMap().mapView.zoomTo(currentMarker .getEastNorth());354 MainApplication.getMap().mapView.zoomTo(currentMarker); 355 355 } 356 356 … … 371 371 } 372 372 } 373 MainApplication.getMap().mapView.zoomTo(currentMarker .getEastNorth());373 MainApplication.getMap().mapView.zoomTo(currentMarker); 374 374 } 375 375 -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java
r12630 r12725 85 85 @Override 86 86 public boolean containsPoint(Point p) { 87 Point screen = MainApplication.getMap().mapView.getPoint( getEastNorth());87 Point screen = MainApplication.getMap().mapView.getPoint(this); 88 88 Rectangle r = new Rectangle(screen.x, screen.y, symbol.getIconWidth(), 89 89 symbol.getIconHeight()); … … 214 214 for (Marker m : recent.parentLayer.data) { 215 215 if (m instanceof AudioMarker) { 216 double distanceSquared = m.getEastNorth( ).distanceSq(en);216 double distanceSquared = m.getEastNorth(Main.getProjection()).distanceSq(en); 217 217 if (distanceSquared < closestAudioMarkerDistanceSquared) { 218 218 ca = (AudioMarker) m; … … 283 283 public void paint(Graphics g, MapView mv) { 284 284 if (time < 0.0) return; 285 Point screen = mv.getPoint( getEastNorth());285 Point screen = mv.getPoint(this); 286 286 paintIcon(mv, g, screen.x, screen.y); 287 287 } … … 347 347 return; 348 348 setEastNorth(w2 == null ? 349 w1.getEastNorth( ) :350 w1.getEastNorth( ).interpolate(w2.getEastNorth(),349 w1.getEastNorth(Main.getProjection()) : 350 w1.getEastNorth(Main.getProjection()).interpolate(w2.getEastNorth(Main.getProjection()), 351 351 (audioTime - w1.time)/(w2.time - w1.time))); 352 352 time = audioTime; … … 354 354 if (jumpToMarker) { 355 355 jumpToMarker = false; 356 mapView.zoomTo(w1 .getEastNorth());356 mapView.zoomTo(w1); 357 357 } 358 358 mapView.repaint();
Note:
See TracChangeset
for help on using the changeset viewer.