Version: 6.3.1
Public Member Functions | Protected Attributes

GLViewer_Context Class Reference

#include <GLViewer_Context.h>

Public Member Functions

 GLViewer_Context (GLViewer_Viewer2d *)
 A constructor.
 ~GLViewer_Context ()
 A desructor.
void setUpdateAll (bool on)
 A function installing update flag in highlighting technology.
bool isUpdateAll () const
 Returns update flag in highlighting technology.
int MoveTo (int x, int y, bool byCircle=FALSE)
 Main interactive method. Trace mouse in viewer window.
int Select (bool Append=FALSE, bool byCircle=FALSE)
int SelectByRect (const QRect &theRect, bool Append=FALSE)
void SetHighlightColor (Quantity_NameOfColor aCol)
 A function installing highlight color for all presentation (does not work)
void SetSelectionColor (Quantity_NameOfColor aCol)
 A function installing select color for all presentation (does not work)
Quantity_NameOfColor HighlightColor ()
 Returns highlight color.
Quantity_NameOfColor SelectionColor ()
 Returns select color.
int NbSelected ()
 Returns number of objects in current selection.
void InitSelected ()
 A function set iterator of selected objects on first object.
bool MoreSelected ()
 Retuns true if iterator of selected objects is not set on last object.
bool NextSelected ()
 Increment of iterator of selected objects.
GLViewer_ObjectSelectedObject ()
 Returns object corresponding the current iterator of selected objects.
bool isSelected (GLViewer_Object *theObject)
 Returns true if theObject is selected.
int insertObject (GLViewer_Object *theObject, bool display=false, bool isActive=true)
 Insert new object in context.
bool replaceObject (GLViewer_Object *oldObject, GLViewer_Object *newObject)
 Replacing objects in context.
void updateScales (GLfloat theX, GLfloat theY)
 A function updating scales of all objects in context.
void setTolerance (int tol)
 A function installing tolerance in window pixels for highlghting and selection methods.
const ObjListgetObjects (bool isActive=true)
 Returns list of context objects.
GLViewer_ObjectgetFirstObject ()
 Returns first active object.
void clearHighlighted (bool updateViewer)
 A function clear highlighted object information.
void clearSelected (bool updateViewer)
 A function clear selection object information.
void setSelected (GLViewer_Object *theObject, bool updateViewer)
 A function make theObject as selected object and update viewer if updateViewer = true.
void remSelected (GLViewer_Object *theObject, bool updateViewer)
 A function make theObject as unselected object and update viewer if updateViewer = true.
GLViewer_ObjectgetCurrentObject ()
 Returns highlighted object.
bool currentObjectIsChanged ()
 Returns true if after last MoveTo method calling highlight object is changed.
void eraseObject (GLViewer_Object *theObject, bool updateViewer=true)
 A function installing to theObject invisible status and update viewer if updateViewer = true.
void deleteObject (GLViewer_Object *theObject, bool updateViewer=true)
 A function remove theObject from context and update viewer if updateViewer = true.
bool setActive (GLViewer_Object *theObject)
 A function installing to theObject active status.
bool setInactive (GLViewer_Object *theObject)
 A function installing to theObject inactive status.

Protected Attributes

bool myUpdateAll
 Flag of updating viewer after highlight.
GLViewer_Viewer2dmyGLViewer2d
GLViewer_ObjectmyLastPicked
 Highlighted object.
bool myLastPickedChanged
 = true if after last MoveTo method calling highlight object is changed
ObjList myActiveObjects
 List of active object.
ObjList myInactiveObjects
 List of inactive object.
ObjList mySelectedObjects
 List of selected objects.
int mySelCurIndex
 Selected object iterator.
GLfloat myXhigh
 X coordinate of mouse cursor.
GLfloat myYhigh
 Y coordinate of mouse cursor.
Quantity_NameOfColor myHighlightColor
 Color for highlight.
Quantity_NameOfColor mySelectionColor
 Color for selection.
GLboolean myHFlag
 If = false - moveTo method is not any highlighting.
GLboolean mySFlag
 If = false - select method is not any select.
int myTolerance
 Tolerance in window pixels for highlghting and selection methods.

Detailed Description

Class for manage of presentations in GLViewer


Constructor & Destructor Documentation

GLViewer_Context::GLViewer_Context ( GLViewer_Viewer2d v)
GLViewer_Context::~GLViewer_Context ( )

Destructor

References myActiveObjects, myInactiveObjects, and mySelectedObjects.


Member Function Documentation

void GLViewer_Context.setUpdateAll ( bool  on)
bool GLViewer_Context.isUpdateAll ( ) const
int GLViewer_Context::MoveTo ( int  xi,
int  yi,
bool  byCircle = FALSE 
)
Parameters:
x- X coord of mouse cursor
y- Y coord of mouse cursor byCircle - true if needs round sensitive area around mouse cursor, else rectangle function search object rectangle which intersect with sensitive area and call object highlight method

Hiilights objects under cursor

Parameters:
x- X coord of mouse cursor
y- Y coord of mouse cursor
byCircle- true if needs round sensitive area around mouse cursor, else rectangle function search object rectangle which intersect with sensitive area and call object highlight method

References GLViewer_Viewer2d.activateDrawers(), GLViewer_Rect.contains(), GLViewer_Object.highlight(), myActiveObjects, myGLViewer2d, myHFlag, myLastPicked, myLastPickedChanged, myTolerance, myUpdateAll, myXhigh, myYhigh, GLViewer_Viewer2d.transPoint(), GLViewer_Object.unhighlight(), and GLViewer_Viewer2d.updateAll().

int GLViewer_Context::Select ( bool  Append = FALSE,
bool  byCircle = FALSE 
)

A function selecting already highlighting object by calling object method select

Parameters:
Append- true if new selection will be append to existing selection, false - another
byCircle- true if needs round selection area in complex object

Selects already highlighting object by calling object method select

Parameters:
Append- true if new selection will be append to existing selection, false - another
byCircle- true if needs round selection area in complex object

References GLViewer_Viewer2d.activateDrawer(), GLViewer_Viewer2d.activateDrawers(), GLViewer_Rect.contains(), GLViewer_Viewer.getActiveView(), GLViewer_ViewPort2d.getScale(), GLViewer_ViewFrame.getViewPort(), GLViewer_Object.isSelected(), myActiveObjects, myGLViewer2d, myHFlag, myLastPicked, mySelectedObjects, mySFlag, myTolerance, myUpdateAll, myXhigh, myYhigh, GLViewer_Object.select(), SS_GlobalChanged, SS_Invalid, SS_LocalChanged, SS_NoChanged, GLViewer_Object.unselect(), and GLViewer_Viewer2d.updateAll().

int GLViewer_Context::SelectByRect ( const QRect &  theRect,
bool  Append = FALSE 
)

A function selecting objects on scene by rectangle

Parameters:
theRect- rectangle of selection
Append- true if new selection will be append to existing selection, false - another function search object rectangle which intersect with theRect and call object select method

Selects objects on scene by rectangle

Parameters:
theRect- rectangle of selection
Append- true if new selection will be append to existing selection, false - another function search object rectangle which intersect with theRect and call object select method

References GLViewer_Viewer2d.activateDrawers(), GLViewer_Viewer.getActiveView(), GLViewer_Viewer2d.getGLVRect(), GLViewer_Viewer2d.getQRect(), GLViewer_ViewPort2d.getScale(), GLViewer_ViewFrame.getViewPort(), myActiveObjects, myGLViewer2d, mySelectedObjects, mySFlag, myTolerance, myUpdateAll, myXhigh, myYhigh, SS_GlobalChanged, SS_Invalid, SS_NoChanged, and GLViewer_Viewer2d.updateAll().

void GLViewer_Context::SetHighlightColor ( Quantity_NameOfColor  aCol)

Sets color of hilighting

Parameters:
aCol- new color of highlighting

References myGLViewer2d, myHighlightColor, mySelectionColor, and GLViewer_Viewer2d.updateColors().

void GLViewer_Context::SetSelectionColor ( Quantity_NameOfColor  aCol)

Sets color of selection

Parameters:
aCol- new color of selection

References myGLViewer2d, myHighlightColor, mySelectionColor, and GLViewer_Viewer2d.updateColors().

Quantity_NameOfColor GLViewer_Context.HighlightColor ( )
Quantity_NameOfColor GLViewer_Context.SelectionColor ( )
int GLViewer_Context::NbSelected ( )
Returns:
number of selected objects

References mySelectedObjects.

void GLViewer_Context::InitSelected ( )

Inits iteration through selected objects

References mySelCurIndex.

bool GLViewer_Context::MoreSelected ( )

Checks if iteration through selected objects may be continued

References mySelCurIndex, and NbSelected().

bool GLViewer_Context::NextSelected ( )

Iterates to next selected object

References mySelCurIndex, and NbSelected().

GLViewer_Object * GLViewer_Context::SelectedObject ( )
Returns:
current selected object (must be used only in cycle as "for( InitSelected(); MoreSelected(); NextSelected() ) {...}" )

References mySelCurIndex, and mySelectedObjects.

bool GLViewer_Context::isSelected ( GLViewer_Object theObj)
Returns:
true if object is selected
Parameters:
theObj- object to be checked

References mySelectedObjects.

int GLViewer_Context::insertObject ( GLViewer_Object object,
bool  display = false,
bool  isActive = true 
)
Parameters:
theObject- inserting object
display- true if needs display object immediatly after inserting, else false
isActive- true if needs inserting object in active list

Inserts new object in context

Parameters:
theObject- object to be inserted
display- true if needs display object immediatly after inserting, else false
isActive- true if needs inserting object in active list

References GLViewer_Viewer2d.activateDrawer(), myActiveObjects, myGLViewer2d, and myInactiveObjects.

bool GLViewer_Context::replaceObject ( GLViewer_Object oldObject,
GLViewer_Object newObject 
)

Function search active and incative objects

Replaces object in context

Parameters:
oldObject- object to be replaced
newObject- object for replacing

References myActiveObjects, and myInactiveObjects.

void GLViewer_Context::updateScales ( GLfloat  scX,
GLfloat  scY 
)

Updates scales of all objects in context

References myActiveObjects, and myInactiveObjects.

void GLViewer_Context.setTolerance ( int  tol)
const ObjList& GLViewer_Context.getObjects ( bool  isActive = true)
Returns:
active objects if isActive = true, else inactive objects
GLViewer_Object* GLViewer_Context.getFirstObject ( )
void GLViewer_Context::clearHighlighted ( bool  updateViewer)

Clears hilighting of objects

Parameters:
updateViewer- if it is true, viewer must be updated

References myGLViewer2d, myHFlag, myLastPicked, GLViewer_Object.unhighlight(), and GLViewer_Viewer2d.updateAll().

void GLViewer_Context::clearSelected ( bool  updateViewer)

Clears selection of objects

Parameters:
updateViewer- if it is true, viewer must be updated

References GLViewer_Viewer2d.activateDrawers(), myGLViewer2d, mySelectedObjects, and mySFlag.

void GLViewer_Context::setSelected ( GLViewer_Object object,
bool  updateViewer 
)

Selects object, other selected objects are left as selected

Parameters:
updateViewer- if it is true, viewer must be updated

References GLViewer_Viewer2d.activateDrawer(), myActiveObjects, myGLViewer2d, and mySelectedObjects.

void GLViewer_Context::remSelected ( GLViewer_Object object,
bool  updateViewer 
)

Unselects object, other selected objects are left as selected

Parameters:
updateViewer- if it is true, viewer must be updated

References GLViewer_Viewer2d.activateDrawer(), myGLViewer2d, and mySelectedObjects.

GLViewer_Object* GLViewer_Context.getCurrentObject ( )
bool GLViewer_Context.currentObjectIsChanged ( )
void GLViewer_Context::eraseObject ( GLViewer_Object theObject,
bool  theUpdateViewer = true 
)

Erases object in viewer

Parameters:
theUpdateViewer- if it is true, viewer must be updated

References myActiveObjects, myGLViewer2d, GLViewer_Object.setVisible(), GLViewer_Object.unhighlight(), GLViewer_Object.unselect(), and GLViewer_Viewer2d.updateAll().

void GLViewer_Context::deleteObject ( GLViewer_Object theObject,
bool  updateViewer = true 
)

Deletes object in

Parameters:
updateViewer- if it is true, viewer must be updated

References GLViewer_Object.getGroup(), myActiveObjects, myGLViewer2d, myInactiveObjects, myLastPicked, mySelectedObjects, GLViewer_Group.removeObject(), and GLViewer_Viewer2d.updateAll().

bool GLViewer_Context::setActive ( GLViewer_Object theObject)

Installs active status to object

Parameters:
theObject

References myActiveObjects, and myInactiveObjects.

bool GLViewer_Context::setInactive ( GLViewer_Object theObject)

Installs inactive status to object

Parameters:
theObject

References myActiveObjects, and myInactiveObjects.


Field Documentation

bool GLViewer_Context.myUpdateAll [protected]

if = true, the viewer update all objects after change of highlight object, else - only highlight object

Active objects if consider in highlight and select methods

Active objects isn't consider in highlight and select methods

GLfloat GLViewer_Context.myXhigh [protected]
GLfloat GLViewer_Context.myYhigh [protected]
Quantity_NameOfColor GLViewer_Context.myHighlightColor [protected]
Quantity_NameOfColor GLViewer_Context.mySelectionColor [protected]
GLboolean GLViewer_Context.myHFlag [protected]
GLboolean GLViewer_Context.mySFlag [protected]
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