This commit is contained in:
asl 2005-08-18 11:21:40 +00:00
parent ee2c380872
commit e84f664198
4 changed files with 44 additions and 61 deletions

View File

@ -2330,6 +2330,7 @@ void SMESHGUI::initialize( CAM_Application* app )
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" );
@ -2565,9 +2566,9 @@ void SMESHGUI::initialize( CAM_Application* app )
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

View File

@ -424,63 +424,27 @@ namespace SMESH{
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();
}
}
}
}
}
}
else if (IObject->hasEntry())
_PTR(SObject) MorSM = SMESH::GetMeshOrSubmesh( aHypObj );
_PTR(SObject) aRealHypo;
if( aHypObj->ReferencedObject( aRealHypo ) )
{
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();
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 );
}
}
}
}
}
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;
@ -544,7 +508,7 @@ namespace SMESH{
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();

View File

@ -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<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 );
}
@ -328,9 +330,16 @@ int SMESHGUI_Selection::type( SalomeApp_DataOwner* owner,
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(),

View File

@ -2125,6 +2125,9 @@ msgstr "Quality controls"
msgid "MEN_RENAME"
msgstr "Rename"
msgid "MEN_UNASSIGN"
msgstr "Unassign"
msgid "MEN_NUM_NODES"
msgstr "Display Nodes #"
@ -2403,6 +2406,9 @@ msgstr "Update"
msgid "TOP_RENAME"
msgstr "Rename"
msgid "TOP_UNASSIGN"
msgstr "Unassign"
msgid "TOP_NUM_NODES"
msgstr "Display Nodes"
@ -2683,6 +2689,9 @@ msgstr "Edit Local Hypothesis"
msgid "STB_RENAME"
msgstr "Rename"
msgid "STB_UNASSIGN"
msgstr "Unassign"
msgid "STB_NUM_NODES"
msgstr "Display Nodes"