Class ProjectionPreference
- All Implemented Interfaces:
PreferenceSetting,TabPreferenceSetting
How to add new Projections:
- Find EPSG code for the projection.
- Look up the parameter string for Proj4, e.g. on https://spatialreference.org/
and add it to the file 'data/projection/epsg' in JOSM trunk
- Search for official references and verify the parameter values. These
documents are often available in the local language only.
- Use registerProjectionChoice(org.openstreetmap.josm.gui.preferences.projection.ProjectionChoice), to make the entry known to JOSM.
In case there is no EPSG code:
- override AbstractProjectionChoice.getProjection() and provide
a manual implementation of the projection. Use CustomProjection
if possible.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFactory used to create a newProjectionPreference. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JLabelprivate final JosmComboBox<ICoordinateFormat>Combobox with all coordinate display possibilitiesstatic final ProjectionChoiceLambert conic conform 4 zones using the French geodetic system NTF.static final ProjectionChoiceLambert Conic Conform 9 Zones projection.static final ProjectionChoiceMercator Projection.private static Stringprivate static final List<ProjectionChoice>private static final Map<String,ProjectionChoice> private final JLabelprivate final Componentprivate final JLabelprivate final JosmComboBox<ProjectionChoice>Combobox with all projections availableprivate final JLabelprivate final Componentprivate final JLabelprivate final VerticallyScrollablePanelThis is the panel holding all projection preferencesprivate JPanelThis variable holds the JPanel with the projection's preferences.private static final GBCThe GridBagConstraints for the Panel containing the ProjectionSubPrefs.private final JPanelprivate static final StringPropertyprivate static final StringPropertyprivate static final ListPropertyprivate final JosmComboBox<SystemOfMeasurement>Combobox with all system of measurementsstatic final ProjectionChoiceFrench regions in the Caribbean Sea and Indian Ocean.static final ProjectionChoiceWGS84: Directly use latitude / longitude values as x/y. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the GUI elements to the dialog.static StringGet the id of the projection choice that is currently set.Returns the help context for this preferences settings tab.static List<ProjectionChoice>Returns the list of projection choices.static Collection<String>Get the preferences that have been selected the last time for the given projection choice.booleanisExpert()Called to know if the preferences tab has only to be displayed in expert mode.booleanok()Called when OK is pressed to save the setting in the preferences file.private static ProjectionChoiceregisterProjectionChoice(String name, String id, Integer epsg) Registers a new projection choice.static voidRegisters a new projection choice.private voidHandles all the work related to update the projection-specific preferencesvoidselectProjection(ProjectionChoice projection) Selects the given projection.static voidSet default projection.static voidsetProjection(String id, Collection<String> pref, boolean makeDefault) Set projection.private ProjectionChoiceSets up projection combobox with default values and action listenerprivate voidMethods inherited from class org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting
addSubTab, addSubTab, canBeHidden, createPreferenceTabWithScrollPane, getDescription, getIconName, getSelectedSubTab, getSubTab, getTabPane, getTitle, getTooltip, registerSubTab, selectSubTabMethods inherited from class org.openstreetmap.josm.gui.preferences.DefaultPreferenceSetting
saveBoolean, saveDouble, saveIntMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.gui.preferences.TabPreferenceSetting
getIcon
-
Field Details
-
projectionChoices
-
projectionChoicesById
-
wgs84
WGS84: Directly use latitude / longitude values as x/y. -
mercator
Mercator Projection.The center of the mercator projection is always the 0 grad coordinate.
See also USGS Bulletin 1532 initially EPSG used 3785 but that has been superseded by 3857, see epsg-registry.org
-
lambert
Lambert conic conform 4 zones using the French geodetic system NTF.This newer version uses the grid translation NTF ⟷ RGF93 provided by IGN for a submillimetric accuracy. (RGF93 is the French geodetic system similar to WGS84 but not mathematically equal)
-
utm_france_dom
French regions in the Caribbean Sea and Indian Ocean.Using the UTM transvers Mercator projection and specific geodesic settings.
-
lambert_cc9
Lambert Conic Conform 9 Zones projection.As specified by the IGN in this document cc9zones.pdf
-
projectionChoice
-
PROP_PROJECTION_DEFAULT
-
PROP_COORDINATES
-
PROP_SUB_PROJECTION_DEFAULT
-
projectionCombo
Combobox with all projections available -
coordinatesCombo
Combobox with all coordinate display possibilities -
unitsCombo
Combobox with all system of measurements -
projSubPrefPanel
This variable holds the JPanel with the projection's preferences. If the selected projection does not implement this, it will be set to an empty Panel. -
projSubPrefPanelWrapper
-
projectionCodeLabel
-
projectionCodeGlue
-
projectionCode
-
projectionNameLabel
-
projectionNameGlue
-
projectionName
-
bounds
-
projPanel
This is the panel holding all projection preferences -
projSubPrefPanelGBC
The GridBagConstraints for the Panel containing the ProjectionSubPrefs. This is required twice in the code, creating it here keeps both occurrences in sync
-
-
Constructor Details
-
ProjectionPreference
public ProjectionPreference()Constructs a newProjectionPreference.
-
-
Method Details
-
registerProjectionChoice
Registers a new projection choice.- Parameters:
c- projection choice
-
registerProjectionChoice
Registers a new projection choice.- Parameters:
name- short name of the projection choice as shown in the GUIid- short name of the projection choice as shown in the GUIepsg- the unique numeric EPSG identifier for the projection- Returns:
- the registered
ProjectionChoice
-
getProjectionChoices
Returns the list of projection choices.- Returns:
- the list of projection choices
-
addGui
Description copied from interface:PreferenceSettingAdd the GUI elements to the dialog. The elements should be initialized after the current preferences.- Parameters:
gui- the preferences tab pane
-
updateMeta
-
ok
Description copied from interface:PreferenceSettingCalled when OK is pressed to save the setting in the preferences file. Return true when restart is required.- Returns:
trueif restart is required
-
setProjection
Set default projection. -
setProjection
Set projection.- Parameters:
id- id of the selected projection choicepref- the configuration for the selected projection choicemakeDefault- true, if it is to be set as permanent default false, if it is to be set for the current session- Since:
- 12306
-
selectedProjectionChanged
Handles all the work related to update the projection-specific preferences- Parameters:
pc- the choice class representing user selection
-
setupProjectionCombo
Sets up projection combobox with default values and action listener- Returns:
- the choice class for user selection
-
getCurrentProjectionChoiceId
Get the id of the projection choice that is currently set.- Returns:
- id of the projection choice that is currently set
-
getSubprojectionPreference
Get the preferences that have been selected the last time for the given projection choice.- Parameters:
pcId- id of the projection choice- Returns:
- projection choice parameters that have been selected by the user the last time; null if user has never selected the given projection choice
-
isExpert
Description copied from interface:PreferenceSettingCalled to know if the preferences tab has only to be displayed in expert mode.- Specified by:
isExpertin interfacePreferenceSetting- Overrides:
isExpertin classDefaultPreferenceSetting- Returns:
- true if the tab has only to be displayed in expert mode, false otherwise.
-
selectProjection
Selects the given projection.- Parameters:
projection- The projection to select.- Since:
- 5604
-
getHelpContext
Description copied from interface:TabPreferenceSettingReturns the help context for this preferences settings tab.- Specified by:
getHelpContextin interfaceTabPreferenceSetting- Overrides:
getHelpContextin classDefaultTabPreferenceSetting- Returns:
- the help context for this preferences settings tab
-