+/*!
+ \brief Display the object with the specified identifier.
+ \param id object ID
+ \param allViewers if \c true the object is displayed in all existing viewers
+ (OCC viewers are supported only)
+ \param upd if \c true, update the viewer(s)
+*/
+void LIGHTGUI::displayLine( const int id, const bool allViewers, const bool upd )
+{
+ LIGHTGUI_DataModel* dm = dynamic_cast<LIGHTGUI_DataModel*>( dataModel() );
+ if ( dm && id > 0 ) {
+ ViewManagerList viewers;
+ if ( allViewers )
+ getApp()->viewManagers( "OCCViewer", viewers );
+ else
+ viewers.append( getApp()->getViewManager( "OCCViewer", true ) );
+
+ for ( ViewManagerList::iterator it = viewers.begin(); it != viewers.end(); ++it ) {
+ OCCViewer_ViewManager* aMgr = dynamic_cast<OCCViewer_ViewManager*>( *it );
+ if ( !aMgr ) continue;
+ SOCC_Viewer* aViewer = (SOCC_Viewer*)aMgr->getViewModel();
+ if ( !aViewer ) continue;
+ QString aLine = dm->getLineText( id );
+ QString entry = LIGHTGUI_DataModel::entry( id );
+ SOCC_Prs* prs = dynamic_cast<SOCC_Prs*>( aViewer->CreatePrs( entry.toLatin1() ) );
+ if ( prs ) {
+ double aX = 0, aY = dm->lineNb( id ) * LIGHTGUI_TextPrs::TextSize(), aZ = 0;
+ aViewer->Erase( prs, true );
+ Handle(LIGHTGUI_TextPrs) aPrs = new LIGHTGUI_TextPrs( aLine.toLatin1(), gp_Pnt( aX, aY, aZ ) );
+ aPrs->SetOwner( new SALOME_InteractiveObject( entry.toLatin1(), "" ) );
+ prs->Clear();
+ prs->AddObject( aPrs );
+ aViewer->Display( prs );
+ if ( upd )
+ aViewer->Repaint();
+ }
+ }
+ }
+}
+
+/*!
+ \brief Erase the object with the specified identifier.
+ \param id object ID
+ \param allViewers if \c true the object is erased in all existing viewers
+ (OCC viewers are supported only)
+ \param upd if \c true, update the viewer(s)
+*/
+void LIGHTGUI::eraseLine( const int id, const bool allViewers, const bool upd )
+{
+ LIGHTGUI_DataModel* dm = dynamic_cast<LIGHTGUI_DataModel*>( dataModel() );
+ if ( dm && id > 0 ) {
+ ViewManagerList viewers;
+ if ( allViewers )
+ getApp()->viewManagers( "OCCViewer", viewers );
+ else
+ viewers.append( getApp()->getViewManager( "OCCViewer", true ) );
+
+ for ( ViewManagerList::iterator it = viewers.begin(); it != viewers.end(); ++it ) {
+ OCCViewer_ViewManager* aMgr = dynamic_cast<OCCViewer_ViewManager*>( *it );
+ if ( !aMgr ) continue;
+ SOCC_Viewer* aViewer = (SOCC_Viewer*)aMgr->getViewModel();
+ if ( !aViewer ) continue;
+ QString entry = LIGHTGUI_DataModel::entry( id );
+ SOCC_Prs* prs = dynamic_cast<SOCC_Prs*>( aViewer->CreatePrs( entry.toLatin1() ) );
+ if ( prs ) {
+ aViewer->Erase( prs, false );
+ if ( upd )
+ aViewer->Repaint();
+ }
+ }
+ }
+}
+
+/*!
+ \brief Update the object presentation.
+ \param id object ID
+ \param allViewers if \c true the object is updated in all existing viewers
+ (OCC viewers are supported only)
+ \param upd if \c true, update the viewer(s)
+*/
+void LIGHTGUI::updateLine( const int id, const bool allViewers, const bool upd )
+{
+ LIGHTGUI_DataModel* dm = dynamic_cast<LIGHTGUI_DataModel*>( dataModel() );
+ if ( dm && id > 0 ) {
+ ViewManagerList viewers;
+ if ( allViewers )
+ getApp()->viewManagers( "OCCViewer", viewers );
+ else
+ viewers.append( getApp()->getViewManager( "OCCViewer", true ) );
+
+ for ( ViewManagerList::iterator it = viewers.begin(); it != viewers.end(); ++it ) {
+ OCCViewer_ViewManager* aMgr = dynamic_cast<OCCViewer_ViewManager*>( *it );
+ if ( !aMgr ) continue;
+ SOCC_Viewer* aViewer = (SOCC_Viewer*)aMgr->getViewModel();
+ if ( !aViewer ) continue;
+ QString aLine = dm->getLineText( id );
+ QString entry = LIGHTGUI_DataModel::entry( id );
+ if ( aViewer->isVisible( new SALOME_InteractiveObject( entry.toLatin1(), "" ) ) ) {
+ SOCC_Prs* prs = dynamic_cast<SOCC_Prs*>( aViewer->CreatePrs( entry.toLatin1() ) );
+ if ( prs ) {
+ if ( aLine.isEmpty() ) {
+ aViewer->Erase( prs, false );
+ }
+ else {
+ double aX = 0, aY = dm->lineNb( id ) * LIGHTGUI_TextPrs::TextSize(), aZ = 0;
+ aViewer->Erase( prs, true );
+ Handle(LIGHTGUI_TextPrs) aPrs = new LIGHTGUI_TextPrs( aLine.toLatin1(), gp_Pnt( aX, aY, aZ ) );
+ aPrs->SetOwner( new SALOME_InteractiveObject( entry.toLatin1(), "" ) );
+ prs->Clear();
+ prs->AddObject( aPrs );
+ aViewer->Display( prs );
+ }
+ if ( upd )
+ aViewer->Repaint();
+ }
+ }
+ }
+ }
+}
+
+/*!
+ \brief Erase objects.
+ \param l objects IDs list
+ \param allViewers if \c true the objects are erased in all existing viewers
+ (OCC viewers are supported only)
+*/
+void LIGHTGUI::eraseLines( const QList<int>& l, const bool allViewers )
+{
+ for ( QList<int>::const_iterator it = l.begin(); it != l.end(); ++it )
+ eraseLine( *it, allViewers );
+}
+
+/*!
+ \brief Update objects presentations.
+ \param l objects IDs list
+ \param allViewers if \c true the objects are updated in all existing viewers
+ (OCC viewers are supported only)
+*/
+void LIGHTGUI::updateLines( const QList<int>& l, const bool allViewers )
+{
+ for ( QList<int>::const_iterator it = l.begin(); it != l.end(); ++it )
+ updateLine( *it, allViewers );
+}
+
+/*!
+ \brief Activate module.
+ \param study current study
+ \return \c true if activaion is done successfully or 0 to prevent
+ activation on error
+*/
+bool LIGHTGUI::activateModule( SUIT_Study* study )