Ignore:
Timestamp:
2019-11-02T15:11:34+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #16796 - Rework of GPX track colors / layer preferences (patch by Bjoeni)

File:
1 edited

Legend:

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

    r14451 r15496  
    22package org.openstreetmap.josm.data.gpx;
    33
     4import java.awt.Color;
    45import java.util.Collection;
    56import java.util.Iterator;
     
    1415    private final Collection<WayPoint> waypoints;
    1516    private final boolean unordered;
     17    private final Color color;
    1618
    1719    /**
     
    1921     * @param waypoints collection of waypoints
    2022     * @param attributes track/route attributes
     23     * @param color color of the track
     24     * @since 15496
    2125     */
    22     public Line(Collection<WayPoint> waypoints, Map<String, Object> attributes) {
     26    public Line(Collection<WayPoint> waypoints, Map<String, Object> attributes, Color color) {
     27        this.color = color;
    2328        this.waypoints = Objects.requireNonNull(waypoints);
    2429        unordered = attributes.isEmpty() && waypoints.stream().allMatch(x -> x.get(GpxConstants.PT_TIME) == null);
     
    2934     * @param trackSegment track segment
    3035     * @param trackAttributes track attributes
     36     * @param color color of the track
     37     * @since 15496
    3138     */
    32     public Line(GpxTrackSegment trackSegment, Map<String, Object> trackAttributes) {
    33         this(trackSegment.getWayPoints(), trackAttributes);
     39    public Line(IGpxTrackSegment trackSegment, Map<String, Object> trackAttributes, Color color) {
     40        this(trackSegment.getWayPoints(), trackAttributes, color);
    3441    }
    3542
     
    3946     */
    4047    public Line(GpxRoute route) {
    41         this(route.routePoints, route.attr);
     48        this(route.routePoints, route.attr, null);
    4249    }
    4350
     
    4855    public boolean isUnordered() {
    4956        return unordered;
     57    }
     58
     59    /**
     60     * Returns the track/route color
     61     * @return the color
     62     * @since 15496
     63     */
     64    public Color getColor() {
     65        return color;
    5066    }
    5167
Note: See TracChangeset for help on using the changeset viewer.