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

OCCViewer_Viewer Class Reference

#include <OCCViewer_ViewModel.h>

Inheritance diagram for OCCViewer_Viewer:
Inheritance graph

Public Types

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 ()
void deselection ()

Public Member Functions

 OCCViewer_Viewer (bool DisplayTrihedron=true, bool DisplayStaticTrihedron=true)
virtual ~OCCViewer_Viewer ()
void update ()
virtual SUIT_ViewWindowcreateView (SUIT_Desktop *theDesktop)
virtual void setViewManager (SUIT_ViewManager *theViewManager)
virtual QString getType () const
virtual void contextMenuPopup (QMenu *)
void getSelectedObjects (AIS_ListOfInteractive &theList)
void setObjectsSelected (const AIS_ListOfInteractive &theList)
void setSelected (const Handle(AIS_InteractiveObject)&theIO)
void performSelectionChanged ()
QColor backgroundColor () const
void setBackgroundColor (const QColor &)
QColor backgroundColor (int theViewId) const
void setBackgroundColor (int theViewId, const QColor &)
bool trihedronActivated () const
 returns true if 3d Trihedron in viewer was created
void toggleTrihedron ()
bool isTrihedronVisible () const
virtual void setTrihedronShown (const bool)
double trihedronSize () const
virtual void setTrihedronSize (const double)
virtual OCCViewer_ViewWindowcreateSubWindow ()
 Handle (V3d_Viewer) getViewer3d() const
 Handle (V3d_Viewer) getCollector3d() const
 Handle (AIS_InteractiveContext) getAISContext() const
 Handle (AIS_Trihedron) getTrihedron() const
int interactionStyle () const
void setInteractionStyle (const int)
int zoomingStyle () const
void setZoomingStyle (const int)
void enableSelection (bool isEnabled)
bool isSelectionEnabled () const
void enableMultiselection (bool isEnable)
bool isMultiSelectionEnabled () const
int getSelectionCount () const
bool isStaticTrihedronDisplayed ()
bool highlight (const Handle(AIS_InteractiveObject)&, bool, bool=true)
bool unHighlightAll (bool=true)
bool isInViewer (const Handle(AIS_InteractiveObject)&, bool=false)
bool isVisible (const Handle(AIS_InteractiveObject)&)
void setColor (const Handle(AIS_InteractiveObject)&, const QColor &, bool=true)
void switchRepresentation (const Handle(AIS_InteractiveObject)&, int, bool=true)
void setTransparency (const Handle(AIS_InteractiveObject)&, float, bool=true)
void setIsos (const int u, const int v)
void isos (int &u, int &v) const
void initView (OCCViewer_ViewWindow *view)
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

void onMousePress (SUIT_ViewWindow *, QMouseEvent *)
void onMouseMove (SUIT_ViewWindow *, QMouseEvent *)
void onMouseRelease (SUIT_ViewWindow *, QMouseEvent *)
void onKeyPress (SUIT_ViewWindow *, QKeyEvent *)
void onDumpView ()
void onChangeBgColor ()

Protected Attributes

SUIT_ViewManagermyViewManager

Private Member Functions

 Handle (V3d_Viewer) myV3dViewer
 Handle (V3d_Viewer) myV3dCollector
 Handle (AIS_Trihedron) myTrihedron
 Handle (AIS_InteractiveContext) myAISContext

Private Attributes

int myInteractionStyle
int myZoomingStyle
bool mySelectionEnabled
bool myMultiSelectionEnabled
QPoint myStartPnt
QPoint myEndPnt
bool myShowStaticTrihedron
QVector< QColor > myColors

Member Typedef Documentation

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

Member Enumeration Documentation

enum SUIT_ViewModel::HotOperation [inherited]
Enumerator:
PAN 
ZOOM 
ROTATE 
FIT_AREA 
Enumerator:
STANDARD 
KEY_FREE 

Constructor & Destructor Documentation

OCCViewer_Viewer::OCCViewer_Viewer ( bool  DisplayTrihedron = true,
bool  DisplayStaticTrihedron = true 
)

Constructor

Parameters:
DisplayTrihedron- is trihedron displayed

References Handle(), myInteractionStyle, myMultiSelectionEnabled, mySelectionEnabled, myZoomingStyle, and OCCViewer_VService.Viewer3d().

OCCViewer_Viewer::~OCCViewer_Viewer ( ) [virtual]

Destructor


Member Function Documentation

static QString OCCViewer_Viewer.Type ( ) [static]
void OCCViewer_Viewer::update ( )
SUIT_ViewWindow * OCCViewer_Viewer::createView ( SUIT_Desktop theDesktop) [virtual]

Creates new view window

Parameters:
theDesktop- main window of application

Reimplemented from SUIT_ViewModel.

References OCCViewer_ViewFrame.getView(), initView(), and OCCViewer_ViewFrame.MAIN_VIEW.

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

Sets new view manager

Parameters:
theViewManager- new view manager

Reimplemented from SUIT_ViewModel.

References onKeyPress(), onMouseMove(), onMousePress(), and onMouseRelease().

virtual QString OCCViewer_Viewer.getType ( ) const [virtual]

Reimplemented from SUIT_ViewModel.

void OCCViewer_Viewer::contextMenuPopup ( QMenu thePopup) [virtual]

Builds popup for occ viewer

Reimplemented from SUIT_ViewModel.

References SUIT_ViewManager.getActiveView(), SUIT_ViewModel.myViewManager, onChangeBgColor(), and onDumpView().

void OCCViewer_Viewer::getSelectedObjects ( AIS_ListOfInteractive &  theList)
Returns:
objects selected in 3D viewer
Parameters:
theList- list to be filled with selected objects
void OCCViewer_Viewer::setObjectsSelected ( const AIS_ListOfInteractive &  theList)

Selects objects in 3D viewer. Other selected objects are left as selected

Parameters:
theList- list objects to be selected
void OCCViewer_Viewer.setSelected ( const Handle(AIS_InteractiveObject)&  theIO)
void OCCViewer_Viewer::performSelectionChanged ( )

Auxiliary method to emit signal selectionChanged()

References selectionChanged().

QColor OCCViewer_Viewer::backgroundColor ( ) const
Returns:
background color of viewer

References myColors.

void OCCViewer_Viewer::setBackgroundColor ( const QColor &  c)

Sets background color

Parameters:
c- new background color
QColor OCCViewer_Viewer::backgroundColor ( int  theViewId) const

References myColors.

void OCCViewer_Viewer::setBackgroundColor ( int  theViewId,
const QColor &  theColor 
)

References myColors.

bool OCCViewer_Viewer.trihedronActivated ( ) const
void OCCViewer_Viewer::toggleTrihedron ( )

Changes visibility of trihedron to opposite

References isTrihedronVisible(), and setTrihedronShown().

bool OCCViewer_Viewer::isTrihedronVisible ( ) const
Returns:
true if trihedron is visible
void OCCViewer_Viewer::setTrihedronShown ( const bool  on) [virtual]

Sets visibility state of trihedron

Parameters:
on- new state
double OCCViewer_Viewer::trihedronSize ( ) const
Returns:
trihedron size
void OCCViewer_Viewer::setTrihedronSize ( const double  sz) [virtual]

Changes trihedron size

Parameters:
sz- new size
OCCViewer_ViewWindow * OCCViewer_Viewer::createSubWindow ( ) [virtual]

Reimplemented in SOCC_Viewer.

OCCViewer_Viewer.Handle ( V3d_Viewer  ) const
OCCViewer_Viewer.Handle ( V3d_Viewer  ) const
OCCViewer_Viewer.Handle ( AIS_InteractiveContext  ) const
OCCViewer_Viewer.Handle ( AIS_Trihedron  ) const
int OCCViewer_Viewer::interactionStyle ( ) const
Returns:
interaction style

References myInteractionStyle.

void OCCViewer_Viewer::setInteractionStyle ( const int  theStyle)

Sets interaction style: 0 - standard, 1 - keyboard free interaction

Parameters:
theStyle- new interaction style

! To be done for view windows

References SUIT_ViewManager.getViews(), myInteractionStyle, SUIT_ViewModel.myViewManager, and OCCViewer_ViewWindow.setInteractionStyle().

int OCCViewer_Viewer::zoomingStyle ( ) const
Returns:
zooming style

References myZoomingStyle.

void OCCViewer_Viewer::setZoomingStyle ( const int  theStyle)

Sets zooming style: 0 - standard, 1 - advanced (at cursor)

Parameters:
theStyle- new zooming style

! To be done for view windows

References SUIT_ViewManager.getViews(), SUIT_ViewModel.myViewManager, myZoomingStyle, and OCCViewer_ViewWindow.setZoomingStyle().

void OCCViewer_Viewer::enableSelection ( bool  isEnabled)

Sets selection enabled status

Parameters:
isEnabled- new status

! To be done for view windows

References SUIT_ViewManager.getViews(), mySelectionEnabled, SUIT_ViewModel.myViewManager, and OCCViewer_ViewWindow.updateEnabledDrawMode().

bool OCCViewer_Viewer.isSelectionEnabled ( ) const
void OCCViewer_Viewer::enableMultiselection ( bool  isEnable)

Sets multiselection enabled status

Parameters:
isEnabled- new status

! To be done for view windows

References SUIT_ViewManager.getViews(), myMultiSelectionEnabled, SUIT_ViewModel.myViewManager, and OCCViewer_ViewWindow.updateEnabledDrawMode().

bool OCCViewer_Viewer.isMultiSelectionEnabled ( ) const
int OCCViewer_Viewer.getSelectionCount ( ) const
bool OCCViewer_Viewer.isStaticTrihedronDisplayed ( )
bool OCCViewer_Viewer::highlight ( const Handle(AIS_InteractiveObject)&  obj,
bool  hilight,
bool  update = true 
)

Hilights/unhilights object in viewer

Parameters:
obj- object to be updated
hilight- if it is true, object will be hilighted, otherwise it will be unhilighted
update- update current viewer
bool OCCViewer_Viewer::unHighlightAll ( bool  updateviewer = true)

Unhilights all objects in viewer

Parameters:
updateviewer- update current viewer
bool OCCViewer_Viewer::isInViewer ( const Handle(AIS_InteractiveObject)&  obj,
bool  onlyInViewer = false 
)
Returns:
true if object is in viewer or in collector
Parameters:
obj- object to be checked
onlyInViewer- search object only in viewer (so object must be displayed)

References PyInterp.obj.

bool OCCViewer_Viewer::isVisible ( const Handle(AIS_InteractiveObject)&  obj)
Returns:
true if object is displayed in viewer
Parameters:
obj- object to be checked
void OCCViewer_Viewer::setColor ( const Handle(AIS_InteractiveObject)&  obj,
const QColor &  color,
bool  update = true 
)

Sets color of object

Parameters:
obj- object to be updated
color- new color
update- update current viewer
void OCCViewer_Viewer::switchRepresentation ( const Handle(AIS_InteractiveObject)&  obj,
int  mode,
bool  update = true 
)

Changes display mode of object

Parameters:
obj- object to be processed
mode- new display mode
update- update current viewer
void OCCViewer_Viewer::setTransparency ( const Handle(AIS_InteractiveObject)&  obj,
float  trans,
bool  update = true 
)

Changes transparency of object

Parameters:
obj- object to be processed
trans- new transparency
update- update current viewer
void OCCViewer_Viewer::setIsos ( const int  u,
const int  v 
)

Set number of isolines

Parameters:
u- u-isolines (first parametric co-ordinate)
v- v-isolines (second parametric co-ordinate)

References Handle().

void OCCViewer_Viewer::isos ( int &  u,
int &  v 
) const
Returns:
number of isolines
Parameters:
u- to return u-isolines (first parametric co-ordinate)
v- to return v-isolines (second parametric co-ordinate)

References Handle().

void OCCViewer_Viewer::initView ( OCCViewer_ViewWindow view)
void OCCViewer_Viewer.selectionChanged ( ) [signal]
void OCCViewer_Viewer.deselection ( ) [signal]
void OCCViewer_Viewer::onMousePress ( SUIT_ViewWindow theWindow,
QMouseEvent *  theEvent 
) [protected, slot]

SLOT: called on mouse button press, stores current mouse position as start point for transformations

References myStartPnt.

void OCCViewer_Viewer::onMouseMove ( SUIT_ViewWindow theWindow,
QMouseEvent *  theEvent 
) [protected, slot]

SLOT: called on mouse move, processes transformation or hilighting

References OCCViewer_ViewWindow.getViewPort(), Handle(), OCCViewer_ViewPort3d.isBusy(), isSelectionEnabled(), and mySelectionEnabled.

void OCCViewer_Viewer::onMouseRelease ( SUIT_ViewWindow theWindow,
QMouseEvent *  theEvent 
) [protected, slot]
void OCCViewer_Viewer::onKeyPress ( SUIT_ViewWindow theWindow,
QKeyEvent *  theEvent 
) [protected, slot]

SLOT: called on key press, processes selection in "key free" interaction style

References deselection(), OCCViewer_ViewWindow.interactionStyle(), SUIT_ViewModel.KEY_FREE, mySelectionEnabled, and selectionChanged().

void OCCViewer_Viewer::onDumpView ( ) [protected, slot]

SLOT: called on dump view operation is activated, stores scene to raster file

References SUIT_ViewManager.getActiveView(), SUIT_ViewModel.myViewManager, and SUIT_ViewWindow.onDumpView().

void OCCViewer_Viewer::onChangeBgColor ( ) [protected, slot]

SLOT: called if background color is to be changed changed, passes new color to view port

References OCCViewer_ViewWindow.backgroundColor(), SUIT_ViewManager.getActiveView(), SUIT_ViewModel.myViewManager, and OCCViewer_ViewWindow.setBackgroundColor().

OCCViewer_Viewer.Handle ( V3d_Viewer  ) [private]
OCCViewer_Viewer.Handle ( V3d_Viewer  ) [private]
OCCViewer_Viewer.Handle ( AIS_Trihedron  ) [private]
OCCViewer_Viewer.Handle ( AIS_InteractiveContext  ) [private]
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

QPoint OCCViewer_Viewer.myStartPnt [private]
QPoint OCCViewer_Viewer.myEndPnt [private]
QVector<QColor> OCCViewer_Viewer.myColors [private]
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