Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

vl::FlatManipulator Class Reference

This class lets you pan (translate) and zoom a 2D scene using the mouse. More...

#include <FlatManipulator.hpp>

Inheritance diagram for vl::FlatManipulator:
vl::UIEventListener vl::Object

List of all members.

Public Types

enum  EManipMode { NoMode, TranslationMode, ZoomMode }

Public Member Functions

 FlatManipulator ()
 Constructor.
virtual void mouseDownEvent (EMouseButton, int x, int y)
 Event generated when one of the mouse buttons is pressed.
virtual void mouseUpEvent (EMouseButton, int x, int y)
 Event generated when one of the mouse buttons is released.
virtual void mouseMoveEvent (int x, int y)
 Event generated when the mouse moves.
virtual void enableEvent (bool enabled)
 Event generated whenever setEnabled() is called.
virtual void initEvent ()
 Event generated when the bound OpenGLContext bocomes initialized or when the event listener is bound to an initialized OpenGLContext.
virtual void destroyEvent ()
 Event generated right before the bound OpenGLContext is destroyed.
virtual void updateEvent ()
 Event generated when the bound OpenGLContext does not have any other message to process and OpenGLContext::continuousUpdate() is set to true or somebody calls OpenGLContext::update().
virtual void addedListenerEvent (OpenGLContext *)
 Event generated whenever a listener is bound to an OpenGLContext context.
virtual void removedListenerEvent (OpenGLContext *)
 Event generated whenever a listener is unbound from an OpenGLContext context.
virtual void mouseWheelEvent (int)
 Event generated when the mouse wheel rotated.
virtual void keyPressEvent (unsigned short, EKey)
 Event generated when a key is pressed.
virtual void keyReleaseEvent (unsigned short, EKey)
 Event generated when a key is released.
virtual void resizeEvent (int, int)
 Event generated when the bound OpenGLContext is resized.
virtual void fileDroppedEvent (const std::vector< String > &)
 Event generated when one or more files are dropped on the bound OpenGLContext's area.
virtual void visibilityEvent (bool)
 Event generated when the bound OpenGLContext is shown or hidden.
void setCamera (Camera *camera)
 The camera through which the manipulator is used.
Cameracamera ()
 The camera through which the manipulator is used.
int zoomButton () const
 Mouse button used to zoom.
void setZoomButton (int mouse_button)
 Mouse button used to zoom.
int translationButton () const
 Mouse button used to translate the view.
void setTranslationButton (int mouse_button)
 Mouse button used to translate the view.
float zoomSpeed () const
 Zoom speed multiplicative factor (default = 1).
void setZoomSpeed (float speed)
 Zoom speed multiplicative factor (default = 1).
EManipMode mode () const
 Returns the current manipulator state.

Protected Member Functions

bool mouseInViewport (int mx, int my, int &vx, int &vy)

Protected Attributes

ref< CameramCamera
vec2 mMouseStart
vec2 mPixelSize
EManipMode mMode
int mTranslationButton
int mZoomButton
float mZoomSpeed

Detailed Description

This class lets you pan (translate) and zoom a 2D scene using the mouse.

The manipulator will perform the actions using only the camera's view matrix, so no other transform is required to be bound.

Note:
Before using a FlatManipulator you have to specify a Camera object using the function setCamera()

Definition at line 57 of file FlatManipulator.hpp.


Member Enumeration Documentation

Enumerator:
NoMode 
TranslationMode 
ZoomMode 

Definition at line 62 of file FlatManipulator.hpp.


Constructor & Destructor Documentation

FlatManipulator::FlatManipulator (  )

Constructor.

Definition at line 37 of file FlatManipulator.cpp.

References VL_DEBUG_SET_OBJECT_NAME.


Member Function Documentation

void FlatManipulator::mouseDownEvent ( EMouseButton  button,
int  x,
int  y 
) [virtual]
void FlatManipulator::mouseUpEvent ( EMouseButton  button,
int  x,
int  y 
) [virtual]

Event generated when one of the mouse buttons is released.

Implements vl::UIEventListener.

Definition at line 119 of file FlatManipulator.cpp.

References camera(), mMode, mode(), NoMode, NULL, translationButton(), TranslationMode, zoomButton(), and ZoomMode.

void FlatManipulator::mouseMoveEvent ( int  x,
int  y 
) [virtual]
void FlatManipulator::enableEvent ( bool  enabled ) [virtual]
virtual void vl::FlatManipulator::initEvent (  ) [inline, virtual]

Event generated when the bound OpenGLContext bocomes initialized or when the event listener is bound to an initialized OpenGLContext.

Implements vl::UIEventListener.

Definition at line 77 of file FlatManipulator.hpp.

virtual void vl::FlatManipulator::destroyEvent (  ) [inline, virtual]

Event generated right before the bound OpenGLContext is destroyed.

Implements vl::UIEventListener.

Definition at line 79 of file FlatManipulator.hpp.

virtual void vl::FlatManipulator::updateEvent (  ) [inline, virtual]

Event generated when the bound OpenGLContext does not have any other message to process and OpenGLContext::continuousUpdate() is set to true or somebody calls OpenGLContext::update().

Implements vl::UIEventListener.

Definition at line 81 of file FlatManipulator.hpp.

virtual void vl::FlatManipulator::addedListenerEvent ( OpenGLContext  ) [inline, virtual]

Event generated whenever a listener is bound to an OpenGLContext context.

Implements vl::UIEventListener.

Definition at line 83 of file FlatManipulator.hpp.

virtual void vl::FlatManipulator::removedListenerEvent ( OpenGLContext  ) [inline, virtual]

Event generated whenever a listener is unbound from an OpenGLContext context.

Implements vl::UIEventListener.

Definition at line 85 of file FlatManipulator.hpp.

virtual void vl::FlatManipulator::mouseWheelEvent ( int  n ) [inline, virtual]

Event generated when the mouse wheel rotated.

Implements vl::UIEventListener.

Definition at line 87 of file FlatManipulator.hpp.

virtual void vl::FlatManipulator::keyPressEvent ( unsigned  unicode_ch,
EKey  key 
) [inline, virtual]

Event generated when a key is pressed.

Implements vl::UIEventListener.

Definition at line 89 of file FlatManipulator.hpp.

virtual void vl::FlatManipulator::keyReleaseEvent ( unsigned  unicode_ch,
EKey  key 
) [inline, virtual]

Event generated when a key is released.

Implements vl::UIEventListener.

Definition at line 91 of file FlatManipulator.hpp.

virtual void vl::FlatManipulator::resizeEvent ( int  x,
int  y 
) [inline, virtual]

Event generated when the bound OpenGLContext is resized.

Implements vl::UIEventListener.

Definition at line 93 of file FlatManipulator.hpp.

virtual void vl::FlatManipulator::fileDroppedEvent ( const std::vector< String > &  files ) [inline, virtual]

Event generated when one or more files are dropped on the bound OpenGLContext's area.

Implements vl::UIEventListener.

Definition at line 95 of file FlatManipulator.hpp.

virtual void vl::FlatManipulator::visibilityEvent ( bool  visible ) [inline, virtual]

Event generated when the bound OpenGLContext is shown or hidden.

Implements vl::UIEventListener.

Definition at line 97 of file FlatManipulator.hpp.

void FlatManipulator::setCamera ( Camera camera )

The camera through which the manipulator is used.

Definition at line 45 of file FlatManipulator.cpp.

References camera(), and mCamera.

Camera* vl::FlatManipulator::camera (  ) [inline]

The camera through which the manipulator is used.

Definition at line 105 of file FlatManipulator.hpp.

References vl::ref< T >::get(), and mCamera.

Referenced by mouseDownEvent(), mouseInViewport(), mouseMoveEvent(), mouseUpEvent(), and setCamera().

int vl::FlatManipulator::zoomButton (  ) const [inline]

Mouse button used to zoom.

Definition at line 108 of file FlatManipulator.hpp.

References mZoomButton.

Referenced by mouseDownEvent(), and mouseUpEvent().

void vl::FlatManipulator::setZoomButton ( int  mouse_button ) [inline]

Mouse button used to zoom.

Definition at line 111 of file FlatManipulator.hpp.

References mZoomButton.

int vl::FlatManipulator::translationButton (  ) const [inline]

Mouse button used to translate the view.

Definition at line 114 of file FlatManipulator.hpp.

References mTranslationButton.

Referenced by mouseDownEvent(), and mouseUpEvent().

void vl::FlatManipulator::setTranslationButton ( int  mouse_button ) [inline]

Mouse button used to translate the view.

Definition at line 117 of file FlatManipulator.hpp.

References mTranslationButton.

float vl::FlatManipulator::zoomSpeed (  ) const [inline]

Zoom speed multiplicative factor (default = 1).

Definition at line 120 of file FlatManipulator.hpp.

References mZoomSpeed.

Referenced by mouseMoveEvent().

void vl::FlatManipulator::setZoomSpeed ( float  speed ) [inline]

Zoom speed multiplicative factor (default = 1).

Definition at line 123 of file FlatManipulator.hpp.

References mZoomSpeed.

EManipMode vl::FlatManipulator::mode (  ) const [inline]

Returns the current manipulator state.

Definition at line 126 of file FlatManipulator.hpp.

References mMode.

Referenced by mouseDownEvent(), mouseMoveEvent(), and mouseUpEvent().

bool FlatManipulator::mouseInViewport ( int  mx,
int  my,
int &  vx,
int &  vy 
) [protected]

Member Data Documentation

Definition at line 133 of file FlatManipulator.hpp.

Referenced by camera(), and setCamera().

Definition at line 134 of file FlatManipulator.hpp.

Referenced by mouseDownEvent(), and mouseMoveEvent().

Definition at line 135 of file FlatManipulator.hpp.

Referenced by mouseDownEvent(), and mouseMoveEvent().

Definition at line 136 of file FlatManipulator.hpp.

Referenced by enableEvent(), mode(), mouseDownEvent(), and mouseUpEvent().

Definition at line 137 of file FlatManipulator.hpp.

Referenced by setTranslationButton(), and translationButton().

Definition at line 138 of file FlatManipulator.hpp.

Referenced by setZoomButton(), and zoomButton().

Definition at line 139 of file FlatManipulator.hpp.

Referenced by setZoomSpeed(), and zoomSpeed().


The documentation for this class was generated from the following files:

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:10.
Permission is granted to use this page to write and publish articles regarding Visualization Library.