LuciadCPillar 2023.1.04
luciad::SelectEventHandler Class Referencefinal

Handler that translates click gesture events to a select operation. More...

#include <luciad/controllers/SelectEventHandler.h>

Public Member Functions

 SelectEventHandler (const SelectEventHandler &other)=delete
 
 SelectEventHandler (SelectMode selectMode)
 Creates a new event handler that uses the given select mode. More...
 
 ~SelectEventHandler ()
 
size_t getMargin () const noexcept
 Returns the margin used to detect if a feature is considered under the mouse cursor or not. More...
 
std::shared_ptr< ISelectionCandidateChoosergetSelectionCandidateChooser () const
 Returns the selection candidate chooser that is used to choose which features need to be selected when there are multiple selection candidates. More...
 
size_t getTouchMargin () const noexcept
 Returns the margin used to detect if a feature is considered under a touch point or not. More...
 
EventResult onClickEvent (const std::shared_ptr< ClickEvent > &clickEvent, const std::shared_ptr< Map > &map)
 Changes the luciad::FeatureState::selected() state of features located under the event location directly or delegates the selection to the handler if it has been set. More...
 
EventResult onTouchLongPressEvent (const std::shared_ptr< TouchLongPressEvent > &touchLongPressEvent, const std::shared_ptr< Map > &map)
 Changes the luciad::FeatureState::selected() state of features located under the event location directly or delegates the selection to the handler if it has been set. More...
 
SelectEventHandleroperator= (const SelectEventHandler &other)=delete
 
void setMargin (size_t margin) noexcept
 Sets the margin used to detect if a feature is considered under the mouse cursor or not. More...
 
void setSelectionCandidateChooser (std::shared_ptr< ISelectionCandidateChooser > selectionCandidateChooser)
 
void setTouchMargin (size_t margin) noexcept
 Sets the margin used to detect if a feature is considered under a touch point or not. More...
 

Detailed Description

Handler that translates click gesture events to a select operation.

The select mode can be configured using the luciad::SelectMode enumeration.

Since
2020.1

Constructor & Destructor Documentation

◆ SelectEventHandler() [1/2]

luciad::SelectEventHandler::SelectEventHandler ( SelectMode  selectMode)
explicit

Creates a new event handler that uses the given select mode.

Parameters
selectModethe mode.

◆ ~SelectEventHandler()

luciad::SelectEventHandler::~SelectEventHandler ( )

◆ SelectEventHandler() [2/2]

luciad::SelectEventHandler::SelectEventHandler ( const SelectEventHandler other)
delete

Member Function Documentation

◆ getMargin()

size_t luciad::SelectEventHandler::getMargin ( ) const
noexcept

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.

◆ getSelectionCandidateChooser()

std::shared_ptr< ISelectionCandidateChooser > luciad::SelectEventHandler::getSelectionCandidateChooser ( ) const

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
luciad::SelectEventHandler::setSelectionCandidateChooser

◆ getTouchMargin()

size_t luciad::SelectEventHandler::getTouchMargin ( ) const
noexcept

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.

◆ onClickEvent()

EventResult luciad::SelectEventHandler::onClickEvent ( const std::shared_ptr< ClickEvent > &  clickEvent,
const std::shared_ptr< Map > &  map 
)

Changes the luciad::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
clickEventa click event. Cannot be nullptr.
mapthe map. Cannot be nullptr.
Returns
whether the click event is consumed or not. The event is not consumed if the amount of clicks is different than 1.
Exceptions
luciad::NullArgumentExceptionwhen passing nullptr for the map or the event.
See also
setMargin and {luciad::SelectEventHandler::setTouchMargin setTouchMargin} for the margin applied to the mouse cursor or touch point position to detect which features are considered.

◆ onTouchLongPressEvent()

EventResult luciad::SelectEventHandler::onTouchLongPressEvent ( const std::shared_ptr< TouchLongPressEvent > &  touchLongPressEvent,
const std::shared_ptr< Map > &  map 
)

Changes the luciad::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
touchLongPressEventa touch long press event.
mapthe map.
Returns
whether the event is consumed or not.
Exceptions
luciad::NullArgumentExceptionwhen passing nullptr.
See also
setTouchMargin for the margin applied to the touch point position to detect which features are considered.
Since
2022.0

◆ operator=()

SelectEventHandler & luciad::SelectEventHandler::operator= ( const SelectEventHandler other)
delete

◆ setMargin()

void luciad::SelectEventHandler::setMargin ( size_t  margin)
noexcept

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
marginthe margin, expressed in device independent pixels

◆ setSelectionCandidateChooser()

void luciad::SelectEventHandler::setSelectionCandidateChooser ( std::shared_ptr< ISelectionCandidateChooser selectionCandidateChooser)

◆ setTouchMargin()

void luciad::SelectEventHandler::setTouchMargin ( size_t  margin)
noexcept

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
marginthe margin, expressed in device independent pixels