Class MapProjectionMenu

All Implemented Interfaces:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, MenuElement, SwingConstants

public class MapProjectionMenu extends JMenu
A JMenu that presents all available EProjection values as mutually exclusive radio-button items.

Default selection

The initially selected projection is MapConstants.DEFAULT_PROJECTION. Previously this class hardcoded EProjection.MOLLWEIDE as the default, which disagreed with MapView2D's actual default of EProjection.MERCATOR. Both now share the constant so they can never diverge silently.

Callback

When the user selects a new projection an ActionEvent is fired on the supplied ActionListener with the command string set to the enum's Enum.name() (e.g. "MERCATOR").

See Also:
  • Constructor Details

    • MapProjectionMenu

      public MapProjectionMenu(ActionListener callback)
      Creates the "Map Projection" menu populated with one radio-button item per EProjection value.
      Parameters:
      callback - listener notified when the projection changes; must not be null
  • Method Details

    • getCurrentProjection

      public EProjection getCurrentProjection()
      Returns the currently selected EProjection.
      Returns:
      the selected projection; never null