From: apl Date: Tue, 8 Nov 2016 11:04:18 +0000 (+0300) Subject: Merge commits, bring-to-front, show/hide all X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=45a135f45f87c9ff522d59f9b7fad74e798e9df5;p=modules%2Fgeom.git Merge commits, bring-to-front, show/hide all --- diff --git a/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx b/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx index a782e9e88..4fe3f9843 100755 --- a/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx +++ b/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx @@ -22,7 +22,9 @@ #include #include #include +#include #include + #include #include @@ -65,6 +67,7 @@ QString GEOMGUI_AnnotationMgr::GetEntrySeparator() //================================================================ SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty, GEOM::GEOM_Object_ptr theObject, + SALOME_View* theView, const QString& theEntry ) { Handle ( GEOM_Annotation ) aPresentation = new GEOM_Annotation(); @@ -104,6 +107,19 @@ SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationA gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() ); GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, theProperty, aShapeLCS ); + SALOME_View* aView = viewOrActiveView( theView ); + if ( aView ) { + + // set top-level flag correspondingly + SalomeApp_Study* aStudy = dynamic_cast( getApplication()->activeStudy() ); + int aMgrId = dynamic_cast< SUIT_ViewModel* >( aView )->getViewManager()->getGlobalId(); + QVariant aVal = aStudy->getObjectProperty( aMgrId, QString( getEntry( theObject ).c_str() ), GEOM::propertyName( GEOM::TopLevel ), QVariant() ); + bool isBringToFront = aVal.isValid() ? aVal.toBool() : false; + if( isBringToFront ) { + aPresentation->SetZLayer( Graphic3d_ZLayerId_Topmost ); + } + } + // add Prs to preview SUIT_ViewWindow* vw = getApplication()->desktop()->activeWindow(); SOCC_Prs* aPrs = @@ -153,7 +169,7 @@ void GEOMGUI_AnnotationMgr::Display( const QString& theEntry, const int theIndex // display presentation in the viewer QString anEntry = QString("%1%2%3").arg(theEntry).arg(GetEntrySeparator()).arg(theIndex); - SALOME_Prs* aPrs = CreatePresentation( aProperty, anObject, anEntry ); + SALOME_Prs* aPrs = CreatePresentation( aProperty, anObject, aView, anEntry ); aView->Display( getDisplayer(), aPrs ); getDisplayer()->UpdateViewer(); @@ -170,7 +186,7 @@ void GEOMGUI_AnnotationMgr::Display( const QString& theEntry, const int theIndex myVisualized[aView] = anEntryToMap; // change persistent for the entry: set visible state in true for indices which presentations are shown - storeVisibleState( theEntry, theView, theIndex ); + storeVisibleState( theEntry, theView ); } void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex, SALOME_View* theView ) @@ -207,7 +223,7 @@ void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex, myVisualized[aView] = anEntryToAnnotation; // change persistent for the entry: set visible state in true for indices which presentations are shown - storeVisibleState( theEntry, theView, theIndex ); + storeVisibleState( theEntry, theView ); } void GEOMGUI_AnnotationMgr::DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView ) @@ -217,9 +233,14 @@ void GEOMGUI_AnnotationMgr::DisplayVisibleAnnotations( const QString& theEntry, const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj ); if ( !aShapeAnnotations.IsNull() ) { const int aCount = aShapeAnnotations->GetNbAnnotation(); + std::vector isVisible( aCount ); for ( int anIndex = 0; anIndex < aCount; ++anIndex ) { - if ( aShapeAnnotations->GetIsVisible( anIndex ) ) + isVisible[anIndex] = aShapeAnnotations->GetIsVisible( anIndex ); + } + for ( int anIndex = 0; anIndex < aCount; ++anIndex ) + { + if ( isVisible[anIndex] ) Display( theEntry, anIndex, theView ); } } @@ -409,7 +430,7 @@ void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theInd } } -void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_View* theView, const int theIndex ) +void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_View* theView ) { SALOME_View* aView = viewOrActiveView( theView ); if ( !aView || !myVisualized.contains( aView ) ) @@ -424,14 +445,15 @@ void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_V SalomeApp_Study* aStudy = dynamic_cast( getApplication()->activeStudy() ); _PTR(SObject) aSObj = aStudy->studyDS()->FindObjectID( theEntry.toStdString() ); const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj ); - if ( !aShapeAnnotations.IsNull() ) { - - bool aVisible = anAnnotationToPrs.contains( theIndex ); - aShapeAnnotations->SetIsVisible( theIndex, aVisible ); + if ( !aShapeAnnotations.IsNull() ) { + const int aCount = aShapeAnnotations->GetNbAnnotation(); + for ( int anIndex = 0; anIndex < aCount; ++anIndex ) { + bool aVisible = anAnnotationToPrs.contains( anIndex ); + aShapeAnnotations->SetIsVisible( anIndex, aVisible ); + } } } - //======================================================================= // function : GEOMGUI_AnnotationMgr::getEntry // purpose : diff --git a/src/GEOMGUI/GEOMGUI_AnnotationMgr.h b/src/GEOMGUI/GEOMGUI_AnnotationMgr.h index 16044bedc..8b3445903 100755 --- a/src/GEOMGUI/GEOMGUI_AnnotationMgr.h +++ b/src/GEOMGUI/GEOMGUI_AnnotationMgr.h @@ -32,7 +32,6 @@ #include class SalomeApp_Application; -class GEOM_Annotation; class GEOM_Displayer; /*! @@ -52,7 +51,9 @@ public: static QString GetEntrySeparator(); SALOME_Prs* CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty, - GEOM::GEOM_Object_ptr theObject, const QString& theEntry = QString() ); + GEOM::GEOM_Object_ptr theObject, + SALOME_View* theView = 0, + const QString& theEntry = QString() ); bool IsDisplayed( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 ) const; void Display( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 ); @@ -85,16 +86,12 @@ protected: GEOM::GEOM_Object_ptr& anObject, GEOMGUI_AnnotationAttrs::Properties& aProperty ); - void storeVisibleState( const QString& theEntry, SALOME_View* theView, const int theIndex ); + void storeVisibleState( const QString& theEntry, SALOME_View* theView ); std::string getEntry( const GEOM::GEOM_Object_ptr theObject ); std::string getName( const GEOM::GEOM_Object_ptr theObject ); - void setAISProperties( const Handle(GEOM_Annotation)& thePresentation, - const GEOMGUI_AnnotationAttrs::Properties& theProperty, - const gp_Ax3& theLCS ); - private: SalomeApp_Application* myApplication; diff --git a/src/MeasureGUI/MeasureGUI.cxx b/src/MeasureGUI/MeasureGUI.cxx old mode 100644 new mode 100755 index 19eccc5fb..d8ea3d555 --- a/src/MeasureGUI/MeasureGUI.cxx +++ b/src/MeasureGUI/MeasureGUI.cxx @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -231,13 +232,16 @@ void MeasureGUI::ChangeAnnotationsVisibility( const bool theIsVisible ) || !anIObject->hasEntry() ) return; - _PTR(SObject) aSObj = anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() ); + const QString aEntry = anIObject->getEntry(),c_str(); + + _PTR(SObject) aSObj = anActiveStudy->studyDS()->FindObjectID( aEntry.toStdString() ); const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj ); - if ( aShapeAnnotations.IsNull() ) + if ( aShapeAnnotations.IsNull() ) { return; + } const int aCount = aShapeAnnotations->GetNbAnnotation(); @@ -247,10 +251,13 @@ void MeasureGUI::ChangeAnnotationsVisibility( const bool theIsVisible ) for ( int anI = 0; anI <= aCount; ++anI ) { - aShapeAnnotations->SetIsVisible( anI, theIsVisible ); + if ( !theIsVisible ) { + getGeometryGUI()->GetAnnotationMgr()->Erase( aEntry, anI ); + } + else { + getGeometryGUI()->GetAnnotationMgr()->Display( aEntry , anI ); + } } - - GEOM_Displayer( anActiveStudy ).Redisplay( anIObject, true ); } } diff --git a/src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx b/src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx index 6ac2edf77..2d347c99b 100755 --- a/src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx @@ -439,10 +439,6 @@ void MeasureGUI_AnnotationDlg::SelectionIntoArgument() hasAttachPoint = true; } - else { - - myIsPositionDefined = false; - } } else if ( myEditCurrentArgument == mySubShapeName ) { if ( !myShape->_is_nil() ) { @@ -474,13 +470,8 @@ void MeasureGUI_AnnotationDlg::SelectionIntoArgument() anAttachPoint = getAttachPoint( aSubShape ); } - hasAttachPoint = true; } - else { - - myIsPositionDefined = false; - } } } myAnnotationProperties.ShapeIndex = aSubShapeIndex; @@ -506,6 +497,10 @@ void MeasureGUI_AnnotationDlg::SelectionIntoArgument() myIsPositionDefined = true; } + else if ( !hasAttachPoint ) { + + myIsPositionDefined = false; + } } redisplayPreview(); }