Class CustomProjectionChoice
- java.lang.Object
-
- org.openstreetmap.josm.gui.preferences.projection.AbstractProjectionChoice
-
- org.openstreetmap.josm.gui.preferences.projection.CustomProjectionChoice
-
- All Implemented Interfaces:
ProjectionChoice
,SubPrefsOptions
public class CustomProjectionChoice extends AbstractProjectionChoice implements SubPrefsOptions
ProjectionChoice where a CRS can be defined using various parameters.The configuration string mimics the syntax of the PROJ.4 project and should be mostly compatible.
- See Also:
CustomProjection
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CustomProjectionChoice.ParameterInfoDialog
A dialog for the available parameters of the custom projectionprivate static class
CustomProjectionChoice.PreferencePanel
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
pref
-
Fields inherited from class org.openstreetmap.josm.gui.preferences.projection.AbstractProjectionChoice
id, name
-
-
Constructor Summary
Constructors Constructor Description CustomProjectionChoice()
Constructs a newCustomProjectionChoice
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]
allCodes()
Return all projection codes supported by this projection choice.java.lang.String
getCurrentCode()
Returns current projection code.javax.swing.JPanel
getPreferencePanel(java.awt.event.ActionListener listener)
Generate and provide the GUI.java.util.Collection<java.lang.String>
getPreferences(javax.swing.JPanel panel)
Extract preferences from the GUI.java.util.Collection<java.lang.String>
getPreferencesFromCode(java.lang.String code)
Get Preferences from projection code.Projection
getProjection()
Get the projection that matches the internal state.java.lang.String
getProjectionName()
Returns projection name.void
setPreferences(java.util.Collection<java.lang.String> args)
Set the internal state to match the preferences.boolean
showProjectionCode()
Determines if the projection code should be displayed in the top panel.boolean
showProjectionName()
Determines if the projection name should be displayed in the top panel.-
Methods inherited from class org.openstreetmap.josm.gui.preferences.projection.AbstractProjectionChoice
getId, toString
-
-
-
-
Field Detail
-
pref
private java.lang.String pref
-
-
Constructor Detail
-
CustomProjectionChoice
public CustomProjectionChoice()
Constructs a newCustomProjectionChoice
.
-
-
Method Detail
-
setPreferences
public void setPreferences(java.util.Collection<java.lang.String> args)
Description copied from interface:ProjectionChoice
Set the internal state to match the preferences. Will be called before getPreferencePanel and when the listener from getPreferencePanel is invoked.- Specified by:
setPreferences
in interfaceProjectionChoice
- Parameters:
args
- preferences as a list of strings; may be null to reset everything.
-
getProjection
public Projection getProjection()
Description copied from interface:ProjectionChoice
Get the projection that matches the internal state.- Specified by:
getProjection
in interfaceProjectionChoice
- Overrides:
getProjection
in classAbstractProjectionChoice
- Returns:
- the effective projection
-
getCurrentCode
public java.lang.String getCurrentCode()
Description copied from class:AbstractProjectionChoice
Returns current projection code.- Specified by:
getCurrentCode
in classAbstractProjectionChoice
- Returns:
- current projection code
-
getProjectionName
public java.lang.String getProjectionName()
Description copied from class:AbstractProjectionChoice
Returns projection name.- Specified by:
getProjectionName
in classAbstractProjectionChoice
- Returns:
- projection name
-
getPreferencePanel
public javax.swing.JPanel getPreferencePanel(java.awt.event.ActionListener listener)
Description copied from interface:ProjectionChoice
Generate and provide the GUI. It will be displayed to the user. Call the listener, when the user makes changes in the GUI, so the projection info in the top panel gets updated.- Specified by:
getPreferencePanel
in interfaceProjectionChoice
- Parameters:
listener
- listener for any change of preferences- Returns:
- the GUI panel
-
getPreferences
public java.util.Collection<java.lang.String> getPreferences(javax.swing.JPanel panel)
Description copied from interface:ProjectionChoice
Extract preferences from the GUI. Will be called when the preference dialog is dismissed or when the listener from getPreferencePanel is invoked.- Specified by:
getPreferences
in interfaceProjectionChoice
- Parameters:
panel
- projection preferences panel- Returns:
- preferences as a list of strings; may be null to reset everything.
- See Also:
ProjectionChoice.setPreferences(java.util.Collection<java.lang.String>)
-
allCodes
public java.lang.String[] allCodes()
Description copied from interface:ProjectionChoice
Return all projection codes supported by this projection choice.- Specified by:
allCodes
in interfaceProjectionChoice
- Returns:
- all supported projection codes
-
getPreferencesFromCode
public java.util.Collection<java.lang.String> getPreferencesFromCode(java.lang.String code)
Description copied from interface:ProjectionChoice
Get Preferences from projection code.- Specified by:
getPreferencesFromCode
in interfaceProjectionChoice
- Parameters:
code
- projection code- Returns:
- null when code is not part of this projection choice. An empty Collection as return value indicates, that the code is supported, but no preferences are required to set it up.
-
showProjectionCode
public boolean showProjectionCode()
Description copied from interface:SubPrefsOptions
Determines if the projection code should be displayed in the top panel.- Specified by:
showProjectionCode
in interfaceSubPrefsOptions
- Returns:
- true, if the projection code should be displayed in the top panel
-
showProjectionName
public boolean showProjectionName()
Description copied from interface:SubPrefsOptions
Determines if the projection name should be displayed in the top panel.- Specified by:
showProjectionName
in interfaceSubPrefsOptions
- Returns:
- true, if the projection name should be displayed in the top panel
-
-