X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI.cxx;h=019bf2d2d5043ed1deb3e635108b27bbdb74236a;hp=c5e3a6adc6ac080eb3c83ddc5f8a86b114ee40b5;hb=9010d190b3120a623ab9727ebb167d82824b84c2;hpb=57b43b4d010e2d0a1529d3c131bbb9d416e63258 diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index c5e3a6adc..019bf2d2d 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // File : SMESHGUI.cxx // Author : Nicolas REJNERI @@ -57,7 +57,6 @@ #include "SMESHGUI_RotationDlg.h" #include "SMESHGUI_SymmetryDlg.h" #include "SMESHGUI_SewingDlg.h" -#include "SMESHGUI_MergeNodesDlg.h" #include "SMESHGUI_EditMeshDlg.h" #include "SMESHGUI_MeshPatternDlg.h" #include "SMESHGUI_Selection.h" @@ -65,6 +64,9 @@ #include "SMESHGUI_ConvToQuadOp.h" #include "SMESHGUI_MeshOp.h" #include "SMESHGUI_Displayer.h" +#include "SMESHGUI_MakeNodeAtPointDlg.h" +#include "SMESHGUI_BuildCompoundDlg.h" +#include "SMESHGUI_ComputeDlg.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_GEOMGenUtils.h" @@ -119,6 +121,7 @@ #include "SALOMEconfig.h" #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_SERVER_HEADER(SMESH_MeshEditor) // QT Includes #define INCLUDE_MENUITEM_DEF @@ -145,7 +148,7 @@ using namespace std; -namespace{ +//namespace{ // Declarations //============================================================= void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh, @@ -257,6 +260,7 @@ namespace{ if ( !aMesh->_is_nil() ) { QString aFilter, aTitle = QObject::tr("Export mesh"); QMap aFilterMap; + QMap aFilterMapSTL; switch ( theCommandID ) { case 125: case 122: @@ -296,6 +300,36 @@ namespace{ aFilter = QObject::tr("IDEAS files (*.unv)"); } break; + case 140: + case 141: + { + // export STL + /* + there must be check on others mesh elements not equal triangles + */ + if (aMesh->NbTriangles() < 1) { + SUIT_MessageBox::warn1 + (SMESHGUI::desktop(), + QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("SMESH_EXPORT_STL1").arg(anIObject->getName()), + QObject::tr("SMESH_BUT_OK")); + return; + } + if (!(aMesh->NbElements() - aMesh->NbTriangles())) { + int aRet = SUIT_MessageBox::warn2 + (SMESHGUI::desktop(), + QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("SMESH_EXPORT_STL2").arg(anIObject->getName()), + QObject::tr("SMESH_BUT_YES"), QObject::tr("SMESH_BUT_NO"), + 0, 1, 0); + if (aRet) + return; + } + + aFilterMapSTL.insert( QObject::tr("STL ASCII (*.stl)"), 1 ); // 1 - ASCII mode + aFilterMapSTL.insert( QObject::tr("STL Binary (*.stl)"), 0 ); // 0 - Binary mode + } + break; default: return; } @@ -303,13 +337,35 @@ namespace{ QString aFilename; SMESH::MED_VERSION aFormat; // Init the parameter with the default value + bool aIsASCII_STL = true; bool toCreateGroups = false; SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); if ( resMgr ) toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false ); - - if ( theCommandID != 122 && theCommandID != 125 ) + + if ( theCommandID != 122 && theCommandID != 125 && theCommandID != 140 && theCommandID != 141) + aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), "", aFilter, aTitle, false); + + else if(theCommandID == 140 || theCommandID == 141) { // Export to STL + QStringList filters; + QMap::const_iterator it = aFilterMapSTL.begin(); + for ( ; it != aFilterMapSTL.end(); ++it ) + filters.push_back( it.key() ); + + SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true ); + fd->setCaption( aTitle ); + fd->setFilters( filters ); + fd->setSelectedFilter( QObject::tr("STL ASCII (*.stl)") ); + bool is_ok = false; + while (!is_ok) { + fd->exec(); + aFilename = fd->selectedFile(); + aIsASCII_STL = (aFilterMapSTL[fd->selectedFilter()]) == 1 ? true: false; + is_ok = true; + } + delete fd; + } else { QStringList filters; QMap::const_iterator it = aFilterMap.begin(); @@ -330,7 +386,7 @@ namespace{ aFormat = aFilterMap[fd->selectedFilter()]; is_ok = true; if ( !aFilename.isEmpty() - && (aMesh->NbPolygons()>0 or aMesh->NbPolyhedrons()>0) + && (aMesh->NbPolygons()>0 || aMesh->NbPolyhedrons()>0) && aFormat==SMESH::MED_V2_1) { int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"), @@ -352,21 +408,47 @@ namespace{ if ( aFile.exists() ) aFile.remove(); SUIT_OverrideCursor wc; - switch ( theCommandID ) { - case 125: - case 122: - aMesh->ExportToMED( aFilename.latin1(), toCreateGroups, aFormat ); - break; - case 124: - case 121: - aMesh->ExportDAT( aFilename.latin1() ); - break; - case 126: - case 123: - aMesh->ExportUNV( aFilename.latin1() ); - break; - default: - break; + + try { + bool Renumber = false ; + // PAL 14172 : Check of we have to renumber or not from the preferences before export + if (resMgr) + Renumber= resMgr->booleanValue("SMESH","renumbering"); + if (Renumber){ + SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor(); + aMeshEditor->RenumberNodes(); + aMeshEditor->RenumberElements(); + if ( SMESHGUI::automaticUpdate() ) + SMESH::UpdateView(); + } + switch ( theCommandID ) { + case 125: + case 122: + aMesh->ExportToMED( aFilename.latin1(), toCreateGroups, aFormat ); + break; + case 124: + case 121: + aMesh->ExportDAT( aFilename.latin1() ); + break; + case 126: + case 123: + aMesh->ExportUNV( aFilename.latin1() ); + break; + case 140: + case 141: + aMesh->ExportSTL( aFilename.latin1(), aIsASCII_STL ); + break; + default: + break; + } + } + catch (const SALOME::SALOME_Exception& S_ex){ + wc.suspend(); + SUIT_MessageBox::warn1(SMESHGUI::desktop(), + QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("SMESH_EXPORT_FAILED"), + QObject::tr("SMESH_BUT_OK")); + wc.resume(); } } } @@ -786,7 +868,7 @@ namespace{ _PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh); if (aMeshSO) - SMESH::ModifiedMesh(aMeshSO, false); + SMESH::ModifiedMesh(aMeshSO, false, aMesh->NbNodes()==0); } else { IObject = new SALOME_InteractiveObject @@ -815,10 +897,10 @@ namespace{ SMESHGUI::GetSMESHGUI()->updateObjBrowser(); } -} +//} extern "C" { - Standard_EXPORT CAM_Module* createModule() + SMESHGUI_EXPORT CAM_Module* createModule() { return new SMESHGUI(); } @@ -833,7 +915,7 @@ SMESH::SMESH_Gen_var SMESHGUI::myComponentSMESH = SMESH::SMESH_Gen::_nil(); //============================================================================= SMESHGUI::SMESHGUI() : SalomeApp_Module( "SMESH" ) -{ +{ if ( CORBA::is_nil( myComponentSMESH ) ) { CORBA::Boolean anIsEmbeddedMode; @@ -1125,6 +1207,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case 124: case 125: case 126: + case 140: + case 141: { ::ExportMeshToFile(theCommandID); break; @@ -1206,16 +1290,26 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) extractContainers( sel_objects, to_process ); - if (vtkwnd) { - SALOME_ListIteratorOfListIO It( to_process ); - for (; It.More(); It.Next()) { - Handle(SALOME_InteractiveObject) IOS = It.Value(); - if (IOS->hasEntry()) { - SMESH::UpdateView(anAction, IOS->getEntry()); - if (anAction == SMESH::eDisplayOnly) - anAction = SMESH::eDisplay; - } - } + try { + if (vtkwnd) { + SALOME_ListIteratorOfListIO It( to_process ); + for (; It.More(); It.Next()) { + Handle(SALOME_InteractiveObject) IOS = It.Value(); + if (IOS->hasEntry()) { + SMESH::UpdateView(anAction, IOS->getEntry()); + if (anAction == SMESH::eDisplayOnly) + anAction = SMESH::eDisplay; + } + } + } + + // PAL13338 + PAL15161 --> + if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy)) + SMESH::UpdateView(); + // PAL13338 + PAL15161 <-- + } + catch (...) { // PAL16774 (Crash after display of many groups) + SMESH::OnVisuException(); } if (anAction == SMESH::eErase) { @@ -1224,6 +1318,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) } else aSel->setSelectedObjects( to_process ); + break; } @@ -1271,88 +1366,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case 701: // COMPUTE MESH { - if(checkLock(aStudy)) break; - - LightApp_SelectionMgr *Sel = selectionMgr(); - SALOME_ListIO selected; Sel->selectedObjects( selected ); - - if ( vtkwnd ) { - int nbSel = selected.Extent(); - if (nbSel != 1){ - break; - } + if (checkLock(aStudy)) break; - SMESH::SMESH_Mesh_var aMesh; - SMESH::SMESH_subMesh_var aSubMesh; - Handle(SALOME_InteractiveObject) IObject = selected.First(); - if (IObject->hasEntry()) { - _PTR(SObject) aMeshSObj = aStudy->FindObjectID(IObject->getEntry()); - GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( aMeshSObj ); - if ( aShapeObject->_is_nil() ) { - // imported mesh - break; - } - if( aMeshSObj ) { - aMesh = SMESH::SObjectToInterface(aMeshSObj); - aSubMesh = SMESH::SObjectToInterface(aMeshSObj); - if ( !aSubMesh->_is_nil() ) - aMesh = aSubMesh->GetFather(); - - if (!aMesh->_is_nil()) { -// if(!GetSMESHGen()->IsReadyToCompute(aMesh,aShapeObject)) { -// SUIT_MessageBox::warn1(desktop(), -// tr("SMESH_WRN_WARNING"), -// tr("SMESH_WRN_MISSING_PARAMETERS"), -// tr("SMESH_BUT_OK")); -// break; -// } - SMESH::algo_error_array_var errors = GetSMESHGen()->GetAlgoState(aMesh,aShapeObject); - if ( errors->length() > 0 ) { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), - SMESH::GetMessageOnAlgoStateErrors( errors.in() ), - tr("SMESH_BUT_OK")); - break; - } - try{ - if (GetSMESHGen()->Compute(aMesh,aShapeObject)) - SMESH::ModifiedMesh(aMeshSObj,true); - else - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), - tr("SMESH_WRN_COMPUTE_FAILED"), - tr("SMESH_BUT_OK")); - } - catch(const SALOME::SALOME_Exception & S_ex){ - SalomeApp_Tools::QtCatchCorbaException(S_ex); - } - } - } - } - CORBA::Long anId = aStudy->StudyId(); - TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,IObject->getEntry()); - if ( automaticUpdate() && aVisualObj){ - aVisualObj->Update(); - SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry()); - if(!anActor){ - anActor = SMESH::CreateActor(aStudy,IObject->getEntry()); - if(anActor){ - SMESH::DisplayActor(view,anActor); //apo - SMESH::FitAll(); - } - } - SMESH::RepaintCurrentView(); - } - }else{ - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), - tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); - } - updateObjBrowser(); - Sel->setSelectedObjects( selected ); - break; + startOperation( 701 ); } + break; case 702: // Create mesh startOperation( 702 ); @@ -1363,6 +1381,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case 704: // Edit mesh/sub-mesh startOperation( 704 ); break; + case 710: // Build compound mesh + { + if (checkLock(aStudy)) break; + EmitSignalDeactivateDialog(); + new SMESHGUI_BuildCompoundDlg( this ); + } + break; case 407: // DIAGONAL INVERSION case 408: // Delete diagonal { @@ -1583,13 +1608,20 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) } updateObjBrowser(); - }catch(const SALOME::SALOME_Exception & S_ex){ + } + catch(const SALOME::SALOME_Exception & S_ex){ SalomeApp_Tools::QtCatchCorbaException(S_ex); } } } } } + else if(nbSel==0) { + SUIT_MessageBox::warn1(desktop(), + tr("SMESH_WRN_WARNING"), + tr("SMESH_WRN_NO_AVAILABLE_DATA"), + tr("SMESH_BUT_OK")); + } break; } @@ -1754,17 +1786,18 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) int nbSel = selected.Extent(); if (nbSel == 1) { - SMESH::SMESH_Hypothesis_var Hyp = SMESH::IObjectToInterface(selected.First()); + Handle(SALOME_InteractiveObject) anIObject = selected.First(); + SMESH::SMESH_Hypothesis_var aHypothesis = SMESH::IObjectToInterface(anIObject); /* Look for all mesh objects that have this hypothesis affected in order to flag as ModifiedMesh */ /* At end below '...->updateObjBrowser(true)' will change icon of mesh objects */ /* Warning : however by internal mechanism all subMeshes icons are changed ! */ - if ( !Hyp->_is_nil() ) + if ( !aHypothesis->_is_nil() ) { - char* sName = Hyp->GetName(); - SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(sName); + CORBA::String_var aHypType = aHypothesis->GetName(); + SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypType); if (aCreator) - aCreator->edit( Hyp.in(), desktop() ); + aCreator->edit( aHypothesis.in(), anIObject->getName(), desktop() ); else { // report error @@ -1903,18 +1936,18 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) int type; switch (theCommandID) { - case 4034: + case 4034: type = QUAD_EDGE; break; - case 4035: + case 4035: type = QUAD_TRIANGLE; break; - case 4036: + case 4036: type = QUAD_QUADRANGLE; break; - case 4037: + case 4037: type = QUAD_TETRAHEDRON; break; - case 4038: - type = QUAD_PYRAMID; break; - case 4039: - type = QUAD_PENTAHEDRON; break; + case 4038: + type = QUAD_PYRAMID; break; + case 4039: + type = QUAD_PENTAHEDRON; break; case 4040: type = QUAD_HEXAHEDRON; break; @@ -2049,7 +2082,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if(checkLock(aStudy)) break; if(vtkwnd) { EmitSignalDeactivateDialog(); - new SMESHGUI_MergeNodesDlg( this ); + new SMESHGUI_EditMeshDlg( this, 0 ); } else { SUIT_MessageBox::warn1(desktop(), @@ -2058,15 +2091,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) } break; } - case 4066: // MERGE EQUAL ELEMENTS + case 4066: // MERGE EQUAL ELEMENTS { if (checkLock(aStudy)) break; if (vtkwnd) { EmitSignalDeactivateDialog(); - new SMESHGUI_EditMeshDlg(this, - "SMESH_MERGE_ELEMENTS_TITLE", - "ICON_DLG_MERGE_ELEMENTS", - 1); // MergeEqualElemets + new SMESHGUI_EditMeshDlg( this, 1 ); } else { SUIT_MessageBox::warn1(desktop(), tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), @@ -2075,6 +2105,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) break; } + case 4067: // MAKE MESH PASS THROUGH POINT + startOperation( 4067 ); + break; + case 5105: // Library of selection filters { static QValueList aTypes; @@ -2143,12 +2177,14 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) LightApp_SelectionMgr* mgr = selectionMgr(); SALOME_ListIO selected; mgr->selectedObjects( selected ); - if (selected.Extent() == 1) { - Handle(SALOME_InteractiveObject) anIObject = selected.First(); - if(anIObject->hasEntry()) + SALOME_ListIteratorOfListIO it(selected); + for(; it.More(); it.Next()) { + Handle(SALOME_InteractiveObject) anIObject = it.Value(); + if(anIObject->hasEntry()) { if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){ anActor->SetPointsLabeled( !anActor->GetPointsLabeled() ); } + } } break; } @@ -2298,15 +2334,18 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 121, "DAT" ); createSMESHAction( 122, "MED" ); createSMESHAction( 123, "UNV" ); + createSMESHAction( 140, "STL" ); createSMESHAction( 124, "EXPORT_DAT" ); createSMESHAction( 125, "EXPORT_MED" ); createSMESHAction( 126, "EXPORT_UNV" ); + createSMESHAction( 141, "EXPORT_STL" ); createSMESHAction( 33, "DELETE", "ICON_DELETE" ); createSMESHAction( 5105, "SEL_FILTER_LIB" ); createSMESHAction( 701, "COMPUTE", "ICON_COMPUTE" ); createSMESHAction( 702, "CREATE_MESH", "ICON_DLG_INIT_MESH" ); createSMESHAction( 703, "CREATE_SUBMESH", "ICON_DLG_ADD_SUBMESH" ); createSMESHAction( 704, "EDIT_MESHSUBMESH","ICON_DLG_EDIT_MESH" ); + createSMESHAction( 710, "BUILD_COMPOUND", "ICON_BUILD_COMPOUND" ); createSMESHAction( 801, "CREATE_GROUP", "ICON_SMESH_TREE_GROUP" ); createSMESHAction( 802, "CONSTRUCT_GROUP", "ICON_CONSTRUCT_GROUP" ); createSMESHAction( 803, "EDIT_GROUP", "ICON_EDIT_GROUP" ); @@ -2344,11 +2383,12 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 4051, "RENUM_NODES", "ICON_DLG_RENUMBERING_NODES" ); createSMESHAction( 4052, "RENUM_ELEMENTS", "ICON_DLG_RENUMBERING_ELEMENTS" ); createSMESHAction( 4061, "TRANS", "ICON_SMESH_TRANSLATION_VECTOR" ); - createSMESHAction( 4062, "ROT", "ICON_DLG_ROTATION" ); + createSMESHAction( 4062, "ROT", "ICON_DLG_MESH_ROTATION" ); createSMESHAction( 4063, "SYM", "ICON_SMESH_SYMMETRY_PLANE" ); createSMESHAction( 4064, "SEW", "ICON_SMESH_SEWING_FREEBORDERS" ); createSMESHAction( 4065, "MERGE", "ICON_SMESH_MERGE_NODES" ); createSMESHAction( 4066, "MERGE_ELEMENTS", "ICON_DLG_MERGE_ELEMENTS" ); + createSMESHAction( 4067, "MESH_THROU_POINT","ICON_DLG_MESH_THROU_POINT" ); createSMESHAction( 406, "MOVE", "ICON_DLG_MOVE_NODE" ); createSMESHAction( 407, "INV", "ICON_DLG_MESH_DIAGONAL" ); createSMESHAction( 408, "UNION2", "ICON_UNION2TRI" ); @@ -2421,6 +2461,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( 121, exportId, -1 ); createMenu( 122, exportId, -1 ); createMenu( 123, exportId, -1 ); + createMenu( 140, exportId, -1 ); // export to stl STL createMenu( separator(), fileId, 10 ); @@ -2431,6 +2472,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( 702, meshId, -1 ); createMenu( 703, meshId, -1 ); createMenu( 704, meshId, -1 ); + createMenu( 710, meshId, -1 ); createMenu( separator(), meshId, -1 ); createMenu( 701, meshId, -1 ); createMenu( separator(), meshId, -1 ); @@ -2497,6 +2539,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( 4066, transfId, -1 ); createMenu( 406, modifyId, -1 ); + createMenu( 4067,modifyId, -1 ); createMenu( 407, modifyId, -1 ); createMenu( 408, modifyId, -1 ); createMenu( 409, modifyId, -1 ); @@ -2521,6 +2564,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createTool( 702, meshTb ); createTool( 703, meshTb ); createTool( 704, meshTb ); + createTool( 710, meshTb ); createTool( separator(), meshTb ); createTool( 701, meshTb ); createTool( separator(), meshTb ); @@ -2582,6 +2626,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createTool( separator(), addRemTb ); createTool( 406, modifyTb ); + createTool( 4067,modifyTb ); createTool( 407, modifyTb ); createTool( 408, modifyTb ); createTool( 409, modifyTb ); @@ -2638,6 +2683,7 @@ void SMESHGUI::initialize( CAM_Application* app ) QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( QtxPopupMgr::Selection::defSelCountParam() ); createPopupItem( 125, OB, mesh, only_one_non_empty ); // EXPORT_MED createPopupItem( 126, OB, mesh, only_one_non_empty ); // EXPORT_UNV + createPopupItem( 141, OB, mesh, only_one_non_empty ); // EXPORT_STL createPopupItem( 33, OB, subMesh + " " + group ); // DELETE popupMgr()->insert( separator(), -1, 0 ); @@ -2866,6 +2912,11 @@ bool SMESHGUI::activateModule( SUIT_Study* study ) setMenuShown( true ); setToolShown( true ); + // Reset actions accelerator keys + action(111)->setAccel(QKeySequence(CTRL + Key_B)); // Import DAT + action(112)->setAccel(QKeySequence(CTRL + Key_U)); // Import UNV + action(113)->setAccel(QKeySequence(CTRL + Key_M)); // Import MED + return res; } @@ -2876,6 +2927,11 @@ bool SMESHGUI::deactivateModule( SUIT_Study* study ) EmitSignalCloseAllDialogs(); + // Unset actions accelerator keys + action(111)->setAccel(QKeySequence()); // Import DAT + action(112)->setAccel(QKeySequence()); // Import UNV + action(113)->setAccel(QKeySequence()); // Import MED + return SalomeApp_Module::deactivateModule( study ); } @@ -2908,7 +2964,7 @@ QString SMESHGUI::engineIOR() const { CORBA::ORB_var anORB = getApp()->orb(); CORBA::String_var anIOR = anORB->object_to_string(GetSMESHGen()); - return anIOR.in(); + return QString( anIOR.in() ); } void SMESHGUI::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ ) @@ -2971,7 +3027,8 @@ void SMESHGUI::createPreferences() int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab ); addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" ); - + addPreference( tr( "PREF_RENUMBER" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "renumbering" ); + int meshTab = addPreference( tr( "PREF_TAB_MESH" ) ); int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab ); @@ -3020,14 +3077,15 @@ void SMESHGUI::createPreferences() addPreference( tr( "PREF_NODES" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_node" ); addPreference( tr( "PREF_ELEMENTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_element" ); + addPreference( tr( "PREF_OBJECTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_object" ); int sbarTab = addPreference( tr( "SMESH_SCALARBAR" ) ); int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab ); int tfont = addPreference( tr( "SMESH_TITLE" ), fontGr, LightApp_Preferences::Font, "SMESH", "scalar_bar_title_font" ); - addPreference( tr( "SMESH_TITLE" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_title_color" ); + addPreference( tr( "PREF_TITLE_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_title_color" ); int lfont = addPreference( tr( "SMESH_LABELS" ), fontGr, LightApp_Preferences::Font, "SMESH", "scalar_bar_label_font" ); - addPreference( tr( "SMESH_LABELS" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_label_color" ); + addPreference( tr( "PREF_LABELS_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_label_color" ); QStringList fam; fam.append( tr( "SMESH_FONT_ARIAL" ) ); @@ -3108,15 +3166,16 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) float aTol = 1.00000009999999; std::string aWarning; SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this); - if( name=="selection_object_color" || name=="selection_element_color" || + if( name=="selection_object_color" || name=="selection_element_color" || name=="selection_width" || name=="highlight_color" || name=="highlight_width" || - name=="selection_precision_node" || name=="selection_precision_element" ) + name=="selection_precision_node" || name=="selection_precision_element" || + name=="selection_precision_object") SMESH::UpdateSelectionProp( this ); else if (name == QString("scalar_bar_vertical_x") || name == QString("scalar_bar_vertical_width")){ sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_x", sbX1); sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_width", sbW); if(sbX1+sbW > aTol){ - aWarning = "Origin and Size Vertical: X+Width > 1\n"; + aWarning = "Origin and Size Vertical: X+Width > 1\n"; sbX1=0.01; sbW=0.05; aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1); @@ -3128,8 +3187,6 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_height",sbH); if(sbY1+sbH > aTol){ aWarning = "Origin and Size Vertical: Y+Height > 1\n"; - sbY1=0.01; - sbH=0.5; aResourceMgr->setValue("SMESH", "scalar_bar_vertical_y", sbY1); aResourceMgr->setValue("SMESH", "scalar_bar_vertical_height",sbH); } @@ -3139,8 +3196,8 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_width", sbW); if(sbX1+sbW > aTol){ aWarning = "Origin and Size Horizontal: X+Width > 1\n"; - sbX1=0.2; - sbW=0.6; + sbX1=0.01; + sbW=0.05; aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_x", sbX1); aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_width", sbW); } @@ -3151,12 +3208,12 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) if(sbY1+sbH > aTol){ aWarning = "Origin and Size Horizontal: Y+Height > 1\n"; sbY1=0.01; - sbH=0.12; + sbH=0.05; aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_y", sbY1); aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH); } } - + if(aWarning.size() != 0){ aWarning += "The default values are applied instead."; SUIT_MessageBox::warn1(SMESHGUI::desktop(), @@ -3230,6 +3287,9 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const // to do : create operation here switch( id ) { + case 701: // Compute mesh + op = new SMESHGUI_ComputeOp(); + break; case 702: // Create mesh op = new SMESHGUI_MeshOp( true, true ); break; @@ -3242,6 +3302,9 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const case 417: //convert to quadratic op = new SMESHGUI_ConvToQuadOp(); break; + case 4067: // make mesh pass through point + op = new SMESHGUI_MakeNodeAtPointOp(); + break; default: break; } @@ -3271,3 +3334,4 @@ LightApp_Displayer* SMESHGUI::displayer() myDisplayer = new SMESHGUI_Displayer( getApp() ); return myDisplayer; } +