X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI.cxx;h=441d71f47c98e41f0047c88aa84d16d40b17a205;hp=075b3eb5407dda8a03de370552eb56664be5f74a;hb=b99e203236dfebf3a3539d1e05719bc817e12dd7;hpb=b3cb4c5a571fe8f36ff6fa5bb90f5d9f122cafad diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 075b3eb54..441d71f47 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -151,6 +151,9 @@ #include #include #include +#include +#include +#include // BOOST includes #include @@ -444,7 +447,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 +467,30 @@ 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 +645,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 +975,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 +1143,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 +1596,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 +1640,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 +1702,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 @@ -2564,6 +2601,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case SMESHOp::OpOrientationOnFaces: { + SUIT_OverrideCursor wc; LightApp_SelectionMgr* mgr = selectionMgr(); SALOME_ListIO selected; mgr->selectedObjects( selected ); @@ -3317,12 +3355,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 @@ -3545,6 +3583,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: @@ -3837,6 +3876,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 ); @@ -3970,7 +4010,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 @@ -4067,6 +4108,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 ); @@ -4212,6 +4254,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 ); @@ -4337,7 +4380,7 @@ 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)"), hasBalls("({'BallElem'} in elemTypes)"), @@ -4450,7 +4493,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 ); @@ -4489,7 +4532,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 + "} &&" + hasDifferentElems, QtxPopupMgr::VisibleRule ); popupMgr()->insert( separator(), anId, -1 ); @@ -4554,6 +4597,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 ); @@ -4954,19 +5001,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" ); @@ -5000,11 +5034,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 );