Changeset 9796 in josm
 Timestamp:
 20160214T15:12:10+01:00 (6 years ago)
 Location:
 trunk/src/org/openstreetmap/josm
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/org/openstreetmap/josm/data/coor/LatLon.java
r9558 r9796 327 327 328 328 /** 329 * Returns the heading, in radians, that you have to use to get from this lat/lon to another. 329 * Returns the heading that you have to use to get from this lat/lon to another. 330 * 331 * Angle starts from north and increases counterclockwise (!), PI/2 means west. 332 * You can get usual clockwise angle from {@link #bearing(LatLon)} method. 333 * This method is kept as deprecated because it is called from many plugins. 330 334 * 331 335 * (I don't know the original source of this formula, but see … … 333 337 * for some hints how it is derived.) 334 338 * 339 * @deprecated see bearing method 335 340 * @param other the "destination" position 336 * @return heading in the range 0 <= hd < 2*PI 337 */ 341 * @return heading in radians in the range 0 <= hd < 2*PI 342 */ 343 @Deprecated 338 344 public double heading(LatLon other) { 339 345 double hd = atan2(sin(toRadians(this.lon()  other.lon())) * cos(toRadians(other.lat())), … … 348 354 349 355 /** 356 * Returns bearing from this point to another. 357 * 358 * Angle starts from north and increases clockwise, PI/2 means east. 359 * Old deprecated method {@link #heading(LatLon)} used unusual reverse angle. 360 * 361 * Please note that reverse bearing (from other point to this point) should NOT be 362 * calculated from return value of this method, because great circle path 363 * between the two points have different bearings at each position. 364 * 365 * To get bearing from another point to this point call other.bearing(this) 366 * 367 * @param other the "destination" position 368 * @return heading in radians in the range 0 <= hd < 2*PI 369 */ 370 public double bearing(LatLon other) { 371 double lat1 = toRadians(this.lat()); 372 double lat2 = toRadians(other.lat()); 373 double dlon = toRadians(other.lon()  this.lon()); 374 double bearing = atan2( 375 sin(dlon) * cos(lat2), 376 cos(lat1) * sin(lat2)  sin(lat1) * cos(lat2) * cos(dlon) 377 ); 378 bearing %= 2 * PI; 379 if (bearing < 0) { 380 bearing += 2 * PI; 381 } 382 return bearing; 383 } 384 385 /** 350 386 * Returns this lat/lon pair in humanreadable format. 351 387 * 
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r9395 r9796 89 89 private static final int sl9 = 3; 90 90 private static final int[][] dir = { 91 {+sl4, +ll0, +ll0, +sl4}, {sl9, +ll0, +sl9, +ll0}, {ll0, +sl4, sl4, +ll0}, 92 {ll0, sl9, ll0, +sl9}, {sl4, ll0, ll0, sl4}, {+sl9, ll0, sl9, ll0}, 93 {+ll0, sl4, +sl4, ll0}, {+ll0, +sl9, +ll0, sl9}, {+sl4, +ll0, +ll0, +sl4}, 94 {sl9, +ll0, +sl9, +ll0}, {ll0, +sl4, sl4, +ll0}, {ll0, sl9, ll0, +sl9}}; 91 {+sl4, +ll0, +ll0, +sl4}, {sl9, +ll0, +sl9, +ll0}, 92 {ll0, +sl4, sl4, +ll0}, {ll0, sl9, ll0, +sl9}, 93 {sl4, ll0, ll0, sl4}, {+sl9, ll0, sl9, ll0}, 94 {+ll0, sl4, +sl4, ll0}, {+ll0, +sl9, +ll0, sl9} 95 }; 95 96 96 97 private void setupColors() { … … 333 334 break; 334 335 case DIRECTION: 335 double dirColor = oldWp.getCoor(). heading(trkPnt.getCoor());336 double dirColor = oldWp.getCoor().bearing(trkPnt.getCoor()); 336 337 color = directionScale.getColor(dirColor); 337 338 break; … … 348 349 if (!noDraw && (maxLineLength == 1  dist <= maxLineLength)) { 349 350 trkPnt.drawLine = true; 350 trkPnt.dir = (int) oldWp.getCoor().heading(trkPnt.getCoor()); 351 double bearing = oldWp.getCoor().bearing(trkPnt.getCoor()); 352 trkPnt.dir = ((int) (bearing / Math.PI * 4 + 1.5)) % 8; 351 353 } else { 352 354 trkPnt.drawLine = false; 
trunk/src/org/openstreetmap/josm/tools/ColorScale.java
r8512 r9796 45 45 for (int i = 0; i < sc.colors.length; i++) { 46 46 47 float angle = 4 i / 256f * 4;47 float angle = i / 256f * 4; 48 48 int quadrant = (int) angle; 49 49 angle = quadrant;
Note: See TracChangeset
for help on using the changeset viewer.