Class ProjectionPreference
- java.lang.Object
-
- org.openstreetmap.josm.gui.preferences.DefaultPreferenceSetting
-
- org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting
-
- org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference
-
- All Implemented Interfaces:
PreferenceSetting,TabPreferenceSetting
public class ProjectionPreference extends DefaultTabPreferenceSetting
Projection preferences.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. UseCustomProjectionif possible.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProjectionPreference.FactoryFactory used to create a newProjectionPreference.
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.JLabelboundsprivate JosmComboBox<ICoordinateFormat>coordinatesComboCombobox with all coordinate display possibilitiesstatic ProjectionChoicelambertLambert conic conform 4 zones using the French geodetic system NTF.static ProjectionChoicelambert_cc9Lambert Conic Conform 9 Zones projection.static ProjectionChoicemercatorMercator Projection.private static java.lang.StringprojectionChoiceprivate static java.util.List<ProjectionChoice>projectionChoicesprivate static java.util.Map<java.lang.String,ProjectionChoice>projectionChoicesByIdprivate javax.swing.JLabelprojectionCodeprivate java.awt.ComponentprojectionCodeGlueprivate javax.swing.JLabelprojectionCodeLabelprivate JosmComboBox<ProjectionChoice>projectionComboCombobox with all projections availableprivate javax.swing.JLabelprojectionNameprivate java.awt.ComponentprojectionNameGlueprivate javax.swing.JLabelprojectionNameLabelprivate VerticallyScrollablePanelprojPanelThis is the panel holding all projection preferencesprivate javax.swing.JPanelprojSubPrefPanelThis variable holds the JPanel with the projection's preferences.private static GBCprojSubPrefPanelGBCThe GridBagConstraints for the Panel containing the ProjectionSubPrefs.private javax.swing.JPanelprojSubPrefPanelWrapperprivate static StringPropertyPROP_COORDINATESprivate static StringPropertyPROP_PROJECTION_DEFAULTprivate static ListPropertyPROP_SUB_PROJECTION_DEFAULTprivate JosmComboBox<SystemOfMeasurement>unitsComboCombobox with all system of measurementsstatic ProjectionChoiceutm_france_domFrench regions in the Caribbean Sea and Indian Ocean.static ProjectionChoicewgs84WGS84: Directly use latitude / longitude values as x/y.
-
Constructor Summary
Constructors Constructor Description ProjectionPreference()Constructs a newProjectionPreference.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGui(PreferenceTabbedPane gui)Add the GUI elements to the dialog.static java.lang.StringgetCurrentProjectionChoiceId()Get the id of the projection choice that is currently set.java.lang.StringgetHelpContext()Returns the help context for this preferences settings tab.static java.util.List<ProjectionChoice>getProjectionChoices()Returns the list of projection choices.static java.util.Collection<java.lang.String>getSubprojectionPreference(java.lang.String pcId)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(java.lang.String name, java.lang.String id, java.lang.Integer epsg)Registers a new projection choice.static voidregisterProjectionChoice(ProjectionChoice c)Registers a new projection choice.private voidselectedProjectionChanged(ProjectionChoice pc)Handles all the work related to update the projection-specific preferencesvoidselectProjection(ProjectionChoice projection)Selects the given projection.static voidsetProjection()Set default projection.static voidsetProjection(java.lang.String id, java.util.Collection<java.lang.String> pref, boolean makeDefault)Set projection.private ProjectionChoicesetupProjectionCombo()Sets up projection combobox with default values and action listenerprivate voidupdateMeta(ProjectionChoice pc)-
Methods inherited from class org.openstreetmap.josm.gui.preferences.DefaultTabPreferenceSetting
addSubTab, addSubTab, canBeHidden, createPreferenceTabWithScrollPane, getDescription, getIconName, getSelectedSubTab, getSubTab, getTabPane, getTitle, getTooltip, registerSubTab, selectSubTab
-
Methods inherited from class org.openstreetmap.josm.gui.preferences.DefaultPreferenceSetting
saveBoolean, saveDouble, saveInt
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.gui.preferences.TabPreferenceSetting
getIcon
-
-
-
-
Field Detail
-
projectionChoices
private static final java.util.List<ProjectionChoice> projectionChoices
-
projectionChoicesById
private static final java.util.Map<java.lang.String,ProjectionChoice> projectionChoicesById
-
wgs84
public static final ProjectionChoice wgs84
WGS84: Directly use latitude / longitude values as x/y.
-
mercator
public static final ProjectionChoice 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
public static final ProjectionChoice 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
public static final ProjectionChoice utm_france_dom
French regions in the Caribbean Sea and Indian Ocean.Using the UTM transvers Mercator projection and specific geodesic settings.
-
lambert_cc9
public static final ProjectionChoice lambert_cc9
Lambert Conic Conform 9 Zones projection.As specified by the IGN in this document cc9zones.pdf
-
projectionChoice
private static java.lang.String projectionChoice
-
PROP_PROJECTION_DEFAULT
private static final StringProperty PROP_PROJECTION_DEFAULT
-
PROP_COORDINATES
private static final StringProperty PROP_COORDINATES
-
PROP_SUB_PROJECTION_DEFAULT
private static final ListProperty PROP_SUB_PROJECTION_DEFAULT
-
projectionCombo
private final JosmComboBox<ProjectionChoice> projectionCombo
Combobox with all projections available
-
coordinatesCombo
private final JosmComboBox<ICoordinateFormat> coordinatesCombo
Combobox with all coordinate display possibilities
-
unitsCombo
private final JosmComboBox<SystemOfMeasurement> unitsCombo
Combobox with all system of measurements
-
projSubPrefPanel
private javax.swing.JPanel 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
private final javax.swing.JPanel projSubPrefPanelWrapper
-
projectionCodeLabel
private final javax.swing.JLabel projectionCodeLabel
-
projectionCodeGlue
private final java.awt.Component projectionCodeGlue
-
projectionCode
private final javax.swing.JLabel projectionCode
-
projectionNameLabel
private final javax.swing.JLabel projectionNameLabel
-
projectionNameGlue
private final java.awt.Component projectionNameGlue
-
projectionName
private final javax.swing.JLabel projectionName
-
bounds
private final javax.swing.JLabel bounds
-
projPanel
private final VerticallyScrollablePanel projPanel
This is the panel holding all projection preferences
-
projSubPrefPanelGBC
private static final GBC 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 Detail
-
ProjectionPreference
public ProjectionPreference()
Constructs a newProjectionPreference.
-
-
Method Detail
-
registerProjectionChoice
public static void registerProjectionChoice(ProjectionChoice c)
Registers a new projection choice.- Parameters:
c- projection choice
-
registerProjectionChoice
private static ProjectionChoice registerProjectionChoice(java.lang.String name, java.lang.String id, java.lang.Integer epsg)
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
public static java.util.List<ProjectionChoice> getProjectionChoices()
Returns the list of projection choices.- Returns:
- the list of projection choices
-
addGui
public void addGui(PreferenceTabbedPane gui)
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
private void updateMeta(ProjectionChoice pc)
-
ok
public boolean 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
public static void setProjection()
Set default projection.
-
setProjection
public static void setProjection(java.lang.String id, java.util.Collection<java.lang.String> pref, boolean makeDefault)
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
private void selectedProjectionChanged(ProjectionChoice pc)
Handles all the work related to update the projection-specific preferences- Parameters:
pc- the choice class representing user selection
-
setupProjectionCombo
private ProjectionChoice setupProjectionCombo()
Sets up projection combobox with default values and action listener- Returns:
- the choice class for user selection
-
getCurrentProjectionChoiceId
public static java.lang.String getCurrentProjectionChoiceId()
Get the id of the projection choice that is currently set.- Returns:
- id of the projection choice that is currently set
-
getSubprojectionPreference
public static java.util.Collection<java.lang.String> getSubprojectionPreference(java.lang.String pcId)
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
public boolean 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
public void selectProjection(ProjectionChoice projection)
Selects the given projection.- Parameters:
projection- The projection to select.- Since:
- 5604
-
getHelpContext
public java.lang.String 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
-
-