Changeset 1396 in josm


Ignore:
Timestamp:
2009-02-14T12:17:03+01:00 (13 years ago)
Author:
stoecker
Message:

fix #1943 and #1872. patch by xeen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java

    r1169 r1396  
    4141                        rawData.recalculateBounds();
    4242                        Bounds b = rawData.bounds;
    43                         String name = b.min.lat() + " " + b.min.lon() + " x " + b.max.lat() + " " + b.max.lon();
     43                        String name = tr("Downloaded GPX Data");
    4444                        GpxLayer layer = new GpxLayer(rawData, name);
    45             if (newLayer || findMergeLayer() == null)
     45            Layer x = findMergeLayer();
     46            if (newLayer || x == null)
    4647                Main.main.addLayer(layer);
    4748            else
    48                 findMergeLayer().mergeFrom(layer);
     49                x.mergeFrom(layer);
    4950        }
    5051
    5152        private Layer findMergeLayer() {
     53            boolean merge = Main.pref.getBoolean("download.gps.mergeWithLocal", false);
    5254            if (Main.map == null)
    5355                return null;
    5456            Layer active = Main.map.mapView.getActiveLayer();
    55             if (active != null && active instanceof GpxLayer)
     57            if (active != null && active instanceof GpxLayer && (merge || ((GpxLayer)active).data.fromServer))
    5658                return active;
    5759            for (Layer l : Main.map.mapView.getAllLayers())
    58                 if (l instanceof GpxLayer)
     60                if (l instanceof GpxLayer &&  (merge || ((GpxLayer)l).data.fromServer))
    5961                    return l;
    6062            return null;
Note: See TracChangeset for help on using the changeset viewer.