Changeset 18233 in josm for trunk/src


Ignore:
Timestamp:
2021-09-27T21:45:27+02:00 (3 years ago)
Author:
Don-vip
Message:

see #21144 - fix #21330 - fix #21335 - proper handling of correlation support layers in "duplicate" and "gpx export" actions

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/layer/DuplicateAction.java

    r13654 r18233  
    88import javax.swing.AbstractAction;
    99
    10 import org.openstreetmap.josm.data.osm.DataSet;
    1110import org.openstreetmap.josm.gui.MainApplication;
    1211import org.openstreetmap.josm.gui.dialogs.IEnabledStateUpdating;
     
    5453        if (layer instanceof OsmDataLayer) {
    5554            String newName = LayerListTransferHandler.suggestNewLayerName(layer.getName(), MainApplication.getLayerManager().getLayers());
    56             OsmDataLayer oldLayer = (OsmDataLayer) layer;
    57             MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(oldLayer.getDataSet()), newName, null));
     55            MainApplication.getLayerManager().addLayer(((OsmDataLayer) layer).duplicate(newName));
    5856        }
    5957    }
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r18208 r18233  
    13551355        return true;
    13561356    }
     1357
     1358    /**
     1359     * Duplicates this layer with a new name and a copy of this layer dataset.
     1360     * @param newName name of new layer
     1361     * @return A copy of this layer
     1362     * @since 18233
     1363     */
     1364    public OsmDataLayer duplicate(String newName) {
     1365        return new OsmDataLayer(new DataSet(getDataSet()), newName, null);
     1366    }
    13571367}
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelationSupportLayer.java

    r18078 r18233  
    4141        data.setUploadPolicy(UploadPolicy.BLOCKED);
    4242        rebuildGpxData();
     43    }
     44
     45    @Override
     46    public GpxData toGpxData() {
     47        GpxData gpxData = new GpxData();
     48        fillGpxData(gpxData, data, getAssociatedFile(), CORRELATION_PREFIX);
     49        return gpxData;
     50    }
     51
     52    @Override
     53    public CorrelationSupportLayer duplicate(String newName) {
     54        return new CorrelationSupportLayer(gpxData, newName);
    4355    }
    4456
Note: See TracChangeset for help on using the changeset viewer.