Version: 6.3.1
Public Types | Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Slots | Protected Member Functions | Protected Attributes | Private Member Functions

GLViewer_Viewer Class Reference

#include <GLViewer_Viewer.h>

Inheritance diagram for GLViewer_Viewer:
Inheritance graph

Public Types

enum  SelectionMode { NoSelection, Single, Multiple }
enum  TransformType {
  NoTransform, Reset, FitAll, FitRect,
  FitSelect, Zoom, PanGlobal, Pan,
  Rotate, UserTransform = 100
}
enum  SketchingType { NoSketching, Rect, UserSketching = 100 }
enum  HotOperation { PAN, ZOOM, ROTATE, FIT_AREA }
enum  InteractionStyle { STANDARD, KEY_FREE }
typedef QMap< HotOperation,
Qt::KeyboardModifiers > 
StatesMap
typedef QMap< HotOperation,
Qt::MouseButtons > 
ButtonsMap
typedef QMap< InteractionStyle,
StatesMap
InteractionStyle2StatesMap
typedef QMap< InteractionStyle,
ButtonsMap
InteractionStyle2ButtonsMap

Signals

void selectionChanged (SelectionChangeStatus)

Public Member Functions

 GLViewer_Viewer (const QString &title)
 ~GLViewer_Viewer ()
virtual void setViewManager (SUIT_ViewManager *theViewManager)
virtual QString getType () const
virtual void contextMenuPopup (QMenu *)
void setSelectionMode (SelectionMode)
SelectionMode getSelectionMode () const
GLViewer_SelectorgetSelector () const
virtual void update (int=0)
void activateTransform (int)
void activateSketching (int)
GLViewer_ViewFramegetActiveView () const
virtual SUIT_ViewWindowcreateView (SUIT_Desktop *theDesktop)
SUIT_ViewManagergetViewManager () const

Static Public Member Functions

static QString Type ()
static void setHotButton (InteractionStyle theInteractionStyle, HotOperation theOper, Qt::KeyboardModifiers theState, Qt::MouseButtons theButton)
static void getHotButton (InteractionStyle theInteractionStyle, HotOperation theOper, Qt::KeyboardModifiers &theState, Qt::MouseButtons &theButton)

Static Public Attributes

static InteractionStyle2StatesMap myStateMap
static InteractionStyle2ButtonsMap myButtonMap

Protected Slots

virtual void onKeyEvent (SUIT_ViewWindow *, QKeyEvent *)
virtual void onMouseEvent (SUIT_ViewWindow *, QMouseEvent *)
virtual void onWheelEvent (SUIT_ViewWindow *, QWheelEvent *)
virtual void onSelectionCancel ()
virtual void onSelectionDone (bool add, SelectionChangeStatus status)
virtual void onChangeBgColor ()

Protected Member Functions

virtual void onSketchingStarted ()
virtual void onSketchingFinished ()
virtual void onTransformationStarted ()
virtual void onTransformationFinished ()
virtual void onSelectionModeChanged ()
virtual void unhilightDetected ()
virtual bool eventFilter (QObject *, QEvent *)
virtual GLViewer_ViewTransformercreateTransformer (int)
virtual GLViewer_ViewSketchercreateSketcher (int)
virtual GLViewer_SelectorcreateSelector ()
virtual void startOperations (QMouseEvent *)
virtual bool updateOperations (QMouseEvent *)
virtual void finishOperations (QMouseEvent *)
virtual void startOperations (QWheelEvent *)

Protected Attributes

GLViewer_SelectormySelector
SelectionMode mySelMode
GLViewer_ViewSketchermySketcher
GLViewer_ViewTransformermyTransformer
SUIT_ViewManagermyViewManager

Private Member Functions

void handleMouseMove (QMouseEvent *)
void handleMousePress (QMouseEvent *)
void handleMouseRelease (QMouseEvent *)
void handleWheel (QWheelEvent *)

Member Typedef Documentation

typedef QMap<HotOperation, Qt::KeyboardModifiers> SUIT_ViewModel.StatesMap [inherited]
typedef QMap<HotOperation, Qt::MouseButtons> SUIT_ViewModel.ButtonsMap [inherited]

Member Enumeration Documentation

Enumerator:
NoSelection 
Single 
Multiple 
Enumerator:
NoTransform 
Reset 
FitAll 
FitRect 
FitSelect 
Zoom 
PanGlobal 
Pan 
Rotate 
UserTransform 
Enumerator:
NoSketching 
Rect 
UserSketching 
enum SUIT_ViewModel::HotOperation [inherited]
Enumerator:
PAN 
ZOOM 
ROTATE 
FIT_AREA 
Enumerator:
STANDARD 
KEY_FREE 

Constructor & Destructor Documentation

GLViewer_Viewer::GLViewer_Viewer ( const QString &  title)

Constructor

GLViewer_Viewer::~GLViewer_Viewer ( )

Destructor

References mySelector.


Member Function Documentation

void GLViewer_Viewer::setViewManager ( SUIT_ViewManager theViewManager) [virtual]

Sets new view manager

Parameters:
theViewManager- new view manager

Reimplemented from SUIT_ViewModel.

References onMouseEvent(), and onWheelEvent().

virtual QString GLViewer_Viewer.getType ( ) const [virtual]

Reimplemented from SUIT_ViewModel.

static QString GLViewer_Viewer.Type ( ) [static]
void GLViewer_Viewer::contextMenuPopup ( QMenu thePopup) [virtual]

Builds popup for GL viewer

Reimplemented from SUIT_ViewModel.

References onChangeBgColor().

void GLViewer_Viewer::setSelectionMode ( GLViewer_Viewer::SelectionMode  mode)

Sets the selection mode for this viewer. [ public ]

References mySelMode, and onSelectionModeChanged().

GLViewer_Viewer::SelectionMode GLViewer_Viewer::getSelectionMode ( ) const

Returns the selection mode of this viewer. [ public ]

References mySelMode.

GLViewer_Selector * GLViewer_Viewer::getSelector ( ) const

Returns selector of this viewer. [ public ]

References createSelector(), mySelector, onSelectionCancel(), and onSelectionDone().

void GLViewer_Viewer::update ( int  flags = 0) [virtual]

Updates all views of this viewer. Use 'flags' to customize update process. [ virtual public ]

References SUIT_ViewModel.getViewManager(), and SUIT_ViewManager.getViews().

void GLViewer_Viewer::activateTransform ( int  type)
void GLViewer_Viewer::activateSketching ( int  type)

Handles requests for sketching in the active view. [ virtual public ]

References createSketcher(), getActiveView(), GLViewer_ViewPort.isSketchingEnabled(), mySketcher, NoSketching, onSketchingFinished(), and onSketchingStarted().

GLViewer_ViewFrame * GLViewer_Viewer::getActiveView ( ) const

Returns the active view. [ public ]

References SUIT_ViewManager.getActiveView(), and SUIT_ViewModel.getViewManager().

void GLViewer_Viewer.selectionChanged ( SelectionChangeStatus  ) [signal]
void GLViewer_Viewer::onSketchingStarted ( ) [protected, virtual]

Unhilights detected entities. [ virtual protected ]

References unhilightDetected().

void GLViewer_Viewer::onSketchingFinished ( ) [protected, virtual]
void GLViewer_Viewer::onTransformationStarted ( ) [protected, virtual]

Unhilights detected entities, lock selection, sets event filter on the whole application. [ virtual protected ]

References getSelector(), GLViewer_Selector.lock(), myTransformer, and unhilightDetected().

void GLViewer_Viewer::onTransformationFinished ( ) [protected, virtual]

Unlock selection, removes event filter. [ virtual protected ]

References getSelector(), GLViewer_Selector.lock(), and myTransformer.

void GLViewer_Viewer::onSelectionModeChanged ( ) [protected, virtual]

Enables / disables rectangle sketching. [ virtual protected ]

References SUIT_ViewModel.getViewManager(), SUIT_ViewManager.getViews(), Multiple, mySelMode, and GLViewer_ViewPort.setSketchingEnabled().

void GLViewer_Viewer::unhilightDetected ( ) [protected, virtual]

Unhilights the currect detected objects. [ virtual private ]

References getSelector(), and GLViewer_Selector.undetectAll().

bool GLViewer_Viewer::eventFilter ( QObject o,
QEvent e 
) [protected, virtual]

Installed while 'fit area' and 'global panning' operations are active. [ virtual protected ]

References activateSketching(), activateTransform(), getActiveView(), GLViewer_ViewFrame.getViewPort(), NoSketching, and NoTransform.

GLViewer_ViewTransformer * GLViewer_Viewer::createTransformer ( int  type) [protected, virtual]

Creates default transformer. [ virtual protected ]

Reimplemented in GLViewer_Viewer2d.

GLViewer_ViewSketcher * GLViewer_Viewer::createSketcher ( int  type) [protected, virtual]

Creates default sketcher. [ virtual protected ]

GLViewer_Selector * GLViewer_Viewer::createSelector ( ) [protected, virtual]

Returns null by default. [ virtual protected ]

Reimplemented in GLViewer_Viewer2d.

virtual void GLViewer_Viewer.startOperations ( QMouseEvent *  ) [protected, virtual]

Reimplemented in GLViewer_Viewer2d.

virtual bool GLViewer_Viewer.updateOperations ( QMouseEvent *  ) [protected, virtual]

Reimplemented in GLViewer_Viewer2d.

virtual void GLViewer_Viewer.finishOperations ( QMouseEvent *  ) [protected, virtual]

Reimplemented in GLViewer_Viewer2d.

virtual void GLViewer_Viewer.startOperations ( QWheelEvent *  ) [protected, virtual]

Reimplemented in GLViewer_Viewer2d.

void GLViewer_Viewer::onKeyEvent ( SUIT_ViewWindow ,
QKeyEvent *   
) [protected, virtual, slot]

Listens to key events of the active view. [ virtual protected slot ]

void GLViewer_Viewer::onMouseEvent ( SUIT_ViewWindow ,
QMouseEvent *  e 
) [protected, virtual, slot]

Listens to mouse events of the active view. [ virtual protected slot ]

Reimplemented in GLViewer_Viewer2d.

References handleMouseMove(), handleMousePress(), and handleMouseRelease().

void GLViewer_Viewer::onWheelEvent ( SUIT_ViewWindow ,
QWheelEvent *  e 
) [protected, virtual, slot]

Listens to mouse events of the active view. [ virtual protected slot ]

References handleWheel().

void GLViewer_Viewer::onSelectionCancel ( ) [protected, virtual, slot]

Called when selection is cleared in this viewer. [ virtual protected slot ]

References SCS_Invalid, and selectionChanged().

void GLViewer_Viewer::onSelectionDone ( bool  bAdded,
SelectionChangeStatus  status 
) [protected, virtual, slot]

Called when smth is selected in this viewer. [ virtual protected slot ]

References selectionChanged().

void GLViewer_Viewer::onChangeBgColor ( ) [protected, virtual, slot]

Sets the background color with color selection dialog. [ virtual protected slot ]

Reimplemented in GLViewer_Viewer2d.

References GLViewer_ViewPort.backgroundColor(), getActiveView(), GLViewer_ViewFrame.getViewPort(), and GLViewer_ViewPort.setBackgroundColor().

void GLViewer_Viewer::handleMouseMove ( QMouseEvent *  e) [private]

Mouse move handler. If dragged with MB1, activates rectangle sketching in the active viewport, otherwise highlights the selectable entities. [ private ]

References activateSketching(), GLViewer_Selector.detect(), getActiveView(), getSelector(), l_mbPressEvent, mySketcher, Rect, GLViewer_ViewSketcher.sketchButton(), and updateOperations().

void GLViewer_Viewer::handleMousePress ( QMouseEvent *  e) [private]

Mouse press handler. If 'accelKey()' is pressed, activates default transformations( Zoom or Pan ) in the active viewport. [ private ]

References GLViewer_ViewTransformer.accelKey(), activateTransform(), Pan, GLViewer_ViewTransformer.panButton(), startOperations(), Zoom, and GLViewer_ViewTransformer.zoomButton().

void GLViewer_Viewer::handleMouseRelease ( QMouseEvent *  e) [private]
void GLViewer_Viewer::handleWheel ( QWheelEvent *  e) [private]

Wheel rolling handler

References startOperations().

SUIT_ViewWindow * SUIT_ViewModel::createView ( SUIT_Desktop theDesktop) [virtual, inherited]

Create new instance of view window on desktop theDesktop.

Return values:
SUIT_ViewWindow*- created view window pointer.

Reimplemented in GLViewer_Viewer2d, LightApp_WgViewModel, OCCViewer_Viewer, Plot2d_Viewer, QxGraph_Viewer, QxScene_Viewer, SPlot2d_Viewer, SUPERVGraph_Viewer, SVTK_Viewer, and VTKViewer_Viewer.

SUIT_ViewManager * SUIT_ViewModel::getViewManager ( ) const [inherited]

Get view manager.

Returns:
view manager

References SUIT_ViewModel.myViewManager.

void SUIT_ViewModel::setHotButton ( InteractionStyle  theInteractionStyle,
HotOperation  theOper,
Qt::KeyboardModifiers  theState,
Qt::MouseButtons  theButton 
) [static, inherited]

Sets hot button

Parameters:
theOper- hot operation
theState- adding state to state map operations.
theButton- adding state to button map operations.

References SUIT_ViewModel.myButtonMap, and SUIT_ViewModel.myStateMap.

void SUIT_ViewModel::getHotButton ( InteractionStyle  theInteractionStyle,
HotOperation  theOper,
Qt::KeyboardModifiers &  theState,
Qt::MouseButtons &  theButton 
) [static, inherited]

Gets hot button for operation theOper.

Parameters:
theOper- input hot operation
theState- output state from state map operations.
theButton- output state from button map operations.

References SUIT_ViewModel.myButtonMap, and SUIT_ViewModel.myStateMap.


Field Documentation

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS