Annotation manager's implementation to:

- update annotations visible state int text tree widget according to active view
- store annotation visible attribute current visible state of the annotation's entry in the current view
- store/restore annotation visualized in view as study visual state
This commit is contained in:
nds 2016-10-31 09:36:47 +03:00
parent 261ce49fc0
commit bb1693ddb1
7 changed files with 246 additions and 45 deletions

183
src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx Normal file → Executable file
View File

@ -97,27 +97,13 @@ SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationA
return aPrs; return aPrs;
} }
//void GEOMGUI_AnnotationMgr::DisplayPresentation( SALOME_Prs* thePresentation ) bool GEOMGUI_AnnotationMgr::IsDisplayed( const QString& theEntry, const int theIndex, SALOME_View* theView ) const
//{
//}
/*void GEOMGUI_AnnotationMgr::erasePresentation( SALOME_Prs* thePresentation )
{ {
SALOME_View* aView = viewOrActiveView( theView );
}*/ if ( !aView || !myVisualized.contains( aView ) )
bool GEOMGUI_AnnotationMgr::IsDisplayed( const QString& theEntry, const int theIndex )
{
SalomeApp_Application* anApp = getApplication();
SUIT_ViewWindow* anActiveWindow = anApp->desktop()->activeWindow();
SALOME_View* aView = dynamic_cast<SALOME_View*>(anActiveWindow->getViewManager()->getViewModel());
if ( !myVisualized.contains( aView ) )
return false; return false;
EntryToAnnotations anEntryToAnnotation = myVisualized[aView]; EntryToAnnotations anEntryToAnnotation = myVisualized[aView];
if ( !anEntryToAnnotation.contains( theEntry ) ) if ( !anEntryToAnnotation.contains( theEntry ) )
return false; return false;
@ -128,19 +114,25 @@ bool GEOMGUI_AnnotationMgr::IsDisplayed( const QString& theEntry, const int theI
return true; return true;
} }
void GEOMGUI_AnnotationMgr::Display( const QString& theEntry, const int theIndex ) //=======================================================================
// function : GEOMGUI_AnnotationMgr::Display
// purpose : Displays annotation shape presentation in view. It creates an annotation presentation
// and stores it in an internal container
//=======================================================================
void GEOMGUI_AnnotationMgr::Display( const QString& theEntry, const int theIndex, SALOME_View* theView )
{ {
if ( IsDisplayed( theEntry, theIndex ) ) if ( IsDisplayed( theEntry, theIndex ) )
return; return;
SalomeApp_Application* anApp = getApplication(); SALOME_View* aView = viewOrActiveView( theView );
SUIT_ViewWindow* anActiveWindow = anApp->desktop()->activeWindow(); if ( !aView )
SALOME_View* aView = dynamic_cast<SALOME_View*>(anActiveWindow->getViewManager()->getViewModel()); return;
GEOMGUI_AnnotationAttrs::Properties aProperty; GEOMGUI_AnnotationAttrs::Properties aProperty;
GEOM::GEOM_Object_ptr anObject; GEOM::GEOM_Object_ptr anObject;
getObject( theEntry, theIndex, anObject, aProperty ); getObject( theEntry, theIndex, anObject, aProperty );
// display presentation in the viewer
SALOME_Prs* aPrs = CreatePresentation( aProperty, anObject ); SALOME_Prs* aPrs = CreatePresentation( aProperty, anObject );
aView->Display( getDisplayer(), aPrs ); aView->Display( getDisplayer(), aPrs );
getDisplayer()->UpdateViewer(); getDisplayer()->UpdateViewer();
@ -149,26 +141,28 @@ void GEOMGUI_AnnotationMgr::Display( const QString& theEntry, const int theIndex
if ( myVisualized.contains( aView ) ) if ( myVisualized.contains( aView ) )
anEntryToMap = myVisualized[aView]; anEntryToMap = myVisualized[aView];
// store displayed parameters to an internal container
AnnotationToPrs anAnnotationToPrsMap; AnnotationToPrs anAnnotationToPrsMap;
if ( anEntryToMap.contains( theEntry ) ) if ( anEntryToMap.contains( theEntry ) )
anAnnotationToPrsMap = anEntryToMap[theEntry]; anAnnotationToPrsMap = anEntryToMap[theEntry];
anAnnotationToPrsMap[theIndex] = aPrs; anAnnotationToPrsMap[theIndex] = aPrs;
anEntryToMap[theEntry] = anAnnotationToPrsMap; anEntryToMap[theEntry] = anAnnotationToPrsMap;
myVisualized[aView] = anEntryToMap; myVisualized[aView] = anEntryToMap;
// change persistent for the entry: set visible state in true for indices which presentations are shown
storeVisibleState( theEntry, theView );
} }
void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex ) void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex, SALOME_View* theView )
{ {
SalomeApp_Application* anApp = getApplication(); SALOME_View* aView = viewOrActiveView( theView );
SUIT_ViewWindow* anActiveWindow = anApp->desktop()->activeWindow(); if ( !aView )
SALOME_View* aView = dynamic_cast<SALOME_View*>(anActiveWindow->getViewManager()->getViewModel()); return;
if ( !myVisualized.contains( aView ) ) if ( !myVisualized.contains( aView ) )
return; return;
EntryToAnnotations anEntryToAnnotation = myVisualized[aView]; EntryToAnnotations anEntryToAnnotation = myVisualized[aView];
if ( !anEntryToAnnotation.contains( theEntry ) ) if ( !anEntryToAnnotation.contains( theEntry ) )
return; return;
@ -176,13 +170,108 @@ void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex )
if ( !anAnnotationToPrs.contains( theIndex ) ) if ( !anAnnotationToPrs.contains( theIndex ) )
return; return;
// erase presentation from the viewer
SALOME_Prs* aPrs = anAnnotationToPrs[theIndex]; SALOME_Prs* aPrs = anAnnotationToPrs[theIndex];
aView->Erase( getDisplayer(), aPrs ); aView->Erase( getDisplayer(), aPrs );
getDisplayer()->UpdateViewer(); getDisplayer()->UpdateViewer();
// remove displayed parameters from an internal container
anAnnotationToPrs.remove( theIndex ); anAnnotationToPrs.remove( theIndex );
anEntryToAnnotation[theEntry] = anAnnotationToPrs; anEntryToAnnotation[theEntry] = anAnnotationToPrs;
if (anAnnotationToPrs.isEmpty()) {
anEntryToAnnotation.remove( theEntry );
}
else {
anEntryToAnnotation[theEntry] = anAnnotationToPrs;
}
myVisualized[aView] = anEntryToAnnotation; myVisualized[aView] = anEntryToAnnotation;
// change persistent for the entry: set visible state in true for indices which presentations are shown
storeVisibleState( theEntry, theView );
}
void GEOMGUI_AnnotationMgr::DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView )
{
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
_PTR(SObject) aSObj = aStudy->studyDS()->FindObjectID( theEntry.toStdString() );
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
if ( !aShapeAnnotations.IsNull() ) {
const int aCount = aShapeAnnotations->GetNbAnnotation();
for ( int anIndex = 0; anIndex < aCount; ++anIndex )
{
if ( aShapeAnnotations->GetIsVisible( anIndex ) )
Display( theEntry, anIndex, theView );
}
}
}
void GEOMGUI_AnnotationMgr::EraseVisibleAnnotations( const QString& theEntry, SALOME_View* theView )
{
if ( !myVisualized.contains( theView ) )
return;
EntryToAnnotations anEntryToAnnotation = myVisualized[theView];
if ( !anEntryToAnnotation.contains( theEntry ) )
return;
AnnotationToPrs anAnnotationToPrs = anEntryToAnnotation[theEntry];
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
_PTR(SObject) aSObj = aStudy->studyDS()->FindObjectID( theEntry.toStdString() );
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
const int aCount = aShapeAnnotations->GetNbAnnotation();
for ( int anIndex = 0; anIndex < aCount; ++anIndex )
{
if ( !anAnnotationToPrs.contains( anIndex ) )
continue;
// erase presentation from the viewer
SALOME_Prs* aPrs = anAnnotationToPrs[anIndex];
theView->Erase( getDisplayer(), aPrs );
}
getDisplayer()->UpdateViewer();
anEntryToAnnotation.remove( theEntry );
myVisualized[theView] = anEntryToAnnotation;
}
void GEOMGUI_AnnotationMgr::RemoveView( SALOME_View* theView )
{
if ( !theView && myVisualized.contains( theView ) )
myVisualized.remove( theView );
}
QString GEOMGUI_AnnotationMgr::getDisplayedIndicesInfo( const QString& theEntry, SALOME_View* theView ) const
{
QString aDisplayedIndices;
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
_PTR(SObject) aSObj = aStudy->studyDS()->FindObjectID( theEntry.toStdString() );
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
if ( !aShapeAnnotations.IsNull() )
{
const int aCount = aShapeAnnotations->GetNbAnnotation();
QStringList anIndices;
for ( int anIndex = 0; anIndex < aCount; ++anIndex )
{
if (IsDisplayed( theEntry, anIndex, theView ) )
anIndices.append( QString::number(anIndex) );
}
aDisplayedIndices = anIndices.join(";");
}
return aDisplayedIndices;
}
void GEOMGUI_AnnotationMgr::setDisplayedIndicesInfo( const QString& theEntry, SALOME_View* theView,
const QString theIndicesInfo )
{
if ( theIndicesInfo.isEmpty() )
return;
QStringList anIndices = theIndicesInfo.split( ";" );
for ( int i = 0, aCount = anIndices.size(); i < aCount; i++ ) {
Display( theEntry, anIndices[i], theView );
}
} }
GEOM_Displayer* GEOMGUI_AnnotationMgr::getDisplayer() const GEOM_Displayer* GEOMGUI_AnnotationMgr::getDisplayer() const
@ -191,6 +280,15 @@ GEOM_Displayer* GEOMGUI_AnnotationMgr::getDisplayer() const
return dynamic_cast<GEOM_Displayer*>( aModule->displayer() ); return dynamic_cast<GEOM_Displayer*>( aModule->displayer() );
} }
SALOME_View* GEOMGUI_AnnotationMgr::viewOrActiveView(SALOME_View* theView) const
{
if ( !theView ) {
SalomeApp_Application* anApp = getApplication();
SUIT_ViewWindow* anActiveWindow = anApp->desktop()->activeWindow();
theView = dynamic_cast<SALOME_View*>(anActiveWindow->getViewManager()->getViewModel());
}
}
void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theIndex, void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theIndex,
GEOM::GEOM_Object_ptr& theObject, GEOM::GEOM_Object_ptr& theObject,
GEOMGUI_AnnotationAttrs::Properties& theProperty ) GEOMGUI_AnnotationAttrs::Properties& theProperty )
@ -198,9 +296,34 @@ void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theInd
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() ); SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
_PTR(SObject) aSObj = aStudy->studyDS()->FindObjectID( theEntry.toStdString() ); _PTR(SObject) aSObj = aStudy->studyDS()->FindObjectID( theEntry.toStdString() );
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj ); const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
if ( !aShapeAnnotations.IsNull() ) {
aShapeAnnotations->GetProperties( theIndex, theProperty );
aShapeAnnotations->GetProperties( theIndex, theProperty ); theObject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject(aSObj) );
}
theObject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject(aSObj) );
} }
void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_View* theView )
{
SALOME_View* aView = viewOrActiveView( theView );
if ( !aView || !myVisualized.contains( aView ) )
return;
EntryToAnnotations anEntryToAnnotation = myVisualized[aView];
AnnotationToPrs anAnnotationToPrs;
if ( anEntryToAnnotation.contains( theEntry ) )
anAnnotationToPrs = anEntryToAnnotation[theEntry];
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
_PTR(SObject) aSObj = aStudy->studyDS()->FindObjectID( theEntry.toStdString() );
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
if ( !aShapeAnnotations.IsNull() ) {
const int aCount = aShapeAnnotations->GetNbAnnotation();
for ( int anIndex = 0; anIndex < aCount; ++anIndex )
{
bool aVisible = anAnnotationToPrs.contains( anIndex );
aShapeAnnotations->SetIsVisible( anIndex, aVisible );
}
}
}

24
src/GEOMGUI/GEOMGUI_AnnotationMgr.h Normal file → Executable file
View File

@ -47,25 +47,35 @@ public:
GEOMGUI_AnnotationMgr( SalomeApp_Application* theApplication ); GEOMGUI_AnnotationMgr( SalomeApp_Application* theApplication );
~GEOMGUI_AnnotationMgr() {} ~GEOMGUI_AnnotationMgr() {}
SALOME_Prs* CreatePresentation(const GEOMGUI_AnnotationAttrs::Properties& theProperty, SALOME_Prs* CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty,
GEOM::GEOM_Object_ptr theObject); GEOM::GEOM_Object_ptr theObject );
//void DisplayPresentation(SALOME_Prs* thePresentation); bool IsDisplayed( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 ) const;
//void erasePresentation(SALOME_Prs* thePresentation); void Display( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 );
void Erase( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 );
bool IsDisplayed(const QString& theEntry, const int theIndex); void DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView );
void Display(const QString& theEntry, const int theIndex); void EraseVisibleAnnotations( const QString& theEntry, SALOME_View* theView );
void Erase(const QString& theEntry, const int theIndex);
void RemoveView( SALOME_View* theView);
QString getDisplayedIndicesInfo( const QString& theEntry, SALOME_View* theView ) const;
void setDisplayedIndicesInfo( const QString& theEntry, SALOME_View* theView, const QString theIndicesInfo );
protected: protected:
SalomeApp_Application* getApplication() const { return myApplication; } SalomeApp_Application* getApplication() const { return myApplication; }
GEOM_Displayer* getDisplayer() const; GEOM_Displayer* getDisplayer() const;
SALOME_View* viewOrActiveView(SALOME_View* theView) const;
void getObject( const QString& theEntry, const int theIndex, void getObject( const QString& theEntry, const int theIndex,
GEOM::GEOM_Object_ptr& anObject, GEOM::GEOM_Object_ptr& anObject,
GEOMGUI_AnnotationAttrs::Properties& aProperty ); GEOMGUI_AnnotationAttrs::Properties& aProperty );
void storeVisibleState( const QString& theEntry, SALOME_View* theView );
private: private:
SalomeApp_Application* myApplication; SalomeApp_Application* myApplication;

View File

@ -199,7 +199,7 @@ GEOMGUI_TextTreeWdg::GEOMGUI_TextTreeWdg( SalomeApp_Application* app )
this, SLOT( showContextMenu(const QPoint&) ) ); this, SLOT( showContextMenu(const QPoint&) ) );
connect( myStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ), connect( myStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ),
this, SLOT( updateVisibilityColumn( QString, Qtx::VisibilityState ) ) ); this, SLOT( onUpdateVisibilityColumn( QString, Qtx::VisibilityState ) ) );
connect( app->objectBrowser(), SIGNAL( updated() ), this, SLOT( updateTree() ) ); connect( app->objectBrowser(), SIGNAL( updated() ), this, SLOT( updateTree() ) );
GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) ); GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
@ -459,10 +459,10 @@ QTreeWidgetItem* GEOMGUI_TextTreeWdg::itemFromEntry( const BranchType& theBranch
} }
//================================================================================= //=================================================================================
// function : updateVisibilityColumn // function : onUpdateVisibilityColumn
// purpose : Update visible state of icons of entry items. // 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 // dimension property branch
updateVisibilityColumn( DimensionShape, theEntry, theState ); updateVisibilityColumn( DimensionShape, theEntry, theState );
@ -615,6 +615,32 @@ void GEOMGUI_TextTreeWdg::setShapeItemVisibility( const BranchType& theBranchTyp
} }
} }
//=================================================================================
// function : setShapeItemVisibility
// purpose :
//=================================================================================
void GEOMGUI_TextTreeWdg::updateVisibility( SALOME_View* theView )
{
//QList<QString> aDimensionObjEntries = getObjects( DimensionShape ).keys();
BranchType aBranchType = AnnotationShape;
QList<QString> anAnnotationObjEntries = getObjects( aBranchType ).keys();
QTreeWidgetItem* anItem;
foreach ( QString anEntry, getObjects( aBranchType ).keys() )
{
anItem = itemFromEntry( aBranchType, anEntry );
int aDimIndex = idFromItem( anItem );
QSharedPointer<VisualProperty> aProp = getVisualProperty( aBranchType, myStudy,
anEntry.toStdString() );
bool isItemVisible = aProp->GetIsVisible( aDimIndex );
anItem->setIcon( 1, isItemVisible ? myVisibleIcon : myInvisibleIcon );
redisplay( anEntry );
}
}
//================================================================================= //=================================================================================
// function : setShapeItemVisibility // function : setShapeItemVisibility
// purpose : // purpose :

View File

@ -66,6 +66,8 @@ public:
const QString& theEntry, const QString& theEntry,
QTreeWidgetItem* theWidgetItem, QTreeWidgetItem* theWidgetItem,
const bool theVisibility ); const bool theVisibility );
void updateVisibility( SALOME_View* theView );
protected: protected:
void createActions(); void createActions();
void redisplay( QString theEntry ); void redisplay( QString theEntry );
@ -78,7 +80,7 @@ public slots:
private slots: private slots:
void onItemClicked(QTreeWidgetItem*, int ); void onItemClicked(QTreeWidgetItem*, int );
void updateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState ); void onUpdateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState );
void setVisibility( QTreeWidgetItem* theItem, bool visibility ); void setVisibility( QTreeWidgetItem* theItem, bool visibility );
void showContextMenu( const QPoint& pos ); void showContextMenu( const QPoint& pos );

View File

@ -47,6 +47,7 @@
#include <GEOMGUI_DimensionProperty.h> #include <GEOMGUI_DimensionProperty.h>
#include <GEOMGUI_AnnotationAttrs.h> #include <GEOMGUI_AnnotationAttrs.h>
#include <GEOMGUI_AnnotationMgr.h>
#include <GEOMUtils.hxx> #include <GEOMUtils.hxx>
@ -1373,6 +1374,7 @@ void GEOM_Displayer::updateShapeAnnotations( const Handle(SALOME_InteractiveObje
const gp_Ax3& theShapeLCS ) const gp_Ax3& theShapeLCS )
{ {
return; return;
/*
SalomeApp_Study* aStudy = getStudy(); SalomeApp_Study* aStudy = getStudy();
if ( !aStudy ) if ( !aStudy )
{ {
@ -1460,7 +1462,7 @@ void GEOM_Displayer::updateShapeAnnotations( const Handle(SALOME_InteractiveObje
for ( aIterateIO.Initialize( aListOfIO ); aIterateIO.More(); aIterateIO.Next() ) for ( aIterateIO.Initialize( aListOfIO ); aIterateIO.More(); aIterateIO.Next() )
{ {
anOccPrs->AddObject( aIterateIO.Value() ); anOccPrs->AddObject( aIterateIO.Value() );
} }*/
} }
//================================================================= //=================================================================
@ -2157,6 +2159,12 @@ void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCPrs* )
void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p ) void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p )
{ {
UpdateColorScale(false,false); UpdateColorScale(false,false);
// 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 ) void GEOM_Displayer::BeforeErase( SALOME_View* v, const SALOME_OCCPrs* p )
@ -2169,6 +2177,13 @@ void GEOM_Displayer::AfterErase( SALOME_View* v, const SALOME_OCCPrs* p )
{ {
LightApp_Displayer::AfterErase( v, p ); LightApp_Displayer::AfterErase( v, p );
UpdateColorScale(false,false); UpdateColorScale(false,false);
// 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);
} }
//================================================================= //=================================================================

View File

@ -1972,6 +1972,12 @@ void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win )
action( GEOMOp::OpEditField )->setEnabled( ViewOCC ); // Edit Field action( GEOMOp::OpEditField )->setEnabled( ViewOCC ); // Edit Field
action( GEOMOp::OpMultiTransform )->setEnabled( ViewOCC ); // MENU BLOCKS - MULTI-TRANSFORMATION action( GEOMOp::OpMultiTransform )->setEnabled( ViewOCC ); // MENU BLOCKS - MULTI-TRANSFORMATION
if ( ViewOCC )
{
SUIT_ViewModel* vmodel = win->getViewManager()->getViewModel();
myTextTreeWdg->updateVisibility(dynamic_cast<SALOME_View*>(vmodel));
}
} }
void GeometryGUI::windows( QMap<int, int>& mappa ) const void GeometryGUI::windows( QMap<int, int>& mappa ) const
@ -2055,6 +2061,7 @@ void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm )
break; break;
} }
} }
GetAnnotationMgr()->RemoveView(dynamic_cast<SALOME_View*>(viewer));
} }
//================================================================================ //================================================================================
@ -2904,6 +2911,9 @@ void GeometryGUI::storeVisualParameters (int savePoint)
for (it = lst.begin(); it != lst.end(); it++) { for (it = lst.begin(); it != lst.end(); it++) {
SUIT_ViewManager* vman = *it; SUIT_ViewManager* vman = *it;
QString vType = vman->getType(); QString vType = vman->getType();
SUIT_ViewModel* vmodel = vman->getViewModel();
SALOME_View* aView = dynamic_cast<SALOME_View*>(vmodel);
int aMgrId = vman->getGlobalId(); int aMgrId = vman->getGlobalId();
// saving VTK actors properties // saving VTK actors properties
QVector<SUIT_ViewWindow*> views = vman->getViews(); QVector<SUIT_ViewWindow*> views = vman->getViews();
@ -3025,6 +3035,13 @@ void GeometryGUI::storeVisualParameters (int savePoint)
param = occParam + GEOM::propertyName( GEOM::IsosWidth ); param = occParam + GEOM::propertyName( GEOM::IsosWidth );
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::IsosWidth )).toString().toStdString()); ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::IsosWidth )).toString().toStdString());
} }
std::string anAnnotationInfo = GetAnnotationMgr()->getDisplayedIndicesInfo(entry.c_str(), aView).toStdString();
if (!anAnnotationInfo.empty()) {
param = occParam + "AttributeParameter";
ip->setParameter(entry, param.toStdString(), anAnnotationInfo);
}
} // object iterator } // object iterator
} // for (views) } // for (views)
} // for (viewManagers) } // for (viewManagers)
@ -3189,7 +3206,10 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::LineWidth ), val.toInt()); aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::LineWidth ), val.toInt());
} else if (paramNameStr == GEOM::propertyName( GEOM::IsosWidth )) { } else if (paramNameStr == GEOM::propertyName( GEOM::IsosWidth )) {
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::IsosWidth ), val.toInt()); aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::IsosWidth ), val.toInt());
} else if (paramNameStr == "AttributeParameter") {
aListOfMap[viewIndex].insert( "AttributeParameter", val);
} }
} // for names/parameters iterator } // for names/parameters iterator
QList<SUIT_ViewManager*> lst = getApp()->viewManagers(); QList<SUIT_ViewManager*> lst = getApp()->viewManagers();
@ -3201,7 +3221,12 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
if (aListOfMap[index].value(GEOM::propertyName( GEOM::Visibility )) == 1) { if (aListOfMap[index].value(GEOM::propertyName( GEOM::Visibility )) == 1) {
SUIT_ViewManager* vman = lst.at(index); SUIT_ViewManager* vman = lst.at(index);
SUIT_ViewModel* vmodel = vman->getViewModel(); SUIT_ViewModel* vmodel = vman->getViewModel();
displayer()->Display(entry, true, dynamic_cast<SALOME_View*>(vmodel)); SALOME_View* aView = dynamic_cast<SALOME_View*>(vmodel);
displayer()->Display(entry, true, aView);
PropMap aProps = aListOfMap[index];
if ( aProps.contains( "AttributeParameter" ) )
GetAnnotationMgr()->setDisplayedIndicesInfo( entry, aView, aProps["AttributeParameter"].toString() );
} }
} }
} // for entries iterator } // for entries iterator

View File

@ -233,8 +233,8 @@ private:
GEOMGUI_CreationInfoWdg* myCreationInfoWdg; GEOMGUI_CreationInfoWdg* myCreationInfoWdg;
GEOMGUI_TextTreeWdg* myTextTreeWdg; GEOMGUI_TextTreeWdg* myTextTreeWdg;
GEOMGUI_AnnotationMgr* myAnnotationMgr; GEOMGUI_AnnotationMgr* myAnnotationMgr;
SALOME_ListIO myTopLevelIOList; SALOME_ListIO myTopLevelIOList;