X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_Selection.cxx;h=014e88a5a224c77011c207fe20d021266716e1a1;hb=fbaf4c789f6f06558d74d449934dd0e05df4213a;hp=eb48d8144df29a323679f849edac57a7a6633341;hpb=25cec45acb2923f66c849516f31337c1a3c4c687;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx index eb48d8144..014e88a5a 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.cxx +++ b/src/SMESHGUI/SMESHGUI_Selection.cxx @@ -86,9 +86,9 @@ QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const else if ( p=="hasReference" ) val = QtxValue( hasReference( 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; + // 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; } @@ -102,7 +102,7 @@ SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const if ( ind >= 0 && ind < myDataOwners.count() ) { const SalomeApp_SVTKDataOwner* owner = dynamic_cast ( myDataOwners[ ind ].get() ); - if ( owner ) + if ( owner ) return dynamic_cast( owner->GetActor() ); } return 0; @@ -286,10 +286,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 ); } @@ -314,23 +316,36 @@ QVariant SMESHGUI_Selection::isVisible( int ind ) const } +//======================================================================= +//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; + int aLevel = obj->Depth() - objComponent->Depth(), aFTag = objFather->Tag(), anOTag = obj->Tag(),