From: asv Date: Mon, 20 Mar 2006 14:48:38 +0000 (+0000) Subject: Fix for a bug with popup in VISU: Display/Erase/Display Only commands were added... X-Git-Tag: OCC_3_2_0a2_TC X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=98cd8bc67a16f3a204fadc76a6118d3e724485ab;p=modules%2Fvisu.git Fix for a bug with popup in VISU: Display/Erase/Display Only commands were added by Visu to popup on OTHER (Geom, Smesh, etc) component objects in Object Browser. --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 3c2ad867..9fa0c8d8 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -2417,7 +2417,7 @@ createPopupMenus() QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")"; QString aPrsVisible = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)"; QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")"; - QString aComponent = "( selcount=1 and canBeDisplayed and isComponent )"; + QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )"; QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible + " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + "))) ) or " + aComponent; diff --git a/src/VISUGUI/VisuGUI_PopupTools.cxx b/src/VISUGUI/VisuGUI_PopupTools.cxx index 68299777..624662df 100644 --- a/src/VISUGUI/VisuGUI_PopupTools.cxx +++ b/src/VISUGUI/VisuGUI_PopupTools.cxx @@ -31,6 +31,7 @@ #include "VisuGUI_Tools.h" #include "VISU_Result_i.hh" +#include "VISU_Gen_i.hh" #include "VISU_Actor.h" #include "VISU_ScalarMapAct.h" @@ -61,6 +62,7 @@ QtxValue VisuGUI_Selection::param( const int ind, const QString& p ) const else if ( p == "hasActor" ) val = QtxValue( hasActor( ind ) ); else if ( p == "isShading" ) val = QtxValue( isShading( ind ) ); else if ( p == "isScalarMapAct" ) val = QtxValue( isScalarMapAct( ind ) ); + else if ( p == "isVisuComponent") val = QtxValue( isVisuComponent( ind ) ); } return val; @@ -355,3 +357,17 @@ QString VisuGUI_Selection::isScalarMapAct( const int ind ) const return aResStr; } + +bool VisuGUI_Selection::isVisuComponent( const int ind ) const +{ + SalomeApp_Study* study = GetStudy(); + if ( !study ) + return false; + + _PTR(SObject) obj = study->studyDS()->FindObjectID( entry( ind ).latin1() ); + CORBA::Object_var anObj = VISU::ClientSObjectToObject( obj ); + if( CORBA::is_nil( anObj ) ) + return false; + + return dynamic_cast( VISU::GetServant( anObj ).in() ); +} diff --git a/src/VISUGUI/VisuGUI_PopupTools.h b/src/VISUGUI/VisuGUI_PopupTools.h index 1a7ae957..9476353d 100644 --- a/src/VISUGUI/VisuGUI_PopupTools.h +++ b/src/VISUGUI/VisuGUI_PopupTools.h @@ -59,6 +59,7 @@ private: QString hasActor( const int ) const; QString isShading( const int ) const; QString isScalarMapAct( const int ) const; + bool isVisuComponent( const int ) const; private: int nbChild( const int, const bool ) const;