Package org.openstreetmap.josm.actions
Class AddImageryLayerAction
java.lang.Object
javax.swing.AbstractAction
org.openstreetmap.josm.actions.JosmAction
org.openstreetmap.josm.actions.AddImageryLayerAction
- All Implemented Interfaces:
ActionListener,Serializable,Cloneable,EventListener,Action,AdaptableAction,Destroyable
Action displayed in imagery menu to add a new imagery layer.
- Since:
- 3715
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents the user choices when selecting layers to display.(package private) static classNested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter -
Field Summary
FieldsFields inherited from class org.openstreetmap.josm.actions.JosmAction
scFields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newAddImageryLayerActionfor the givenImageryInfo. -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate static AddImageryLayerAction.LayerSelectionprivate static ImageryInfoconvertImagery(ImageryInfo info) Converts general ImageryInfo to specific one, that does not need any user action to initialize see: https://josm.openstreetmap.de/ticket/13868protected static ImageryInfogetWMSLayerInfo(ImageryInfo info) Asks user to choose a WMS layer from a WMS endpoint.static ImageryInfoAsks user to choose a WMS layer from a WMS endpoint.private static voidhandleException(Exception ex, String uiMessage, String uiTitle, String logMessage) protected booleanOverwrite this ifJosmAction.updateEnabledState()should be called when the selection changed.toString()protected voidOverride in subclasses to update the enabled state of the action when something in the JOSM state changes, i.e.Methods inherited from class org.openstreetmap.josm.actions.JosmAction
buildActiveLayerChangeAdapter, buildLayerChangeAdapter, checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, setHelpId, setToolbarId, setTooltip, updateEnabledState, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFutureMethods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabledMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javax.swing.Action
accept, addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Field Details
-
WMS_ERROR
-
info
-
-
Constructor Details
-
AddImageryLayerAction
Constructs a newAddImageryLayerActionfor the givenImageryInfo. If an http:// icon is specified, it is fetched asynchronously.- Parameters:
info- The imagery info
-
-
Method Details
-
convertImagery
Converts general ImageryInfo to specific one, that does not need any user action to initialize see: https://josm.openstreetmap.de/ticket/13868- Parameters:
info- ImageryInfo that will be converted (or returned when no conversion needed)- Returns:
- ImageryInfo object that's ready to be used to create TileSource
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
askToSelectLayers
-
getWMSLayerInfo
protected static ImageryInfo getWMSLayerInfo(ImageryInfo info) throws IOException, WMSImagery.WMSGetCapabilitiesException Asks user to choose a WMS layer from a WMS endpoint.- Parameters:
info- the WMS endpoint.- Returns:
- chosen WMS layer, or null
- Throws:
IOException- if any I/O error occurs while contacting the WMS endpointWMSImagery.WMSGetCapabilitiesException- if the WMS getCapabilities request failsInvalidPathException- if a Path object cannot be constructed for the capabilities cached file
-
getWMSLayerInfo
public static ImageryInfo getWMSLayerInfo(ImageryInfo info, Function<WMSImagery, AddImageryLayerAction.LayerSelection> choice) throws IOException, WMSImagery.WMSGetCapabilitiesExceptionAsks user to choose a WMS layer from a WMS endpoint.- Parameters:
info- the WMS endpoint.choice- how the user may choose the WMS layer- Returns:
- chosen WMS layer, or null
- Throws:
IOException- if any I/O error occurs while contacting the WMS endpointWMSImagery.WMSGetCapabilitiesException- if the WMS getCapabilities request failsInvalidPathException- if a Path object cannot be constructed for the capabilities cached file- Since:
- 14549
-
handleException
private static void handleException(Exception ex, String uiMessage, String uiTitle, String logMessage) -
listenToSelectionChange
Description copied from class:JosmActionOverwrite this ifJosmAction.updateEnabledState()should be called when the selection changed. Default is true.- Overrides:
listenToSelectionChangein classJosmAction- Returns:
trueif aDataSelectionListenershould be registered.
-
updateEnabledState
Description copied from class:JosmActionOverride in subclasses to update the enabled state of the action when something in the JOSM state changes, i.e. when a layer is removed or added. SeeJosmAction.updateEnabledState(Collection)to respond to changes in the collection of selected primitives. Default behavior is empty.- Overrides:
updateEnabledStatein classJosmAction- See Also:
-
toString
-