X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_Selection.cxx;h=33f01403f46fb1df5a0e5ee31d98d3b923a7f1d4;hp=a77ff9a407146f775b2884cf1da1aa480f7fbb8b;hb=d89db6381da9e4b1a7827239bd6997b06992a73d;hpb=656c73ce33943675389576c4b17446b18d530e1e diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx index a77ff9a40..33f01403f 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 ); } //======================================================================= @@ -214,6 +218,7 @@ QString SMESHGUI_Selection::controlMode( int ind ) const case SMESH_Actor::eMultiConnection: return "eMultiConnection"; case SMESH_Actor::eMultiConnection2D: return "eMultiConnection2D"; case SMESH_Actor::eArea: return "eArea"; + case SMESH_Actor::eVolume3D: return "eVolume3D"; case SMESH_Actor::eTaper: return "eTaper"; case SMESH_Actor::eAspectRatio: return "eAspectRatio"; case SMESH_Actor::eAspectRatio3D: return "eAspectRatio3D"; @@ -286,10 +291,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 +321,39 @@ 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; + + if( objComponent->GetIOR()==obj->GetIOR() ) + return COMPONENT; + int aLevel = obj->Depth() - objComponent->Depth(), aFTag = objFather->Tag(), anOTag = obj->Tag(), @@ -412,6 +435,8 @@ QString SMESHGUI_Selection::typeName( const int t ) return "Mesh compound"; case GROUP: return "Group"; + case COMPONENT: + return "Component"; default: return "Unknown"; }