Problem case: Click on tree widget item do not visualizes it, icon stays gray.
void GEOMGUI_AnnotationMgr::EraseVisibleAnnotations( const QString& theEntry, SALOME_View* theView )
{
- if ( !myVisualized.contains( theView ) )
+ SALOME_View* aView = viewOrActiveView( theView );
+ if ( !myVisualized.contains( aView ) )
return;
- EntryToAnnotations anEntryToAnnotation = myVisualized[theView];
+ EntryToAnnotations anEntryToAnnotation = myVisualized[aView];
if ( !anEntryToAnnotation.contains( theEntry ) )
return;
AnnotationToPrs anAnnotationToPrs = anEntryToAnnotation[theEntry];
// erase presentation from the viewer
SALOME_Prs* aPrs = anAnnotationToPrs[anIndex];
- theView->Erase( getDisplayer(), aPrs );
+ aView->Erase( getDisplayer(), aPrs );
}
getDisplayer()->UpdateViewer();
anEntryToAnnotation.remove( theEntry );
- myVisualized[theView] = anEntryToAnnotation;
+ myVisualized[aView] = anEntryToAnnotation;
}
void GEOMGUI_AnnotationMgr::RemoveView( SALOME_View* theView )
SALOME_View* GEOMGUI_AnnotationMgr::viewOrActiveView(SALOME_View* theView) const
{
- if ( !theView ) {
+ SALOME_View* aView = theView;
+ if ( !aView ) {
SalomeApp_Application* anApp = getApplication();
SUIT_ViewWindow* anActiveWindow = anApp->desktop()->activeWindow();
- theView = dynamic_cast<SALOME_View*>(anActiveWindow->getViewManager()->getViewModel());
+ if (anActiveWindow)
+ aView = dynamic_cast<SALOME_View*>(anActiveWindow->getViewManager()->getViewModel());
}
+ return aView;
}
void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theIndex,
this, SLOT( updateAnnotationBranch( const QString& ) ) );
connect( this, SIGNAL( itemClicked( QTreeWidgetItem*, int) ),
this, SLOT( onItemClicked( QTreeWidgetItem*, int ) ) );
-
+ connect( myStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ),
+ this, SLOT( onUpdateVisibilityColumn( QString, Qtx::VisibilityState ) ) );
}
//=================================================================================
QSharedPointer<VisualProperty> aProp = getVisualProperty( aBranchType, myStudy, anEntry );
+ CAM_Application* anApp = dynamic_cast<CAM_Application*>(myStudy->application());
+ GeometryGUI* aModule = dynamic_cast<GeometryGUI*>(anApp->activeModule());
if ( aProp->GetIsVisible( aDimIndex ) ) {
- aProp->SetIsVisible( aDimIndex, false );
+ aModule->GetAnnotationMgr()->Erase(anEntry.c_str(), aDimIndex);
theItem->setIcon( 1, myInvisibleIcon );
} else {
- aProp->SetIsVisible( aDimIndex, true );
+ aModule->GetAnnotationMgr()->Display(anEntry.c_str(), aDimIndex);
+
theItem->setIcon( 1, myVisibleIcon );
}
- aProp->Save();
-
redisplay( anEntry.c_str() );
}
// function : onUpdateVisibilityColumn
// purpose : Update visible state of icons of entry items.
//=================================================================================
-void GEOMGUI_TextTreeWdg::updateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState )
+void GEOMGUI_TextTreeWdg::onUpdateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState )
{
// dimension property branch
updateVisibilityColumn( DimensionShape, theEntry, theState );
QTreeWidgetItem* theWidgetItem,
const bool theVisibility );
void updateVisibility( SALOME_View* theView );
- void updateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState );
protected:
void createActions();
void updateAnnotationBranch( const QString& theEntry );
private slots:
+ void onUpdateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState );
void onItemClicked(QTreeWidgetItem*, int );
void setVisibility( QTreeWidgetItem* theItem, bool visibility );
void showContextMenu( const QPoint& pos );
*/
//=================================================================
GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st )
+: myIsRedisplayed( false )
{
if( st )
myApp = dynamic_cast<SalomeApp_Application*>( st->application() );
const bool updateViewer,
const bool checkActiveViewer )
{
+ bool aRedisplayed = myIsRedisplayed;
+ myIsRedisplayed = true;
// Remove the object permanently (<forced> == true)
SUIT_Session* ses = SUIT_Session::session();
SUIT_Application* app = ses->activeApplication();
}
}
}
+ myIsRedisplayed = aRedisplayed;
}
//=================================================================
return;
}
+ bool aRedisplayed = myIsRedisplayed;
+ myIsRedisplayed = true;
Erase( theIO, true, false, theViewFrame );
Display( theIO, theUpdateViewer, theViewFrame );
+ myIsRedisplayed = aRedisplayed;
+ if ( !theViewFrame->isVisible( theIO ) ) {
+ // hide annotations for erased presentation
+ SUIT_Session* session = SUIT_Session::session();
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
+ GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
+ if ( aModule )
+ aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(theIO->getEntry()), theViewFrame);
+ }
}
//=================================================================
void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p )
{
UpdateColorScale(false,false);
+ if ( !myIsRedisplayed ) {
+ // visualize annotations for displayed presentation
+ SUIT_Session* session = SUIT_Session::session();
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
+ GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
+ if ( aModule )
+ aModule->GetAnnotationMgr()->DisplayVisibleAnnotations(QString(p->GetEntry()), v);
+ }
}
void GEOM_Displayer::BeforeErase( SALOME_View* v, const SALOME_OCCPrs* p )
{
LightApp_Displayer::AfterErase( v, p );
UpdateColorScale(false,false);
+
+ if ( !myIsRedisplayed ) {
+ // hide annotations for erased presentation
+ SUIT_Session* session = SUIT_Session::session();
+ SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
+ GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
+ if ( aModule )
+ aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(p->GetEntry()), v);
+ }
}
//=================================================================
Aspect_TypeOfMarker myTypeOfMarker;
double myScaleOfMarker;
double myTransparency;
+ bool myIsRedisplayed;
private:
SalomeApp_Application* myApp;
connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
- if ( appStudy )
- connect( appStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ),
- this, SLOT( onUpdateVisibilityColumn( QString, Qtx::VisibilityState ) ) );
-
// Reset actions accelerator keys
action(GEOMOp::OpDelete)->setEnabled( true ); // Delete: Key_Delete
// 0020836 (Basic vectors and origin)
SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
if ( aResourceMgr->booleanValue( "Geometry", "auto_create_base_objects", false ) ) {
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
if ( appStudy ) {
_PTR(Study) studyDS = appStudy->studyDS();
if ( studyDS ) {
disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
- if ( appStudy )
- disconnect( appStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ),
- this, SLOT( onUpdateVisibilityColumn( QString, Qtx::VisibilityState ) ) );
LightApp_SelectionMgr* selMrg = getApp()->selectionMgr();
}
}
-void GeometryGUI::onUpdateVisibilityColumn( QString theEntry,
- Qtx::VisibilityState theState )
-{
- if ( myTextTreeWdg )
- myTextTreeWdg->updateVisibilityColumn( theEntry, theState );
-
- if ( theState == Qtx::ShownState )
- GetAnnotationMgr()->DisplayVisibleAnnotations( theEntry );
- else
- GetAnnotationMgr()->EraseVisibleAnnotations( theEntry );
-}
-
void GeometryGUI::windows( QMap<int, int>& mappa ) const
{
mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
private slots:
void OnGUIEvent();
void onWindowActivated( SUIT_ViewWindow* );
- void onUpdateVisibilityColumn( QString theEntry,
- Qtx::VisibilityState theState );
-
void onViewAboutToShow();
void OnSetMaterial( const QString& );
void updateMaterials();