X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ComputeDlg.cxx;h=a7cb0d0dc7840c6dd8231e4d28f67027bd08caaf;hp=10e4b196f3c757253c0dd509f7931277ee8706aa;hb=19720c1ef8ed1ff65a87ae63b7fff432b924b2f3;hpb=7bbc6346f7c74142c3e039630846c9c731c560e3 diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index 10e4b196f..a7cb0d0dc 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -656,6 +656,24 @@ SMESHGUI_BaseComputeOp::SMESHGUI_BaseComputeOp() myHelpFileName = "about_meshes.html"; // V4 } +//================================================================================ +/*! + * \brief Gets dialog of this operation + * \retval LightApp_Dialog* - pointer to dialog of this operation + */ +//================================================================================ + +LightApp_Dialog* SMESHGUI_BaseComputeOp::dlg() const +{ + return myCompDlg; +} + +//================================================================================ +/*! + * \brief Return a selected mesh + */ +//================================================================================ + SMESH::SMESH_Mesh_ptr SMESHGUI_BaseComputeOp::getMesh() { LightApp_SelectionMgr* Sel = selectionMgr(); @@ -665,6 +683,23 @@ SMESH::SMESH_Mesh_ptr SMESHGUI_BaseComputeOp::getMesh() return myMesh->_is_nil() ? aMesh._retn() : SMESH::SMESH_Mesh::_duplicate( myMesh ); } +//================================================================================ +/*! + * \brief check the same operations on the same mesh + */ +//================================================================================ + +bool SMESHGUI_BaseComputeOp::isValid( SUIT_Operation* theOp ) const +{ + SMESHGUI_BaseComputeOp* baseOp = dynamic_cast( theOp ); + bool ret = true; + if ( !myMesh->_is_nil() && baseOp ) { + SMESH::SMESH_Mesh_var aMesh = baseOp->getMesh(); + if ( !aMesh->_is_nil() && aMesh->GetId() == myMesh->GetId() ) ret = false; + } + return ret; +} + //================================================================================ /*! * \brief Start operation @@ -720,6 +755,8 @@ void SMESHGUI_BaseComputeOp::startOperation() return; } + myCompDlg->myMeshName->setText( SMESH::GetName( myIObject )); + myMainShape = myMesh->GetShapeToMesh(); SMESHGUI_Operation::startOperation(); @@ -883,7 +920,6 @@ void SMESHGUI_BaseComputeOp::computeMesh() bool shapeOK = myMainShape->_is_nil() ? !hasShape : hasShape; if ( shapeOK ) { - myCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() ); SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen(); SMESH::algo_error_array_var errors = gen->GetAlgoState(myMesh,myMainShape); if ( errors->length() > 0 ) { @@ -951,7 +987,7 @@ void SMESHGUI_BaseComputeOp::computeMesh() SMESH::SMESH_IDSource_var aSubMeshObj = SMESH::SObjectToInterface( smSObj ); SMESH_Actor *anActor = SMESH::FindActorByObject( aSubMeshObj ); - if ( anActor && anActor->GetVisibility() ) + if ( anActor /*&& anActor->GetVisibility()*/ ) aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aSubMeshObj, smSObj )); } // put Groups into list @@ -967,7 +1003,7 @@ void SMESHGUI_BaseComputeOp::computeMesh() SMESH::SMESH_IDSource_var aGroupObj = SMESH::SObjectToInterface( aGroupSO ); SMESH_Actor *anActor = SMESH::FindActorByObject( aGroupObj ); - if ( anActor && anActor->GetVisibility() ) + if ( anActor /*&& anActor->GetVisibility()*/ ) aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aGroupObj, aGroupSO )); } @@ -994,6 +1030,13 @@ void SMESHGUI_BaseComputeOp::computeMesh() //SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor ); -- 23615 } } + else + { + SMESH_Actor *anActor = SMESH::FindActorByEntry( entry.c_str() ); + anActor->Update(); + if ( !anActor->GetVisibility() ) + continue; + } SMESH::UpdateView( SMESH::eDisplay, entry.c_str() ); if ( SVTK_ViewWindow* vtkWnd = SMESH::GetVtkViewWindow(SMESH::GetActiveWindow() )) @@ -1251,8 +1294,8 @@ void SMESHGUI_BaseComputeOp::stopOperation() void SMESHGUI_BaseComputeOp::onPublishShape() { - GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); GEOM::GEOM_Object_var meshShape = myMesh->GetShapeToMesh(); + GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( meshShape ); QStringList entryList; QList rows; @@ -1273,7 +1316,7 @@ void SMESHGUI_BaseComputeOp::onPublishShape() // look for myMainShape in the table for ( int r = 0, nr = table()->rowCount(); r < nr; ++r ) { if ( table()->item( r, COL_SHAPEID )->text() == "1" ) { - if ( so->_is_nil() ) { + if ( !so->_is_nil() ) { CORBA::String_var name = so->GetName(); CORBA::String_var entry = so->GetID(); QString shapeText = QString("%1 (%2)").arg( name.in() ).arg( entry.in() ); @@ -1545,23 +1588,6 @@ void SMESHGUI_ComputeOp::startOperation() computeMesh(); } -//================================================================================ -/*! - * \brief check the same operations on the same mesh - */ -//================================================================================ - -bool SMESHGUI_BaseComputeOp::isValid( SUIT_Operation* theOp ) const -{ - SMESHGUI_BaseComputeOp* baseOp = dynamic_cast( theOp ); - bool ret = true; - if ( !myMesh->_is_nil() && baseOp ) { - SMESH::SMESH_Mesh_var aMesh = baseOp->getMesh(); - if ( !aMesh->_is_nil() && aMesh->GetId() == myMesh->GetId() ) ret = false; - } - return ret; -} - //================================================================================ /*! * \brief Gets dialog of this operation @@ -1949,7 +1975,6 @@ void SMESHGUI_PrecomputeOp::onPreview() bool computeFailed = true, memoryLack = false; SMESHGUI_ComputeDlg* aCompDlg = computeDlg(); - aCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() ); SMESHGUI* gui = getSMESHGUI(); SMESH::SMESH_Gen_var gen = gui->GetSMESHGen(); @@ -2196,7 +2221,6 @@ void SMESHGUI_BaseComputeOp::evaluateMesh() bool shapeOK = myMainShape->_is_nil() ? !hasShape : hasShape; if ( shapeOK ) { - myCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() ); SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen(); SMESH::algo_error_array_var errors = gen->GetAlgoState(myMesh,myMainShape); if ( errors->length() > 0 ) { @@ -2400,3 +2424,43 @@ SMESHGUI_ComputeDlg* SMESHGUI_BaseComputeOp::evaluateDlg() const return myCompDlg; } +//================================================================================ +/*! + * \brief SMESHGUI_BaseComputeOp constructor + */ +//================================================================================ + +SMESHGUI_ShowErrorsOp::SMESHGUI_ShowErrorsOp(): + SMESHGUI_BaseComputeOp() +{ +} + +//================================================================================ +/*! + * \brief Start SMESHGUI_ShowErrorsOp + */ +//================================================================================ + +void SMESHGUI_ShowErrorsOp::startOperation() +{ + SMESHGUI_BaseComputeOp::startOperation(); + + if ( myMesh->_is_nil() ) + return; + + SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen(); + SMESH::compute_error_array_var compErrors = gen->GetComputeErrors( myMesh, myMainShape ); + QString hypErrors; + if ( compErrors->length() == 0 ) + return; + + showComputeResult( /*MemoryLack=*/false, /*NoCompError=*/false, compErrors, + /*NoHypoError=*/true, hypErrors ); + + SMESHGUI_ComputeDlg* aCompDlg = computeDlg(); + aCompDlg->setWindowTitle( tr( "SMESH_WRN_COMPUTE_FAILED" )); + aCompDlg->myFullInfo->hide(); + aCompDlg->myBriefInfo->hide(); + + return; +}