- Timestamp:
- 2017-08-14T13:32:37+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/imagery/TileSourceDisplaySettings.java
r12134 r12600 2 2 package org.openstreetmap.josm.gui.layer.imagery; 3 3 4 import java.util.HashMap; 4 5 import java.util.Map; 5 6 import java.util.concurrent.CopyOnWriteArrayList; … … 11 12 import org.openstreetmap.josm.data.preferences.BooleanProperty; 12 13 import org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer; 14 import org.openstreetmap.josm.io.session.SessionAwareReadApply; 13 15 import org.openstreetmap.josm.tools.CheckParameterUtil; 14 16 import org.openstreetmap.josm.tools.JosmRuntimeException; … … 22 24 * @since 10568 23 25 */ 24 public class TileSourceDisplaySettings {26 public class TileSourceDisplaySettings implements SessionAwareReadApply { 25 27 /** 26 28 * A string returned by {@link DisplaySettingsChangeEvent#getChangedSetting()} if auto load was changed. … … 249 251 * Stores the current settings object to the given hashmap. 250 252 * The offset data is not stored and needs to be handled separately. 251 * @param data The map to store the settings to. 252 * @see #loadFrom(Map) 253 * @see #applyFromPropertiesMap(Map) 253 254 * @see OffsetBookmark#toPropertiesMap() 254 255 */ 255 public void storeTo(Map<String, String> data) { 256 @Override 257 public Map<String, String> toPropertiesMap() { 258 Map<String, String> data = new HashMap<>(); 256 259 data.put(AUTO_LOAD, Boolean.toString(autoLoad)); 257 260 data.put(AUTO_ZOOM, Boolean.toString(autoZoom)); 258 261 data.put(SHOW_ERRORS, Boolean.toString(showErrors)); 262 return data; 259 263 } 260 264 … … 263 267 * The offset data is not loaded and needs to be handled separately. 264 268 * @param data The data 265 * @see # storeTo(Map)269 * @see #toPropertiesMap() 266 270 * @see OffsetBookmark#fromPropertiesMap(java.util.Map) 267 271 */ 268 public void loadFrom(Map<String, String> data) { 272 @Override 273 public void applyFromPropertiesMap(Map<String, String> data) { 269 274 try { 270 275 String doAutoLoad = data.get(AUTO_LOAD); -
trunk/src/org/openstreetmap/josm/io/session/ImagerySessionExporter.java
r12594 r12600 86 86 Map<String, String> data = new LinkedHashMap<>(Preferences.serializeStruct(e, ImageryPreferenceEntry.class)); 87 87 if (layer instanceof AbstractTileSourceLayer) { 88 ((AbstractTileSourceLayer<?>) layer).getDisplaySettings().storeTo(data);88 data.putAll(((AbstractTileSourceLayer<?>) layer).getDisplaySettings().toPropertiesMap()); 89 89 } 90 90 addAttributes(layerElem, data, support); -
trunk/src/org/openstreetmap/josm/io/session/ImagerySessionImporter.java
r12594 r12600 46 46 if (layer instanceof AbstractTileSourceLayer) { 47 47 AbstractTileSourceLayer<?> tsLayer = (AbstractTileSourceLayer<?>) layer; 48 tsLayer.getDisplaySettings(). loadFrom(attributes);48 tsLayer.getDisplaySettings().applyFromPropertiesMap(attributes); 49 49 Element offsetEl = getFirstElementByTagName(elem, "offset"); 50 50 if (offsetEl != null) {
Note:
See TracChangeset
for help on using the changeset viewer.