Class RecentReferenceSystems
ReferenceSystems.
 The list can be shown in a ChoiceBox or in a list of MenuItem controls.
 The last choice is an "Other…" item which, when selected, popups the CRSChooser.
 The choices are listed in following order:
- The first choice is the native or preferred reference system of visualized data. That choice stay always in the first position.
- The last choice is "Other…" and stay always in the last position.
- All other choices between first and last are ordered with most recently used first.
- Since:
- 1.1
Defined in the sis-javafx module
- 
Field SummaryFieldsModifier and TypeFieldDescriptionfinal ObjectProperty<Envelope>The area of interest, ornullif none.final ObjectProperty<ComparisonMode>The comparison criterion for considering two reference systems as a duplication.
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a builder which will use a default authority factory.RecentReferenceSystems(CRSAuthorityFactory factory, Locale locale) Creates a builder which will use the specified authority factory.
- 
Method SummaryModifier and TypeMethodDescriptionfinal voidaddAlternatives(boolean replaceByAuthoritativeDefinition, ReferenceSystem... systems) Adds the given reference systems to the list of alternative choices.voidaddAlternatives(String... codes) Adds the coordinate reference system identified by the given authority codes.voidAdds the coordinate reference systems saved in user preferences.ChoiceBox<ReferenceSystem>createChoiceBox(boolean filtered, ChangeListener<ReferenceSystem> action) Creates a box offering choices among the reference systems specified to thisRecentReferenceSystems.ChoiceBox<ReferenceSystem>createChoiceBox(ChangeListener<ReferenceSystem> action) Deprecated.MenucreateMenuItems(boolean filtered, ChangeListener<ReferenceSystem> action) Creates menu items offering choices among the reference systems specified to thisRecentReferenceSystems.MenucreateMenuItems(ChangeListener<ReferenceSystem> action) Deprecated.Replaced bycreateMenuItems(boolean, ChangeListener).protected voidInvoked when an error occurred while filtering aReferenceSysteminstance.ObservableList<ReferenceSystem>Returns all reference systems in the order they appear in JavaFX controls.Returns all currently selected reference systems in the order they appear in JavaFX controls.static ObjectProperty<ReferenceSystem>getSelectedProperty(Menu menu) Returns the property for the selected value in a menu created bycreateMenuItems(ChangeListener).voidsetGridReferencing(boolean replaceByAuthoritativeDefinition, Map<String, GridGeometry> geometries) Sets the reference systems, area of interest and "referencing by grid indices" systems.final voidsetPreferred(boolean replaceByAuthoritativeDefinition, ReferenceSystem system) Sets the native or preferred reference system.voidsetPreferred(String code) Sets the native or preferred reference system as an authority code.
- 
Field Details- 
areaOfInterestThe area of interest, ornullif none. This is used for filtering the reference systems added byaddAlternatives(…)and for providing some guidance to user whenCRSChooseris shown.API note: We do not provide getter/setter for this property; useWritableObjectValue.set(Object)directly instead. We omit the "Property" suffix for making this operation more natural.
- 
duplicationCriterionThe comparison criterion for considering two reference systems as a duplication. The default value isComparisonMode.ALLOW_VARIANT, i.e. axis orders are ignored.API note: We do not provide getter/setter for this property; useWritableObjectValue.set(Object)directly instead. We omit the "Property" suffix for making this operation more natural.
 
- 
- 
Constructor Details- 
RecentReferenceSystemspublic RecentReferenceSystems()Creates a builder which will use a default authority factory. The factory will be capable to handle at least some EPSG codes.
- 
RecentReferenceSystemsCreates a builder which will use the specified authority factory.- Parameters:
- factory- the factory to use for building CRS from authority codes, or- nullfor the default.
- locale- the preferred locale for displaying object name, or- nullfor the default locale.
- See Also:
 
 
- 
- 
Method Details- 
setGridReferencingpublic void setGridReferencing(boolean replaceByAuthoritativeDefinition, Map<String, GridGeometry> geometries) Sets the reference systems, area of interest and "referencing by grid indices" systems. This method performs all the following work:- Invokes setPreferred(boolean, ReferenceSystem)with the first CRS in iteration order.
- Invokes addAlternatives(boolean, ReferenceSystem...)for all other CRS (single call).
- Sets the areaOfInterestto the union of all envelopes.
- Sets the content of "Referencing by cell indices" sub-menu.
 - Parameters:
- replaceByAuthoritativeDefinition- whether the reference systems should be replaced by authoritative definition.
- geometries- grid coverage names together with their grid geometry. May be empty.
- Since:
- 1.3
 
- Invokes 
- 
setPreferredSets the native or preferred reference system. This is the system to always show as the first choice and should typically be the nativeCoordinateReferenceSystemof visualized data. If a previous preferred system existed, the previous system will be moved to alternative choices.The replaceByAuthoritativeDefinitionargument specifies whether the given reference system should be replaced by authoritative definition. Iftruethen for example a "WGS 84" geographic CRS with (longitude, latitude) axis order may be replaced by "EPSG::4326" definition with (latitude, longitude) axis order.- Parameters:
- replaceByAuthoritativeDefinition- whether the given system should be replaced by authoritative definition.
- system- the native or preferred reference system to show as the first choice.
 
- 
setPreferredSets the native or preferred reference system as an authority code. This is the system to always show as the first choice and should typically be the nativeCoordinateReferenceSystemof visualized data. If a previous preferred system existed, the previous system will be moved to alternative choices.If the given code is not recognized, then the error will be notified at some later time by a call to errorOccurred(FactoryException)in a background thread and the given code will be silently ignored. This behavior allows the use of codes that depend on whether an optional dependency is present or not, in particular the EPSG dataset.- Parameters:
- code- authority code of the native of preferred reference system to show as the first choice.
 
- 
addAlternativespublic final void addAlternatives(boolean replaceByAuthoritativeDefinition, ReferenceSystem... systems) Adds the given reference systems to the list of alternative choices. If there is duplicated values in the given list or with previously added systems, then only the first occurrence of duplicated values is retained. If an area of interest (AOI) is specified, then reference systems that do not intersect the AOI will be hidden.The replaceByAuthoritativeDefinitionargument specifies whether the given reference systems should be replaced by authoritative definitions. Iftruethen for example a "WGS 84" geographic CRS with (longitude, latitude) axis order may be replaced by "EPSG::4326" definition with (latitude, longitude) axis order.- Parameters:
- replaceByAuthoritativeDefinition- whether the given systems should be replaced by authoritative definitions.
- systems- the reference systems to add as alternative choices. Null elements are ignored.
 
- 
addAlternativesAdds the coordinate reference system identified by the given authority codes. If there is duplicated values in the given list or with previously added systems, then only the first occurrence of duplicated values is retained. If an area of interest (AOI) is specified, then reference systems that do not intersect the AOI will be hidden.If a code is not recognized, then the error will be notified at some later time by a call to errorOccurred(FactoryException)in a background thread and the code will be silently ignored. This behavior allows the use of codes that depend on whether an optional dependency is present or not, in particular the EPSG dataset.- Parameters:
- codes- authority codes of the coordinate reference systems to add as alternative choices. Null or empty elements are ignored.
 
- 
addUserPreferencespublic void addUserPreferences()Adds the coordinate reference systems saved in user preferences. The user preferences are determined from the reference systems observed during current execution or previous executions of JavaFX application. If an area of interest (AOI) is specified, then reference systems that do not intersect the AOI will be ignored.
- 
getItemsReturns all reference systems in the order they appear in JavaFX controls. The first element is thepreferred(or native) reference system. All other elements are alternatives.- Returns:
- all reference systems in the order they appear in JavaFX controls.
 
- 
getSelectedItemsReturns all currently selected reference systems in the order they appear in JavaFX controls. This method collects selected values of all controls created by acreateXXX(…)method. The returned list does not contain duplicated values.- Returns:
- currently selected values of all controls, without duplicated values and in the order they appear in choice lists.
 
- 
createChoiceBoxpublic ChoiceBox<ReferenceSystem> createChoiceBox(boolean filtered, ChangeListener<ReferenceSystem> action) Creates a box offering choices among the reference systems specified to thisRecentReferenceSystems. The returned control may be initially empty, in which case its content will be automatically set at a later time (after a background thread finished to process theCoordinateReferenceSystems).If the filteredargument istrue, then the choice box will contain only reference systems that can be used for rendering purposes. That filtered list can containCoordinateReferenceSysteminstances but not reference systems by identifiers such as MGRS. The latter are usable only for the purposes of formatting coordinate values as texts.LimitationsThere is currently no mechanism for disposing the returned control. For garbage collecting the returnedChoiceBox, thisRecentReferenceSystemsmust be garbage-collected as well.- Parameters:
- filtered- whether the choice box should contain only- CoordinateReferenceSysteminstances.
- action- the action to execute when a reference system is selected.
- Returns:
- a choice box with reference systems specified by setPreferred(…)andaddAlternatives(…)methods.
- Since:
- 1.3
 
- 
createMenuItemsCreates menu items offering choices among the reference systems specified to thisRecentReferenceSystems. The items will be inserted in the menu list. The content of that list will change at any time after this method returned: items will be added or removed as a result of user actions.If the filteredargument istrue, then the menu items will contain only reference systems that can be used for rendering purposes. That filtered list can containCoordinateReferenceSysteminstances but not reference systems by identifiers such as MGRS. The latter are usable only for the purposes of formatting coordinate values as texts.LimitationsThere is currently no mechanism for disposing the returned control. For garbage collecting the returnedMenu, thisRecentReferenceSystemsmust be garbage-collected as well.- Parameters:
- filtered- whether the menu should contain only- CoordinateReferenceSysteminstances.
- action- the action to execute when a reference system is selected.
- Returns:
- the menu containing items for reference systems.
- Since:
- 1.3
 
- 
createChoiceBox@Deprecated public ChoiceBox<ReferenceSystem> createChoiceBox(ChangeListener<ReferenceSystem> action) Deprecated.Replaced bycreateChoiceBox(boolean, ChangeListener).
- 
createMenuItemsDeprecated.Replaced bycreateMenuItems(boolean, ChangeListener).
- 
getSelectedPropertyReturns the property for the selected value in a menu created bycreateMenuItems(ChangeListener).- Parameters:
- menu- the menu, or- nullif none.
- Returns:
- the property for the selected value, or nullif none.
 
- 
errorOccurredInvoked when an error occurred while filtering aReferenceSysteminstance. The error may be a failure to convert an EPSG code to aCoordinateReferenceSysteminstance, or an error during a CRS verification. Some errors may be normal, for example because EPSG dataset is not expected to be present in every runtime environments. The consequence of this error is "only" that the CRS will not be listed among the reference systems that the user can choose.The default implementation popups an alert dialog only if the error occurred after the user accepted to download optional dependencies, because the error may be caused by a problem related to the download operation. Otherwise this method only logs the error at Level.FINE. No other processing is done; user is not notified unless (s)he paid attention to loggings.- Parameters:
- e- the error that occurred.
 
 
- 
createChoiceBox(boolean, ChangeListener).