MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSL3DInteractionMode Class Reference
Inheritance diagram for TSL3DInteractionMode:

Detailed Description

This is the base class for a simple 3D interaction mode handling system. This allows the various interaction modes such as zoom and pan to be implemented in an encapsulated and operating system independent manner.

The user's application creates an instance of one the TSL3DInteractionMode derived classes and passes it to an instance of a TSL3DInteractionMode Manager derived class. The 'm_display' attribute of this base class provides access to useful methods for interacting and querying the drawing surface to which the mode is attached. It also provides basic echo rectangle and line handling. The 'm_cameraManager' method of this base class provides access to derived values based on the camera of the attached drawing surface.

When the application wants to activate this mode, it passes the id to the mode manager. All subsequent mouse events are passed to the mode - until it is replaced by another. When a mode becomes active, the 'activate' method is triggered. When a mode becomes inactive, the 'deactivate' method is triggered. The mode event handlers typically return true to indicate that the view should be redrawn.

Any derived mode should ensure that the 'viewChanged' method and 'resetMode' methods are triggered when the view has been changed, or when the current mode has finished and should be reset to the default mode.

Some event handlers have specific default behaviours. See individual handlers for further details. Most other handlers in this base class return false to indicate that no redraw is required. In the derived classes, only those locator methods that are actually useful need to be overridden.

Note: If you are not using the same version of the compiler that MapLink was built with then any user derived classes that have been added to a TSLInteractionModeManager through the addMode() method should be removed from the mode manager before the manager is deleted in order to ensure memory is freed using the correct heap.

Deprecated
Deprecated as of MapLink 11.1. Advised to use MapLink Earth SDK instead.

Public Member Functions

virtual ~TSL3DInteractionMode ()
 
virtual void activate ()
 
virtual void deactivate ()
 
virtual void onDraw (TSLDeviceUnits x1, TSLDeviceUnits y1, TSLDeviceUnits x2, TSLDeviceUnits y2)
 
virtual bool onLButtonDown (TSLDeviceUnits x, TSLDeviceUnits y, bool shift, bool control)
 
virtual bool onLButtonUp (TSLDeviceUnits x, TSLDeviceUnits y, bool shift, bool control)
 
virtual bool onMButtonDown (TSLDeviceUnits x, TSLDeviceUnits y, bool shift, bool control)
 
virtual bool onMButtonUp (TSLDeviceUnits x, TSLDeviceUnits y, bool shift, bool control)
 
virtual bool onMouseMove (TSLButtonType button, TSLDeviceUnits x, TSLDeviceUnits y, bool shift, bool control)
 
virtual bool onMouseWheel (short delta, TSLDeviceUnits x, TSLDeviceUnits y)
 
virtual bool onRButtonUp (TSLDeviceUnits x, TSLDeviceUnits y, bool shift, bool control)
 
virtual bool onRButtonDown (TSLDeviceUnits x, TSLDeviceUnits y, bool shift, bool control)
 
virtual void onSize (TSLDeviceUnits cx, TSLDeviceUnits cy)
 
virtual TSLCursorStyle queryCursor ()
 
virtual const char * queryPrompt ()
 
virtual void setDisplay (TSL3DInteractionModeDisplay *display)
 
int id () const
 

Protected Member Functions

 TSL3DInteractionMode (int modeID)
 

Protected Attributes

int m_id
 
TSL3DInteractionModeDisplaym_display
 
TSL3DInteractionCameraManagerm_cameraManager
 
TSL3DDrawingSurfacem_drawingSurface
 
bool m_pressed
 

Constructor & Destructor Documentation

◆ ~TSL3DInteractionMode()

virtual TSL3DInteractionMode::~TSL3DInteractionMode ( )
virtual

Destructor for the interaction mode

◆ TSL3DInteractionMode()

TSL3DInteractionMode::TSL3DInteractionMode ( int modeID)
protected

Member Function Documentation

◆ activate()

virtual void TSL3DInteractionMode::activate ( )
virtual

This method is triggered when a mode is activated by the user - and therefore becomes the current mode.

Reimplemented in TSL3DInteractionModeTrackballEyepoint, and TSL3DInteractionModeTrackballWorld.

◆ deactivate()

virtual void TSL3DInteractionMode::deactivate ( )
virtual

This method is triggered when a mode is deactivated by the user - and therefore is no longer the current mode.

The derived class should clear any echo lines that may be active and generally tidy up after itself.

Reimplemented in TSL3DInteractionModeTrackballEyepoint, and TSL3DInteractionModeTrackballWorld.

◆ id()

int TSL3DInteractionMode::id ( ) const
inline

Query the unique id passed in the constructor.

◆ onDraw()

virtual void TSL3DInteractionMode::onDraw ( TSLDeviceUnits x1,
TSLDeviceUnits y1,
TSLDeviceUnits x2,
TSLDeviceUnits y2 )
virtual

Event handler for the paint method.

The default handler does nothing.

Parameters
(x1,y1)Bottom left, in device units, of the area being redrawn.
(x2,y2)Top right, in device units, of the area being redrawn.

◆ onLButtonDown()

virtual bool TSL3DInteractionMode::onLButtonDown ( TSLDeviceUnits x,
TSLDeviceUnits y,
bool shift,
bool control )
virtual

Locator handler for interaction modes. This event will be passed on to the currently active mode.

The default base implementation returns false.

Parameters
(x,y)Position of locator event, in device unit coordinates.
shiftFlag to indicate whether the shift key is pressed. An interaction mode may use this to modify its behaviour.
controlFlag to indicate whether the control key is pressed. An interaction mode may use this to modify its behaviour.
Returns
true if the view needs to be redrawn, false otherwise.

Reimplemented in TSL3DInteractionModeTrackballEyepoint, and TSL3DInteractionModeTrackballWorld.

◆ onLButtonUp()

virtual bool TSL3DInteractionMode::onLButtonUp ( TSLDeviceUnits x,
TSLDeviceUnits y,
bool shift,
bool control )
virtual

Locator handler for interaction modes. This event will be passed on to the currently active mode.

The default base implementation returns false.

Parameters
(x,y)Position of locator event, in device unit coordinates.
shiftFlag to indicate whether the shift key is pressed. An interaction mode may use this to modify its behaviour.
controlFlag to indicate whether the control key is pressed. An interaction mode may use this to modify its behaviour.
Returns
true if the view needs to be redrawn, false otherwise.

Reimplemented in TSL3DInteractionModeTrackballEyepoint, and TSL3DInteractionModeTrackballWorld.

◆ onMButtonDown()

virtual bool TSL3DInteractionMode::onMButtonDown ( TSLDeviceUnits x,
TSLDeviceUnits y,
bool shift,
bool control )
virtual

Locator handler for interaction modes. This event will be passed on to the currently active mode.

The default base implementation returns false.

Parameters
(x,y)Position of locator event, in device unit coordinates.
shiftFlag to indicate whether the shift key is pressed. An interaction mode may use this to modify its behaviour.
controlFlag to indicate whether the control key is pressed. An interaction mode may use this to modify its behaviour.
Returns
true if the view needs to be redrawn, false otherwise.

Reimplemented in TSL3DInteractionModeTrackballWorld.

◆ onMButtonUp()

virtual bool TSL3DInteractionMode::onMButtonUp ( TSLDeviceUnits x,
TSLDeviceUnits y,
bool shift,
bool control )
virtual

Locator handler for interaction modes. This event will be passed on to the currently active mode.

The default base implementation returns false.

Parameters
(x,y)Position of locator event, in device unit coordinates.
shiftFlag to indicate whether the shift key is pressed. An interaction mode may use this to modify its behaviour.
controlFlag to indicate whether the control key is pressed. An interaction mode may use this to modify its behaviour.
Returns
true if the view needs to be redrawn, false otherwise.

Reimplemented in TSL3DInteractionModeTrackballWorld.

◆ onMouseMove()

virtual bool TSL3DInteractionMode::onMouseMove ( TSLButtonType button,
TSLDeviceUnits x,
TSLDeviceUnits y,
bool shift,
bool control )
virtual

Mouse move handlers for interaction mode base class

The default base class implementations all do nothing and return false.

Parameters
buttonType of button pressed, if any.
(x,y)Position of locator event, in device unit co-ordinates.
shiftFlag to indicate whether the shift key is pressed. An interaction mode may use this to modify its behaviour.
controlFlag to indicate whether the control key is pressed. An interaction mode may use this to modify its behaviour.
Returns
true if the view needs to be redrawn, false otherwise. The default base class implementations all return false.

Reimplemented in TSL3DInteractionModeTrackballEyepoint, and TSL3DInteractionModeTrackballWorld.

◆ onMouseWheel()

virtual bool TSL3DInteractionMode::onMouseWheel ( short delta,
TSLDeviceUnits x,
TSLDeviceUnits y )
virtual

Mouse wheel hander for interaction modes. This event will be passed on to the currently active mode.

Parameters
deltaDelta value of mouse wheel movement. See Windows help for further information.
(x,y)Position of locator event, in device unit coordinates.
Returns
true if the view needs to be redrawn, false otherwise.

Reimplemented in TSL3DInteractionModeTrackballEyepoint, and TSL3DInteractionModeTrackballWorld.

◆ onRButtonDown()

virtual bool TSL3DInteractionMode::onRButtonDown ( TSLDeviceUnits x,
TSLDeviceUnits y,
bool shift,
bool control )
virtual

Locator handler for interaction modes. This event will be passed on to the currently active mode.

The default base implementation returns false.

Parameters
(x,y)Position of locator event, in device unit coordinates.
shiftFlag to indicate whether the shift key is pressed. An interaction mode may use this to modify its behaviour.
controlFlag to indicate whether the control key is pressed. An interaction mode may use this to modify its behaviour.
Returns
true if the view needs to be redrawn, false otherwise.

Reimplemented in TSL3DInteractionModeTrackballEyepoint, and TSL3DInteractionModeTrackballWorld.

◆ onRButtonUp()

virtual bool TSL3DInteractionMode::onRButtonUp ( TSLDeviceUnits x,
TSLDeviceUnits y,
bool shift,
bool control )
virtual

Locator handler for interaction modes. This event will be passed on to the currently active mode.

The default base implementation returns false.

Parameters
(x,y)Position of locator event, in device unit coordinates.
shiftFlag to indicate whether the shift key is pressed. An interaction mode may use this to modify its behaviour.
controlFlag to indicate whether the control key is pressed. An interaction mode may use this to modify its behaviour.
Returns
true if the view needs to be redrawn, false otherwise.

Reimplemented in TSL3DInteractionModeTrackballEyepoint, and TSL3DInteractionModeTrackballWorld.

◆ onSize()

virtual void TSL3DInteractionMode::onSize ( TSLDeviceUnits cx,
TSLDeviceUnits cy )
virtual

Event handler for the size method.

This default handler does nothing.

Parameters
cxNew width of drawing surface.
cyNew height of drawing surface.

◆ queryCursor()

virtual TSLCursorStyle TSL3DInteractionMode::queryCursor ( )
virtual

Query the cursor style that may be appropriate to the currently active mode.

Returns TSLCursorStyleNone if no particular cursor style is appropriate. This is also the default return value if the method is not overridden.

Reimplemented in TSL3DInteractionModeTrackballEyepoint, and TSL3DInteractionModeTrackballWorld.

◆ queryPrompt()

virtual const char * TSL3DInteractionMode::queryPrompt ( )
virtual

Query prompt to display for this mode.

The default implementation returns an empty string. It is up to the derived modes to decide what prompt to return.

Reimplemented in TSL3DInteractionModeTrackballEyepoint, and TSL3DInteractionModeTrackballWorld.

◆ setDisplay()

virtual void TSL3DInteractionMode::setDisplay ( TSL3DInteractionModeDisplay * display)
virtual

Internal function called by the mode manager to bind an instance of TSL3DInteractionModeDisplay to the mode.

Member Data Documentation

◆ m_cameraManager

TSL3DInteractionCameraManager* TSL3DInteractionMode::m_cameraManager
protected

Additional Protected Declarations

◆ m_display

TSL3DInteractionModeDisplay* TSL3DInteractionMode::m_display
protected

◆ m_drawingSurface

TSL3DDrawingSurface* TSL3DInteractionMode::m_drawingSurface
protected

◆ m_id

int TSL3DInteractionMode::m_id
protected

ID of the mode, as specified during the construction.

◆ m_pressed

bool TSL3DInteractionMode::m_pressed
protected