Ignore:
Timestamp:
2016-05-10T17:56:23+02:00 (10 years ago)
Author:
Don-vip
Message:

fix #12813 - adapt GPX color scale bar to system of measurement for HDOP and velocity

File:
1 edited

Legend:

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

    r8846 r10175  
    3939     * @since 3406
    4040     */
    41     public static final SystemOfMeasurement METRIC = new SystemOfMeasurement(1, "m", 1000, "km", 10000, "ha");
     41    public static final SystemOfMeasurement METRIC = new SystemOfMeasurement(1, "m", 1000, "km", "km/h", 3.6, 10000, "ha");
    4242
    4343    /**
    4444     * Chinese system.
    45      * @since 3406
    46      */
    47     public static final SystemOfMeasurement CHINESE = new SystemOfMeasurement(1.0/3.0, "\u5e02\u5c3a" /* chi */, 500, "\u5e02\u91cc" /* li */);
     45     * See <a href="https://en.wikipedia.org/wiki/Chinese_units_of_measurement#Chinese_length_units_effective_in_1930">length units</a>,
     46     * <a href="https://en.wikipedia.org/wiki/Chinese_units_of_measurement#Chinese_area_units_effective_in_1930">area units</a>
     47     * @since 3406
     48     */
     49    public static final SystemOfMeasurement CHINESE = new SystemOfMeasurement(1.0/3.0, "\u5e02\u5c3a" /* chi */, 500, "\u5e02\u91cc" /* li */,
     50            "km/h", 3.6, 666.0 + 2.0/3.0, "\u4ea9" /* mu */);
    4851
    4952    /**
     
    5154     * @since 3406
    5255     */
    53     public static final SystemOfMeasurement IMPERIAL = new SystemOfMeasurement(0.3048, "ft", 1609.344, "mi", 4046.86, "ac");
     56    public static final SystemOfMeasurement IMPERIAL = new SystemOfMeasurement(0.3048, "ft", 1609.344, "mi", "mph", 2.23694, 4046.86, "ac");
    5457
    5558    /**
     
    5760     * @since 5549
    5861     */
    59     public static final SystemOfMeasurement NAUTICAL_MILE = new SystemOfMeasurement(185.2, "kbl", 1852, "NM");
     62    public static final SystemOfMeasurement NAUTICAL_MILE = new SystemOfMeasurement(185.2, "kbl", 1852, "NM", "kn", 1.94384);
    6063
    6164    /**
     
    138141    /** Second unit used to format text. */
    139142    public final String bName;
     143    /** Speed value for the most common speed symbol, in meters per second
     144     *  @since 10175 */
     145    public final double speedValue;
     146    /** Most common speed symbol (kmh/h, mph, kn, etc.)
     147     *  @since 10175 */
     148    public final String speedName;
    140149    /** Specific optional area value, in squared meters, between {@code aValue*aValue} and {@code bValue*bValue}. Set to {@code -1} if not used.
    141150     *  @since 5870 */
     
    155164     * @param bValue Second value, in meters, used to translate unit according to above formula.
    156165     * @param bName Second unit used to format text.
    157      */
    158     public SystemOfMeasurement(double aValue, String aName, double bValue, String bName) {
    159         this(aValue, aName, bValue, bName, -1, null);
     166     * @param speedName the most common speed symbol (kmh/h, mph, kn, etc.)
     167     * @param speedValue the speed value for the most common speed symbol, for 1 meter per second
     168     * @since 10175
     169     */
     170    public SystemOfMeasurement(double aValue, String aName, double bValue, String bName, String speedName, double speedValue) {
     171        this(aValue, aName, bValue, bName, speedName, speedValue, -1, null);
    160172    }
    161173
     
    170182     * @param bValue Second value, in meters, used to translate unit according to above formula.
    171183     * @param bName Second unit used to format text.
     184     * @param speedName the most common speed symbol (kmh/h, mph, kn, etc.)
     185     * @param speedValue the speed value for the most common speed symbol, for 1 meter per second
    172186     * @param areaCustomValue Specific optional area value, in squared meters, between {@code aValue*aValue} and {@code bValue*bValue}.
    173187     *                        Set to {@code -1} if not used.
    174188     * @param areaCustomName Specific optional area unit. Set to {@code null} if not used.
    175189     *
    176      * @since 5870
    177      */
    178     public SystemOfMeasurement(double aValue, String aName, double bValue, String bName, double areaCustomValue, String areaCustomName) {
     190     * @since 10175
     191     */
     192    public SystemOfMeasurement(double aValue, String aName, double bValue, String bName, String speedName, double speedValue,
     193            double areaCustomValue, String areaCustomName) {
    179194        this.aValue = aValue;
    180195        this.aName = aName;
    181196        this.bValue = bValue;
    182197        this.bName = bName;
     198        this.speedValue = speedValue;
     199        this.speedName = speedName;
    183200        this.areaCustomValue = areaCustomValue;
    184201        this.areaCustomName = areaCustomName;
Note: See TracChangeset for help on using the changeset viewer.