createSMESHAction( 220, "ALL" );
createSMESHAction( 1100, "EDIT_HYPO" );
createSMESHAction( 1101, "RENAME" );
+ createSMESHAction( 1102, "UNASSIGN" );
createSMESHAction( 9010, "NUM_NODES", "", 0, true );
createSMESHAction( 9011, "NUM_ELEMENTS", "", 0, true );
createSMESHAction( 1131, "DISPMODE" );
createPopupItem( 801, OB, mesh ); // CREATE_GROUP
createPopupItem( 802, OB, subMesh ); // CONSTRUCT_GROUP
popupMgr()->insert( separator(), -1, 0 );
- createPopupItem( 1100, OB, hypo ); // EDIT HYPOTHESIS
- createPopupItem( 1102, OB, hyp_alg, "&& hasReference" ); // REMOVE HYPOTHESIS / ALGORITHMS
- createPopupItem( 1101, OB, mesh_group + " " + hyp_alg ); // RENAME
+ createPopupItem( 1100, OB, hypo, "&& $hasReference={false}" ); // EDIT HYPOTHESIS
+ createPopupItem( 1102, OB, hyp_alg ); // REMOVE HYPOTHESIS / ALGORITHMS
+ createPopupItem( 1101, OB, mesh_group + " " + hyp_alg, "&& $hasReference={false}" ); // RENAME
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( 125, OB, mesh ); // EXPORT_MED
createPopupItem( 126, OB, mesh ); // EXPORT_UNV
try {
_PTR(Study) aStudy = GetActiveStudyDocument();
- SMESH_Hypothesis_var anHyp = IObjectToInterface<SMESH_Hypothesis>(IObject);
- if (IObject->hasReference())
+ _PTR(SObject) aHypObj = aStudy->FindObjectID( IObject->getEntry() );
+ if( aHypObj )
{
- if(MYDEBUG) MESSAGE("HAS REFERENCE " << IObject->getEntry());
- _PTR(SObject) aHypSObj = aStudy->FindObjectID(IObject->getReference());
- if (aHypSObj) {
- _PTR(SObject) MorSM = SMESH::GetMeshOrSubmesh(aHypSObj);
- if (MorSM) {
- GEOM::GEOM_Object_var aShape = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
- if (!aShape->_is_nil()){
- SMESH::SMESH_Mesh_var aMesh =
- SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
- SMESH::SMESH_subMesh_var aSubMesh =
- SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
-
- if (!aSubMesh->_is_nil())
- aMesh = aSubMesh->GetFather();
-
- if (!aMesh->_is_nil()) {
- res = aMesh->RemoveHypothesis(aShape, anHyp);
- if (res < SMESH::HYP_UNKNOWN_FATAL) {
- _PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
- if (meshSO)
- SMESH::ModifiedMesh(meshSO, false);
- }
- if (res > SMESH::HYP_OK) {
- wc.suspend();
- processHypothesisStatus(res, anHyp, false);
- wc.resume();
- }
- }
- }
- }
+ _PTR(SObject) MorSM = SMESH::GetMeshOrSubmesh( aHypObj );
+ _PTR(SObject) aRealHypo;
+ if( aHypObj->ReferencedObject( aRealHypo ) )
+ {
+ SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aRealHypo ) );
+ RemoveHypothesisOrAlgorithmOnMesh( MorSM, hypo );
+ }
+ else
+ {
+ SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aHypObj ) );
+ SObjectList meshList = GetMeshesUsingAlgoOrHypothesis( hypo );
+ for( int i = 0; i < meshList.size(); i++ )
+ RemoveHypothesisOrAlgorithmOnMesh( meshList[ i ], hypo );
}
- }
- else if (IObject->hasEntry())
- {
- if(MYDEBUG) MESSAGE("IObject entry HAS ENTRY " << IObject->getEntry());
- SObjectList meshList = GetMeshesUsingAlgoOrHypothesis(anHyp);
- for ( int i = 0; i < meshList.size(); ++i ) {
- SMESH::SMESH_Mesh_var aMesh =
- SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( meshList[ i ]);
- GEOM::GEOM_Object_var aShape = SMESH::GetShapeOnMeshOrSubMesh( meshList[ i ]);
- if ( ! aMesh->_is_nil() && !aShape->_is_nil() ) {
- res = aMesh->RemoveHypothesis(aShape, anHyp);
- if ( res < SMESH::HYP_UNKNOWN_FATAL )
- SMESH::ModifiedMesh( meshList[ i ], false);
- if ( res > SMESH::HYP_OK ) {
- wc.suspend();
- processHypothesisStatus( res, anHyp, false );
- wc.resume();
- }
- }
- }
}
}
- catch(const SALOME::SALOME_Exception& S_ex) {
+ catch(const SALOME::SALOME_Exception& S_ex)
+ {
wc.suspend();
SalomeApp_Tools::QtCatchCorbaException(S_ex);
res = SMESH::HYP_UNKNOWN_FATAL;
if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency number ="<<listSO.size());
for (unsigned int i = 0; i < listSO.size(); i++) {
_PTR(SObject) SO = listSO[i];
- if (!SO) {
+ if (SO) {
_PTR(SObject) aFather = SO->GetFather();
if (aFather) {
_PTR(SObject) SOfatherFather = aFather->GetFather();
{
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
{
- Handle(SALOME_InteractiveObject) io =
- static_cast<SalomeApp_DataOwner*>( myDataOwners[ ind ].get() )->IO();
- if ( !io.IsNull() )
- return QVariant( io->hasReference(), 0 );
+ SalomeApp_DataOwner* owner = dynamic_cast<SalomeApp_DataOwner*>( 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 );
}
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(),