SHAPER  9.12.0
XGUI_Displayer Class Reference

Displayer. More...

Inheritance diagram for XGUI_Displayer:
Inheritance graph

Public Types

enum  DisplayMode { NoMode = -1 , Wireframe , Shading }
 display mode More...
 

Signals

void objectDisplayed (ObjectPtr theObject, AISObjectPtr theAIS)
 Signal on object display. More...
 
void beforeObjectErase (ObjectPtr theObject, AISObjectPtr theAIS)
 Signal on before object erase. More...
 

Public Member Functions

 XGUI_Displayer (XGUI_Workshop *theWorkshop)
 Constructor. More...
 
virtual ~XGUI_Displayer ()
 Destructor. More...
 
bool isVisible (ObjectPtr theObject) const
 Returns the feature visibility state. More...
 
bool display (ObjectPtr theObject, bool theUpdateViewer=true)
 Display the feature. More...
 
bool displayAIS (AISObjectPtr theAIS, const bool toActivateInSelectionModes, const Standard_Integer theDisplayMode=0, bool theUpdateViewer=true)
 Display the given AIS object. More...
 
bool redisplay (ObjectPtr theObject, bool theUpdateViewer=true)
 Redisplay the shape if it was displayed. More...
 
void redisplayObjects ()
 Sends and flushes a signal to redisplay all visualized objects. More...
 
void setSelected (const QList< std::shared_ptr< ModuleBase_ViewerPrs >> &theValues, bool theUpdateViewer=true)
 Add presentations to current selection. More...
 
void clearSelected (const bool theUpdateViewer=true)
 Unselect all objects. More...
 
bool erase (ObjectPtr theObject, const bool theUpdateViewer=true)
 Erase the feature and a shape. More...
 
bool eraseAIS (AISObjectPtr theAIS, const bool theUpdateViewer=true)
 Erase the given AIS object displayed by corresponded display method. More...
 
bool eraseAll (const bool theUpdateViewer=true)
 Erase all presentations. More...
 
void deactivateSelectionFilters (const bool theAddFilterOnly=true)
 Remove default selection filters of the module from the current viewer. More...
 
void addSelectionFilter (const Handle &&theFilter)
 Add selection filter. More...
 
void removeSelectionFilter (const Handle &&theFilter)
 Remove selection filter. More...
 
virtual bool hasSelectionFilter (const Handle &&theFilter)
 Returns true if the selection filter is set to the viewer. More...
 
void removeFilters ()
 Remove all selection filters. More...
 
bool enableUpdateViewer (const bool isEnabled)
 Sets a flag to the displayer whether the internal viewer can be updated by the updateViewer method call. More...
 
bool isUpdateEnabled () const
 Returns true if the viewer update is not blocked. More...
 
void updateViewer () const
 Updates the viewer. More...
 
AISObjectPtr getAISObject (ObjectPtr theObject) const
 Searches the interactive object by feature. More...
 
ObjectPtr getObject (const AISObjectPtr &theIO) const
 Searches the feature by interactive object. More...
 
ObjectPtr getObject (const Handle &&theIO) const
 Searches the feature by interactive object. More...
 
void deactivateObjects (const QObjectPtrList &theObjList, const bool theUpdateViewer=true)
 Deactivates the given objects (not allow selection) More...
 
void setDisplayMode (ObjectPtr theObject, DisplayMode theMode, bool theUpdateViewer=true)
 Sets display mode for the given object if this object is displayed. More...
 
DisplayMode displayMode (ObjectPtr theObject) const
 Returns current display mode for the given object. More...
 
void showOnly (const QObjectPtrList &theList)
 Displays only objects listed in the list. More...
 
int objectsCount () const
 Returns number of displayed objects. More...
 
QObjectPtrList displayedObjects () const
 Returns list of displayed objects. More...
 
QList< Handle > displayedPresentations () const
 Returns list of displayed objects. More...
 
bool canBeShaded (ObjectPtr theObject) const
 Returns true if the given object can be shown in shaded mode. More...
 
QColor setObjectColor (ObjectPtr theObject, const QColor &theColor, bool theUpdateViewer=true)
 Set color on presentation of an object if it is displayed. More...
 
void displayTrihedron (bool theToDisplay) const
 Displays/erases thrihedron in current modes. More...
 
GeomPlanePtr getScreenPlane () const
 Returns screen plane of active view. More...
 
double getViewScale () const
 Returns scale of active view. More...
 
void setSelectionColor (const std::vector< int > &theColor)
 Set color of selection. More...
 
std::vector< int > selectionColor () const
 Returns current selection color. More...
 

Static Public Member Functions

static bool isVisible (XGUI_Displayer *theDisplayer, const ObjectPtr &theObject)
 Return true if the object is visible. More...
 

Protected Member Functions

 HandleAAISContext () const
 Returns currently installed AIS_InteractiveContext. More...
 
 HandleGGetFilter ()
 Returns the viewer context top filter. More...
 
bool display (ObjectPtr theObject, AISObjectPtr theAIS, bool isShading, bool theUpdateViewer=true)
 Display the feature and a shape. More...
 

Detailed Description

Displayer.

Provides mechanizm of display/erase of objects in the viewer

Member Enumeration Documentation

◆ DisplayMode

display mode

Enumerator
NoMode 

Mode is not defined.

Wireframe 

Wireframe display mode.

Shading 

Shading display mode.

Constructor & Destructor Documentation

◆ XGUI_Displayer()

XGUI_Displayer::XGUI_Displayer ( XGUI_Workshop theWorkshop)

Constructor.

Parameters
theWorkshopa workshop instance

◆ ~XGUI_Displayer()

XGUI_Displayer::~XGUI_Displayer ( )
virtual

Destructor.

Member Function Documentation

◆ isVisible() [1/2]

bool XGUI_Displayer::isVisible ( ObjectPtr  theObject) const

Returns the feature visibility state.

Parameters
theObjectan object instance

◆ display() [1/2]

bool XGUI_Displayer::display ( ObjectPtr  theObject,
bool  theUpdateViewer = true 
)

Display the feature.

Obtain the visualized object from the feature.

Parameters
theObjectan object to display
theUpdateViewerthe parameter whether the viewer should be update immediatelly
Returns
true if the object visibility state is changed

◆ displayAIS()

bool XGUI_Displayer::displayAIS ( AISObjectPtr  theAIS,
const bool  toActivateInSelectionModes,
const Standard_Integer  theDisplayMode = 0,
bool  theUpdateViewer = true 
)

Display the given AIS object.

This object is not added to the displayer internal map of objects So, it can not be obtained from displayer. This is just a wrap method of OCC display in order to perform the display with correct flags.

Parameters
theAISAIOS object to display
toActivateInSelectionModesboolean value whether the presentation should be activated in the current selection modes
theDisplayModemode how the presentation should be displayed
theUpdateViewerthe parameter whether the viewer should be update immediatelly
Returns
true if the object visibility state is changed

◆ redisplay()

bool XGUI_Displayer::redisplay ( ObjectPtr  theObject,
bool  theUpdateViewer = true 
)

Redisplay the shape if it was displayed.

Parameters
theObjectan object instance
theUpdateViewerthe parameter whether the viewer should be update immediatelly
Returns
true if the object visibility state is changed

◆ redisplayObjects()

void XGUI_Displayer::redisplayObjects ( )

Sends and flushes a signal to redisplay all visualized objects.

◆ setSelected()

void XGUI_Displayer::setSelected ( const QList< std::shared_ptr< ModuleBase_ViewerPrs >> &  theValues,
bool  theUpdateViewer = true 
)

Add presentations to current selection.

It unhighlight and deselect the current selection. The shape and result components are processed in the values. If the presentation shape is not empty, select it, otherwise select the result.

Parameters
theValuesa list of presentation to be selected
theUpdateViewerthe parameter whether the viewer should be update immediatelly

◆ clearSelected()

void XGUI_Displayer::clearSelected ( const bool  theUpdateViewer = true)

Unselect all objects.

Parameters
theUpdateViewerthe parameter whether the viewer should be update immediatelly
theUpdateViewerthe parameter to update viewer

◆ erase()

bool XGUI_Displayer::erase ( ObjectPtr  theObject,
const bool  theUpdateViewer = true 
)

Erase the feature and a shape.

Parameters
theObjectan object instance
theUpdateViewerthe parameter whether the viewer should be update immediatelly
Returns
true if the object visibility state is changed

◆ eraseAIS()

bool XGUI_Displayer::eraseAIS ( AISObjectPtr  theAIS,
const bool  theUpdateViewer = true 
)

Erase the given AIS object displayed by corresponded display method.

Parameters
theAISinstance of AIS object
theUpdateViewerthe parameter whether the viewer should be update immediatelly
Returns
true if the object visibility state is changed

◆ eraseAll()

bool XGUI_Displayer::eraseAll ( const bool  theUpdateViewer = true)

Erase all presentations.

Parameters
theUpdateViewerthe parameter whether the viewer should be update immediatelly
Returns
true if the object visibility state is changed

◆ deactivateSelectionFilters()

void XGUI_Displayer::deactivateSelectionFilters ( const bool  theAddFilterOnly = true)

Remove default selection filters of the module from the current viewer.

Parameters
theAddFilterOnlyif is not 'true' it will deactivate all fiters in viewer

◆ addSelectionFilter()

void XGUI_Displayer::addSelectionFilter ( const Handle &&  theFilter)

Add selection filter.

Parameters
theFiltera filter instance

◆ removeSelectionFilter()

void XGUI_Displayer::removeSelectionFilter ( const Handle &&  theFilter)

Remove selection filter.

Parameters
theFiltera filter instance

◆ hasSelectionFilter()

bool XGUI_Displayer::hasSelectionFilter ( const Handle &&  theFilter)
virtual

Returns true if the selection filter is set to the viewer.

Parameters
theFiltera selection filter

◆ removeFilters()

void XGUI_Displayer::removeFilters ( )

Remove all selection filters.

◆ enableUpdateViewer()

bool XGUI_Displayer::enableUpdateViewer ( const bool  isEnabled)

Sets a flag to the displayer whether the internal viewer can be updated by the updateViewer method call.

If it is not enabled, this method do nothing. This state maintain recurse, if the update is blocked twice or three times, the viewer will not be updated until it is unblocked necessary times (twice or three in the example).

Parameters
isEnableda boolean value

◆ isUpdateEnabled()

bool XGUI_Displayer::isUpdateEnabled ( ) const
inline

Returns true if the viewer update is not blocked.

◆ updateViewer()

void XGUI_Displayer::updateViewer ( ) const

Updates the viewer.

◆ getAISObject()

AISObjectPtr XGUI_Displayer::getAISObject ( ObjectPtr  theObject) const

Searches the interactive object by feature.

Parameters
theObjectthe object or presentable feature
Returns
theIO an interactive object

◆ getObject() [1/2]

ObjectPtr XGUI_Displayer::getObject ( const AISObjectPtr &  theIO) const

Searches the feature by interactive object.

Parameters
theIOan interactive object
Returns
feature the feature or NULL if it not visualized

◆ getObject() [2/2]

ObjectPtr XGUI_Displayer::getObject ( const Handle &&  theIO) const

Searches the feature by interactive object.

Parameters
theIOan interactive object
Returns
corresponded object or NULL if it not found

◆ deactivateObjects()

void XGUI_Displayer::deactivateObjects ( const QObjectPtrList &  theObjList,
const bool  theUpdateViewer = true 
)

Deactivates the given objects (not allow selection)

Parameters
theObjList- list of objects which has to be deactivated.
theUpdateViewerupdate viewer flag

◆ setDisplayMode()

void XGUI_Displayer::setDisplayMode ( ObjectPtr  theObject,
DisplayMode  theMode,
bool  theUpdateViewer = true 
)

Sets display mode for the given object if this object is displayed.

◆ displayMode()

XGUI_Displayer::DisplayMode XGUI_Displayer::displayMode ( ObjectPtr  theObject) const

Returns current display mode for the given object.

If object is not dis played then returns NoMode.

Parameters
theObjectobject to check

◆ showOnly()

void XGUI_Displayer::showOnly ( const QObjectPtrList &  theList)

Displays only objects listed in the list.

Parameters
theListlist of objects

◆ objectsCount()

int XGUI_Displayer::objectsCount ( ) const
inline

Returns number of displayed objects.

◆ displayedObjects()

QObjectPtrList XGUI_Displayer::displayedObjects ( ) const
inline

Returns list of displayed objects.

◆ displayedPresentations()

QList<Handle> XGUI_Displayer::displayedPresentations ( ) const
inline

Returns list of displayed objects.

◆ canBeShaded()

bool XGUI_Displayer::canBeShaded ( ObjectPtr  theObject) const

Returns true if the given object can be shown in shaded mode.

Parameters
theObjectobject to check

◆ setObjectColor()

QColor XGUI_Displayer::setObjectColor ( ObjectPtr  theObject,
const QColor &  theColor,
bool  theUpdateViewer = true 
)

Set color on presentation of an object if it is displayed.

Parameters
theObjectan object
theColora color which has to be set
theUpdateViewerupdate viewer flag
Returns
previously defined color on the object

◆ displayTrihedron()

void XGUI_Displayer::displayTrihedron ( bool  theToDisplay) const

Displays/erases thrihedron in current modes.

It will be activated or deactivated depending on the trihedron visible state and displayer active trihedron state

◆ isVisible() [2/2]

bool XGUI_Displayer::isVisible ( XGUI_Displayer theDisplayer,
const ObjectPtr &  theObject 
)
static

Return true if the object is visible.

If the object is feature, it returns true if all results of the feature are shown

Parameters
theDisplayera displayer
theObjectan object
Returns
a boolean value

◆ getScreenPlane()

GeomPlanePtr XGUI_Displayer::getScreenPlane ( ) const

Returns screen plane of active view.

◆ getViewScale()

double XGUI_Displayer::getViewScale ( ) const

Returns scale of active view.

◆ setSelectionColor()

void XGUI_Displayer::setSelectionColor ( const std::vector< int > &  theColor)

Set color of selection.

Parameters
theColorR,G,B values of color

◆ selectionColor()

std::vector< int > XGUI_Displayer::selectionColor ( ) const

Returns current selection color.

◆ objectDisplayed

void XGUI_Displayer::objectDisplayed ( ObjectPtr  theObject,
AISObjectPtr  theAIS 
)
signal

Signal on object display.

Parameters
theObjecta data object
theAISa presentation object

◆ beforeObjectErase

void XGUI_Displayer::beforeObjectErase ( ObjectPtr  theObject,
AISObjectPtr  theAIS 
)
signal

Signal on before object erase.

Parameters
theObjecta data object
theAISa presentation object

◆ HandleAAISContext()

XGUI_Displayer::HandleAAISContext ( ) const
protected

Returns currently installed AIS_InteractiveContext.

◆ HandleGGetFilter()

XGUI_Displayer::HandleGGetFilter ( )
protected

Returns the viewer context top filter.

If there is no a filter, it is created and set into The context should have only this filter inside. Other filters should be add to the filter

◆ display() [2/2]

bool XGUI_Displayer::display ( ObjectPtr  theObject,
AISObjectPtr  theAIS,
bool  isShading,
bool  theUpdateViewer = true 
)
protected

Display the feature and a shape.

This shape would be associated to the given feature

Parameters
theObjectan object instance
theAISAIS presentation
isShadingflag to show in shading mode
theUpdateViewerthe parameter whether the viewer should be update immediatelly
Returns
true if the object visibility state is changed