Ignore:
Timestamp:
2008-03-21T01:24:05+01:00 (12 years ago)
Author:
framm
Message:
  • new boolean config option draw.rawgps.direction enables arrowheads on lines between GPS points (only if lines are drawn). can currently only be set manually or through expert mode. Fixes #650.
  • new integer config option draw.rawgps.max-line-length can be set to suppress line drawing between GPS points further apart than the configured value (in metres). Beware: Using this option will SLOW THINGS DOWN because distance computation is expensive. can currently only be set manually or through expert mode. Fixes #494.
File:
1 edited

Legend:

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

    r318 r587  
    22package org.openstreetmap.josm.data.coor;
    33
     4import org.openstreetmap.josm.Main;
    45import org.openstreetmap.josm.data.Bounds;
    56import org.openstreetmap.josm.data.projection.Projection;
     
    5152                return lat() >= b.min.lat() && lat() <= b.max.lat() && lon() > b.min.lon() && lon() < b.max.lon();
    5253        }
     54       
     55        /**
     56         * Computes the distance between this lat/lon and another point on the earth.
     57         * Uses spherical law of cosines formula, not Haversine.
     58         * @param other the other point.
     59         * @return distance in metres.
     60         */
     61        public int distance(LatLon other) {
     62                return (int) (Math.acos(
     63                        Math.sin(Math.toRadians(lat())) * Math.sin(Math.toRadians(other.lat())) +
     64                    Math.cos(Math.toRadians(lat()))*Math.cos(Math.toRadians(other.lat())) *
     65                                  Math.cos(Math.toRadians(other.lon()-lon()))) * 6378135);
     66        }
    5367
    5468        /**
Note: See TracChangeset for help on using the changeset viewer.