X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_Selection.cxx;h=81a656b2ec07f5e2352d03d1ece2eef7be373966;hp=2a763c298d2dfea20ad7b6b201b0fb70e03f9270;hb=e356c6f27ed83572e6a8dfaf74af99afbfc8be24;hpb=f44f3fbf0b54abd2e6a730d44c51f94233802458 diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx index 2a763c298..81a656b2e 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.cxx +++ b/src/SMESHGUI/SMESHGUI_Selection.cxx @@ -84,12 +84,16 @@ QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const else if ( p=="displayMode" ) val = QtxValue( displayMode( ind ) ); else if ( p=="isComputable" ) val = QtxValue( isComputable( ind ) ); else if ( p=="hasReference" ) val = QtxValue( hasReference( ind ) ); - else if ( p=="isVisible" ) val = QtxValue( isVisible( ind ) ); +// else if ( p=="isVisible" ) val = QtxValue( isVisible( ind ) ); -// printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() ); -// if ( val.type() == QVariant::List ) -// cout << "size: " << val.toList().count() << endl; - return val; + // printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() ); + //if ( val.type() == QVariant::List ) + //cout << "size: " << val.toList().count() << endl; + + if( val.isValid() ) + return val; + else + return SalomeApp_Selection::param( ind, p ); } //======================================================================= @@ -100,15 +104,10 @@ QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const { if ( ind >= 0 && ind < myDataOwners.count() ) { - const SalomeApp_DataOwner* owner = - dynamic_cast ( myDataOwners[ ind ].get() ); - if ( owner ) - { - Handle( SALOME_InteractiveObject ) anObj = owner->IO(); - QString entry = anObj->getEntry(); - return dynamic_cast( SMESH::FindActorByEntry( entry ) ); - } - //return dynamic_cast( owner->GetActor() ); + const SalomeApp_SVTKDataOwner* owner = + dynamic_cast ( myDataOwners[ ind ].get() ); + if ( owner ) + return dynamic_cast( owner->GetActor() ); } return 0; } @@ -291,10 +290,12 @@ QVariant SMESHGUI_Selection::hasReference( int ind ) const { if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" ) { - Handle(SALOME_InteractiveObject) io = - static_cast( myDataOwners[ ind ].get() )->IO(); - if ( !io.IsNull() ) - return QVariant( io->hasReference(), 0 ); + SalomeApp_DataOwner* owner = dynamic_cast( myDataOwners[ ind ].operator->() ); + if( owner ) + { + _PTR(SObject) obj ( study()->studyDS()->FindObjectID( owner->entry().latin1() ) ), ref; + return QVariant( obj->ReferencedObject( ref ), 0 ); + } } return QVariant( false, 0 ); } @@ -311,31 +312,47 @@ QVariant SMESHGUI_Selection::isVisible( int ind ) const QString entry = static_cast( myDataOwners[ ind ].get() )->entry(); SMESH_Actor* actor = SMESH::FindActorByEntry( entry.latin1() ); if ( actor && actor->hasIO() ) { - SVTK_RenderWindowInteractor* renderInter = SMESH::GetCurrentVtkView()->getRWInteractor(); - return QVariant( renderInter->isVisible( actor->getIO() ), 0 ); + if(SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView()) + return QVariant( aViewWindow->isVisible( actor->getIO() ), 0 ); } } return QVariant( false, 0 ); } +//======================================================================= +//function : type +//purpose : +//======================================================================= +int SMESHGUI_Selection::type( SalomeApp_DataOwner* owner, _PTR(Study) study ) +{ + return type( owner->entry(), study ); +} + //======================================================================= //function : type //purpose : //======================================================================= -int SMESHGUI_Selection::type( SalomeApp_DataOwner* owner, - _PTR(Study) study ) +int SMESHGUI_Selection::type( const QString& entry, _PTR(Study) study ) { - QString entry = owner->entry(); - _PTR(SObject) obj (study->FindObjectID(entry.latin1())); if( !obj ) return -1; + _PTR(SObject) ref; + if( obj->ReferencedObject( ref ) ) + obj = ref; + _PTR(SObject) objFather = obj->GetFather(); _PTR(SComponent) objComponent = obj->GetFatherComponent(); + if( objComponent->ComponentDataType()!="SMESH" ) + return -1; + + if( objComponent->GetIOR()==obj->GetIOR() ) + return COMPONENT; + int aLevel = obj->Depth() - objComponent->Depth(), aFTag = objFather->Tag(), anOTag = obj->Tag(), @@ -417,6 +434,8 @@ QString SMESHGUI_Selection::typeName( const int t ) return "Mesh compound"; case GROUP: return "Group"; + case COMPONENT: + return "Component"; default: return "Unknown"; }