LuciadCPillar 2023.1.03
luciad::ZoomEventHandler Class Referencefinal

Handler that translates scroll or click gesture events to a zoom operation. More...

#include <luciad/controllers/ZoomEventHandler.h>

Public Member Functions

 ZoomEventHandler ()
 Creates a new zoom event handler. More...
 
 ZoomEventHandler (const ZoomEventHandler &other)=delete
 
 ~ZoomEventHandler ()
 
EventResult onClickEvent (const std::shared_ptr< ClickEvent > &clickEvent, const std::shared_ptr< Map > &map, bool zoomIn, double zoomSpeed=1.0)
 Zooms towards or from the mouse position of a click. More...
 
EventResult onScrollEvent (const std::shared_ptr< ScrollEvent > &scrollEvent, const std::shared_ptr< Map > &map, double zoomSpeed=1.0, bool invertZoomDirection=false)
 Applies a zoom towards or from the mouse position using the wheel uses the given zoom speed, with 1 being the default zoom speed. More...
 
ZoomEventHandleroperator= (const ZoomEventHandler &other)=delete
 

Detailed Description

Handler that translates scroll or click gesture events to a zoom operation.

This is a reusable code block that a controller designer can use in its implementation.

Since
2020.1

Constructor & Destructor Documentation

◆ ZoomEventHandler() [1/2]

luciad::ZoomEventHandler::ZoomEventHandler ( )
explicit

Creates a new zoom event handler.

◆ ~ZoomEventHandler()

luciad::ZoomEventHandler::~ZoomEventHandler ( )

◆ ZoomEventHandler() [2/2]

luciad::ZoomEventHandler::ZoomEventHandler ( const ZoomEventHandler other)
delete

Member Function Documentation

◆ onClickEvent()

EventResult luciad::ZoomEventHandler::onClickEvent ( const std::shared_ptr< ClickEvent > &  clickEvent,
const std::shared_ptr< Map > &  map,
bool  zoomIn,
double  zoomSpeed = 1.0 
)

Zooms towards or from the mouse position of a click.

Parameters
clickEventa click event, cannot be nullptr.
mapthe map, cannot be nullptr.
zoomIntrue if zooming in, false otherwise.
zoomSpeedthe zoom speed. Must be a number greater than 0. Default value is 1.0.
Returns
whether the click event is consumed or not. Always EventResult::Consumed.
Exceptions
luciad::NullArgumentExceptionwhen passing nullptr for the map or the event.

◆ onScrollEvent()

EventResult luciad::ZoomEventHandler::onScrollEvent ( const std::shared_ptr< ScrollEvent > &  scrollEvent,
const std::shared_ptr< Map > &  map,
double  zoomSpeed = 1.0,
bool  invertZoomDirection = false 
)

Applies a zoom towards or from the mouse position using the wheel uses the given zoom speed, with 1 being the default zoom speed.

For example: 0.5 zooms twice as slow, 2 zooms twice as much. The direction of the scroll is used to determine the direction of this action.

Parameters
scrollEventa scroll event, cannot be nullptr.
mapthe map, cannot be nullptr.
zoomSpeedthe zoom speed. Must be a number greater than 0. Default value is 1.0.
invertZoomDirectionto invert the zoom direction. By default, this method will zoom in when the verticals scrolling delta is positive, and zoom out when it is negative
Returns
whether the scroll event is consumed or not. Always EventResult::Consumed.
Exceptions
luciad::NullArgumentExceptionwhen passing nullptr for the map or the event.

◆ operator=()

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