Class SelectEventHandler

java.lang.Object
com.luciad.controllers.SelectEventHandler
All Implemented Interfaces:
AutoCloseable

public final class SelectEventHandler extends Object implements AutoCloseable
Handler that translates click gesture events to a select operation.

The select mode can be configured using the SelectMode enumeration.

  • Constructor Details Link icon

    • SelectEventHandler Link icon

      public SelectEventHandler(@NotNull SelectMode selectMode)
      Creates a new event handler that uses the given select mode.
      Parameters:
      selectMode - the mode.
  • Method Details Link icon

    • finalize Link icon

      protected void finalize()
      Overrides:
      finalize in class Object
    • close Link icon

      public void close()
      Specified by:
      close in interface AutoCloseable
    • onClickEvent Link icon

      @NotNull public EventResult onClickEvent(@NotNull ClickEvent clickEvent, @NotNull Map map) throws NullPointerException
      Changes the FeatureState#selected() state of features located under the event location directly or delegates the selection to the handler if it has been set.

      This allows the display of a context menu when multiple features are below the cursor, for example.

      Parameters:
      clickEvent - a click event. Cannot be null.
      map - the map. Cannot be null.
      Returns:
      whether the click event is consumed or not. The event is not consumed if the amount of clicks is different than 1.
      Throws:
      NullPointerException - when passing null for the map or the event.
      See Also:
    • onTouchLongPressEvent Link icon

      @NotNull public EventResult onTouchLongPressEvent(@NotNull TouchLongPressEvent touchLongPressEvent, @NotNull Map map) throws NullPointerException
      Changes the FeatureState#selected() state of features located under the event location directly or delegates the selection to the handler if it has been set.

      This allows the display of a context menu when multiple features are below the cursor, for example.

      Parameters:
      touchLongPressEvent - a touch long press event.
      map - the map.
      Returns:
      whether the event is consumed or not.
      Throws:
      NullPointerException - when passing null.
      See Also:
      • setTouchMargin for the margin applied to the touch point position to detect which features are considered.
    • setMargin Link icon

      public void setMargin(long margin)
      Sets the margin used to detect if a feature is considered under the mouse cursor or not.

      By default, the margin is 1 pixel.

      Parameters:
      margin - the margin, expressed in device independent pixels
    • getMargin Link icon

      public long getMargin()
      Returns the margin used to detect if a feature is considered under the mouse cursor or not.
      Returns:
      the margin used to detect if a feature is considered under the mouse cursor or not.
    • setTouchMargin Link icon

      public void setTouchMargin(long margin)
      Sets the margin used to detect if a feature is considered under a touch point or not.

      By default, the margin is 5 pixels.

      Parameters:
      margin - the margin, expressed in device independent pixels
    • getTouchMargin Link icon

      public long getTouchMargin()
      Returns the margin used to detect if a feature is considered under a touch point or not.
      Returns:
      the margin used to detect if a feature is considered under a touch point or not.
    • setSelectionCandidateChooser Link icon

      public void setSelectionCandidateChooser(@Nullable ISelectionCandidateChooser selectionCandidateChooser)
      Sets the selection candidate chooser that is used to choose which features need to be selected when there are multiple selection candidates.

      This selection chooser can for example be implemented by showing a popup menu that allows you to choose the feature to select. By default, this handler is null and no selection is requested.

      Parameters:
      selectionCandidateChooser - the candidate chooser.
    • getSelectionCandidateChooser Link icon

      @Nullable public ISelectionCandidateChooser getSelectionCandidateChooser()
      Returns the selection candidate chooser that is used to choose which features need to be selected when there are multiple selection candidates.
      Returns:
      the candidate chooser if any.
      See Also:
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals Link icon

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object