Ignore:
Timestamp:
2016-07-20T00:15:30+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #13169 - Extract imagery layer settings to new class (patch by michael2402, modified) - gsoc-core

Location:
trunk/src/org/openstreetmap/josm/io/session
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/session/ImagerySessionExporter.java

    r9983 r10568  
    8282        Map<String, String> data = new LinkedHashMap<>(Preferences.serializeStruct(e, ImageryPreferenceEntry.class));
    8383        if (layer instanceof AbstractTileSourceLayer) {
    84             AbstractTileSourceLayer tsLayer = (AbstractTileSourceLayer) layer;
    85             data.put("automatic-downloading", Boolean.toString(tsLayer.autoLoad));
    86             data.put("automatically-change-resolution", Boolean.toString(tsLayer.autoZoom));
    87             data.put("show-errors", Boolean.toString(tsLayer.showErrors));
     84            AbstractTileSourceLayer<?> tsLayer = (AbstractTileSourceLayer<?>) layer;
     85            tsLayer.getDisplaySettings().storeTo(data);
    8886        }
    8987        data.put("dx", String.valueOf(layer.getDx()));
  • trunk/src/org/openstreetmap/josm/io/session/ImagerySessionImporter.java

    r9455 r10568  
    5151        ImageryLayer layer = ImageryLayer.create(i);
    5252        if (layer instanceof AbstractTileSourceLayer) {
    53             AbstractTileSourceLayer tsLayer = (AbstractTileSourceLayer) layer;
    54             if (attributes.containsKey("automatic-downloading")) {
    55                 tsLayer.autoLoad = Boolean.parseBoolean(attributes.get("automatic-downloading"));
    56             }
    57 
    58             if (attributes.containsKey("automatically-change-resolution")) {
    59                 tsLayer.autoZoom = Boolean.parseBoolean(attributes.get("automatically-change-resolution"));
    60             }
    61 
    62             if (attributes.containsKey("show-errors")) {
    63                 tsLayer.showErrors = Boolean.parseBoolean(attributes.get("show-errors"));
    64             }
     53            AbstractTileSourceLayer<?> tsLayer = (AbstractTileSourceLayer<?>) layer;
     54            tsLayer.getDisplaySettings().loadFrom(attributes);
    6555        }
    6656        if (attributes.containsKey("dx") && attributes.containsKey("dy")) {
Note: See TracChangeset for help on using the changeset viewer.