Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GLViewer_Context Class Reference

#include <GLViewer_Context.h>

Public Member Functions

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

Protected Attributes

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

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::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.

bool GLViewer_Context::currentObjectIsChanged ( )
inline
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().

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().

GLViewer_Object* GLViewer_Context::getCurrentObject ( )
inline
GLViewer_Object* GLViewer_Context::getFirstObject ( )
inline
const ObjList& GLViewer_Context::getObjects ( bool  isActive = true)
inline
Returns
active objects if isActive = true, else inactive objects
Quantity_NameOfColor GLViewer_Context::HighlightColor ( )
inline
void GLViewer_Context::InitSelected ( )

Inits iteration through selected objects

References mySelCurIndex.

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::isSelected ( GLViewer_Object theObj)
Returns
true if object is selected
Parameters
theObj- object to be checked

References mySelectedObjects.

bool GLViewer_Context::isUpdateAll ( ) const
inline
bool GLViewer_Context::MoreSelected ( )

Checks if iteration through selected objects may be continued

References mySelCurIndex, and NbSelected().

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::NbSelected ( )
Returns
number of selected objects

References mySelectedObjects.

bool GLViewer_Context::NextSelected ( )

Iterates to next selected object

References mySelCurIndex, and NbSelected().

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.

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.

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().

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

References mySelCurIndex, and mySelectedObjects.

Quantity_NameOfColor GLViewer_Context::SelectionColor ( )
inline
bool GLViewer_Context::setActive ( GLViewer_Object theObject)

Installs active status to object

Parameters
theObject

References myActiveObjects, and myInactiveObjects.

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().

bool GLViewer_Context::setInactive ( GLViewer_Object theObject)

Installs inactive status to object

Parameters
theObject

References myActiveObjects, and myInactiveObjects.

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::SetSelectionColor ( Quantity_NameOfColor  aCol)

Sets color of selection

Parameters
aCol- new color of selection

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

void GLViewer_Context::setTolerance ( int  tol)
inline
void GLViewer_Context::setUpdateAll ( bool  on)
inline
void GLViewer_Context::updateScales ( GLfloat  scX,
GLfloat  scY 
)

Updates scales of all objects in context

References myActiveObjects, and myInactiveObjects.

Member Data Documentation

ObjList GLViewer_Context::myActiveObjects
protected

Active objects if consider in highlight and select methods

GLViewer_Viewer2d* GLViewer_Context::myGLViewer2d
protected
GLboolean GLViewer_Context::myHFlag
protected
Quantity_NameOfColor GLViewer_Context::myHighlightColor
protected
ObjList GLViewer_Context::myInactiveObjects
protected

Active objects isn't consider in highlight and select methods

GLViewer_Object* GLViewer_Context::myLastPicked
protected
bool GLViewer_Context::myLastPickedChanged
protected
int GLViewer_Context::mySelCurIndex
protected
ObjList GLViewer_Context::mySelectedObjects
protected
Quantity_NameOfColor GLViewer_Context::mySelectionColor
protected
GLboolean GLViewer_Context::mySFlag
protected
int GLViewer_Context::myTolerance
protected
bool GLViewer_Context::myUpdateAll
protected

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

GLfloat GLViewer_Context::myXhigh
protected
GLfloat GLViewer_Context::myYhigh
protected

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