Changeset 13966 in josm


Ignore:
Timestamp:
2018-06-22T23:18:21+02:00 (4 weeks ago)
Author:
Don-vip
Message:

see #14120, see #12524 - remove deprecated method LatLon.heading()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/coor/LatLon.java

    r13173 r13966  
    242242
    243243    /**
    244      * Returns the heading that you have to use to get from this lat/lon to another.
    245      *
    246      * Angle starts from north and increases counterclockwise (!), PI/2 means west.
    247      * You can get usual clockwise angle from {@link #bearing(LatLon)} method.
    248      * This method is kept as deprecated because it is called from many plugins.
    249      *
    250      * (I don't know the original source of this formula, but see
    251      * <a href="https://math.stackexchange.com/questions/720/how-to-calculate-a-heading-on-the-earths-surface">this question</a>
    252      * for some hints how it is derived.)
    253      *
    254      * @deprecated see bearing method
    255      * @param other the "destination" position
    256      * @return heading in radians in the range 0 &lt;= hd &lt; 2*PI
    257      */
    258     @Deprecated
    259     public double heading(LatLon other) {
    260         double hd = atan2(sin(toRadians(this.lon() - other.lon())) * cos(toRadians(other.lat())),
    261                 cos(toRadians(this.lat())) * sin(toRadians(other.lat())) -
    262                 sin(toRadians(this.lat())) * cos(toRadians(other.lat())) * cos(toRadians(this.lon() - other.lon())));
    263         hd %= 2 * PI;
    264         if (hd < 0) {
    265             hd += 2 * PI;
    266         }
    267         return hd;
    268     }
    269 
    270     /**
    271244     * Returns bearing from this point to another.
    272245     *
    273246     * Angle starts from north and increases clockwise, PI/2 means east.
    274      * Old deprecated method {@link #heading(LatLon)} used unusual reverse angle.
    275247     *
    276248     * Please note that reverse bearing (from other point to this point) should NOT be
     
    282254     * @param other the "destination" position
    283255     * @return heading in radians in the range 0 &lt;= hd &lt; 2*PI
     256     * @since 9796
    284257     */
    285258    public double bearing(LatLon other) {
Note: See TracChangeset for help on using the changeset viewer.