Class MapMenu

All Implemented Interfaces:
Styleable, Event­Target, Skinnable

public class MapMenu extends ContextMenu
A Context­Menu that can be shown in a Map­Canvas. On construction, this menu is initially empty. Items can be added by the following method calls: More choices may be added in a future versions. In current implementation, there is no mechanism for removing menu items.
Since:
1.1
  • Constructor Details

    • MapMenu

      public MapMenu(MapCanvas canvas)
      Creates an initially empty menu for the given canvas.
      Parameters:
      canvas - the canvas for which to create menus.
  • Method Details

    • addReferenceSystems

      public void addReferenceSystems(RecentReferenceSystems preferences)
      Adds menu items for CRS selection. The menu items are in two groups:
      • Reference system with some items from EPSG database.
      • Centered projection with the list of Positionable­Projection items.
      This method can be invoked at most once.
      Parameters:
      preferences - handler of menu items for selecting a CRS from a list of EPSG codes. Often built from user preferences.
      Throws:
      Illegal­State­Exception - if this method has already been invoked.
      See Also:
    • addCopyOptions

      public void addCopyOptions(StatusBar format)
      Adds a menu item for copying coordinates at the mouse position where right click occurred. The coordinate reference system is determined by the status bar, it is not necessarily the coordinate reference system of the map. This method can be invoked at most once.
      Parameters:
      format - status bar determining the CRS and format to use for coordinate values.
      Throws:
      Illegal­State­Exception - if this method has already been invoked.
    • selectedReferenceSystem

      public Optional<ObservableObjectValue<String>> selectedReferenceSystem()
      Returns an observable value for showing the name of the currently selected CRS for the map canvas. The value is absent if add­Reference­Systems(Recent­Reference­Systems) has never been invoked.
      Returns:
      name of the currently selected CRS for the map canvas.
      See Also: