X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI.cxx;h=e485f10ffd6ca38272c3335515c31cd101685cef;hb=184f00f38ef65b5d58b798e8c13042c16e030a4f;hp=50f44fb18b8fc5def2e34667645a29a6df991ce4;hpb=0635c9fc80f67d1e5dc0e94ec85f487286a92070;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 50f44fb18..e485f10ff 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -644,6 +644,14 @@ case 215: anActor->SetRepresentation(SMESH_Actor::ePoint); break; + case 231: + if(anActor->GetQuadratic2DRepresentation() != SMESH_Actor::eLines) + anActor->SetQuadratic2DRepresentation(SMESH_Actor::eLines); + break; + case 232: + if(anActor->GetQuadratic2DRepresentation() != SMESH_Actor::eArcs) + anActor->SetQuadratic2DRepresentation(SMESH_Actor::eArcs); + break; case 1132:{ vtkFloatingPointType color[3]; anActor->GetSufaceColor(color[0], color[1], color[2]); @@ -719,11 +727,20 @@ SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface(IObject); if( !aGroupObject->_is_nil() ) { - SALOMEDS::Color aColor; - aColor.R = (float)color.red() / 255.0; - aColor.G = (float)color.green() / 255.0; - aColor.B = (float)color.blue() / 255.0; - aGroupObject->SetColor( aColor ); + SMESH::ElementType anElementType = aGroupObject->GetType(); + QColor aColor; + switch( anElementType ) + { + case SMESH::NODE: aColor = nodecolor; break; + case SMESH::EDGE: aColor = edgecolor; break; + default: aColor = color; break; + } + + SALOMEDS::Color aGroupColor; + aGroupColor.R = (float)aColor.red() / 255.0; + aGroupColor.G = (float)aColor.green() / 255.0; + aGroupColor.B = (float)aColor.blue() / 255.0; + aGroupObject->SetColor( aGroupColor ); } delete aDlg; @@ -1063,7 +1080,8 @@ SMESH::SMESH_Gen_var SMESHGUI::myComponentSMESH = SMESH::SMESH_Gen::_nil(); */ //============================================================================= SMESHGUI::SMESHGUI() : -SalomeApp_Module( "SMESH" ) +SalomeApp_Module( "SMESH" ), +LightApp_Module( "SMESH" ) { if ( CORBA::is_nil( myComponentSMESH ) ) { @@ -1442,7 +1460,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) ::SetDisplayMode(theCommandID); break; - // Display Entity + //2D quadratic representation + case 231: + case 232: + ::SetDisplayMode(theCommandID); + break; + + // Display Entity case 217: // Edges case 218: // Faces case 219: // Volumes @@ -1590,6 +1614,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case 701: // COMPUTE MESH case 711: // PRECOMPUTE MESH + case 712: // EVALUATE MESH { if (checkLock(aStudy)) break; startOperation( theCommandID ); @@ -2119,6 +2144,15 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) { SMESHGUI::GetSMESHGen()->SetName(obj->GetIOR().c_str(), newName.toLatin1().data()); + // update name of group object and its actor + SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface(IObject); + if( !aGroupObject->_is_nil() ) + { + aGroupObject->SetName( newName.toLatin1().data() ); + if ( SMESH_Actor *anActor = SMESH::FindActorByEntry( IObject->getEntry() ) ) + anActor->setName( newName.toLatin1().data() ); + } + updateObjBrowser(); } } @@ -2659,6 +2693,8 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 704, "EDIT_MESHSUBMESH","ICON_DLG_EDIT_MESH" ); createSMESHAction( 710, "BUILD_COMPOUND", "ICON_BUILD_COMPOUND" ); createSMESHAction( 711, "PRECOMPUTE", "ICON_PRECOMPUTE" ); + //createSMESHAction( 712, "EVALUATE", "ICON_EVALUATE" ); + createSMESHAction( 712, "EVALUATE", "ICON_COMPUTE" ); createSMESHAction( 806, "CREATE_GEO_GROUP","ICON_CREATE_GEO_GROUP" ); createSMESHAction( 801, "CREATE_GROUP", "ICON_CREATE_GROUP" ); createSMESHAction( 802, "CONSTRUCT_GROUP", "ICON_CONSTRUCT_GROUP" ); @@ -2733,6 +2769,10 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS", 0, true ); createSMESHAction( 220, "ALL" ); createSMESHAction( 221, "FACE_ORIENTATION", "", 0, true ); + + createSMESHAction( 231, "LINE_REPRESENTATION", "", 0, true ); + createSMESHAction( 232, "ARC_REPRESENTATION", "", 0, true ); + createSMESHAction( 1100, "EDIT_HYPO" ); createSMESHAction( 1101, "RENAME", "", Qt::Key_F2 ); createSMESHAction( 1102, "UNASSIGN" ); @@ -2799,6 +2839,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( separator(), meshId, -1 ); createMenu( 701, meshId, -1 ); createMenu( 711, meshId, -1 ); + createMenu( 712, meshId, -1 ); createMenu( separator(), meshId, -1 ); createMenu( 801, meshId, -1 ); createMenu( 806, meshId, -1 ); @@ -2900,6 +2941,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createTool( separator(), meshTb ); createTool( 701, meshTb ); createTool( 711, meshTb ); + createTool( 712, meshTb ); createTool( separator(), meshTb ); createTool( 801, meshTb ); createTool( 806, meshTb ); @@ -3015,6 +3057,7 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->insert( separator(), -1, 0 ); createPopupItem( 701, OB, mesh, "&& isComputable" ); // COMPUTE createPopupItem( 711, OB, mesh, "&& isComputable" ); // PRECOMPUTE + createPopupItem( 712, OB, mesh ); // EVALUATE createPopupItem( 214, OB, mesh_group ); // UPDATE createPopupItem( 900, OB, mesh_group ); // ADV_INFO createPopupItem( 902, OB, mesh ); // STD_INFO @@ -3141,6 +3184,19 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->insert( action( 220 ), anId, -1 ); // ALL popupMgr()->setRule( action( 220 ), aDiffElemsInVTK + "&& isVisible && not( elemTypes in entityMode )", QtxPopupMgr::VisibleRule ); + + //------------------------------------------------- + // Representation of the 2D Quadratic elements + //------------------------------------------------- + anId = popupMgr()->insert( tr( "MEN_QUADRATIC_REPRESENT" ), -1, -1 ); + popupMgr()->insert( action( 231 ), anId, -1 ); // LINE REPRESENTATION + popupMgr()->setRule( action( 231 ), aMeshInVTK + "and isVisible",QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 231 ), "quadratic2DMode = 'eLines'", QtxPopupMgr::ToggleRule ); + + popupMgr()->insert( action( 232 ), anId, -1 ); // ARC REPRESENTATION + popupMgr()->setRule( action( 232 ), aMeshInVTK + "and isVisible", QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 232 ), "quadratic2DMode = 'eArcs'", QtxPopupMgr::ToggleRule ); + //------------------------------------------------- // Orientation of faces //------------------------------------------------- @@ -3178,7 +3234,7 @@ void SMESHGUI::initialize( CAM_Application* app ) aMeshInVtkHasVolumes = aMeshInVTK + "&&" + hasVolumes; anId = popupMgr()->insert( tr( "MEN_CTRL" ), -1, -1 ); - + popupMgr()->insert( action( 200 ), anId, -1 ); // RESET popupMgr()->setRule( action( 200 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule ); @@ -3259,7 +3315,7 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->setRule( action( 201 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule ); popupMgr()->insert( separator(), -1, -1 ); - + //------------------------------------------------- // Display / Erase //------------------------------------------------- @@ -3319,6 +3375,14 @@ bool SMESHGUI::activateModule( SUIT_Study* study ) action( 33)->setEnabled(true); // Delete: Key_Delete action(1101)->setEnabled(true); // Rename: Key_F2 + // 0020210. Make SMESH_Gen update meshes at switching GEOM->SMESH + GetSMESHGen()->SetCurrentStudy(SALOMEDS::Study::_nil()); + if ( SalomeApp_Study* s = dynamic_cast( study )) + if ( _PTR(Study) aStudy = s->studyDS()) { + GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() ); + updateObjBrowser(); // objects can be removed + } + return res; } @@ -3451,6 +3515,25 @@ void SMESHGUI::createPreferences() setPreferenceProperty( dispmode, "strings", modes ); setPreferenceProperty( dispmode, "indexes", indices ); + int arcgroup = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), genTab ); + setPreferenceProperty( arcgroup, "columns", 2 ); + int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), arcgroup, LightApp_Preferences::Selector, "SMESH", "quadratic_mode" ); + QStringList quadraticModes; + quadraticModes.append("Lines"); + quadraticModes.append("Arcs"); + indices.clear(); + indices.append( 0 ); + indices.append( 1 ); + setPreferenceProperty( quadraticmode, "strings", quadraticModes ); + setPreferenceProperty( quadraticmode, "indexes", indices ); + + int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), arcgroup, LightApp_Preferences::IntSpin, + "SMESH", "max_angle" ); + setPreferenceProperty( maxAngle, "min", 1 ); + setPreferenceProperty( maxAngle, "max", 90 ); + + + int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab ); setPreferenceProperty( exportgroup, "columns", 2 ); addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" ); @@ -3777,6 +3860,9 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const case 711: // Precompute mesh op = new SMESHGUI_PrecomputeOp(); break; + case 712: // Evaluate mesh + op = new SMESHGUI_EvaluateOp(); + break; case 806: // Create group on geom op = new SMESHGUI_GroupOnShapeOp(); break;