Changeset 9395 in josm for trunk/src


Ignore:
Timestamp:
2016-01-10T18:40:36+01:00 (8 years ago)
Author:
simon04
Message:

Extent the unit test for GpxDrawHelper

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java

    r9338 r9395  
    1212import java.awt.Stroke;
    1313import java.util.ArrayList;
     14import java.util.Arrays;
    1415import java.util.Collection;
    1516import java.util.Collections;
     
    106107     */
    107108    public enum ColorMode {
    108         NONE, VELOCITY, HDOP, DIRECTION, TIME
     109        NONE, VELOCITY, HDOP, DIRECTION, TIME;
     110
     111        static ColorMode fromIndex(final int index) {
     112            return values()[index];
     113        }
     114
     115        int toIndex() {
     116            return Arrays.asList(values()).indexOf(this);
     117        }
    109118    }
    110119
     
    141150        try {
    142151            int i = Main.pref.getInteger("draw.rawgps.colors", specName(layerName), 0);
    143             return ColorMode.values()[i];
     152            return ColorMode.fromIndex(i);
    144153        } catch (Exception e) {
    145154            Main.warn(e);
Note: See TracChangeset for help on using the changeset viewer.