Changeset 7438 in josm for trunk/src


Ignore:
Timestamp:
2014-08-23T21:26:31+02:00 (5 years ago)
Author:
bastiK
Message:

fixed #10410 - session: imagery layer settings not stored

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

Legend:

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

    r7425 r7438  
    239239        return autoDownloadEnabled;
    240240    }
     241   
     242    public void setAutoDownload(boolean val) {
     243        autoDownloadEnabled = val;
     244    }
     245   
     246    public boolean isAutoResolution() {
     247        return autoResolutionEnabled;
     248    }
     249   
     250    public void setAutoResolution(boolean val) {
     251        autoResolutionEnabled = val;
     252    }
    241253
    242254    public void downloadAreaToCache(PrecacheTask precacheTask, List<LatLon> points, double bufferX, double bufferY) {
  • trunk/src/org/openstreetmap/josm/io/session/ImagerySessionExporter.java

    r6070 r7438  
    77import java.util.Collection;
    88import java.util.Collections;
     9import java.util.LinkedHashMap;
    910import java.util.Map;
    1011
     
    7879        layerElem.setAttribute("version", "0.1");
    7980        ImageryPreferenceEntry e = new ImageryPreferenceEntry(layer.getInfo());
    80         Map<String,String> data = Preferences.serializeStruct(e, ImageryPreferenceEntry.class);
     81        Map<String,String> data = new LinkedHashMap<>(Preferences.serializeStruct(e, ImageryPreferenceEntry.class));
     82        if (layer instanceof WMSLayer) {
     83            WMSLayer wms = (WMSLayer) layer;
     84            data.put("automatic-downloading", Boolean.toString(wms.hasAutoDownload()));
     85            data.put("automatically-change-resolution", Boolean.toString(wms.isAutoResolution()));
     86        }
    8187        for (Map.Entry<String,String> entry : data.entrySet()) {
    8288            Element attrElem = support.createElement(entry.getKey());
  • trunk/src/org/openstreetmap/josm/io/session/ImagerySessionImporter.java

    r7005 r7438  
    1313import org.openstreetmap.josm.gui.layer.ImageryLayer;
    1414import org.openstreetmap.josm.gui.layer.Layer;
     15import org.openstreetmap.josm.gui.layer.WMSLayer;
    1516import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1617import org.openstreetmap.josm.io.IllegalDataException;
     
    4445        ImageryPreferenceEntry prefEntry = Preferences.deserializeStruct(attributes, ImageryPreferenceEntry.class);
    4546        ImageryInfo i = new ImageryInfo(prefEntry);
    46         return ImageryLayer.create(i);
     47        ImageryLayer layer = ImageryLayer.create(i);
     48        if (layer instanceof WMSLayer) {
     49            WMSLayer wms = (WMSLayer) layer;
     50            String autoDownload = attributes.get("automatic-downloading");
     51            if (autoDownload != null) {
     52                wms.setAutoDownload(Boolean.parseBoolean(autoDownload));
     53            }
     54            String autoResolution = attributes.get("automatically-change-resolution");
     55            if (autoResolution != null) {
     56                wms.setAutoResolution(Boolean.parseBoolean(autoResolution));
     57            }
     58        }
     59        return layer;
    4760    }
    4861}
Note: See TracChangeset for help on using the changeset viewer.