X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVISUGUI%2FVisuGUI_PopupTools.cxx;h=39f904b0ee0038628ff637af89b78db8fd157100;hb=809d25eb876eeece6fdc8239efee639b21ed18da;hp=837ba8afa79c8ed87f67f738bb821f179ec6effd;hpb=96e22851c7d22f9f095d68ac56fa765d36268d39;p=modules%2Fvisu.git diff --git a/src/VISUGUI/VisuGUI_PopupTools.cxx b/src/VISUGUI/VisuGUI_PopupTools.cxx index 837ba8af..39f904b0 100644 --- a/src/VISUGUI/VisuGUI_PopupTools.cxx +++ b/src/VISUGUI/VisuGUI_PopupTools.cxx @@ -27,8 +27,11 @@ #include "VisuGUI_PopupTools.h" #include "VisuGUI_Tools.h" +#include "SalomeApp_Study.h" +#include "LightApp_Study.h" #include "VISU_Actor.h" +#include "VISU_ScalarMapAct.h" using namespace VISU; @@ -38,7 +41,7 @@ using namespace VISU; QtxValue VisuGUI_Selection::param( const int ind, const QString& p ) const { - QtxValue val( SalomeApp_Selection::param( ind, p ) ); + QtxValue val( LightApp_Selection::param( ind, p ) ); if ( !val.isValid() ) { if ( p == "type" ) val = QtxValue( type( ind ) ); else if ( p == "nbComponents" ) val = QtxValue( nbComponents( ind ) ); @@ -49,6 +52,8 @@ QtxValue VisuGUI_Selection::param( const int ind, const QString& p ) const else if ( p == "isVisible" ) val = QtxValue( isVisible( ind ) ); else if ( p == "isShrunk" ) val = QtxValue( isShrunk( ind ) ); else if ( p == "hasActor" ) val = QtxValue( hasActor( ind ) ); + else if ( p == "isShading" ) val = QtxValue( isShading( ind ) ); + else if ( p == "isScalarMapAct" ) val = QtxValue( isScalarMapAct( ind ) ); } return val; @@ -58,17 +63,61 @@ QtxValue VisuGUI_Selection::param( const int ind, const QString& p ) const #define ENUM2STRING( x, y ) \ case y: \ x = QString( #y ); \ - break; + break QString VisuGUI_Selection::type( const int ind ) const { QString aResStr; VISU::Storable::TRestoringMap aMap; - GetSelectedObj( study(), entry( ind ), &aMap ); - bool isExist; - const QString& aVal = VISU::Storable::FindValue(aMap,"myComment",&isExist); - if ( isExist ) - aResStr = "VISU::T" + aVal; + SalomeApp_Study* aStudy = dynamic_cast( ( LightApp_Study* )study() ); + if ( !aStudy ) + return aResStr; + CORBA::Object_var anObject = GetSelectedObj( aStudy, entry( ind ), &aMap ); + + VISU::Base_var aVisuObj = VISU::Base::_narrow( anObject ); + if ( !CORBA::is_nil( aVisuObj ) ){ + VISU::VISUType aType = aVisuObj->GetType(); + switch (aType) { + ENUM2STRING( aResStr, VISU::TVISUGEN ); + ENUM2STRING( aResStr, VISU::TRESULT ); + ENUM2STRING( aResStr, VISU::TTABLE ); + ENUM2STRING( aResStr, VISU::TCURVE ); + ENUM2STRING( aResStr, VISU::TCONTAINER ); + ENUM2STRING( aResStr, VISU::TMESH ); + ENUM2STRING( aResStr, VISU::TSCALARMAP ); + ENUM2STRING( aResStr, VISU::TISOSURFACE ); + ENUM2STRING( aResStr, VISU::TDEFORMEDSHAPE ); + ENUM2STRING( aResStr, VISU::TCUTPLANES ); + ENUM2STRING( aResStr, VISU::TCUTLINES ); + ENUM2STRING( aResStr, VISU::TVECTORS ); + ENUM2STRING( aResStr, VISU::TSTREAMLINES ); + ENUM2STRING( aResStr, VISU::TPLOT3D ); + ENUM2STRING( aResStr, VISU::TANIMATION ); + } + } + + if(aResStr.isNull()){ + bool isExist; + VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue( aMap, "myType", &isExist).toInt(); + if( isExist ){ + switch (aType) { + ENUM2STRING( aResStr, VISU::TENTITY ); + ENUM2STRING( aResStr, VISU::TFAMILY ); + ENUM2STRING( aResStr, VISU::TGROUP ); + ENUM2STRING( aResStr, VISU::TVIEW3D ); + ENUM2STRING( aResStr, VISU::TFIELD ); + ENUM2STRING( aResStr, VISU::TTIMESTAMP ); + } + } + } + + if(aResStr.isNull()){ + bool isExist; + QString aVal = VISU::Storable::FindValue(aMap,"myComment",&isExist); + if ( isExist && aVal!="MESH" ) + aResStr = "VISU::T" + aVal; + } + return aResStr; } @@ -76,7 +125,10 @@ QString VisuGUI_Selection::nbComponents( const int ind ) const { QString aResStr; VISU::Storable::TRestoringMap aMap; - GetSelectedObj( study(), entry( ind ), &aMap ); + SalomeApp_Study* aStudy = dynamic_cast( ( LightApp_Study* )study() ); + if ( !aStudy ) + return aResStr; + GetSelectedObj( aStudy, entry( ind ), &aMap ); bool isExist; const QString& aVal = VISU::Storable::FindValue(aMap,"myNumComponent",&isExist); if ( isExist ) @@ -88,7 +140,10 @@ QString VisuGUI_Selection::nbTimeStamps( const int ind ) const { QString aResStr; VISU::Storable::TRestoringMap aMap; - GetSelectedObj( study(), entry( ind ), &aMap ); + SalomeApp_Study* aStudy = dynamic_cast( ( LightApp_Study* )study() ); + if ( !aStudy ) + return aResStr; + GetSelectedObj( aStudy, entry( ind ), &aMap ); bool isExist; const QString& aVal = VISU::Storable::FindValue(aMap,"myNbTimeStamps",&isExist); if ( isExist ) @@ -104,11 +159,11 @@ QString VisuGUI_Selection::representation( const int ind ) const if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) ){ int aRepresent = anVISUActor->GetRepresentation(); switch ( aRepresent ){ - ENUM2STRING( aResStr, VISU::POINT ) - ENUM2STRING( aResStr, VISU::WIREFRAME ) - ENUM2STRING( aResStr, VISU::SHADED ) - ENUM2STRING( aResStr, VISU::INSIDEFRAME ) - ENUM2STRING( aResStr, VISU::SURFACEFRAME ) + ENUM2STRING( aResStr, VISU::POINT ); + ENUM2STRING( aResStr, VISU::WIREFRAME ); + ENUM2STRING( aResStr, VISU::SHADED ); + ENUM2STRING( aResStr, VISU::INSIDEFRAME ); + ENUM2STRING( aResStr, VISU::SURFACEFRAME ); } } } @@ -119,7 +174,10 @@ QString VisuGUI_Selection::representation( const int ind ) const int VisuGUI_Selection::nbChild( const int ind, const bool named ) const { int cnt = 0; - _PTR(Study) aStudy = GetCStudy( study() ); + SalomeApp_Study* aSStudy = dynamic_cast( ( LightApp_Study* )study() ); + if ( !aSStudy ) + return cnt; + _PTR(Study) aStudy = GetCStudy( aSStudy ); if ( aStudy ){ _PTR(SObject) SO = aStudy->FindObjectID( entry( ind ).latin1() ); if ( SO ){ @@ -174,3 +232,29 @@ QString VisuGUI_Selection::hasActor( const int ind ) const { return representation( ind ).isEmpty() ? "0" : "1"; } + +QString VisuGUI_Selection::isShading( const int ind ) const +{ + QString aResStr; + + if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) ) + if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) ) + if ( VISU_ScalarMapAct* anActor = dynamic_cast(anVISUActor) ) + aResStr = anActor->IsShading() ? "1" : "0"; + + return aResStr; +} + +QString VisuGUI_Selection::isScalarMapAct( const int ind ) const +{ + QString aResStr; + + if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) ) + if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) ) + { + VISU_ScalarMapAct* anActor = dynamic_cast(anVISUActor); + aResStr = anActor ? "1" : "0"; + } + + return aResStr; +}