Version: 9.15.0
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_Context ( GLViewer_Viewer2d v)

A constructor.

Constructor

References myHFlag, myLastPicked, myLastPickedChanged, mySelCurIndex, mySFlag, and myUpdateAll.

◆ ~GLViewer_Context()

GLViewer_Context::~GLViewer_Context ( )

A desructor.

Destructor

References myActiveObjects, myInactiveObjects, and mySelectedObjects.

Member Function Documentation

◆ clearHighlighted()

void GLViewer_Context::clearHighlighted ( bool  updateViewer)

A function clear highlighted object information.

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

◆ clearSelected()

void GLViewer_Context::clearSelected ( bool  updateViewer)

A function clear selection object information.

Clears selection of objects

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

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

◆ currentObjectIsChanged()

bool GLViewer_Context::currentObjectIsChanged ( )
inline

Returns true if after last MoveTo method calling highlight object is changed.

◆ deleteObject()

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

A function remove theObject from context and update viewer if 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().

◆ eraseObject()

void GLViewer_Context::eraseObject ( GLViewer_Object theObject,
bool  theUpdateViewer = true 
)

A function installing to theObject invisible status and update viewer if updateViewer = 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().

◆ getCurrentObject()

GLViewer_Object* GLViewer_Context::getCurrentObject ( )
inline

Returns highlighted object.

◆ getFirstObject()

GLViewer_Object* GLViewer_Context::getFirstObject ( )
inline

Returns first active object.

◆ getObjects()

const ObjList& GLViewer_Context::getObjects ( bool  isActive = true)
inline

Returns list of context objects.

Returns
active objects if isActive = true, else inactive objects

◆ HighlightColor()

Quantity_NameOfColor GLViewer_Context::HighlightColor ( )
inline

Returns highlight color.

◆ InitSelected()

void GLViewer_Context::InitSelected ( )

A function set iterator of selected objects on first object.

Inits iteration through selected objects

References mySelCurIndex.

◆ insertObject()

int GLViewer_Context::insertObject ( GLViewer_Object object,
bool  display = false,
bool  isActive = true 
)

Insert new object in context.

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.

◆ isSelected()

bool GLViewer_Context::isSelected ( GLViewer_Object theObj)

Returns true if theObject is selected.

Returns
true if object is selected
Parameters
theObj- object to be checked

References mySelectedObjects.

◆ isUpdateAll()

bool GLViewer_Context::isUpdateAll ( ) const
inline

Returns update flag in highlighting technology.

◆ MoreSelected()

bool GLViewer_Context::MoreSelected ( )

Retuns true if iterator of selected objects is not set on last object.

Checks if iteration through selected objects may be continued

References mySelCurIndex, and NbSelected().

◆ MoveTo()

int GLViewer_Context::MoveTo ( int  xi,
int  yi,
bool  byCircle = false 
)

Main interactive method. Trace mouse in viewer window.

Parameters
x- X coord of mouse cursor
y- Y coord of mouse cursor \paran 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(), GLViewer_Object::isSelectable(), myActiveObjects, myGLViewer2d, myHFlag, myLastPicked, myLastPickedChanged, myTolerance, myUpdateAll, myXhigh, myYhigh, GLViewer_Viewer2d::transPoint(), GLViewer_Object::unhighlight(), and GLViewer_Viewer2d::updateAll().

◆ NbSelected()

int GLViewer_Context::NbSelected ( )

Returns number of objects in current selection.

Returns
number of selected objects

References mySelectedObjects.

◆ NextSelected()

bool GLViewer_Context::NextSelected ( )

Increment of iterator of selected objects.

Iterates to next selected object

References mySelCurIndex, and NbSelected().

◆ remSelected()

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

A function make theObject as unselected object and update viewer if updateViewer = true.

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.

◆ replaceObject()

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

Replacing objects in context.

Function search active and incative objects

Replaces object in context

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

References myActiveObjects, and myInactiveObjects.

◆ Select()

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

◆ SelectByRect()

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

◆ SelectedObject()

GLViewer_Object * GLViewer_Context::SelectedObject ( )

Returns object corresponding the current iterator of selected objects.

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

References mySelCurIndex, and mySelectedObjects.

◆ SelectionColor()

Quantity_NameOfColor GLViewer_Context::SelectionColor ( )
inline

Returns select color.

◆ setActive()

bool GLViewer_Context::setActive ( GLViewer_Object theObject)

A function installing to theObject active status.

Installs active status to object

Parameters
theObject

References myActiveObjects, and myInactiveObjects.

◆ SetHighlightColor()

void GLViewer_Context::SetHighlightColor ( Quantity_NameOfColor  aCol)

A function installing highlight color for all presentation (does not work)

Sets color of hilighting

Parameters
aCol- new color of highlighting

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

◆ setInactive()

bool GLViewer_Context::setInactive ( GLViewer_Object theObject)

A function installing to theObject inactive status.

Installs inactive status to object

Parameters
theObject

References myActiveObjects, and myInactiveObjects.

◆ setSelected()

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

A function make theObject as selected object and update viewer if updateViewer = true.

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.

◆ SetSelectionColor()

void GLViewer_Context::SetSelectionColor ( Quantity_NameOfColor  aCol)

A function installing select color for all presentation (does not work)

Sets color of selection

Parameters
aCol- new color of selection

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

◆ setTolerance()

void GLViewer_Context::setTolerance ( int  tol)
inline

A function installing tolerance in window pixels for highlghting and selection methods.

◆ setUpdateAll()

void GLViewer_Context::setUpdateAll ( bool  on)
inline

A function installing update flag in highlighting technology.

◆ updateScales()

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

A function updating scales of all objects in context.

Updates scales of all objects in context

References myActiveObjects, and myInactiveObjects.

Member Data Documentation

◆ myActiveObjects

ObjList GLViewer_Context::myActiveObjects
protected

List of active object.

Active objects if consider in highlight and select methods

◆ myGLViewer2d

GLViewer_Viewer2d* GLViewer_Context::myGLViewer2d
protected

◆ myHFlag

GLboolean GLViewer_Context::myHFlag
protected

If = false - moveTo method is not any highlighting.

◆ myHighlightColor

Quantity_NameOfColor GLViewer_Context::myHighlightColor
protected

Color for highlight.

◆ myInactiveObjects

ObjList GLViewer_Context::myInactiveObjects
protected

List of inactive object.

Active objects isn't consider in highlight and select methods

◆ myLastPicked

GLViewer_Object* GLViewer_Context::myLastPicked
protected

Highlighted object.

◆ myLastPickedChanged

bool GLViewer_Context::myLastPickedChanged
protected

= true if after last MoveTo method calling highlight object is changed

◆ mySelCurIndex

int GLViewer_Context::mySelCurIndex
protected

Selected object iterator.

◆ mySelectedObjects

ObjList GLViewer_Context::mySelectedObjects
protected

List of selected objects.

◆ mySelectionColor

Quantity_NameOfColor GLViewer_Context::mySelectionColor
protected

Color for selection.

◆ mySFlag

GLboolean GLViewer_Context::mySFlag
protected

If = false - select method is not any select.

◆ myTolerance

int GLViewer_Context::myTolerance
protected

Tolerance in window pixels for highlghting and selection methods.

◆ myUpdateAll

bool GLViewer_Context::myUpdateAll
protected

Flag of updating viewer after highlight.

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

◆ myXhigh

GLfloat GLViewer_Context::myXhigh
protected

X coordinate of mouse cursor.

◆ myYhigh

GLfloat GLViewer_Context::myYhigh
protected

Y coordinate of mouse cursor.


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