Class TileSourceDisplaySettings
java.lang.Object
org.openstreetmap.josm.gui.layer.imagery.TileSourceDisplaySettings
- All Implemented Interfaces:
SessionAwareReadApply
This are the preferences of how to display a
TileSource.
They have been extracted from the AbstractTileSourceLayer. Each layer has one set of such settings.
- Since:
- 10568
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAn event that is created whenever the display settings change.static interfaceA listener that listens to changes to theTileSourceDisplaySettingsobject. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA string returned byTileSourceDisplaySettings.DisplaySettingsChangeEvent.getChangedSetting()if auto load was changed.static final StringA string returned byTileSourceDisplaySettings.DisplaySettingsChangeEvent.getChangedSetting()if auto zoom was changed.private booleanif layer automatically loads new tilesprivate booleanif layers changes automatically, when user zooms inprivate EastNorththe displacement (basically caches the displacement from the offsetBookmark in the current projection)private static final Stringprivate OffsetBookmarkprivate static final Stringprivate OffsetBookmarkstatic final BooleanPropertyThe default auto load propertystatic final BooleanPropertyThe default auto zoom propertystatic final BooleanPropertyThe default tile borders property, remembered whenever the user toggles them, so that the choice also applies to layers created later and after a restartprivate static final StringA string returned byTileSourceDisplaySettings.DisplaySettingsChangeEvent.getChangedSetting()if the show errors property was changed.private static final Stringprivate booleanif layer should show errors on tilesprivate booleanif layer should draw a border around each tile -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate a newTileSourceDisplaySettingsTileSourceDisplaySettings(String preferencePrefix) Create a newTileSourceDisplaySettingsprivateTileSourceDisplaySettings(String... prefixes) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a listener that listens to display settings changes.voidapplyFromPropertiesMap(Map<String, String> data) Load the settings from the given data instance.booleanprivate voidfireSettingsChange(String changedSetting) Notifies all listeners that the paint settings have changedGets the displacement of the imagegetDisplacementString(Locale locale) Gets the displacement of the image formatted as a stringdoublegetDx()Gets the displacement in x (east) directiondoublegetDy()Gets the displacement in y (north) directionGets the offset bookmark in use.Gets the offset bookmark previously in use.private static booleangetProperty(String[] prefixes, String name, Boolean def) inthashCode()booleanGets if the layer should automatically load new tiles.booleanLet the layer zoom automatically if the user zooms inbooleanIf the layer should display the errors it encountered while loading the tiles.booleanIf the layer should draw a thin border around each tile.voidRemove a listener that listens to display settings changes.voidsetAutoLoad(boolean autoLoad) Sets the auto load propertyvoidsetAutoZoom(boolean autoZoom) Sets the auto zoom propertyprivate voidsetDisplacement(EastNorth displacement) voidsetOffsetBookmark(OffsetBookmark offsetBookmark) Sets an offset bookmark to use.voidsetShowErrors(boolean showErrors) Sets the show errors property.voidsetShowTileBorders(boolean showTileBorders) Sets the show tile borders property.Stores the current settings object to the given hashmap.toString()
-
Field Details
-
AUTO_LOAD
A string returned byTileSourceDisplaySettings.DisplaySettingsChangeEvent.getChangedSetting()if auto load was changed.- See Also:
-
AUTO_ZOOM
A string returned byTileSourceDisplaySettings.DisplaySettingsChangeEvent.getChangedSetting()if auto zoom was changed.- See Also:
-
SHOW_ERRORS
A string returned byTileSourceDisplaySettings.DisplaySettingsChangeEvent.getChangedSetting()if the show errors property was changed.- See Also:
-
SHOW_TILE_BORDERS
- See Also:
-
DISPLACEMENT
- See Also:
-
PREFERENCE_PREFIX
- See Also:
-
PROP_AUTO_LOAD
The default auto load property -
PROP_AUTO_ZOOM
The default auto zoom property -
PROP_SHOW_TILE_BORDERS
The default tile borders property, remembered whenever the user toggles them, so that the choice also applies to layers created later and after a restart- Since:
- 19640
-
autoZoom
if layers changes automatically, when user zooms in -
autoLoad
if layer automatically loads new tiles -
showErrors
if layer should show errors on tiles -
showTileBorders
if layer should draw a border around each tile -
previousOffsetBookmark
-
offsetBookmark
-
displacement
the displacement (basically caches the displacement from the offsetBookmark in the current projection) -
listeners
-
-
Constructor Details
-
TileSourceDisplaySettings
public TileSourceDisplaySettings()Create a newTileSourceDisplaySettings -
TileSourceDisplaySettings
Create a newTileSourceDisplaySettings- Parameters:
preferencePrefix- The additional prefix to scan for preferences.
-
TileSourceDisplaySettings
-
-
Method Details
-
getProperty
-
isAutoZoom
Let the layer zoom automatically if the user zooms in- Returns:
- auto zoom
-
setAutoZoom
Sets the auto zoom property- Parameters:
autoZoom-trueto let the layer zoom automatically if the user zooms in- See Also:
-
isAutoLoad
Gets if the layer should automatically load new tiles.- Returns:
trueif it should
-
setAutoLoad
Sets the auto load property- Parameters:
autoLoad-trueif the layer should automatically load new tiles- See Also:
-
isShowErrors
If the layer should display the errors it encountered while loading the tiles.- Returns:
trueto show errors.
-
setShowErrors
Sets the show errors property. Fires a change event.- Parameters:
showErrors-trueif the layer should display the errors it encountered while loading the tiles- See Also:
-
isShowTileBorders
If the layer should draw a thin border around each tile.- Returns:
trueto draw tile borders.- Since:
- 19640
-
setShowTileBorders
Sets the show tile borders property. Fires a change event.- Parameters:
showTileBorders-trueif the layer should draw a thin border around each tile- Since:
- 19640
- See Also:
-
getDx
Gets the displacement in x (east) direction- Returns:
- The displacement.
- Since:
- 10571
- See Also:
-
getDy
Gets the displacement in y (north) direction- Returns:
- The displacement.
- Since:
- 10571
- See Also:
-
getDisplacement
Gets the displacement of the image- Returns:
- The displacement.
- Since:
- 10571
-
getDisplacementString
Gets the displacement of the image formatted as a string- Parameters:
locale- the locale used to format the decimals- Returns:
- the displacement string
- Since:
- 15733
- See Also:
-
setOffsetBookmark
Sets an offset bookmark to use. Loads the displacement from the bookmark.- Parameters:
offsetBookmark- the offset bookmark, may be null
-
getOffsetBookmark
Gets the offset bookmark in use.- Returns:
- the offset bookmark, may be null
-
getPreviousOffsetBookmark
Gets the offset bookmark previously in use.- Returns:
- the previously used offset bookmark, may be null
-
setDisplacement
-
fireSettingsChange
Notifies all listeners that the paint settings have changed- Parameters:
changedSetting- The setting name
-
addSettingsChangeListener
Add a listener that listens to display settings changes.- Parameters:
l- The listener
-
removeSettingsChangeListener
Remove a listener that listens to display settings changes.- Parameters:
l- The listener
-
toPropertiesMap
Stores the current settings object to the given hashmap. The offset data is not stored and needs to be handled separately.- Specified by:
toPropertiesMapin interfaceSessionAwareReadApply- Returns:
- map of properties
- See Also:
-
applyFromPropertiesMap
Load the settings from the given data instance. The offset data is not loaded and needs to be handled separately.- Specified by:
applyFromPropertiesMapin interfaceSessionAwareReadApply- Parameters:
data- The data- See Also:
-
hashCode
-
equals
-
toString
-