X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI.cxx;h=0f08808d0b766c228c18f766da8f73620e4d7964;hp=a14b72eed2c353479538fccc2bf3a81b852e9896;hb=7dbb2914d9aa9785661fc4ffb43358ec9a578cf9;hpb=c18fd9d00c0ebf0fbad0f1ce8861cc67549d83e4 diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index a14b72eed..0f08808d0 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -151,6 +151,9 @@ #include #include #include +#include +#include +#include // BOOST includes #include @@ -212,29 +215,34 @@ namespace QStringList filter; std::string myExtension; - if ( theCommandID == SMESHOp::OpImportMED ) { + if ( theCommandID == SMESHOp::OpImportMED || + theCommandID == SMESHOp::OpPopupImportMED ) { filter.append( QObject::tr( "MED_FILES_FILTER" ) + " (*.*med)" ); filter.append( QObject::tr( "ALL_FILES_FILTER" ) + " (*)" ); } - else if ( theCommandID == SMESHOp::OpImportUNV ) { + else if ( theCommandID == SMESHOp::OpImportUNV || + theCommandID == SMESHOp::OpPopupImportUNV ) { filter.append( QObject::tr( "IDEAS_FILES_FILTER" ) + " (*.unv)" ); } - else if ( theCommandID == SMESHOp::OpImportDAT ) { + else if ( theCommandID == SMESHOp::OpImportDAT || + theCommandID == SMESHOp::OpPopupImportDAT ) { filter.append( QObject::tr( "DAT_FILES_FILTER" ) + " (*.dat)" ); } - else if ( theCommandID == SMESHOp::OpImportSTL ) { + else if ( theCommandID == SMESHOp::OpImportSTL || + theCommandID == SMESHOp::OpPopupImportSTL ) { filter.append( QObject::tr( "STL_FILES_FILTER" ) + " (*.stl)" ); } - #ifdef WITH_CGNS - else if ( theCommandID == SMESHOp::OpImportCGNS ) { + else if ( theCommandID == SMESHOp::OpImportCGNS || + theCommandID == SMESHOp::OpPopupImportCGNS ) { filter.append( QObject::tr( "CGNS_FILES_FILTER" ) + " (*.cgns)" ); } - #endif - else if ( theCommandID == SMESHOp::OpImportSAUV ) { + else if ( theCommandID == SMESHOp::OpImportSAUV || + theCommandID == SMESHOp::OpPopupImportSAUV ) { filter.append( QObject::tr( "SAUV files (*.sauv*)" ) ); filter.append( QObject::tr( "All files (*)" ) ); } - else if ( theCommandID == SMESHOp::OpImportGMF ) { + else if ( theCommandID == SMESHOp::OpImportGMF || + theCommandID == SMESHOp::OpPopupImportGMF ) { filter.append( QObject::tr( "GMF_ASCII_FILES_FILTER" ) + " (*.mesh)" ); filter.append( QObject::tr( "GMF_BINARY_FILES_FILTER") + " (*.meshb)" ); } @@ -280,6 +288,7 @@ namespace try { switch ( theCommandID ) { case SMESHOp::OpImportDAT: + case SMESHOp::OpPopupImportDAT: { // DAT format (currently unsupported) errors.append( QString( "%1 :\n\t%2" ).arg( filename ). @@ -287,6 +296,7 @@ namespace break; } case SMESHOp::OpImportUNV: + case SMESHOp::OpPopupImportUNV: { // UNV format aMeshes->length( 1 ); @@ -297,6 +307,7 @@ namespace break; } case SMESHOp::OpImportMED: + case SMESHOp::OpPopupImportMED: { // MED format SMESH::DriverMED_ReadStatus res; @@ -308,6 +319,7 @@ namespace break; } case SMESHOp::OpImportSTL: + case SMESHOp::OpPopupImportSTL: { // STL format aMeshes->length( 1 ); @@ -318,8 +330,8 @@ namespace } break; } - #ifdef WITH_CGNS case SMESHOp::OpImportCGNS: + case SMESHOp::OpPopupImportCGNS: { // CGNS format SMESH::DriverMED_ReadStatus res; @@ -330,8 +342,8 @@ namespace } break; } - #endif case SMESHOp::OpImportSAUV: + case SMESHOp::OpPopupImportSAUV: { // SAUV format SMESH::DriverMED_ReadStatus res; @@ -343,6 +355,7 @@ namespace break; } case SMESHOp::OpImportGMF: + case SMESHOp::OpPopupImportGMF: { // GMF format SMESH::ComputeError_var res; @@ -430,12 +443,8 @@ namespace theCommandID == SMESHOp::OpPopupExportUNV ); const bool isSTL = ( theCommandID == SMESHOp::OpExportSTL || theCommandID == SMESHOp::OpPopupExportSTL ); -#ifdef WITH_CGNS const bool isCGNS= ( theCommandID == SMESHOp::OpExportCGNS || theCommandID == SMESHOp::OpPopupExportCGNS ); -#else - const bool isCGNS= false; -#endif const bool isSAUV= ( theCommandID == SMESHOp::OpExportSAUV || theCommandID == SMESHOp::OpPopupExportSAUV ); const bool isGMF = ( theCommandID == SMESHOp::OpExportGMF || @@ -444,7 +453,10 @@ namespace const bool multiMeshSupported = ( isMED || isCGNS ); // file can hold several meshes if ( selected.Extent() == 0 || ( selected.Extent() > 1 && !multiMeshSupported )) return; - + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + bool aCheckWarn = true; + if ( resMgr ) + aCheckWarn = resMgr->booleanValue( "SMESH", "show_warning", false ); // get mesh object from selection and check duplication of their names bool hasDuplicatedMeshNames = false; QList< QPair< SMESH::SMESH_IDSource_var, QString > > aMeshList; @@ -461,6 +473,34 @@ namespace QObject::tr( "SMESH_BAD_MESH_SELECTION" )); return; } + SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aMeshItem ); + if ( aCheckWarn && !aGroup->_is_nil() ) + { + QMessageBox msgBox(SUIT_MessageBox::Warning, + QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("SMESH_EXPORT_ONLY_GPOUP"), + QMessageBox::StandardButton::NoButton, + SMESHGUI::desktop()); + QCheckBox dontShowCheckBox(QObject::tr("SMESH_WRN_SHOW_DLG_CHECKBOX")); + msgBox.addButton(QMessageBox::Ok); + msgBox.addButton(QMessageBox::Cancel); + msgBox.setDefaultButton(QMessageBox::Cancel); + QGridLayout* lt = qobject_cast(msgBox.layout()); + QDialogButtonBox* btnbox = msgBox.findChild(); + lt->addWidget(&dontShowCheckBox, lt->rowCount(), lt->columnCount()-1, lt->rowCount(), lt->columnCount()); + lt->addWidget(btnbox, lt->rowCount(), 0, lt->rowCount(), lt->columnCount()); + if(msgBox.exec() == QMessageBox::Ok) + { + if(dontShowCheckBox.checkState() == Qt::Checked) + { + if ( resMgr ) + resMgr->setValue( "SMESH", "show_warning", false); + } + aCheckWarn = false; + } + else + return; + } QString aMeshName = anIObject->getName(); @@ -615,7 +655,6 @@ namespace // Init the parameters with the default values bool aIsASCII_STL = true; bool toCreateGroups = false; - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); if ( resMgr ) toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false ); bool toOverwrite = true; @@ -946,6 +985,7 @@ namespace aSel->selectedObjects( selected ); if ( selected.Extent() >= 1 ) { + SUIT_OverrideCursor wc; SALOME_ListIteratorOfListIO It( selected ); for( ; It.More(); It.Next()){ Handle(SALOME_InteractiveObject) IObject = It.Value(); @@ -1113,6 +1153,8 @@ namespace type = QObject::tr( "EQUAL_FACE" ); else if ( dynamic_cast< SMESH::Controls::CoincidentElements3D* >( f.get() ) ) type = QObject::tr( "EQUAL_VOLUME" ); + else if ( dynamic_cast< SMESH::Controls::NodeConnectivityNumber* >( f.get() ) ) + type = QObject::tr( "NODE_CONNECTIVITY_NB" ); return type; } @@ -1564,6 +1606,7 @@ namespace return; } // case SMESHOp::OpProperties: } // switch(theCommandID) + SUIT_OverrideCursor wc; SALOME_ListIteratorOfListIO It( selected ); for( ; It.More(); It.Next()){ Handle(SALOME_InteractiveObject) IObject = It.Value(); @@ -1607,6 +1650,7 @@ namespace ActionControl.Bind( 0, SMESH_Actor::eNone ); ActionControl.Bind( SMESHOp::OpFreeNode, SMESH_Actor::eFreeNodes ); ActionControl.Bind( SMESHOp::OpEqualNode, SMESH_Actor::eCoincidentNodes ); + ActionControl.Bind( SMESHOp::OpNodeConnectivityNb, SMESH_Actor::eNodeConnectivityNb ); ActionControl.Bind( SMESHOp::OpFreeEdge, SMESH_Actor::eFreeEdges ); ActionControl.Bind( SMESHOp::OpFreeBorder, SMESH_Actor::eFreeBorders ); ActionControl.Bind( SMESHOp::OpLength, SMESH_Actor::eLength ); @@ -1668,6 +1712,9 @@ namespace if ( anActor->GetControlMode() != aControl ) anActor->SetControlMode( aControl ); QString functorName = functorToString( anActor->GetFunctor() ); + int anEntitiesCount = anActor->GetNumberControlEntities(); + if (anEntitiesCount >= 0) + functorName = functorName + ": " + QString::number(anEntitiesCount); anActor->GetScalarBarActor()->SetTitle( functorName.toLatin1().constData() ); SMESH::RepaintCurrentView(); #ifndef DISABLE_PLOT2DVIEWER @@ -2410,11 +2457,16 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case SMESHOp::OpImportUNV: case SMESHOp::OpImportMED: case SMESHOp::OpImportSTL: -#ifdef WITH_CGNS case SMESHOp::OpImportCGNS: -#endif case SMESHOp::OpImportSAUV: case SMESHOp::OpImportGMF: + case SMESHOp::OpPopupImportDAT: + case SMESHOp::OpPopupImportUNV: + case SMESHOp::OpPopupImportMED: + case SMESHOp::OpPopupImportSTL: + case SMESHOp::OpPopupImportCGNS: + case SMESHOp::OpPopupImportSAUV: + case SMESHOp::OpPopupImportGMF: { if(checkLock(aStudy)) break; ::ImportMeshesFromFile(GetSMESHGen(),theCommandID); @@ -2443,18 +2495,14 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case SMESHOp::OpExportMED: case SMESHOp::OpExportUNV: case SMESHOp::OpExportSTL: -#ifdef WITH_CGNS case SMESHOp::OpExportCGNS: -#endif case SMESHOp::OpExportSAUV: case SMESHOp::OpExportGMF: case SMESHOp::OpPopupExportDAT: case SMESHOp::OpPopupExportMED: case SMESHOp::OpPopupExportUNV: case SMESHOp::OpPopupExportSTL: -#ifdef WITH_CGNS case SMESHOp::OpPopupExportCGNS: -#endif case SMESHOp::OpPopupExportSAUV: case SMESHOp::OpPopupExportGMF: { @@ -2564,6 +2612,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case SMESHOp::OpOrientationOnFaces: { + SUIT_OverrideCursor wc; LightApp_SelectionMgr* mgr = selectionMgr(); SALOME_ListIO selected; mgr->selectedObjects( selected ); @@ -2629,9 +2678,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) extractContainers( sel_objects, to_process ); try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; -#endif if (vtkwnd) { SALOME_ListIteratorOfListIO It( to_process ); for ( ; It.More(); It.Next()) @@ -2688,7 +2735,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case SMESHOp::OpCreateMesh: case SMESHOp::OpCreateSubMesh: case SMESHOp::OpEditMeshOrSubMesh: + case SMESHOp::OpEditMesh: + case SMESHOp::OpEditSubMesh: case SMESHOp::OpCompute: + case SMESHOp::OpComputeSubMesh: case SMESHOp::OpPreCompute: case SMESHOp::OpEvaluate: case SMESHOp::OpMeshOrder: @@ -3314,12 +3364,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) for ( ; It.More(); It.Next() ) { Handle(SALOME_InteractiveObject) IOS = It.Value(); - SMESH::SMESH_Mesh_var aMesh = - SMESH::IObjectToInterface(IOS); + SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface(IOS); if ( aMesh->_is_nil()) continue; try { - SMESH::RemoveVisualObjectWithActors(IOS->getEntry(), true); aMesh->Clear(); + if ( aMesh->NbNodes() == 0 ) // imported mesh is not empty + SMESH::RemoveVisualObjectWithActors(IOS->getEntry(), true); _PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh); SMESH::ModifiedMesh( aMeshSObj, false, true); // hide groups and submeshes @@ -3542,6 +3592,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) // CONTROLS case SMESHOp::OpFreeNode: case SMESHOp::OpEqualNode: + case SMESHOp::OpNodeConnectivityNb: case SMESHOp::OpFreeEdge: case SMESHOp::OpFreeBorder: case SMESHOp::OpLength: @@ -3775,13 +3826,21 @@ void SMESHGUI::initialize( CAM_Application* app ) //createSMESHAction( SMESHOp::OpImportDAT, "IMPORT_DAT", "", (Qt::CTRL+Qt::Key_B) ); createSMESHAction( SMESHOp::OpImportUNV, "IMPORT_UNV", "", (Qt::CTRL+Qt::Key_I) ); createSMESHAction( SMESHOp::OpImportMED, "IMPORT_MED", "", (Qt::CTRL+Qt::Key_M) ); - //createSMESHAction( 114, "NUM" ); createSMESHAction( SMESHOp::OpImportSTL, "IMPORT_STL" ); #ifdef WITH_CGNS createSMESHAction( SMESHOp::OpImportCGNS, "IMPORT_CGNS" ); #endif createSMESHAction( SMESHOp::OpImportSAUV, "IMPORT_SAUV" ); createSMESHAction( SMESHOp::OpImportGMF, "IMPORT_GMF" ); + createSMESHAction( SMESHOp::OpPopupImportUNV, "IMPORT_UNV"); + createSMESHAction( SMESHOp::OpPopupImportMED, "IMPORT_MED"); + createSMESHAction( SMESHOp::OpPopupImportSTL, "IMPORT_STL" ); +#ifdef WITH_CGNS + createSMESHAction( SMESHOp::OpPopupImportCGNS, "IMPORT_CGNS" ); +#endif + createSMESHAction( SMESHOp::OpPopupImportSAUV, "IMPORT_SAUV" ); + createSMESHAction( SMESHOp::OpPopupImportGMF, "IMPORT_GMF" ); + createSMESHAction( SMESHOp::OpExportDAT, "DAT" ); createSMESHAction( SMESHOp::OpExportMED, "MED" ); createSMESHAction( SMESHOp::OpExportUNV, "UNV" ); @@ -3806,9 +3865,12 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( SMESHOp::OpCreateMesh, "CREATE_MESH", "ICON_DLG_INIT_MESH" ); createSMESHAction( SMESHOp::OpCreateSubMesh, "CREATE_SUBMESH", "ICON_DLG_ADD_SUBMESH" ); createSMESHAction( SMESHOp::OpEditMeshOrSubMesh, "EDIT_MESHSUBMESH", "ICON_DLG_EDIT_MESH" ); + createSMESHAction( SMESHOp::OpEditMesh, "EDIT_MESH", "ICON_DLG_EDIT_MESH" ); + createSMESHAction( SMESHOp::OpEditSubMesh, "EDIT_SUBMESH", "ICON_DLG_EDIT_MESH" ); createSMESHAction( SMESHOp::OpBuildCompoundMesh, "BUILD_COMPOUND", "ICON_BUILD_COMPOUND" ); createSMESHAction( SMESHOp::OpCopyMesh, "COPY_MESH", "ICON_COPY_MESH" ); createSMESHAction( SMESHOp::OpCompute, "COMPUTE", "ICON_COMPUTE" ); + createSMESHAction( SMESHOp::OpComputeSubMesh, "COMPUTE_SUBMESH", "ICON_COMPUTE" ); createSMESHAction( SMESHOp::OpPreCompute, "PRECOMPUTE", "ICON_PRECOMPUTE" ); createSMESHAction( SMESHOp::OpEvaluate, "EVALUATE", "ICON_EVALUATE" ); createSMESHAction( SMESHOp::OpMeshOrder, "MESH_ORDER", "ICON_MESH_ORDER"); @@ -3821,8 +3883,8 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( SMESHOp::OpIntersectGroups, "INT_GROUP", "ICON_INTERSECT" ); createSMESHAction( SMESHOp::OpCutGroups, "CUT_GROUP", "ICON_CUT" ); createSMESHAction( SMESHOp::OpGroupUnderlyingElem, "UNDERLYING_ELEMS", "ICON_UNDERLYING_ELEMS" ); - createSMESHAction( SMESHOp::OpAddElemGroupPopup, "ADD" ); - createSMESHAction( SMESHOp::OpRemoveElemGroupPopup, "REMOVE" ); + createSMESHAction( SMESHOp::OpAddElemGroupPopup, "ADD_TO_GROUP" ); + createSMESHAction( SMESHOp::OpRemoveElemGroupPopup, "REMOVE_FROM_GROUP" ); createSMESHAction( SMESHOp::OpDeleteGroup, "DEL_GROUP", "ICON_DEL_GROUP" ); createSMESHAction( SMESHOp::OpMeshInformation , "ADV_INFO", "ICON_ADV_INFO" ); //createSMESHAction( SMESHOp::OpStdInfo, "STD_INFO", "ICON_STD_INFO" ); @@ -3831,6 +3893,7 @@ void SMESHGUI::initialize( CAM_Application* app ) //update createSMESHAction( SMESHOp::OpFreeNode, "FREE_NODE", "ICON_FREE_NODE", 0, true ); createSMESHAction( SMESHOp::OpEqualNode, "EQUAL_NODE", "ICON_EQUAL_NODE", 0, true ); + createSMESHAction( SMESHOp::OpNodeConnectivityNb, "NODE_CONNECTIVITY_NB", "ICON_NODE_CONN_NB", 0, true ); createSMESHAction( SMESHOp::OpFreeEdge, "FREE_EDGE", "ICON_FREE_EDGE", 0, true ); createSMESHAction( SMESHOp::OpFreeBorder, "FREE_BORDER", "ICON_FREE_EDGE_2D", 0, true ); createSMESHAction( SMESHOp::OpLength, "LENGTH", "ICON_LENGTH", 0, true ); @@ -3855,7 +3918,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( SMESHOp::OpBareBorderVolume, "BARE_BORDER_VOLUME", "ICON_BARE_BORDER_VOLUME", 0, true ); createSMESHAction( SMESHOp::OpOverConstrainedVolume, "OVER_CONSTRAINED_VOLUME", "ICON_OVER_CONSTRAINED_VOLUME", 0, true ); createSMESHAction( SMESHOp::OpEqualVolume, "EQUAL_VOLUME", "ICON_EQUAL_VOLUME", 0, true ); - createSMESHAction( SMESHOp::OpOverallMeshQuality, "OVERALL_MESH_QUALITY" ); + createSMESHAction( SMESHOp::OpOverallMeshQuality, "OVERALL_MESH_QUALITY", "ICON_OVL_MESH_QUALITY" ); createSMESHAction( SMESHOp::OpNode, "NODE", "ICON_DLG_NODE" ); createSMESHAction( SMESHOp::OpElem0D, "ELEM0D", "ICON_DLG_ELEM0D" ); @@ -3964,7 +4027,8 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" ); QList aCtrlActions; - aCtrlActions << SMESHOp::OpFreeNode << SMESHOp::OpEqualNode // node controls + aCtrlActions << SMESHOp::OpFreeNode << SMESHOp::OpEqualNode + << SMESHOp::OpNodeConnectivityNb // node controls << SMESHOp::OpFreeEdge << SMESHOp::OpFreeBorder << SMESHOp::OpLength << SMESHOp::OpConnection << SMESHOp::OpEqualEdge // edge controls << SMESHOp::OpFreeFace << SMESHOp::OpLength2D << SMESHOp::OpConnection2D @@ -4061,6 +4125,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( SMESHOp::OpFreeNode, nodeId, -1 ); createMenu( SMESHOp::OpEqualNode, nodeId, -1 ); + //createMenu( SMESHOp::OpNodeConnectivityNb, nodeId, -1 ); createMenu( SMESHOp::OpFreeBorder, edgeId, -1 ); createMenu( SMESHOp::OpLength, edgeId, -1 ); createMenu( SMESHOp::OpConnection, edgeId, -1 ); @@ -4206,6 +4271,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createTool( SMESHOp::OpFreeNode, ctrl0dTb ); createTool( SMESHOp::OpEqualNode, ctrl0dTb ); + //createTool( SMESHOp::OpNodeConnectivityNb, ctrl0dTb ); createTool( SMESHOp::OpFreeBorder, ctrl1dTb ); createTool( SMESHOp::OpLength, ctrl1dTb ); @@ -4303,24 +4369,27 @@ void SMESHGUI::initialize( CAM_Application* app ) QString dc = "selcount"; // VSR : instead of QtxPopupSelection::defSelCountParam() myRules.clear(); - QString OB = "'ObjectBrowser'", - View = "'" + SVTK_Viewer::Type() + "'", - pat = "'%1'", - mesh = pat.arg( SMESHGUI_Selection::typeName( SMESH::MESH ) ), - group = pat.arg( SMESHGUI_Selection::typeName( SMESH::GROUP ) ), - hypo = pat.arg( SMESHGUI_Selection::typeName( SMESH::HYPOTHESIS ) ), - algo = pat.arg( SMESHGUI_Selection::typeName( SMESH::ALGORITHM ) ), - elems = QString( "'%1' '%2' '%3' '%4' '%5' '%6'" ). - arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_VERTEX ) ). - arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_EDGE ) ). - arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_FACE ) ). - arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_SOLID ) ). - arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_COMPOUND ) ). - arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH ) ), - subMesh = elems, - mesh_part = mesh + " " + subMesh + " " + group, - mesh_group = mesh + " " + group, - hyp_alg = hypo + " " + algo; + QString + OB = "'ObjectBrowser'", + View = "'" + SVTK_Viewer::Type() + "'", + pat = "'%1'", + mesh = pat.arg( SMESHGUI_Selection::typeName( SMESH::MESH ) ), + group = pat.arg( SMESHGUI_Selection::typeName( SMESH::GROUP ) ), + hypo = pat.arg( SMESHGUI_Selection::typeName( SMESH::HYPOTHESIS ) ), + algo = pat.arg( SMESHGUI_Selection::typeName( SMESH::ALGORITHM ) ), + smesh = pat.arg( SMESHGUI_Selection::typeName( SMESH::COMPONENT ) ), + elems = QString( "'%1' '%2' '%3' '%4' '%5' '%6'" ). + arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_VERTEX ) ). + arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_EDGE ) ). + arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_FACE ) ). + arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_SOLID ) ). + arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH_COMPOUND ) ). + arg( SMESHGUI_Selection::typeName( SMESH::SUBMESH ) ), + subMesh = elems, + mesh_part = mesh + " " + subMesh + " " + group, + mesh_group = mesh + " " + group, + mesh_submesh = mesh + " " + subMesh, + hyp_alg = hypo + " " + algo; // popup for object browser QString @@ -4329,9 +4398,10 @@ void SMESHGUI::initialize( CAM_Application* app ) isNotEmpty("numberOfNodes <> 0"), // has nodes, edges, etc in VISIBLE! actor - hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"), + hasNodes("(numberOfNodes > 0 ) && hasActor"), hasElems("(count( elemTypes ) > 0)"), hasDifferentElems("(count( elemTypes ) > 1)"), + hasDifferentObjElems("(count( objElemTypes ) > 1)"), hasBalls("({'BallElem'} in elemTypes)"), hasElems0d("({'Elem0d'} in elemTypes)"), hasEdges("({'Edge'} in elemTypes)"), @@ -4339,36 +4409,36 @@ void SMESHGUI::initialize( CAM_Application* app ) hasVolumes("({'Volume'} in elemTypes)"), hasFacesOrVolumes("(({'Face'} in elemTypes) || ({'Volume'} in elemTypes)) "); - createPopupItem( SMESHOp::OpFileInformation, OB, mesh, "&& selcount=1 && isImported" ); - createPopupItem( SMESHOp::OpCreateSubMesh, OB, mesh, "&& hasGeomReference"); - createPopupItem( SMESHOp::OpEditMeshOrSubMesh, OB, mesh ); - createPopupItem( SMESHOp::OpEditMeshOrSubMesh, OB, subMesh, "&& hasGeomReference" ); - createPopupItem( SMESHOp::OpEditGroup, OB, group ); + createPopupItem( SMESHOp::OpFileInformation, OB, mesh, "&& selcount=1 && isImported" ); + createPopupItem( SMESHOp::OpCreateSubMesh, OB, mesh, "&& hasGeomReference"); + createPopupItem( SMESHOp::OpEditMesh, OB, mesh, "&& selcount=1" ); + createPopupItem( SMESHOp::OpEditSubMesh, OB, subMesh, "&& selcount=1 && hasGeomReference" ); + createPopupItem( SMESHOp::OpEditGroup, OB, group ); createPopupItem( SMESHOp::OpEditGeomGroupAsGroup, OB, group, "&& groupType != 'Group'" ); popupMgr()->insert( separator(), -1, 0 ); - createPopupItem( SMESHOp::OpCompute, OB, mesh, "&& isComputable" ); - createPopupItem( SMESHOp::OpPreCompute, OB, mesh, "&& isPreComputable" ); - createPopupItem( SMESHOp::OpEvaluate, OB, mesh, "&& isComputable" ); - createPopupItem( SMESHOp::OpMeshOrder, OB, mesh, "&& isComputable && hasGeomReference" ); - createPopupItem( SMESHOp::OpUpdate, OB, mesh_part ); - createPopupItem( SMESHOp::OpMeshInformation, OB, mesh_part ); - createPopupItem( SMESHOp::OpFindElementByPoint, OB, mesh_group ); - createPopupItem( SMESHOp::OpOverallMeshQuality, OB, mesh_part ); + createPopupItem( SMESHOp::OpCompute, OB, mesh, "&& selcount=1 && isComputable" ); + createPopupItem( SMESHOp::OpComputeSubMesh, OB, subMesh, "&& selcount=1 && isComputable" ); + createPopupItem( SMESHOp::OpPreCompute, OB, mesh, "&& selcount=1 && isPreComputable" ); + createPopupItem( SMESHOp::OpEvaluate, OB, mesh, "&& selcount=1 && isComputable" ); + createPopupItem( SMESHOp::OpMeshOrder, OB, mesh, "&& selcount=1 && isComputable && hasGeomReference" ); + createPopupItem( SMESHOp::OpUpdate, OB, mesh_part ); + createPopupItem( SMESHOp::OpMeshInformation, OB, mesh_part ); + createPopupItem( SMESHOp::OpFindElementByPoint,OB, mesh_group, "&& selcount=1" ); + createPopupItem( SMESHOp::OpOverallMeshQuality,OB, mesh_part ); popupMgr()->insert( separator(), -1, 0 ); - createPopupItem( SMESHOp::OpCreateGroup, OB, mesh ); - createPopupItem( SMESHOp::OpCreateGeometryGroup, OB, mesh, "&& hasGeomReference" ); - createPopupItem( SMESHOp::OpConstructGroup, OB, subMesh ); + createPopupItem( SMESHOp::OpCreateGroup, OB, mesh, "&& selcount=1" ); + createPopupItem( SMESHOp::OpCreateGeometryGroup, OB, mesh, "&& selcount=1 && hasGeomReference" ); + createPopupItem( SMESHOp::OpConstructGroup, OB, subMesh ); popupMgr()->insert( separator(), -1, 0 ); - createPopupItem( SMESHOp::OpEditHypothesis, OB, hypo, "&& isEditableHyp"); - createPopupItem( SMESHOp::OpUnassign, OB, hyp_alg ); // REMOVE HYPOTHESIS / ALGORITHMS + createPopupItem( SMESHOp::OpEditHypothesis, OB, hypo, "&& isEditableHyp"); + createPopupItem( SMESHOp::OpUnassign, OB, hyp_alg ); popupMgr()->insert( separator(), -1, 0 ); - createPopupItem( SMESHOp::OpConvertMeshToQuadratic, OB, mesh + " " + subMesh ); // convert to quadratic - createPopupItem( SMESHOp::OpCreateBoundaryElements, OB, mesh + " " + group, // create 2D mesh from 3D - "&& dim>=2"); + createPopupItem( SMESHOp::OpConvertMeshToQuadratic, OB, mesh_submesh ); + createPopupItem( SMESHOp::OpCreateBoundaryElements, OB, mesh_group, "&& selcount=1 && dim>=2"); popupMgr()->insert( separator(), -1, 0 ); createPopupItem( SMESHOp::OpClearMesh, OB, mesh ); - popupMgr()->insert( separator(), -1, 0 ); + //popupMgr()->insert( separator(), -1, 0 ); QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc ); QString multiple_non_empty = QString( " && %1>0 && numberOfNodes>0" ).arg( dc ); @@ -4386,12 +4456,23 @@ void SMESHGUI::initialize( CAM_Application* app ) createPopupItem( SMESHOp::OpPopupExportDAT, OB, mesh_group, only_one_non_empty, anId ); createPopupItem( SMESHOp::OpDelete, OB, mesh_part + " " + hyp_alg ); createPopupItem( SMESHOp::OpDeleteGroup, OB, group ); + + anId = popupMgr()->insert( tr( "MEN_IMPORT" ), -1, -1 ); // IMPORT submenu + createPopupItem( SMESHOp::OpPopupImportMED, OB, smesh, "", anId ); + createPopupItem( SMESHOp::OpPopupImportUNV, OB, smesh, "", anId ); + createPopupItem( SMESHOp::OpPopupImportSTL, OB, smesh, "", anId ); +#ifdef WITH_CGNS + createPopupItem( SMESHOp::OpPopupImportCGNS, OB, smesh, "", anId ); +#endif + createPopupItem( SMESHOp::OpPopupImportSAUV, OB, smesh, "", anId ); + createPopupItem( SMESHOp::OpPopupImportGMF, OB, smesh, "", anId ); + createPopupItem( SMESHOp::OpPopupImportDAT, OB, smesh, "", anId ); popupMgr()->insert( separator(), -1, 0 ); // popup for viewer createPopupItem( SMESHOp::OpEditGroup, View, group ); - createPopupItem( SMESHOp::OpAddElemGroupPopup, View, elems ); - createPopupItem( SMESHOp::OpRemoveElemGroupPopup, View, elems ); + createPopupItem( SMESHOp::OpAddElemGroupPopup, View, elems, "&& guiState = 800" ); + createPopupItem( SMESHOp::OpRemoveElemGroupPopup, View, elems, "&& guiState = 800" ); popupMgr()->insert( separator(), -1, 0 ); createPopupItem( SMESHOp::OpUpdate, View, mesh_part ); @@ -4442,7 +4523,7 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->setRule( action( SMESHOp::OpDMShading ), "displayMode = 'eSurface'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( SMESHOp::OpDMNodes ), anId, -1 ); - popupMgr()->setRule( action( SMESHOp::OpDMNodes ), aMeshInVTK + "&&" + hasNodes, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( SMESHOp::OpDMNodes ), aMeshInVTK + "&&" + hasNodes + "&&" + hasElems, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( SMESHOp::OpDMNodes ), "displayMode = 'ePoint'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( separator(), anId, -1 ); @@ -4481,7 +4562,7 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( action( SMESHOp::OpDEChoose ), anId, -1 ); - popupMgr()->setRule( action( SMESHOp::OpDEChoose ), aClient + "&&" + aType + "&&" + isNotEmpty, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( SMESHOp::OpDEChoose ), aClient + "&& $type in {" + mesh + "} &&" + hasDifferentObjElems, QtxPopupMgr::VisibleRule ); popupMgr()->insert( separator(), anId, -1 ); @@ -4524,9 +4605,9 @@ void SMESHGUI::initialize( CAM_Application* app ) // Controls //------------------------------------------------- QString - aMeshInVtkHasNodes = aMeshInVTK + "&&" + hasNodes, - aMeshInVtkHasEdges = aMeshInVTK + "&&" + hasEdges, - aMeshInVtkHasFaces = aMeshInVTK + "&&" + hasFaces, + aMeshInVtkHasNodes = aMeshInVTK + "&&" + hasNodes, + aMeshInVtkHasEdges = aMeshInVTK + "&&" + hasEdges, + aMeshInVtkHasFaces = aMeshInVTK + "&&" + hasFaces, aMeshInVtkHasVolumes = aMeshInVTK + "&&" + hasVolumes; anId = popupMgr()->insert( tr( "MEN_CTRL" ), -1, -1 ); @@ -4546,6 +4627,10 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->setRule( action( SMESHOp::OpEqualNode ), aMeshInVtkHasNodes, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( SMESHOp::OpEqualNode ), "controlMode = 'eCoincidentNodes'", QtxPopupMgr::ToggleRule); + // popupMgr()->insert( action( SMESHOp::OpNodeConnectivityNb ), aSubId, -1 ); + // popupMgr()->setRule( action( SMESHOp::OpNodeConnectivityNb ), aMeshInVtkHasNodes, QtxPopupMgr::VisibleRule ); + // popupMgr()->setRule( action( SMESHOp::OpNodeConnectivityNb ), "controlMode = 'eNodeConnectivityNb'", QtxPopupMgr::ToggleRule ); + aSubId = popupMgr()->insert( tr( "MEN_EDGE_CTRL" ), anId, -1 ); // EDGE CONTROLS popupMgr()->insert( action( SMESHOp::OpFreeBorder ), aSubId, -1 ); @@ -4946,19 +5031,6 @@ void SMESHGUI::createPreferences() setPreferenceProperty( lim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) ); addPreference( tr( "PREF_INCREMENTAL_LIMIT" ), autoUpdate, LightApp_Preferences::Bool, "SMESH", "incremental_limit" ); - int qaGroup = addPreference( tr( "PREF_GROUP_QUALITY" ), genTab ); - setPreferenceProperty( qaGroup, "columns", 2 ); - addPreference( tr( "PREF_DISPLAY_ENTITY" ), qaGroup, LightApp_Preferences::Bool, "SMESH", "display_entity" ); - addPreference( tr( "PREF_PRECISION_USE" ), qaGroup, LightApp_Preferences::Bool, "SMESH", "use_precision" ); - int prec = addPreference( tr( "PREF_PRECISION_VALUE" ), qaGroup, LightApp_Preferences::IntSpin, "SMESH", "controls_precision" ); - setPreferenceProperty( prec, "min", 0 ); - setPreferenceProperty( prec, "max", 100 ); - int doubleNodesTol = addPreference( tr( "PREF_EQUAL_NODES_TOL" ), qaGroup, LightApp_Preferences::DblSpin, "SMESH", "equal_nodes_tolerance" ); - setPreferenceProperty( doubleNodesTol, "precision", 10 ); - setPreferenceProperty( doubleNodesTol, "min", 0.0000000001 ); - setPreferenceProperty( doubleNodesTol, "max", 1000000.0 ); - setPreferenceProperty( doubleNodesTol, "step", 0.0000001 ); - int dispgroup = addPreference( tr( "PREF_DISPLAY_MODE_GROUP" ), genTab ); setPreferenceProperty( dispgroup, "columns", 2 ); int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), dispgroup, LightApp_Preferences::Selector, "SMESH", "display_mode" ); @@ -4992,11 +5064,24 @@ void SMESHGUI::createPreferences() setPreferenceProperty( maxAngle, "min", 1 ); setPreferenceProperty( maxAngle, "max", 90 ); + int qaGroup = addPreference( tr( "PREF_GROUP_QUALITY" ), genTab ); + setPreferenceProperty( qaGroup, "columns", 2 ); + addPreference( tr( "PREF_DISPLAY_ENTITY" ), qaGroup, LightApp_Preferences::Bool, "SMESH", "display_entity" ); + addPreference( tr( "PREF_PRECISION_USE" ), qaGroup, LightApp_Preferences::Bool, "SMESH", "use_precision" ); + int prec = addPreference( tr( "PREF_PRECISION_VALUE" ), qaGroup, LightApp_Preferences::IntSpin, "SMESH", "controls_precision" ); + setPreferenceProperty( prec, "min", 0 ); + setPreferenceProperty( prec, "max", 100 ); + int doubleNodesTol = addPreference( tr( "PREF_EQUAL_NODES_TOL" ), qaGroup, LightApp_Preferences::DblSpin, "SMESH", "equal_nodes_tolerance" ); + setPreferenceProperty( doubleNodesTol, "precision", 10 ); + setPreferenceProperty( doubleNodesTol, "min", 0.0000000001 ); + setPreferenceProperty( doubleNodesTol, "max", 1000000.0 ); + setPreferenceProperty( doubleNodesTol, "step", 0.0000001 ); int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab ); setPreferenceProperty( exportgroup, "columns", 2 ); addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" ); + addPreference( tr( "PREF_SHOW_WARN" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "show_warning" ); //addPreference( tr( "PREF_RENUMBER" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "renumbering" ); int computeGroup = addPreference( tr( "PREF_GROUP_COMPUTE" ), genTab ); @@ -5428,7 +5513,7 @@ void SMESHGUI::update( const int flags ) /*! * \brief Set default selection mode * -* SLOT called when operation commited. Sets default selection mode +* SLOT called when operation committed. Sets default selection mode */ //================================================================================ void SMESHGUI::onOperationCommited( SUIT_Operation* ) @@ -5489,9 +5574,12 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const op = new SMESHGUI_MeshOp( true, false ); break; case SMESHOp::OpEditMeshOrSubMesh: + case SMESHOp::OpEditMesh: + case SMESHOp::OpEditSubMesh: op = new SMESHGUI_MeshOp( false ); break; case SMESHOp::OpCompute: + case SMESHOp::OpComputeSubMesh: op = new SMESHGUI_ComputeOp(); break; case SMESHOp::OpPreCompute: @@ -5747,7 +5835,7 @@ void SMESHGUI::storeVisualParameters (int savePoint) Handle(SALOME_InteractiveObject) io = aSmeshActor->getIO(); if (io->hasEntry()) { - // entry is "encoded" = it does NOT contain component adress, + // entry is "encoded" = it does NOT contain component address, // since it is a subject to change on next component loading std::string entry = ip->encodeEntry(io->getEntry(), componentName); @@ -6148,7 +6236,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint) for (std::vector::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt) { - // entry is a normal entry - it should be "decoded" (setting base adress of component) + // entry is a normal entry - it should be "decoded" (setting base address of component) QString entry (ip->decodeEntry(*entIt).c_str()); // Check that the entry corresponds to a real object in the Study @@ -6219,8 +6307,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint) if (ac->IsA("SMESH_Actor")) { SMESH_Actor* aGeomAc = SMESH_Actor::SafeDownCast(ac); if (aGeomAc->hasIO()) { - Handle(SALOME_InteractiveObject) io = - Handle(SALOME_InteractiveObject)::DownCast(aGeomAc->getIO()); + Handle(SALOME_InteractiveObject) io = aGeomAc->getIO(); if (io->hasEntry() && strcmp(io->getEntry(), entry.toLatin1().data()) == 0) { isFound = true; vtkActors.Bind(viewIndex, aGeomAc);