+ case SMESHOp::OpMergeElements:
+ {
+ if (checkLock(aStudy)) break;
+ if (vtkwnd) {
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_MergeDlg( this, 1 ) )->show();
+ } else {
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ }
+ break;
+ }
+
+ case SMESHOp::OpMoveNode: // MAKE MESH PASS THROUGH POINT
+ startOperation( SMESHOp::OpMoveNode );
+ break;
+
+ case SMESHOp::OpDuplicateNodes:
+ {
+ if(checkLock(aStudy)) break;
+ if ( vtkwnd ) {
+ EmitSignalDeactivateDialog();
+ ( new SMESHGUI_DuplicateNodesDlg( this ) )->show();
+ }
+ else {
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
+ }
+ break;
+ }
+
+ case SMESHOp::OpElem0DOnElemNodes: // 0D_ON_ALL_NODES
+ startOperation( SMESHOp::OpElem0DOnElemNodes );
+ break;
+
+ case SMESHOp::OpSelectFiltersLibrary: // Library of selection filters
+ {
+ static QList<int> aTypes;
+ if ( aTypes.isEmpty() )
+ {
+ aTypes.append( SMESH::NODE );
+ aTypes.append( SMESH::EDGE );
+ aTypes.append( SMESH::FACE );
+ aTypes.append( SMESH::VOLUME );
+ }
+ if (!myFilterLibraryDlg)
+ myFilterLibraryDlg = new SMESHGUI_FilterLibraryDlg( this, SMESH::GetDesktop( this ), aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
+ else if (myFilterLibraryDlg->isHidden())
+ myFilterLibraryDlg->Init( aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
+ myFilterLibraryDlg->raise();
+ }
+ break;
+ // CONTROLS
+ case SMESHOp::OpFreeNode:
+ case SMESHOp::OpEqualNode:
+ case SMESHOp::OpFreeEdge:
+ case SMESHOp::OpFreeBorder:
+ case SMESHOp::OpLength:
+ case SMESHOp::OpConnection:
+ case SMESHOp::OpEqualEdge:
+ case SMESHOp::OpFreeFace:
+ case SMESHOp::OpBareBorderFace:
+ case SMESHOp::OpOverConstrainedFace:
+ case SMESHOp::OpLength2D:
+ case SMESHOp::OpConnection2D:
+ case SMESHOp::OpArea:
+ case SMESHOp::OpTaper:
+ case SMESHOp::OpAspectRatio:
+ case SMESHOp::OpMinimumAngle:
+ case SMESHOp::OpWarpingAngle:
+ case SMESHOp::OpSkew:
+ case SMESHOp::OpMaxElementLength2D:
+ case SMESHOp::OpEqualFace:
+ case SMESHOp::OpAspectRatio3D:
+ case SMESHOp::OpVolume:
+ case SMESHOp::OpMaxElementLength3D:
+ case SMESHOp::OpBareBorderVolume:
+ case SMESHOp::OpOverConstrainedVolume:
+ case SMESHOp::OpEqualVolume:
+ if ( vtkwnd ) {
+
+ LightApp_SelectionMgr* mgr = selectionMgr();
+ SALOME_ListIO selected; mgr->selectedObjects( selected );
+
+ if( !selected.IsEmpty() ) {
+ SUIT_OverrideCursor wc;
+ ::Control( theCommandID );
+ break;
+ }
+ SUIT_MessageBox::warning(desktop(),
+ tr( "SMESH_WRN_WARNING" ),
+ tr( "SMESH_BAD_SELECTION" ) );
+ break;
+ }
+ else {
+ SUIT_MessageBox::warning(desktop(),
+ tr( "SMESH_WRN_WARNING" ),
+ tr( "NOT_A_VTK_VIEWER" ) );
+ }
+ break;
+ case SMESHOp::OpOverallMeshQuality:
+ OverallMeshQuality();
+ break;
+ case SMESHOp::OpNumberingNodes:
+ {
+ SUIT_OverrideCursor wc;
+ LightApp_SelectionMgr* mgr = selectionMgr();
+ SALOME_ListIO selected; mgr->selectedObjects( selected );
+
+ 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;
+ }
+ case SMESHOp::OpNumberingElements:
+ {
+ SUIT_OverrideCursor wc;
+ LightApp_SelectionMgr* mgr = selectionMgr();
+ SALOME_ListIO selected; mgr->selectedObjects( selected );
+
+ 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->SetCellsLabeled( !anActor->GetCellsLabeled() );
+ }
+ }
+ break;
+ }
+ case SMESHOp::OpPropertiesLength:
+ case SMESHOp::OpPropertiesArea:
+ case SMESHOp::OpPropertiesVolume:
+ case SMESHOp::OpMinimumDistance:
+ case SMESHOp::OpBoundingBox:
+ {
+ int page = SMESHGUI_MeasureDlg::MinDistance;
+ if ( theCommandID == SMESHOp::OpBoundingBox )
+ page = SMESHGUI_MeasureDlg::BoundingBox;
+ else if ( theCommandID == SMESHOp::OpPropertiesLength )
+ page = SMESHGUI_MeasureDlg::Length;
+ else if ( theCommandID == SMESHOp::OpPropertiesArea )
+ page = SMESHGUI_MeasureDlg::Area;
+ else if ( theCommandID == SMESHOp::OpPropertiesVolume )
+ page = SMESHGUI_MeasureDlg::Volume;
+
+ EmitSignalDeactivateDialog();
+ SMESHGUI_MeasureDlg* dlg = new SMESHGUI_MeasureDlg( SMESHGUI::desktop(), page );
+ dlg->show();
+ break;
+ }
+ case SMESHOp::OpSortChild:
+ ::sortChildren();
+ break;
+
+ }
+
+ anApp->updateActions(); //SRN: To update a Save button in the toolbar
+ //updateObjBrowser();
+ return true;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+bool SMESHGUI::OnMousePress( QMouseEvent * pe, SUIT_ViewWindow * wnd )
+{
+ return false;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+bool SMESHGUI::OnMouseMove( QMouseEvent * pe, SUIT_ViewWindow * wnd )
+{
+ return true;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+bool SMESHGUI::OnKeyPress( QKeyEvent * pe, SUIT_ViewWindow * wnd )
+{
+ return true;
+}
+
+//=============================================================================
+/*! Method: BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
+ * Purpose: ensures that the actor for the given <theIO> exists in the active VTK view
+ */
+//=============================================================================
+void SMESHGUI::BuildPresentation( const Handle(SALOME_InteractiveObject) & theIO,
+ SUIT_ViewWindow* wnd )
+{
+ if(theIO->hasEntry()){
+ //SUIT_ViewWindow* wnd = SMESH::GetActiveWindow();
+ SMESH::UpdateView(wnd,SMESH::eDisplay,theIO->getEntry());
+ }
+}
+
+//=======================================================================
+// function : createSMESHAction
+// purpose :
+//=======================================================================
+void SMESHGUI::createSMESHAction( const int id, const QString& po_id, const QString& icon_id,
+ const int key, const bool toggle, const QString& shortcutAction )
+{
+ QIcon icon;
+ QWidget* parent = application()->desktop();
+ SUIT_ResourceMgr* resMgr = resourceMgr();
+ QPixmap pix;
+ if ( !icon_id.isEmpty() )
+ pix = resMgr->loadPixmap( "SMESH", tr( icon_id.toLatin1().data() ) );
+ else
+ pix = resMgr->loadPixmap( "SMESH", tr( QString( "ICO_%1" ).arg( po_id ).toLatin1().data() ), false );
+ if ( !pix.isNull() )
+ icon = QIcon( pix );
+
+ QString tooltip = tr( QString( "TOP_%1" ).arg( po_id ).toLatin1().data() ),
+ menu = tr( QString( "MEN_%1" ).arg( po_id ).toLatin1().data() ),
+ status_bar = tr( QString( "STB_%1" ).arg( po_id ).toLatin1().data() );
+
+ createAction( id, tooltip, icon, menu, status_bar, key, parent,
+ toggle, this, SLOT( OnGUIEvent() ), shortcutAction );
+}
+
+//=======================================================================
+// function : createPopupItem
+// purpose :
+//=======================================================================
+void SMESHGUI::createPopupItem( const int id,
+ const QString& clients,
+ const QString& types,
+ const QString& theRule,
+ const int pId )
+{
+ if( !popupMgr()->contains( popupMgr()->actionId( action( id ) ) ) )
+ popupMgr()->insert( action( id ), pId, 0 );
+
+ QString lc = "$"; // VSR : instead of QtxPopupSelection::defEquality();
+ QString dc = "selcount"; // VSR : insetad of QtxPopupSelection::defSelCountParam()
+ QString rule = "(%1) and (%2) and (%3)";
+ rule = rule.arg( QString( "%1>0" ).arg( dc ) );
+ if( clients.isEmpty() )
+ rule = rule.arg( QString( "true" ) );
+ else
+ rule = rule.arg( QString( "%1client in {%2}" ).arg( lc ).arg( clients ) );
+ rule = rule.arg( QString( "%1type in {%2}" ).arg( lc ).arg( types ) );
+ rule += theRule;
+
+ bool cont = myRules.contains( id );
+ if( cont )
+ rule = QString( "%1 or (%2)" ).arg( myRules[ id ] ).arg( rule );
+
+ popupMgr()->setRule( action( id ), rule, QtxPopupMgr::VisibleRule );
+ myRules[ id ] = QString( cont ? "%1" : "(%1)" ).arg( rule );
+}
+
+//=======================================================================
+// function : initialize
+// purpose :
+//=======================================================================
+void SMESHGUI::initialize( CAM_Application* app )
+{
+ SalomeApp_Module::initialize( app );
+
+// SUIT_ResourceMgr* mgr = app->resourceMgr();
+// if ( mgr )
+ /* Automatic Update flag */
+// myAutomaticUpdate = mgr->booleanValue( "SMESH", "AutomaticUpdate", myAutomaticUpdate );
+
+ // ----- create actions --------------
+
+ //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::OpExportDAT, "DAT" );
+ createSMESHAction( SMESHOp::OpExportMED, "MED" );
+ createSMESHAction( SMESHOp::OpExportUNV, "UNV" );
+ createSMESHAction( SMESHOp::OpExportSTL, "STL" );
+#ifdef WITH_CGNS
+ createSMESHAction( SMESHOp::OpExportCGNS, "CGNS");
+#endif
+ createSMESHAction( SMESHOp::OpExportSAUV, "SAUV");
+ createSMESHAction( SMESHOp::OpExportGMF, "GMF" );
+ createSMESHAction( SMESHOp::OpPopupExportDAT, "DAT" );
+ createSMESHAction( SMESHOp::OpPopupExportMED, "MED" );
+ createSMESHAction( SMESHOp::OpPopupExportUNV, "UNV" );
+ createSMESHAction( SMESHOp::OpPopupExportSTL, "STL" );
+#ifdef WITH_CGNS
+ createSMESHAction( SMESHOp::OpPopupExportCGNS, "CGNS");
+#endif
+ createSMESHAction( SMESHOp::OpPopupExportSAUV, "SAUV");
+ createSMESHAction( SMESHOp::OpPopupExportGMF, "GMF" );
+ createSMESHAction( SMESHOp::OpFileInformation, "FILE_INFO" );
+ createSMESHAction( SMESHOp::OpDelete, "DELETE", "ICON_DELETE", Qt::Key_Delete );
+ createSMESHAction( SMESHOp::OpSelectFiltersLibrary, "SEL_FILTER_LIB" );
+ 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::OpBuildCompoundMesh, "BUILD_COMPOUND", "ICON_BUILD_COMPOUND" );
+ createSMESHAction( SMESHOp::OpCopyMesh, "COPY_MESH", "ICON_COPY_MESH" );
+ createSMESHAction( SMESHOp::OpCompute, "COMPUTE", "ICON_COMPUTE" );
+ createSMESHAction( SMESHOp::OpPreCompute, "PRECOMPUTE", "ICON_PRECOMPUTE" );
+ createSMESHAction( SMESHOp::OpEvaluate, "EVALUATE", "ICON_EVALUATE" );
+ createSMESHAction( SMESHOp::OpMeshOrder, "MESH_ORDER", "ICON_MESH_ORDER");
+ createSMESHAction( SMESHOp::OpCreateGroup, "CREATE_GROUP", "ICON_CREATE_GROUP" );
+ createSMESHAction( SMESHOp::OpCreateGeometryGroup, "CREATE_GEO_GROUP", "ICON_CREATE_GEO_GROUP" );
+ createSMESHAction( SMESHOp::OpConstructGroup, "CONSTRUCT_GROUP", "ICON_CONSTRUCT_GROUP" );
+ createSMESHAction( SMESHOp::OpEditGroup, "EDIT_GROUP", "ICON_EDIT_GROUP" );
+ createSMESHAction( SMESHOp::OpEditGeomGroupAsGroup, "EDIT_GEOMGROUP_AS_GROUP", "ICON_EDIT_GROUP" );
+ createSMESHAction( SMESHOp::OpUnionGroups, "UN_GROUP", "ICON_UNION" );
+ 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::OpDeleteGroup, "DEL_GROUP", "ICON_DEL_GROUP" );
+ createSMESHAction( SMESHOp::OpMeshInformation , "ADV_INFO", "ICON_ADV_INFO" );
+ //createSMESHAction( SMESHOp::OpStdInfo, "STD_INFO", "ICON_STD_INFO" );
+ //createSMESHAction( SMESHOp::OpWhatIs, "WHAT_IS", "ICON_WHAT_IS" ); // VSR: issue #0021242 (eliminate "Mesh Element Information" command)
+ createSMESHAction( SMESHOp::OpFindElementByPoint, "FIND_ELEM", "ICON_FIND_ELEM" );
+ //update
+ createSMESHAction( SMESHOp::OpFreeNode, "FREE_NODE", "ICON_FREE_NODE", 0, true );
+ createSMESHAction( SMESHOp::OpEqualNode, "EQUAL_NODE", "ICON_EQUAL_NODE", 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 );
+ createSMESHAction( SMESHOp::OpConnection, "CONNECTION", "ICON_CONNECTION", 0, true );
+ createSMESHAction( SMESHOp::OpEqualEdge, "EQUAL_EDGE", "ICON_EQUAL_EDGE", 0, true );
+ createSMESHAction( SMESHOp::OpFreeFace, "FREE_FACES", "ICON_FREE_FACES", 0, true );
+ createSMESHAction( SMESHOp::OpBareBorderFace, "BARE_BORDER_FACE", "ICON_BARE_BORDER_FACE", 0, true );
+ createSMESHAction( SMESHOp::OpOverConstrainedFace, "OVER_CONSTRAINED_FACE", "ICON_OVER_CONSTRAINED_FACE", 0, true );
+ createSMESHAction( SMESHOp::OpLength2D, "LENGTH_2D", "ICON_LENGTH_2D", 0, true );
+ createSMESHAction( SMESHOp::OpConnection2D, "CONNECTION_2D", "ICON_CONNECTION_2D", 0, true );
+ createSMESHAction( SMESHOp::OpArea, "AREA", "ICON_AREA", 0, true );
+ createSMESHAction( SMESHOp::OpTaper, "TAPER", "ICON_TAPER", 0, true );
+ createSMESHAction( SMESHOp::OpAspectRatio, "ASPECT", "ICON_ASPECT", 0, true );
+ createSMESHAction( SMESHOp::OpMinimumAngle, "MIN_ANG", "ICON_ANGLE", 0, true );
+ createSMESHAction( SMESHOp::OpWarpingAngle, "WARP", "ICON_WARP", 0, true );
+ createSMESHAction( SMESHOp::OpSkew, "SKEW", "ICON_SKEW", 0, true );
+ createSMESHAction( SMESHOp::OpMaxElementLength2D, "MAX_ELEMENT_LENGTH_2D", "ICON_MAX_ELEMENT_LENGTH_2D", 0, true );
+ createSMESHAction( SMESHOp::OpEqualFace, "EQUAL_FACE", "ICON_EQUAL_FACE", 0, true );
+ createSMESHAction( SMESHOp::OpAspectRatio3D, "ASPECT_3D", "ICON_ASPECT_3D", 0, true );
+ createSMESHAction( SMESHOp::OpVolume, "VOLUME_3D", "ICON_VOLUME_3D", 0, true );
+ createSMESHAction( SMESHOp::OpMaxElementLength3D, "MAX_ELEMENT_LENGTH_3D", "ICON_MAX_ELEMENT_LENGTH_3D", 0, true );
+ 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::OpNode, "NODE", "ICON_DLG_NODE" );
+ createSMESHAction( SMESHOp::OpElem0D, "ELEM0D", "ICON_DLG_ELEM0D" );
+ createSMESHAction( SMESHOp::OpElem0DOnElemNodes, "0D_ON_ALL_NODES", "ICON_0D_ON_ALL_NODES" );
+ createSMESHAction( SMESHOp::OpBall, "BALL", "ICON_DLG_BALL" );
+ createSMESHAction( SMESHOp::OpEdge, "EDGE", "ICON_DLG_EDGE" );
+ createSMESHAction( SMESHOp::OpTriangle, "TRIANGLE", "ICON_DLG_TRIANGLE" );
+ createSMESHAction( SMESHOp::OpQuadrangle, "QUAD", "ICON_DLG_QUADRANGLE" );
+ createSMESHAction( SMESHOp::OpPolygon, "POLYGON", "ICON_DLG_POLYGON" );
+ createSMESHAction( SMESHOp::OpTetrahedron, "TETRA", "ICON_DLG_TETRAS" );
+ createSMESHAction( SMESHOp::OpHexahedron, "HEXA", "ICON_DLG_HEXAS" );
+ createSMESHAction( SMESHOp::OpPentahedron, "PENTA", "ICON_DLG_PENTA" );
+ createSMESHAction( SMESHOp::OpPyramid , "PYRAMID", "ICON_DLG_PYRAMID" );
+ createSMESHAction( SMESHOp::OpHexagonalPrism, "OCTA", "ICON_DLG_OCTA" );
+ createSMESHAction( SMESHOp::OpPolyhedron, "POLYHEDRON", "ICON_DLG_POLYHEDRON" );
+ createSMESHAction( SMESHOp::OpQuadraticEdge, "QUADRATIC_EDGE", "ICON_DLG_QUADRATIC_EDGE" );
+ createSMESHAction( SMESHOp::OpQuadraticTriangle, "QUADRATIC_TRIANGLE", "ICON_DLG_QUADRATIC_TRIANGLE" );
+ createSMESHAction( SMESHOp::OpBiQuadraticTriangle, "BIQUADRATIC_TRIANGLE", "ICON_DLG_BIQUADRATIC_TRIANGLE" );
+ createSMESHAction( SMESHOp::OpQuadraticQuadrangle, "QUADRATIC_QUADRANGLE", "ICON_DLG_QUADRATIC_QUADRANGLE" );
+ createSMESHAction( SMESHOp::OpBiQuadraticQuadrangle, "BIQUADRATIC_QUADRANGLE", "ICON_DLG_BIQUADRATIC_QUADRANGLE" );
+ createSMESHAction( SMESHOp::OpQuadraticPolygon, "QUADRATIC_POLYGON", "ICON_DLG_QUADRATIC_POLYGON" );
+ createSMESHAction( SMESHOp::OpQuadraticTetrahedron, "QUADRATIC_TETRAHEDRON", "ICON_DLG_QUADRATIC_TETRAHEDRON" );
+ createSMESHAction( SMESHOp::OpQuadraticPyramid, "QUADRATIC_PYRAMID", "ICON_DLG_QUADRATIC_PYRAMID" );
+ createSMESHAction( SMESHOp::OpQuadraticPentahedron, "QUADRATIC_PENTAHEDRON", "ICON_DLG_QUADRATIC_PENTAHEDRON" );
+ createSMESHAction( SMESHOp::OpQuadraticHexahedron, "QUADRATIC_HEXAHEDRON", "ICON_DLG_QUADRATIC_HEXAHEDRON" );
+ createSMESHAction( SMESHOp::OpTriQuadraticHexahedron, "TRIQUADRATIC_HEXAHEDRON", "ICON_DLG_TRIQUADRATIC_HEXAHEDRON" );
+
+ createSMESHAction( SMESHOp::OpRemoveNodes, "REMOVE_NODES", "ICON_DLG_REM_NODE" );
+ createSMESHAction( SMESHOp::OpRemoveElements, "REMOVE_ELEMENTS", "ICON_DLG_REM_ELEMENT" );
+ createSMESHAction( SMESHOp::OpRemoveOrphanNodes, "REMOVE_ORPHAN_NODES", "ICON_DLG_REM_ORPHAN_NODES" );
+ createSMESHAction( SMESHOp::OpClearMesh, "CLEAR_MESH", "ICON_CLEAR_MESH" );
+
+ //createSMESHAction( SMESHOp::OpRenumberingNodes, "RENUM_NODES", "ICON_DLG_RENUMBERING_NODES" );
+ //createSMESHAction( SMESHOp::OpRenumberingElements, "RENUM_ELEMENTS", "ICON_DLG_RENUMBERING_ELEMENTS" );
+
+ createSMESHAction( SMESHOp::OpTranslation, "TRANS", "ICON_SMESH_TRANSLATION_VECTOR" );
+ createSMESHAction( SMESHOp::OpRotation, "ROT", "ICON_DLG_MESH_ROTATION" );
+ createSMESHAction( SMESHOp::OpSymmetry, "SYM", "ICON_SMESH_SYMMETRY_PLANE" );
+ createSMESHAction( SMESHOp::OpScale, "SCALE", "ICON_DLG_MESH_SCALE" );
+ createSMESHAction( SMESHOp::OpSewing, "SEW", "ICON_SMESH_SEWING_FREEBORDERS" );
+ createSMESHAction( SMESHOp::OpMergeNodes, "MERGE", "ICON_SMESH_MERGE_NODES" );
+ createSMESHAction( SMESHOp::OpMergeElements, "MERGE_ELEMENTS", "ICON_DLG_MERGE_ELEMENTS" );
+ createSMESHAction( SMESHOp::OpMoveNode, "MESH_THROU_POINT","ICON_DLG_MOVE_NODE" );
+ createSMESHAction( SMESHOp::OpDuplicateNodes, "DUPLICATE_NODES", "ICON_SMESH_DUPLICATE_NODES" );
+ createSMESHAction( SMESHOp::OpDiagonalInversion, "INV", "ICON_DLG_MESH_DIAGONAL" );
+ createSMESHAction( SMESHOp::OpUnionOfTwoTriangle, "UNION2", "ICON_UNION2TRI" );
+ createSMESHAction( SMESHOp::OpOrientation, "ORIENT", "ICON_DLG_MESH_ORIENTATION" );
+ createSMESHAction( SMESHOp::OpReorientFaces, "REORIENT_2D", "ICON_REORIENT_2D" );
+ createSMESHAction( SMESHOp::OpUnionOfTriangles, "UNION", "ICON_UNIONTRI" );
+ createSMESHAction( SMESHOp::OpCuttingOfQuadrangles, "CUT", "ICON_CUTQUAD" );
+ createSMESHAction( SMESHOp::OpSplitVolumes, "SPLIT_TO_TETRA", "ICON_SPLIT_TO_TETRA" );
+ createSMESHAction( SMESHOp::OpSplitBiQuadratic, "SPLIT_BIQUAD", "ICON_SPLIT_BIQUAD" );
+ createSMESHAction( SMESHOp::OpSmoothing, "SMOOTH", "ICON_DLG_SMOOTHING" );
+ createSMESHAction( SMESHOp::OpExtrusion, "EXTRUSION", "ICON_EXTRUSION" );
+ createSMESHAction( SMESHOp::OpExtrusionAlongAPath, "EXTRUSION_ALONG", "ICON_EXTRUSION_ALONG" );
+ createSMESHAction( SMESHOp::OpRevolution, "REVOLUTION", "ICON_REVOLUTION" );
+ createSMESHAction( SMESHOp::OpPatternMapping, "MAP", "ICON_MAP" );
+ createSMESHAction( SMESHOp::OpConvertMeshToQuadratic, "CONV_TO_QUAD", "ICON_CONV_TO_QUAD" );
+ createSMESHAction( SMESHOp::OpCreateBoundaryElements, "2D_FROM_3D", "ICON_2D_FROM_3D" );
+
+ createSMESHAction( SMESHOp::OpReset, "RESET" );
+ createSMESHAction( SMESHOp::OpScalarBarProperties, "SCALAR_BAR_PROP" );
+ createSMESHAction( SMESHOp::OpShowScalarBar, "SHOW_SCALAR_BAR","",0, true );
+ createSMESHAction( SMESHOp::OpSaveDistribution, "SAVE_DISTRIBUTION" );
+ createSMESHAction( SMESHOp::OpShowDistribution, "SHOW_DISTRIBUTION","",0, true );
+#ifndef DISABLE_PLOT2DVIEWER
+ createSMESHAction( SMESHOp::OpPlotDistribution, "PLOT_DISTRIBUTION" );
+#endif
+ createSMESHAction( SMESHOp::OpDMWireframe, "WIRE", "ICON_WIRE", 0, true );
+ createSMESHAction( SMESHOp::OpDMShading, "SHADE", "ICON_SHADE", 0, true );
+ createSMESHAction( SMESHOp::OpDMNodes, "NODES", "ICON_POINTS", 0, true );
+ createSMESHAction( SMESHOp::OpDMShrink, "SHRINK", "ICON_SHRINK", 0, true );
+ createSMESHAction( SMESHOp::OpUpdate, "UPDATE", "ICON_UPDATE" );
+ createSMESHAction( SMESHOp::OpDE0DElements, "ELEMS0D", "ICON_DLG_ELEM0D", 0, true );
+ createSMESHAction( SMESHOp::OpDEEdges, "EDGES", "ICON_DLG_EDGE", 0, true );
+ createSMESHAction( SMESHOp::OpDEFaces, "FACES", "ICON_DLG_TRIANGLE", 0, true );
+ createSMESHAction( SMESHOp::OpDEVolumes, "VOLUMES", "ICON_DLG_TETRAS", 0, true );
+ createSMESHAction( SMESHOp::OpDEBalls, "BALLS", "ICON_DLG_BALL", 0, true );
+ createSMESHAction( SMESHOp::OpDEChoose, "CHOOSE", "ICON_DLG_CHOOSE", 0, false );
+ createSMESHAction( SMESHOp::OpDEAllEntity, "ALL", "ICON_DLG_CHOOSE_ALL", 0, false );
+ createSMESHAction( SMESHOp::OpOrientationOnFaces, "FACE_ORIENTATION", "", 0, true );
+
+ createSMESHAction( SMESHOp::OpRepresentationLines, "LINE_REPRESENTATION", "", 0, true );
+ createSMESHAction( SMESHOp::OpRepresentationArcs, "ARC_REPRESENTATION", "", 0, true );
+
+ createSMESHAction( SMESHOp::OpEditHypothesis, "EDIT_HYPO" );
+ createSMESHAction( SMESHOp::OpUnassign, "UNASSIGN" );
+ createSMESHAction( SMESHOp::OpNumberingNodes, "NUM_NODES", "", 0, true );
+ createSMESHAction( SMESHOp::OpNumberingElements, "NUM_ELEMENTS", "", 0, true );
+ createSMESHAction( SMESHOp::OpProperties, "COLORS" );
+ createSMESHAction( SMESHOp::OpTransparency, "TRANSP" );
+ createSMESHAction( SMESHOp::OpClipping, "CLIP" );
+ createSMESHAction( SMESHOp::OpAutoColor, "AUTO_COLOR" );
+ createSMESHAction( SMESHOp::OpDisableAutoColor, "DISABLE_AUTO_COLOR" );
+
+ createSMESHAction( SMESHOp::OpMinimumDistance, "MEASURE_MIN_DIST", "ICON_MEASURE_MIN_DIST" );
+ createSMESHAction( SMESHOp::OpBoundingBox, "MEASURE_BND_BOX", "ICON_MEASURE_BND_BOX" );
+ createSMESHAction( SMESHOp::OpPropertiesLength, "MEASURE_LENGTH", "ICON_MEASURE_LENGTH" );
+ createSMESHAction( SMESHOp::OpPropertiesArea, "MEASURE_AREA", "ICON_MEASURE_AREA" );
+ createSMESHAction( SMESHOp::OpPropertiesVolume, "MEASURE_VOLUME", "ICON_MEASURE_VOLUME" );
+
+ createSMESHAction( SMESHOp::OpHide, "HIDE" );
+ createSMESHAction( SMESHOp::OpShow, "SHOW" );
+ createSMESHAction( SMESHOp::OpShowOnly, "DISPLAY_ONLY" );
+
+ createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" );
+
+ QList<int> aCtrlActions;
+ aCtrlActions << SMESHOp::OpFreeNode << SMESHOp::OpEqualNode // node controls
+ << SMESHOp::OpFreeEdge << SMESHOp::OpFreeBorder
+ << SMESHOp::OpLength << SMESHOp::OpConnection << SMESHOp::OpEqualEdge // edge controls
+ << SMESHOp::OpFreeFace << SMESHOp::OpLength2D << SMESHOp::OpConnection2D
+ << SMESHOp::OpArea << SMESHOp::OpTaper << SMESHOp::OpAspectRatio
+ << SMESHOp::OpMinimumAngle << SMESHOp::OpWarpingAngle << SMESHOp::OpSkew
+ << SMESHOp::OpMaxElementLength2D << SMESHOp::OpBareBorderFace
+ << SMESHOp::OpOverConstrainedFace << SMESHOp::OpEqualFace // face controls
+ << SMESHOp::OpAspectRatio3D << SMESHOp::OpVolume
+ << SMESHOp::OpMaxElementLength3D << SMESHOp::OpBareBorderVolume
+ << SMESHOp::OpOverConstrainedVolume << SMESHOp::OpEqualVolume; // volume controls
+ QActionGroup* aCtrlGroup = new QActionGroup( application()->desktop() );
+ aCtrlGroup->setExclusive( true );
+ for( int i = 0; i < aCtrlActions.size(); i++ )
+ aCtrlGroup->addAction( action( aCtrlActions[i] ) );
+
+ // ----- create menu --------------
+ int fileId = createMenu( tr( "MEN_FILE" ), -1, 1 ),
+ editId = createMenu( tr( "MEN_EDIT" ), -1, 3 ),
+ toolsId = createMenu( tr( "MEN_TOOLS" ), -1, 5, 50 ),
+ meshId = createMenu( tr( "MEN_MESH" ), -1, 70, 10 ),
+ ctrlId = createMenu( tr( "MEN_CTRL" ), -1, 60, 10 ),
+ modifyId = createMenu( tr( "MEN_MODIFY" ), -1, 40, 10 ),
+ measureId = createMenu( tr( "MEN_MEASURE" ), -1, 50, 10 ),
+ viewId = createMenu( tr( "MEN_VIEW" ), -1, 2 );
+
+ createMenu( separator(), fileId );
+
+ QMenu* nodeMenu = new QMenu(); QMenu* edgeMenu = new QMenu();
+ QMenu* faceMenu = new QMenu(); QMenu* volumeMenu = new QMenu();
+ int importId = createMenu( tr( "MEN_IMPORT" ), fileId, -1, 10 ),
+ exportId = createMenu( tr( "MEN_EXPORT" ), fileId, -1, 10 ),
+ nodeId = createMenu( tr( "MEN_NODE_CTRL" ), ctrlId, -1, 10, -1, nodeMenu ),
+ edgeId = createMenu( tr( "MEN_EDGE_CTRL" ), ctrlId, -1, 10, -1, edgeMenu ),
+ faceId = createMenu( tr( "MEN_FACE_CTRL" ), ctrlId, -1, 10, -1, faceMenu ),
+ volumeId = createMenu( tr( "MEN_VOLUME_CTRL" ), ctrlId, -1, 10, -1, volumeMenu ),
+ addId = createMenu( tr( "MEN_ADD" ), modifyId, 402 ),
+ removeId = createMenu( tr( "MEN_REMOVE" ), modifyId, 403 ),
+ //renumId = createMenu( tr( "MEN_RENUM" ), modifyId, 404 ),
+ transfId = createMenu( tr( "MEN_TRANSF" ), modifyId, 405 ),
+ basicPropId = createMenu( tr( "MEN_BASIC_PROPERTIES" ), measureId, -1, 10 );
+
+ //createMenu( SMESHOp::OpImportDAT, importId, -1 );
+ createMenu( SMESHOp::OpImportUNV, importId, -1 );
+ createMenu( SMESHOp::OpImportMED, importId, -1 );
+ createMenu( SMESHOp::OpImportSTL, importId, -1 );
+#ifdef WITH_CGNS
+ createMenu( SMESHOp::OpImportCGNS, importId, -1 );
+#endif
+ createMenu( SMESHOp::OpImportSAUV, importId, -1 );
+ createMenu( SMESHOp::OpImportGMF, importId, -1 );
+ createMenu( SMESHOp::OpExportDAT, exportId, -1 );
+ createMenu( SMESHOp::OpExportMED, exportId, -1 );
+ createMenu( SMESHOp::OpExportUNV, exportId, -1 );
+ createMenu( SMESHOp::OpExportSTL, exportId, -1 );
+#ifdef WITH_CGNS
+ createMenu( SMESHOp::OpExportCGNS, exportId, -1 );
+#endif
+ createMenu( SMESHOp::OpExportSAUV, exportId, -1 );
+ createMenu( SMESHOp::OpExportGMF, exportId, -1 );
+ createMenu( separator(), fileId, 10 );
+
+ createMenu( SMESHOp::OpDelete, editId, -1 );
+
+ createMenu( SMESHOp::OpSelectFiltersLibrary, toolsId, -1 );
+
+ createMenu( SMESHOp::OpCreateMesh, meshId, -1 ); // "Mesh" menu
+ createMenu( SMESHOp::OpCreateSubMesh, meshId, -1 );
+ createMenu( SMESHOp::OpEditMeshOrSubMesh, meshId, -1 );
+ createMenu( SMESHOp::OpBuildCompoundMesh, meshId, -1 );
+ createMenu( SMESHOp::OpCopyMesh, meshId, -1 );
+ createMenu( separator(), meshId, -1 );
+ createMenu( SMESHOp::OpCompute, meshId, -1 );
+ createMenu( SMESHOp::OpPreCompute, meshId, -1 );
+ createMenu( SMESHOp::OpEvaluate, meshId, -1 );
+ createMenu( SMESHOp::OpMeshOrder, meshId, -1 );
+ createMenu( separator(), meshId, -1 );
+ createMenu( SMESHOp::OpCreateGroup, meshId, -1 );
+ createMenu( SMESHOp::OpCreateGeometryGroup, meshId, -1 );
+ createMenu( SMESHOp::OpConstructGroup, meshId, -1 );
+ createMenu( SMESHOp::OpEditGroup, meshId, -1 );
+ createMenu( SMESHOp::OpEditGeomGroupAsGroup, meshId, -1 );
+ createMenu( separator(), meshId, -1 );
+ createMenu( SMESHOp::OpUnionGroups, meshId, -1 );
+ createMenu( SMESHOp::OpIntersectGroups, meshId, -1 );
+ createMenu( SMESHOp::OpCutGroups, meshId, -1 );
+ createMenu( separator(), meshId, -1 );
+ createMenu( SMESHOp::OpGroupUnderlyingElem, meshId, -1 );
+ createMenu( separator(), meshId, -1 );
+ createMenu( SMESHOp::OpMeshInformation, meshId, -1 );
+ //createMenu( SMESHOp::OpStdInfo, meshId, -1 );
+ //createMenu( SMESHOp::OpWhatIs, meshId, -1 ); // VSR: issue #0021242 (eliminate "Mesh Element Information" command)
+ createMenu( SMESHOp::OpFindElementByPoint, meshId, -1 );
+ createMenu( separator(), meshId, -1 );
+
+ createMenu( SMESHOp::OpFreeNode, nodeId, -1 );
+ createMenu( SMESHOp::OpEqualNode, nodeId, -1 );
+ createMenu( SMESHOp::OpFreeBorder, edgeId, -1 );
+ createMenu( SMESHOp::OpLength, edgeId, -1 );
+ createMenu( SMESHOp::OpConnection, edgeId, -1 );
+ createMenu( SMESHOp::OpEqualEdge, edgeId, -1 );
+ createMenu( SMESHOp::OpFreeEdge, faceId, -1 );
+ createMenu( SMESHOp::OpFreeFace, faceId, -1 );
+ createMenu( SMESHOp::OpBareBorderFace, faceId, -1 );
+ createMenu( SMESHOp::OpOverConstrainedFace, faceId, -1 );
+ createMenu( SMESHOp::OpLength2D, faceId, -1 );
+ createMenu( SMESHOp::OpConnection2D, faceId, -1 );
+ createMenu( SMESHOp::OpArea, faceId, -1 );
+ createMenu( SMESHOp::OpTaper, faceId, -1 );
+ createMenu( SMESHOp::OpAspectRatio, faceId, -1 );
+ createMenu( SMESHOp::OpMinimumAngle, faceId, -1 );
+ createMenu( SMESHOp::OpWarpingAngle, faceId, -1 );
+ createMenu( SMESHOp::OpSkew, faceId, -1 );
+ createMenu( SMESHOp::OpMaxElementLength2D, faceId, -1 );
+ createMenu( SMESHOp::OpEqualFace, faceId, -1 );
+ createMenu( SMESHOp::OpAspectRatio3D, volumeId, -1 );
+ createMenu( SMESHOp::OpVolume, volumeId, -1 );
+ createMenu( SMESHOp::OpMaxElementLength3D, volumeId, -1 );
+ createMenu( SMESHOp::OpBareBorderVolume, volumeId, -1 );
+ createMenu( SMESHOp::OpOverConstrainedVolume, volumeId, -1 );
+ createMenu( SMESHOp::OpEqualVolume, volumeId, -1 );
+ createMenu( separator(), ctrlId, -1 );
+ createMenu( SMESHOp::OpReset, ctrlId, -1 );
+ createMenu( separator(), ctrlId, -1 );
+ createMenu( SMESHOp::OpOverallMeshQuality, ctrlId, -1 );
+
+ createMenu( SMESHOp::OpNode, addId, -1 );
+ createMenu( SMESHOp::OpElem0D, addId, -1 );
+ createMenu( SMESHOp::OpElem0DOnElemNodes, addId, -1 );
+ createMenu( SMESHOp::OpBall, addId, -1 );
+ createMenu( SMESHOp::OpEdge, addId, -1 );
+ createMenu( SMESHOp::OpTriangle, addId, -1 );
+ createMenu( SMESHOp::OpQuadrangle, addId, -1 );
+ createMenu( SMESHOp::OpPolygon, addId, -1 );
+ createMenu( SMESHOp::OpTetrahedron, addId, -1 );
+ createMenu( SMESHOp::OpHexahedron, addId, -1 );
+ createMenu( SMESHOp::OpPentahedron, addId, -1 );
+ createMenu( SMESHOp::OpPyramid, addId, -1 );
+ createMenu( SMESHOp::OpHexagonalPrism, addId, -1 );
+ createMenu( SMESHOp::OpPolyhedron, addId, -1 );
+ createMenu( separator(), addId, -1 );
+ createMenu( SMESHOp::OpQuadraticEdge, addId, -1 );
+ createMenu( SMESHOp::OpQuadraticTriangle, addId, -1 );
+ createMenu( SMESHOp::OpBiQuadraticTriangle , addId, -1 );
+ createMenu( SMESHOp::OpQuadraticQuadrangle, addId, -1 );
+ createMenu( SMESHOp::OpBiQuadraticQuadrangle, addId, -1 );
+ createMenu( SMESHOp::OpQuadraticPolygon, addId, -1 );
+ createMenu( SMESHOp::OpQuadraticTetrahedron, addId, -1 );
+ createMenu( SMESHOp::OpQuadraticPyramid, addId, -1 );
+ createMenu( SMESHOp::OpQuadraticPentahedron, addId, -1 );
+ createMenu( SMESHOp::OpQuadraticHexahedron, addId, -1 );
+ createMenu( SMESHOp::OpTriQuadraticHexahedron, addId, -1 );
+
+ createMenu( SMESHOp::OpRemoveNodes, removeId, -1 );
+ createMenu( SMESHOp::OpRemoveElements, removeId, -1 );
+ createMenu( SMESHOp::OpRemoveOrphanNodes, removeId, -1 );
+ createMenu( separator(), removeId, -1 );
+ createMenu( SMESHOp::OpDeleteGroup, removeId, -1 );
+ createMenu( separator(), removeId, -1 );
+ createMenu( SMESHOp::OpClearMesh, removeId, -1 );
+
+ //createMenu( SMESHOp::OpRenumberingNodes, renumId, -1 );
+ //createMenu( SMESHOp::OpRenumberingElements, renumId, -1 );
+
+ createMenu( SMESHOp::OpTranslation, transfId, -1 );
+ createMenu( SMESHOp::OpRotation, transfId, -1 );
+ createMenu( SMESHOp::OpSymmetry, transfId, -1 );
+ createMenu( SMESHOp::OpScale, transfId, -1 );
+ createMenu( SMESHOp::OpSewing, transfId, -1 );
+ createMenu( SMESHOp::OpMergeNodes, transfId, -1 );
+ createMenu( SMESHOp::OpMergeElements, transfId, -1 );
+ createMenu( SMESHOp::OpDuplicateNodes, transfId, -1 );
+
+ createMenu( SMESHOp::OpMoveNode, modifyId, -1 );
+ createMenu( SMESHOp::OpDiagonalInversion, modifyId, -1 );
+ createMenu( SMESHOp::OpUnionOfTwoTriangle, modifyId, -1 );
+ createMenu( SMESHOp::OpOrientation, modifyId, -1 );
+ createMenu( SMESHOp::OpReorientFaces, modifyId, -1 );
+ createMenu( SMESHOp::OpUnionOfTriangles, modifyId, -1 );
+ createMenu( SMESHOp::OpCuttingOfQuadrangles, modifyId, -1 );
+ createMenu( SMESHOp::OpSplitVolumes, modifyId, -1 );
+ createMenu( SMESHOp::OpSplitBiQuadratic, modifyId, -1 );
+ createMenu( SMESHOp::OpSmoothing, modifyId, -1 );
+ createMenu( SMESHOp::OpExtrusion, modifyId, -1 );
+ createMenu( SMESHOp::OpExtrusionAlongAPath , modifyId, -1 );
+ createMenu( SMESHOp::OpRevolution, modifyId, -1 );
+ createMenu( SMESHOp::OpPatternMapping, modifyId, -1 );
+ createMenu( SMESHOp::OpConvertMeshToQuadratic, modifyId, -1 );
+ createMenu( SMESHOp::OpCreateBoundaryElements, modifyId, -1 );
+
+ createMenu( SMESHOp::OpMinimumDistance, measureId, -1 );
+ createMenu( SMESHOp::OpBoundingBox, measureId, -1 );
+ createMenu( SMESHOp::OpPropertiesLength, basicPropId, -1 );
+ createMenu( SMESHOp::OpPropertiesArea, basicPropId, -1 );
+ createMenu( SMESHOp::OpPropertiesVolume, basicPropId, -1 );
+ createMenu( SMESHOp::OpUpdate, viewId, -1 );
+
+ connect( nodeMenu, SIGNAL( aboutToShow() ), this, SLOT( onUpdateControlActions() ) );
+ connect( edgeMenu, SIGNAL( aboutToShow() ), this, SLOT( onUpdateControlActions() ) );
+ connect( faceMenu, SIGNAL( aboutToShow() ), this, SLOT( onUpdateControlActions() ) );
+ connect( volumeMenu, SIGNAL( aboutToShow() ), this, SLOT( onUpdateControlActions() ) );
+
+ // ----- create toolbars --------------
+ int meshTb = createTool( tr( "TB_MESH" ), QString( "SMESHMeshToolbar" ) ),
+ info = createTool( tr( "TB_INFO" ), QString( "SMESHInformationToolbar" ) ),
+ groupTb = createTool( tr( "TB_GROUP" ), QString( "SMESHGroupToolbar" ) ),
+ ctrl0dTb = createTool( tr( "TB_CTRL0D" ), QString( "SMESHNodeControlsToolbar" ) ),
+ ctrl1dTb = createTool( tr( "TB_CTRL1D" ), QString( "SMESHEdgeControlsToolbar" ) ),
+ ctrl2dTb = createTool( tr( "TB_CTRL2D" ), QString( "SMESHFaceControlsToolbar" ) ),
+ ctrl3dTb = createTool( tr( "TB_CTRL3D" ), QString( "SMESHVolumeControlsToolbar" ) ),
+ addElemTb = createTool( tr( "TB_ADD" ), QString( "SMESHAddElementToolbar" ) ),
+ addNonElemTb = createTool( tr( "TB_ADDNON" ), QString( "SMESHAddElementToolbar" ) ),
+ remTb = createTool( tr( "TB_REM" ), QString( "SMESHRemoveToolbar" ) ),
+ //renumbTb = createTool( tr( "TB_RENUMBER" ), QString( "SMESHRenumberingToolbar" ) ),
+ transformTb = createTool( tr( "TB_TRANSFORM" ), QString( "SMESHTransformationToolbar" ) ),
+ modifyTb = createTool( tr( "TB_MODIFY" ), QString( "SMESHModificationToolbar" ) ),
+ measuremTb = createTool( tr( "TB_MEASUREM" ), QString( "SMESHMeasurementsToolbar" ) ),
+ dispModeTb = createTool( tr( "TB_DISP_MODE" ), QString( "SMESHDisplayModeToolbar" ) );
+
+ createTool( SMESHOp::OpCreateMesh, meshTb );
+ createTool( SMESHOp::OpCreateSubMesh, meshTb );
+ createTool( SMESHOp::OpEditMeshOrSubMesh, meshTb );
+ createTool( SMESHOp::OpBuildCompoundMesh, meshTb );
+ createTool( SMESHOp::OpCopyMesh, meshTb );
+ createTool( separator(), meshTb );
+ createTool( SMESHOp::OpCompute, meshTb );
+ createTool( SMESHOp::OpPreCompute, meshTb );
+ createTool( SMESHOp::OpEvaluate, meshTb );
+ createTool( SMESHOp::OpMeshOrder, meshTb );
+
+ createTool( SMESHOp::OpCreateGroup, groupTb );
+ createTool( SMESHOp::OpCreateGeometryGroup, groupTb );
+ createTool( SMESHOp::OpConstructGroup, groupTb );
+ createTool( SMESHOp::OpEditGroup, groupTb );
+
+ createTool( SMESHOp::OpMeshInformation, info );
+ //createTool( SMESHOp::OpStdInfo, meshTb );
+ //createTool( SMESHOp::OpWhatIs, meshTb ); // VSR: issue #0021242 (eliminate "Mesh Element Information" command)
+ createTool( SMESHOp::OpFindElementByPoint, info );
+
+ createTool( SMESHOp::OpFreeNode, ctrl0dTb );
+ createTool( SMESHOp::OpEqualNode, ctrl0dTb );
+
+ createTool( SMESHOp::OpFreeBorder, ctrl1dTb );
+ createTool( SMESHOp::OpLength, ctrl1dTb );
+ createTool( SMESHOp::OpConnection, ctrl1dTb );
+ createTool( SMESHOp::OpEqualEdge, ctrl1dTb );
+
+ createTool( SMESHOp::OpFreeEdge, ctrl2dTb );
+ createTool( SMESHOp::OpFreeFace, ctrl2dTb );
+ createTool( SMESHOp::OpBareBorderFace, ctrl2dTb );
+ createTool( SMESHOp::OpOverConstrainedFace, ctrl2dTb );
+ createTool( SMESHOp::OpLength2D, ctrl2dTb );
+ createTool( SMESHOp::OpConnection2D, ctrl2dTb );
+ createTool( SMESHOp::OpArea, ctrl2dTb );
+ createTool( SMESHOp::OpTaper, ctrl2dTb );
+ createTool( SMESHOp::OpAspectRatio, ctrl2dTb );
+ createTool( SMESHOp::OpMinimumAngle, ctrl2dTb );
+ createTool( SMESHOp::OpWarpingAngle, ctrl2dTb );
+ createTool( SMESHOp::OpSkew, ctrl2dTb );
+ createTool( SMESHOp::OpMaxElementLength2D, ctrl2dTb );
+ createTool( SMESHOp::OpEqualFace, ctrl2dTb );
+
+ createTool( SMESHOp::OpAspectRatio3D, ctrl3dTb );
+ createTool( SMESHOp::OpVolume, ctrl3dTb );
+ createTool( SMESHOp::OpMaxElementLength3D, ctrl3dTb );
+ createTool( SMESHOp::OpBareBorderVolume, ctrl3dTb );
+ createTool( SMESHOp::OpOverConstrainedVolume, ctrl3dTb );
+ createTool( SMESHOp::OpEqualVolume, ctrl3dTb );
+
+ createTool( SMESHOp::OpNode, addElemTb );
+ createTool( SMESHOp::OpElem0D, addElemTb );
+ createTool( SMESHOp::OpElem0DOnElemNodes, addElemTb );
+ createTool( SMESHOp::OpBall, addElemTb );
+ createTool( SMESHOp::OpEdge, addElemTb );
+ createTool( SMESHOp::OpTriangle, addElemTb );
+ createTool( SMESHOp::OpQuadrangle, addElemTb );
+ createTool( SMESHOp::OpPolygon, addElemTb );
+ createTool( SMESHOp::OpTetrahedron, addElemTb );
+ createTool( SMESHOp::OpHexahedron, addElemTb );
+ createTool( SMESHOp::OpPentahedron, addElemTb );
+ createTool( SMESHOp::OpPyramid, addElemTb );
+ createTool( SMESHOp::OpHexagonalPrism, addElemTb );
+ createTool( SMESHOp::OpPolyhedron, addElemTb );
+
+ createTool( SMESHOp::OpQuadraticEdge, addNonElemTb );
+ createTool( SMESHOp::OpQuadraticTriangle, addNonElemTb );
+ createTool( SMESHOp::OpBiQuadraticTriangle, addNonElemTb );
+ createTool( SMESHOp::OpQuadraticQuadrangle, addNonElemTb );
+ createTool( SMESHOp::OpBiQuadraticQuadrangle, addNonElemTb );
+ createTool( SMESHOp::OpQuadraticPolygon, addNonElemTb );
+ createTool( SMESHOp::OpQuadraticTetrahedron, addNonElemTb );
+ createTool( SMESHOp::OpQuadraticPyramid, addNonElemTb );
+ createTool( SMESHOp::OpQuadraticPentahedron, addNonElemTb );
+ createTool( SMESHOp::OpQuadraticHexahedron, addNonElemTb );
+ createTool( SMESHOp::OpTriQuadraticHexahedron, addNonElemTb );
+
+ createTool( SMESHOp::OpRemoveNodes, remTb );
+ createTool( SMESHOp::OpRemoveElements, remTb );
+ createTool( SMESHOp::OpRemoveOrphanNodes, remTb );
+ createTool( SMESHOp::OpClearMesh, remTb );
+
+ //createTool( SMESHOp::OpRenumberingNodes, renumbTb );
+ //createTool( SMESHOp::OpRenumberingElements, renumbTb );
+
+ createTool( SMESHOp::OpTranslation, transformTb );
+ createTool( SMESHOp::OpRotation, transformTb );
+ createTool( SMESHOp::OpSymmetry, transformTb );
+ createTool( SMESHOp::OpScale, transformTb );
+ createTool( SMESHOp::OpSewing, transformTb );
+ createTool( SMESHOp::OpMergeNodes, transformTb );
+ createTool( SMESHOp::OpMergeElements, transformTb );
+ createTool( SMESHOp::OpDuplicateNodes, transformTb );
+
+ createTool( SMESHOp::OpMoveNode, modifyTb );
+ createTool( SMESHOp::OpDiagonalInversion, modifyTb );
+ createTool( SMESHOp::OpUnionOfTwoTriangle, modifyTb );
+ createTool( SMESHOp::OpOrientation, modifyTb );
+ createTool( SMESHOp::OpReorientFaces, modifyTb );
+ createTool( SMESHOp::OpUnionOfTriangles, modifyTb );
+ createTool( SMESHOp::OpCuttingOfQuadrangles, modifyTb );
+ createTool( SMESHOp::OpSplitVolumes, modifyTb );
+ createTool( SMESHOp::OpSplitBiQuadratic, modifyTb );
+ createTool( SMESHOp::OpSmoothing, modifyTb );
+ createTool( SMESHOp::OpExtrusion, modifyTb );
+ createTool( SMESHOp::OpExtrusionAlongAPath, modifyTb );
+ createTool( SMESHOp::OpRevolution, modifyTb );
+ createTool( SMESHOp::OpPatternMapping, modifyTb );
+ createTool( SMESHOp::OpConvertMeshToQuadratic, modifyTb );
+ createTool( SMESHOp::OpCreateBoundaryElements, modifyTb );
+
+ createTool( SMESHOp::OpMinimumDistance, measuremTb );
+
+ createTool( SMESHOp::OpUpdate, dispModeTb );
+
+ QString lc = "$"; // VSR : instead of QtxPopupSelection::defEquality();
+ 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;
+
+ // popup for object browser
+ QString
+ isInvisible("not( isVisible )"),
+ isEmpty("numberOfNodes = 0"),
+ isNotEmpty("numberOfNodes <> 0"),
+
+ // has nodes, edges, etc in VISIBLE! actor
+ hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"),
+ hasElems("(count( elemTypes ) > 0)"),
+ hasDifferentElems("(count( elemTypes ) > 1)"),
+ hasBalls("({'BallElem'} in elemTypes)"),
+ hasElems0d("({'Elem0d'} in elemTypes)"),
+ hasEdges("({'Edge'} in elemTypes)"),
+ hasFaces("({'Face'} in elemTypes)"),
+ 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::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 );
+ popupMgr()->insert( separator(), -1, 0 );
+ createPopupItem( SMESHOp::OpCreateGroup, OB, mesh );
+ createPopupItem( SMESHOp::OpCreateGeometryGroup, OB, mesh, "&& 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
+ 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");
+ popupMgr()->insert( separator(), -1, 0 );
+ createPopupItem( SMESHOp::OpClearMesh, OB, mesh );
+ 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 );
+ QString only_one_2D = only_one_non_empty + " && dim>1";
+
+ int anId = popupMgr()->insert( tr( "MEN_EXPORT" ), -1, -1 ); // EXPORT submenu
+ createPopupItem( SMESHOp::OpPopupExportMED, OB, mesh_group, multiple_non_empty, anId );
+ createPopupItem( SMESHOp::OpPopupExportUNV, OB, mesh_group, only_one_non_empty, anId );
+ createPopupItem( SMESHOp::OpPopupExportSTL, OB, mesh_group, only_one_2D, anId );
+#ifdef WITH_CGNS
+ createPopupItem( SMESHOp::OpPopupExportCGNS, OB, mesh_group, multiple_non_empty, anId );
+#endif
+ createPopupItem( SMESHOp::OpPopupExportSAUV, OB, mesh_group, only_one_non_empty, anId );
+ createPopupItem( SMESHOp::OpPopupExportGMF, OB, mesh_group, only_one_non_empty, anId );
+ createPopupItem( SMESHOp::OpPopupExportDAT, OB, mesh_group, only_one_non_empty, anId );
+ createPopupItem( SMESHOp::OpDelete, OB, mesh_part + " " + hyp_alg );
+ createPopupItem( SMESHOp::OpDeleteGroup, OB, group );
+ popupMgr()->insert( separator(), -1, 0 );
+
+ // popup for viewer
+ createPopupItem( SMESHOp::OpEditGroup, View, group );
+ createPopupItem( SMESHOp::OpAddElemGroupPopup, View, elems );
+ createPopupItem( SMESHOp::OpRemoveElemGroupPopup, View, elems );
+
+ popupMgr()->insert( separator(), -1, 0 );
+ createPopupItem( SMESHOp::OpUpdate, View, mesh_part );
+ createPopupItem( SMESHOp::OpMeshInformation, View, mesh_part );
+ createPopupItem( SMESHOp::OpOverallMeshQuality, View, mesh_part );
+ createPopupItem( SMESHOp::OpFindElementByPoint, View, mesh );
+ popupMgr()->insert( separator(), -1, 0 );
+
+ createPopupItem( SMESHOp::OpAutoColor, OB + " " + View, mesh, "&& (not isAutoColor)" );
+ createPopupItem( SMESHOp::OpDisableAutoColor, OB + " " + View, mesh, "&& isAutoColor" );
+ popupMgr()->insert( separator(), -1, 0 );
+
+ QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" );
+ QString aType = QString( "%1type in {%2}" ).arg( lc );
+ aType = aType.arg( mesh_part );
+ QString aMeshInVTK = aClient + "&&" + aType;
+
+ aClient = "($client in {'VTKViewer' 'ObjectBrowser'})";
+ QString anActiveVTK = QString("activeView = '%1'").arg(SVTK_Viewer::Type());
+ QString aSelCount = QString( "%1 > 0" ).arg( dc );
+
+ //-------------------------------------------------
+ // Numbering
+ //-------------------------------------------------
+ anId = popupMgr()->insert( tr( "MEN_NUM" ), -1, -1 );
+
+ popupMgr()->insert( action( SMESHOp::OpNumberingNodes ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpNumberingNodes ), aMeshInVTK + "&& isVisible &&" + hasNodes, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpNumberingNodes ), "{'Point'} in labeledTypes", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( action( SMESHOp::OpNumberingElements ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpNumberingElements ), aMeshInVTK + "&& isVisible &&" + hasElems, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpNumberingElements ), "{'Cell'} in labeledTypes", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( separator(), -1, -1 );
+
+ //-------------------------------------------------
+ // Display Mode
+ //-------------------------------------------------
+ anId = popupMgr()->insert( tr( "MEN_DISPMODE" ), -1, -1 );
+
+ popupMgr()->insert( action( SMESHOp::OpDMWireframe ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpDMWireframe ), aMeshInVTK + "&&" + hasElems, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpDMWireframe ), "displayMode = 'eEdge'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( action( SMESHOp::OpDMShading ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpDMShading ),aMeshInVTK+ "&& (" + hasFaces + "||" + hasVolumes + ")", QtxPopupMgr::VisibleRule);
+ 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 ), "displayMode = 'ePoint'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( separator(), anId, -1 );
+
+ popupMgr()->insert( action( SMESHOp::OpDMShrink ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpDMShrink ), aMeshInVTK + "&& shrinkMode <> 'IsNotShrinkable' && displayMode <> 'ePoint'", QtxPopupMgr::VisibleRule);
+ popupMgr()->setRule( action( SMESHOp::OpDMShrink ), "shrinkMode = 'IsShrunk'", QtxPopupMgr::ToggleRule );
+
+ //-------------------------------------------------
+ // Display Entity
+ //-------------------------------------------------
+ QString aDiffElemsInVTK = aMeshInVTK + "&&" + hasDifferentElems;
+
+ anId = popupMgr()->insert( tr( "MEN_DISP_ENT" ), -1, -1 );
+
+ popupMgr()->insert( action( SMESHOp::OpDE0DElements ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpDE0DElements ), aDiffElemsInVTK + "&& isVisible &&" + hasElems0d, QtxPopupMgr::VisibleRule);
+ popupMgr()->setRule( action( SMESHOp::OpDE0DElements ), "{'Elem0d'} in entityMode", QtxPopupMgr::ToggleRule);
+
+ popupMgr()->insert( action( SMESHOp::OpDEEdges ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpDEEdges ), aDiffElemsInVTK + "&& isVisible &&" + hasEdges, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpDEEdges ), "{'Edge'} in entityMode", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( action( SMESHOp::OpDEFaces ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpDEFaces ), aDiffElemsInVTK + "&& isVisible &&" + hasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpDEFaces ), "{'Face'} in entityMode", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( action( SMESHOp::OpDEVolumes ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpDEVolumes ), aDiffElemsInVTK + "&& isVisible &&" + hasVolumes, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpDEVolumes ), "{'Volume'} in entityMode", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( action( SMESHOp::OpDEBalls ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpDEBalls ), aDiffElemsInVTK + "&& isVisible &&" + hasBalls, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpDEBalls ), "{'BallElem'} in entityMode", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( separator(), anId, -1 );
+
+ popupMgr()->insert( action( SMESHOp::OpDEChoose ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpDEChoose ), aClient + "&&" + aType + "&&" + isNotEmpty, QtxPopupMgr::VisibleRule );
+
+ popupMgr()->insert( separator(), anId, -1 );
+
+ popupMgr()->insert( action( SMESHOp::OpDEAllEntity ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpDEAllEntity ), 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( SMESHOp::OpRepresentationLines ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpRepresentationLines ), aMeshInVTK + "&& isVisible && isQuadratic",QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpRepresentationLines ), "quadratic2DMode = 'eLines'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( action( SMESHOp::OpRepresentationArcs ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpRepresentationArcs ), aMeshInVTK + "&& isVisible && isQuadratic", QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpRepresentationArcs ), "quadratic2DMode = 'eArcs'", QtxPopupMgr::ToggleRule );
+
+ //-------------------------------------------------
+ // Orientation of faces
+ //-------------------------------------------------
+ popupMgr()->insert( action( SMESHOp::OpOrientationOnFaces ), -1, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpOrientationOnFaces ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule);
+ popupMgr()->setRule( action( SMESHOp::OpOrientationOnFaces ), "facesOrientationMode = 'IsOriented'", QtxPopupMgr::ToggleRule );
+
+ //-------------------------------------------------
+ // Color / Size
+ //-------------------------------------------------
+ popupMgr()->insert( action( SMESHOp::OpProperties ), -1, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpProperties ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule );
+
+ //-------------------------------------------------
+ // Transparency
+ //-------------------------------------------------
+ popupMgr()->insert( action( SMESHOp::OpTransparency ), -1, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpTransparency ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule );
+
+ //-------------------------------------------------
+ // Controls
+ //-------------------------------------------------
+ QString
+ aMeshInVtkHasNodes = aMeshInVTK + "&&" + hasNodes,
+ aMeshInVtkHasEdges = aMeshInVTK + "&&" + hasEdges,
+ aMeshInVtkHasFaces = aMeshInVTK + "&&" + hasFaces,
+ aMeshInVtkHasVolumes = aMeshInVTK + "&&" + hasVolumes;
+
+ anId = popupMgr()->insert( tr( "MEN_CTRL" ), -1, -1 );
+
+ popupMgr()->insert( action( SMESHOp::OpReset ), anId, -1 ); // RESET
+ popupMgr()->setRule( action( SMESHOp::OpReset ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
+
+ popupMgr()->insert( separator(), anId, -1 );
+
+ int aSubId = popupMgr()->insert( tr( "MEN_NODE_CTRL" ), anId, -1 ); // NODE CONTROLS
+
+ popupMgr()->insert( action( SMESHOp::OpFreeNode ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpFreeNode ), aMeshInVtkHasNodes, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpFreeNode ), "controlMode = 'eFreeNodes'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpEqualNode ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpEqualNode ), aMeshInVtkHasNodes, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpEqualNode ), "controlMode = 'eCoincidentNodes'", QtxPopupMgr::ToggleRule);
+
+ aSubId = popupMgr()->insert( tr( "MEN_EDGE_CTRL" ), anId, -1 ); // EDGE CONTROLS
+
+ popupMgr()->insert( action( SMESHOp::OpFreeBorder ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpFreeBorder ), aMeshInVTK + "&&" + hasEdges + "&&" + hasFacesOrVolumes, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpFreeBorder ), "controlMode = 'eFreeBorders'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( action( SMESHOp::OpLength ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpLength ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpLength ), "controlMode = 'eLength'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( action( SMESHOp::OpConnection ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpConnection ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpConnection ), "controlMode = 'eMultiConnection'", QtxPopupMgr::ToggleRule );
+ popupMgr()->insert ( action( SMESHOp::OpEqualEdge ), aSubId, -1 ); // EQUAL_EDGE
+ popupMgr()->setRule( action( SMESHOp::OpEqualEdge ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpEqualEdge ), "controlMode = 'eCoincidentElems1D'", QtxPopupMgr::ToggleRule);
+
+ aSubId = popupMgr()->insert( tr( "MEN_FACE_CTRL" ), anId, -1 ); // FACE CONTROLS
+
+ popupMgr()->insert( action( SMESHOp::OpFreeEdge ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpFreeEdge ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpFreeEdge ), "controlMode = 'eFreeEdges'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpFreeFace ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpFreeFace ), aMeshInVtkHasFaces /*aMeshInVtkHasVolumes*/,
+ QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpFreeFace ), "controlMode = 'eFreeFaces'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpLength2D ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpLength2D ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpLength2D ), "controlMode = 'eLength2D'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpConnection2D ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpConnection2D ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpConnection2D ), "controlMode = 'eMultiConnection2D'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpArea ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpArea ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpArea ), "controlMode = 'eArea'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpTaper ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpTaper ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpTaper ), "controlMode = 'eTaper'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpAspectRatio ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpAspectRatio ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpAspectRatio ), "controlMode = 'eAspectRatio'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpMinimumAngle ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpMinimumAngle ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpMinimumAngle ), "controlMode = 'eMinimumAngle'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpWarpingAngle ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpWarpingAngle ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpWarpingAngle ), "controlMode = 'eWarping'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpSkew ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpSkew ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpSkew ), "controlMode = 'eSkew'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpMaxElementLength2D ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpMaxElementLength2D ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpMaxElementLength2D ), "controlMode = 'eMaxElementLength2D'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpBareBorderFace ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpBareBorderFace ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpBareBorderFace ), "controlMode = 'eBareBorderFace'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpOverConstrainedFace ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpOverConstrainedFace ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpOverConstrainedFace ), "controlMode = 'eOverConstrainedFace'", QtxPopupMgr::ToggleRule );
+ popupMgr()->insert ( action( SMESHOp::OpEqualFace ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpEqualFace ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpEqualFace ), "controlMode = 'eCoincidentElems2D'", QtxPopupMgr::ToggleRule );
+
+ aSubId = popupMgr()->insert( tr( "MEN_VOLUME_CTRL" ), anId, -1 ); // VOLUME CONTROLS
+
+ popupMgr()->insert ( action( SMESHOp::OpAspectRatio3D ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpAspectRatio3D ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpAspectRatio3D ), "controlMode = 'eAspectRatio3D'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpVolume ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpVolume ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpVolume ), "controlMode = 'eVolume3D'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpMaxElementLength3D ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpMaxElementLength3D ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpMaxElementLength3D ), "controlMode = 'eMaxElementLength3D'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpBareBorderVolume ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpBareBorderVolume ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpBareBorderVolume ), "controlMode = 'eBareBorderVolume'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpOverConstrainedVolume ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpOverConstrainedVolume ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpOverConstrainedVolume ), "controlMode = 'eOverConstrainedVolume'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert ( action( SMESHOp::OpEqualVolume ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpEqualVolume ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpEqualVolume ), "controlMode = 'eCoincidentElems3D'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( separator(), anId, -1 );
+
+ popupMgr()->insert( action( SMESHOp::OpShowScalarBar ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpShowScalarBar ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpShowScalarBar ), aMeshInVTK + "&& controlMode <> 'eNone' && isScalarBarVisible", QtxPopupMgr::ToggleRule );
+ popupMgr()->insert( action( SMESHOp::OpScalarBarProperties ), anId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpScalarBarProperties ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
+
+ popupMgr()->insert( separator(), anId, -1 );
+
+ aSubId = popupMgr()->insert( tr( "MEN_DISTRIBUTION_CTRL" ), anId, -1 ); // NODE CONTROLS
+
+ popupMgr()->insert( action( SMESHOp::OpSaveDistribution ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpSaveDistribution ), aMeshInVTK + "&& isNumFunctor", QtxPopupMgr::VisibleRule );
+
+ popupMgr()->insert( action( SMESHOp::OpShowDistribution ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpShowDistribution ), aMeshInVTK + "&& isNumFunctor", QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( SMESHOp::OpShowDistribution ), aMeshInVTK + "&& isNumFunctor && isScalarBarVisible && isDistributionVisible", QtxPopupMgr::ToggleRule);
+
+#ifndef DISABLE_PLOT2DVIEWER
+ popupMgr()->insert( action( SMESHOp::OpPlotDistribution ), aSubId, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpPlotDistribution ), aMeshInVTK + "&& isNumFunctor", QtxPopupMgr::VisibleRule );
+#endif
+
+ //-------------------------------------------------
+ // Show / Hide
+ //-------------------------------------------------
+ popupMgr()->insert( separator(), -1, -1 );
+ QString aRule = "$component={'SMESH'} and ( type='Component' or (" + aClient + " and " +
+ aType + " and " + aSelCount + " and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )";
+ popupMgr()->insert( action( SMESHOp::OpShow ), -1, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpShow ), aRule.arg( "and (not isVisible)" ), QtxPopupMgr::VisibleRule );
+
+ popupMgr()->insert( action( SMESHOp::OpHide ), -1, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpHide ), aRule.arg( "and isVisible" ), QtxPopupMgr::VisibleRule );
+
+ popupMgr()->insert( action( SMESHOp::OpShowOnly ), -1, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpShowOnly ), aRule.arg( "" ), QtxPopupMgr::VisibleRule );
+
+ popupMgr()->insert( separator(), -1, -1 );
+
+ //-------------------------------------------------
+ // Clipping
+ //-------------------------------------------------
+ popupMgr()->insert( action( SMESHOp::OpClipping ), -1, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpClipping ), "client='VTKViewer'", QtxPopupMgr::VisibleRule );
+
+ popupMgr()->insert( separator(), -1, -1 );
+
+ popupMgr()->insert( action( SMESHOp::OpSortChild ), -1, -1 );
+ popupMgr()->setRule( action( SMESHOp::OpSortChild ), "$component={'SMESH'} and client='ObjectBrowser' and isContainer and nbChildren>1", QtxPopupMgr::VisibleRule );
+ popupMgr()->insert( separator(), -1, -1 );
+
+ connect( application(), SIGNAL( viewManagerActivated( SUIT_ViewManager* ) ),
+ this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
+
+ connect( application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
+ this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
+}
+
+//================================================================================
+/*!
+ * \brief Return true if SMESH or GEOM objects are selected.
+ * Is called form LightApp_Module::activateModule() which clear selection if
+ * not isSelectionCompatible()
+ */
+//================================================================================
+
+bool SMESHGUI::isSelectionCompatible()
+{
+ bool isCompatible = true;
+ SALOME_ListIO selected;
+ if ( LightApp_SelectionMgr *Sel = selectionMgr() )
+ Sel->selectedObjects( selected );
+
+ SALOME_ListIteratorOfListIO It( selected );
+ for ( ; isCompatible && It.More(); It.Next())
+ isCompatible =
+ ( strcmp("GEOM", It.Value()->getComponentDataType()) == 0 ) ||
+ ( strcmp("SMESH", It.Value()->getComponentDataType()) == 0 );
+
+ return isCompatible;
+}
+
+
+bool SMESHGUI::reusableOperation( const int id )
+{
+ // compute, evaluate and precompute are not reusable operations
+ return ( id == SMESHOp::OpCompute || id == SMESHOp::OpPreCompute || id == SMESHOp::OpEvaluate ) ? false : SalomeApp_Module::reusableOperation( id );
+}
+
+bool SMESHGUI::activateModule( SUIT_Study* study )
+{
+ bool res = SalomeApp_Module::activateModule( study );
+
+ setMenuShown( true );
+ setToolShown( true );
+
+ // import Python module that manages SMESH plugins (need to be here because SalomePyQt API uses active module)
+ PyGILState_STATE gstate = PyGILState_Ensure();
+ PyObject* pluginsmanager = PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
+ if ( !pluginsmanager ) {
+ PyErr_Print();
+ }
+ else {
+ PyObject* result = PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"smesh",tr("MEN_MESH").toUtf8().data(),tr("SMESH_PLUGINS_OTHER").toUtf8().data());
+ if ( !result )
+ PyErr_Print();
+ Py_XDECREF(result);
+ }
+ PyGILState_Release(gstate);
+ // end of SMESH plugins loading
+
+ // Reset actions accelerator keys
+ action(SMESHOp::OpDelete)->setEnabled(true); // Delete: Key_Delete
+
+ // 0020210. Make SMESH_Gen update meshes at switching GEOM->SMESH
+ GetSMESHGen()->SetCurrentStudy(SALOMEDS::Study::_nil());
+ if ( SalomeApp_Study* s = dynamic_cast<SalomeApp_Study*>( study )) {
+ if ( _PTR(Study) aStudy = s->studyDS() )
+ GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
+ }
+
+ // get all view currently opened in the study and connect their signals to
+ // the corresponding slots of the class.
+ SUIT_Desktop* aDesk = study->application()->desktop();
+ if ( aDesk ) {
+ QList<SUIT_ViewWindow*> wndList = aDesk->windows();
+ SUIT_ViewWindow* wnd;
+ foreach ( wnd, wndList )
+ connectView( wnd );
+ }
+
+ Py_XDECREF(pluginsmanager);
+ return res;
+}
+
+bool SMESHGUI::deactivateModule( SUIT_Study* study )
+{
+ setMenuShown( false );
+ setToolShown( false );
+
+ EmitSignalCloseAllDialogs();
+
+ // Unset actions accelerator keys
+ action(SMESHOp::OpDelete)->setEnabled(false); // Delete: Key_Delete
+
+ return SalomeApp_Module::deactivateModule( study );
+}
+
+void SMESHGUI::studyClosed( SUIT_Study* s )
+{
+ if( !s )
+ return;
+ SMESH::RemoveVisuData( s->id() );
+ SalomeApp_Module::studyClosed( s );
+}
+
+void SMESHGUI::OnGUIEvent()
+{
+ const QObject* obj = sender();
+ if ( !obj || !obj->inherits( "QAction" ) )
+ return;
+ int id = actionId((QAction*)obj);
+ if ( id != -1 )
+ OnGUIEvent( id );
+}
+
+SMESH::SMESH_Gen_var SMESHGUI::GetSMESHGen()
+{
+ _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
+ if ( CORBA::is_nil( myComponentSMESH ) )
+ {
+ SMESHGUI aGUI; //SRN BugID: IPAL9186: Create an instance of SMESHGUI to initialize myComponentSMESH
+ if ( aStudy )
+ aGUI.myComponentSMESH->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
+ return aGUI.myComponentSMESH;
+ }
+ if ( aStudy )
+ myComponentSMESH->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
+ return myComponentSMESH;
+}
+
+QString SMESHGUI::engineIOR() const
+{
+ CORBA::ORB_var anORB = getApp()->orb();
+ CORBA::String_var anIOR = anORB->object_to_string(GetSMESHGen());
+ return QString( anIOR.in() );
+}
+
+void SMESHGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
+{
+ SalomeApp_Module::contextMenuPopup( client, menu, title );
+ SALOME_ListIO lst;
+ selectionMgr()->selectedObjects( lst );
+ if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) {
+ Handle(SALOME_InteractiveObject) io = lst.First();
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
+ _PTR(Study) study = appStudy->studyDS();
+ _PTR(SObject) obj = study->FindObjectID( io->getEntry() );
+ if ( obj ) {
+ QString aName = QString( SMESH::fromUtf8(obj->GetName()) );
+ while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup
+ aName.remove( (aName.length() - 1), 1 );
+ title = aName;
+ }
+ }
+}
+
+LightApp_Selection* SMESHGUI::createSelection() const
+{
+ return new SMESHGUI_Selection();
+}
+
+void SMESHGUI::windows( QMap<int, int>& aMap ) const
+{
+ aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
+ aMap.insert( SalomeApp_Application::WT_NoteBook, Qt::LeftDockWidgetArea );
+#ifndef DISABLE_PYCONSOLE
+ aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
+#endif
+}
+
+void SMESHGUI::viewManagers( QStringList& list ) const
+{
+ list.append( SVTK_Viewer::Type() );
+}
+
+void SMESHGUI::onViewManagerActivated( SUIT_ViewManager* mgr )
+{
+ if ( dynamic_cast<SVTK_ViewManager*>( mgr ) ) {
+ SMESH::UpdateSelectionProp( this );
+
+ QVector<SUIT_ViewWindow*> aViews = mgr->getViews();
+ for(int i = 0; i < aViews.count() ; i++){
+ SUIT_ViewWindow *sf = aViews[i];
+ connectView( sf );
+ }
+ EmitSignalActivatedViewManager();
+ }
+}
+
+void SMESHGUI::onViewManagerRemoved( SUIT_ViewManager* theViewManager )
+{
+ if( theViewManager && theViewManager->getType() == SVTK_Viewer::Type() )
+ myClippingPlaneInfoMap.erase( theViewManager );
+}
+
+void SMESHGUI::addActorAsObserver( SMESH_Actor* theActor )
+{
+ theActor->AddObserver( SMESH::DeleteActorEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority );
+}
+
+void SMESHGUI::ProcessEvents( vtkObject* theObject,
+ unsigned long theEvent,
+ void* theClientData,
+ void* theCallData )
+{
+ if( SMESHGUI* aSMESHGUI = reinterpret_cast<SMESHGUI*>( theClientData ) ) {
+ if( theObject && (int) theEvent == SMESH::DeleteActorEvent ) {
+ if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( theObject ) ) {
+ SMESHGUI_ClippingPlaneInfoMap& aClippingPlaneInfoMap = aSMESHGUI->getClippingPlaneInfoMap();
+ SMESHGUI_ClippingPlaneInfoMap::iterator anIter1 = aClippingPlaneInfoMap.begin();
+ for( ; anIter1 != aClippingPlaneInfoMap.end(); anIter1++ ) {
+ SMESHGUI_ClippingPlaneInfoList& aClippingPlaneInfoList = anIter1->second;
+ SMESHGUI_ClippingPlaneInfoList::iterator anIter2 = aClippingPlaneInfoList.begin();
+ for( ; anIter2 != aClippingPlaneInfoList.end(); anIter2++ ) {
+ SMESH::ClippingPlaneInfo& aClippingPlaneInfo = *anIter2;
+ std::list<vtkActor*>& anActorList = aClippingPlaneInfo.ActorList;
+ SMESH::TActorList::iterator anIter3 = anActorList.begin();
+ for ( ; anIter3 != anActorList.end(); anIter3++ ) {
+ if( anActor == *anIter3 ) {
+ anActorList.erase( anIter3 );
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void SMESHGUI::createPreferences()
+{
+ // General tab ------------------------------------------------------------------------
+ int genTab = addPreference( tr( "PREF_TAB_GENERAL" ) );
+
+ int autoUpdate = addPreference( tr( "PREF_AUTO_UPDATE" ), genTab, LightApp_Preferences::Auto, "SMESH", "auto_update" );
+ setPreferenceProperty( autoUpdate, "columns", 2 );
+ int lim = addPreference( tr( "PREF_UPDATE_LIMIT" ), autoUpdate, LightApp_Preferences::IntSpin, "SMESH", "update_limit" );
+ setPreferenceProperty( lim, "min", 0 );
+ setPreferenceProperty( lim, "max", 100000000 );
+ setPreferenceProperty( lim, "step", 1000 );
+ 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" );
+ QStringList modes;
+ modes.append( tr("MEN_WIRE") );
+ modes.append( tr("MEN_SHADE") );
+ modes.append( tr("MEN_NODES") );
+ modes.append( tr("MEN_SHRINK") );
+ QList<QVariant> indices;
+ indices.append( 0 );
+ indices.append( 1 );
+ indices.append( 2 );
+ indices.append( 3 );
+ setPreferenceProperty( dispmode, "strings", modes );
+ setPreferenceProperty( dispmode, "indexes", indices );
+
+ int arcgroup = addPreference( tr( "QUADRATIC_REPRESENT_MODE_GROUP" ), genTab );
+ setPreferenceProperty( arcgroup, "columns", 2 );
+ int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), arcgroup, LightApp_Preferences::Selector, "SMESH", "quadratic_mode" );
+ QStringList quadraticModes;
+ quadraticModes.append(tr("MEN_LINE_REPRESENTATION"));
+ quadraticModes.append(tr("MEN_ARC_REPRESENTATION"));
+ 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" );
+ //addPreference( tr( "PREF_RENUMBER" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "renumbering" );
+
+ int computeGroup = addPreference( tr( "PREF_GROUP_COMPUTE" ), genTab );
+ setPreferenceProperty( computeGroup, "columns", 2 );
+ int notifyMode = addPreference( tr( "PREF_NOTIFY_MODE" ), computeGroup, LightApp_Preferences::Selector, "SMESH", "show_result_notification" );
+ modes.clear();
+ modes.append( tr( "PREF_NOTIFY_NEVER" ) );
+ modes.append( tr( "PREF_NOTIFY_ERROR" ) );
+ modes.append( tr( "PREF_NOTIFY_ALWAYS" ) );
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ indices.append( 2 );
+ setPreferenceProperty( notifyMode, "strings", modes );
+ setPreferenceProperty( notifyMode, "indexes", indices );
+
+ int infoGroup = addPreference( tr( "PREF_GROUP_INFO" ), genTab );
+ setPreferenceProperty( infoGroup, "columns", 2 );
+ int elemInfo = addPreference( tr( "PREF_ELEM_INFO" ), infoGroup, LightApp_Preferences::Selector, "SMESH", "mesh_elem_info" );
+ modes.clear();
+ modes.append( tr( "PREF_ELEM_INFO_SIMPLE" ) );
+ modes.append( tr( "PREF_ELEM_INFO_TREE" ) );
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ setPreferenceProperty( elemInfo, "strings", modes );
+ setPreferenceProperty( elemInfo, "indexes", indices );
+ int nodesLim = addPreference( tr( "PREF_GPP_NODES_LIMIT" ), infoGroup, LightApp_Preferences::IntSpin, "SMESH", "info_groups_nodes_limit" );
+ setPreferenceProperty( nodesLim, "min", 0 );
+ setPreferenceProperty( nodesLim, "max", 10000000 );
+ setPreferenceProperty( nodesLim, "step", 10000 );
+ setPreferenceProperty( nodesLim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) );
+ int ctrlLim = addPreference( tr( "PREF_CTRL_LIMIT" ), infoGroup, LightApp_Preferences::IntSpin, "SMESH", "info_controls_limit" );
+ setPreferenceProperty( ctrlLim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) );
+ setPreferenceProperty( ctrlLim, "min", 0 );
+ setPreferenceProperty( ctrlLim, "max", 10000000 );
+ setPreferenceProperty( ctrlLim, "step", 1000 );
+ addPreference( tr( "PREF_ELEM_INFO_GRP_DETAILS" ), infoGroup, LightApp_Preferences::Bool, "SMESH", "elem_info_grp_details" );
+ addPreference( tr( "PREF_DUMP_BASE_INFO" ), infoGroup, LightApp_Preferences::Bool, "SMESH", "info_dump_base" );
+ addPreference( tr( "PREF_DUMP_ELEM_INFO" ), infoGroup, LightApp_Preferences::Bool, "SMESH", "info_dump_elem" );
+ addPreference( tr( "PREF_DUMP_ADD_INFO" ), infoGroup, LightApp_Preferences::Bool, "SMESH", "info_dump_add" );
+ addPreference( tr( "PREF_DUMP_CTRL_INFO" ), infoGroup, LightApp_Preferences::Bool, "SMESH", "info_dump_ctrl" );
+
+ int segGroup = addPreference( tr( "PREF_GROUP_SEGMENT_LENGTH" ), genTab );
+ setPreferenceProperty( segGroup, "columns", 2 );
+ int segLen = addPreference( tr( "PREF_SEGMENT_LENGTH" ), segGroup, LightApp_Preferences::IntSpin,
+ "SMESH", "segmentation" );
+ setPreferenceProperty( segLen, "min", 1 );
+ setPreferenceProperty( segLen, "max", 10000000 );
+ int nbSeg = addPreference( tr( "PREF_NB_SEGMENTS" ), segGroup, LightApp_Preferences::IntSpin,
+ "SMESH", "nb_segments_per_edge" );
+ setPreferenceProperty( nbSeg, "min", 1 );
+ setPreferenceProperty( nbSeg, "max", 10000000 );
+
+ int loadGroup = addPreference( tr( "SMESH_PREF_MESH_LOADING" ), genTab );
+ addPreference( tr( "PREF_FORGET_MESH_AT_HYP_MODIF" ), loadGroup, LightApp_Preferences::Bool,
+ "SMESH", "forget_mesh_on_hyp_modif" );
+
+
+ // Quantities with individual precision settings
+ int precGroup = addPreference( tr( "SMESH_PREF_GROUP_PRECISION" ), genTab );
+ setPreferenceProperty( precGroup, "columns", 2 );
+
+ const int nbQuantities = 6;
+ int precs[nbQuantities], ii = 0;
+ precs[ii++] = addPreference( tr( "SMESH_PREF_length_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "length_precision" );
+ precs[ii++] = addPreference( tr( "SMESH_PREF_angle_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "angle_precision" );
+ precs[ii++] = addPreference( tr( "SMESH_PREF_len_tol_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "len_tol_precision" );
+ precs[ii++] = addPreference( tr( "SMESH_PREF_parametric_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "parametric_precision" );
+ precs[ii++] = addPreference( tr( "SMESH_PREF_area_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "area_precision" );
+ precs[ii ] = addPreference( tr( "SMESH_PREF_vol_precision" ), precGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "vol_precision" );
+
+ // Set property for precision value for spinboxes
+ for ( ii = 0; ii < nbQuantities; ii++ ){
+ setPreferenceProperty( precs[ii], "min", -14 );
+ setPreferenceProperty( precs[ii], "max", 14 );
+ setPreferenceProperty( precs[ii], "precision", 2 );
+ }
+
+ int previewGroup = addPreference( tr( "SMESH_PREF_GROUP_PREVIEW" ), genTab );
+ setPreferenceProperty( previewGroup, "columns", 2 );
+ int chunkSize = addPreference( tr( "PREF_PREVIEW_CHUNK_SIZE" ), previewGroup, LightApp_Preferences::IntSpin, "SMESH", "preview_actor_chunk_size" );
+ setPreferenceProperty( chunkSize, "min", 1 );
+ setPreferenceProperty( chunkSize, "max", 1000 );
+ setPreferenceProperty( chunkSize, "step", 50 );
+
+ int pyDumpGroup = addPreference( tr( "PREF_PYTHON_DUMP" ), genTab );
+ addPreference( tr( "PREF_HISTORICAL_PYTHON_DUMP" ), pyDumpGroup, LightApp_Preferences::Bool, "SMESH", "historical_python_dump" );
+
+ // Mesh tab ------------------------------------------------------------------------
+ int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
+ int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab );
+ setPreferenceProperty( nodeGroup, "columns", 3 );
+
+ addPreference( tr( "PREF_COLOR" ), nodeGroup, LightApp_Preferences::Color, "SMESH", "node_color" );
+
+ int typeOfMarker = addPreference( tr( "PREF_TYPE_OF_MARKER" ), nodeGroup, LightApp_Preferences::Selector, "SMESH", "type_of_marker" );
+
+ SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
+ QList<QVariant> aMarkerTypeIndicesList;
+ QList<QVariant> aMarkerTypeIconsList;
+ for ( int i = VTK::MT_POINT; i < VTK::MT_USER; i++ ) {
+ QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
+ QPixmap pixmap = aResourceMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) );
+ aMarkerTypeIndicesList << i;
+ aMarkerTypeIconsList << pixmap;
+ }
+ setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
+ setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
+
+ int markerScale = addPreference( tr( "PREF_MARKER_SCALE" ), nodeGroup, LightApp_Preferences::Selector, "SMESH", "marker_scale" );
+
+ QList<QVariant> aMarkerScaleIndicesList;
+ QStringList aMarkerScaleValuesList;
+ for ( int i = VTK::MS_10; i <= VTK::MS_70; i++ ) {
+ aMarkerScaleIndicesList << i;
+ aMarkerScaleValuesList << QString::number( (i-(int)VTK::MS_10)*0.5 + 1.0 );
+ }
+ setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
+ setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
+
+ int elemGroup = addPreference( tr( "PREF_GROUP_ELEMENTS" ), meshTab );
+ //setPreferenceProperty( elemGroup, "columns", 2 );
+
+ int ColorId = addPreference( tr( "PREF_FILL" ), elemGroup, LightApp_Preferences::BiColor, "SMESH", "fill_color" );
+ setPreferenceProperty( ColorId, "text", tr("PREF_BACKFACE") );
+ ColorId = addPreference( tr( "PREF_VOLUME" ), elemGroup, LightApp_Preferences::BiColor, "SMESH", "volume_color" );
+ setPreferenceProperty( ColorId, "text", tr("PREF_REVERSEDVOLUME") );
+ addPreference( tr( "PREF_COLOR_0D" ), elemGroup, LightApp_Preferences::Color, "SMESH", "elem0d_color" );
+ addPreference( tr( "PREF_BALL_COLOR" ), elemGroup, LightApp_Preferences::Color, "SMESH", "ball_elem_color" );
+ addPreference( tr( "PREF_OUTLINE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "outline_color" );
+ addPreference( tr( "PREF_WIREFRAME" ), elemGroup, LightApp_Preferences::Color, "SMESH", "wireframe_color" );
+ addPreference( tr( "PREF_PREVIEW_COLOR" ), elemGroup, LightApp_Preferences::BiColor, "SMESH", "preview_color" );
+
+
+ int grpGroup = addPreference( tr( "PREF_GROUP_GROUPS" ), meshTab );
+ setPreferenceProperty( grpGroup, "columns", 2 );
+
+ addPreference( tr( "PREF_GRP_NAMES" ), grpGroup, LightApp_Preferences::Color, "SMESH", "group_name_color" );
+ addPreference( tr( "PREF_GRP_DEF_COLOR" ), grpGroup, LightApp_Preferences::Color, "SMESH", "default_grp_color" );
+
+ int size0d = addPreference(tr("PREF_SIZE_0D"), elemGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "elem0d_size");
+ /* int ballSize = addPreference(tr("PREF_BALL_SIZE"), elemGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "ball_elem_size"); */
+ double ballDiameter = addPreference(tr("PREF_BALL_DIAMETER"), elemGroup,
+ LightApp_Preferences::DblSpin, "SMESH", "ball_elem_diameter");
+ double ballScale = addPreference(tr("PREF_BALL_SCALE"), elemGroup,
+ LightApp_Preferences::DblSpin, "SMESH", "ball_elem_scale");
+ int elemW = addPreference(tr("PREF_WIDTH"), elemGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "element_width");
+ int outW = addPreference(tr("PREF_OUTLINE_WIDTH"), elemGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "outline_width");
+ int shrink = addPreference(tr("PREF_SHRINK_COEFF"), elemGroup,
+ LightApp_Preferences::IntSpin, "SMESH", "shrink_coeff");
+
+ setPreferenceProperty( size0d, "min", 1 );
+ setPreferenceProperty( size0d, "max", 10 );
+
+ // setPreferenceProperty( ballSize, "min", 1 );
+ // setPreferenceProperty( ballSize, "max", 10 );
+
+ setPreferenceProperty( ballDiameter, "min", 1e-7 );
+ setPreferenceProperty( ballDiameter, "max", 1e9 );
+ setPreferenceProperty( ballDiameter, "step", 0.1 );
+
+ setPreferenceProperty( ballScale, "min", 1e-2 );
+ setPreferenceProperty( ballScale, "max", 1e7 );
+ setPreferenceProperty( ballScale, "step", 0.5 );
+
+ setPreferenceProperty( elemW, "min", 1 );
+ setPreferenceProperty( elemW, "max", 5 );
+
+ setPreferenceProperty( outW, "min", 1 );
+ setPreferenceProperty( outW, "max", 5 );
+
+ setPreferenceProperty( shrink, "min", 0 );
+ setPreferenceProperty( shrink, "max", 100 );
+
+ int numGroup = addPreference( tr( "PREF_GROUP_NUMBERING" ), meshTab );
+ setPreferenceProperty( numGroup, "columns", 2 );
+
+ addPreference( tr( "PREF_NUMBERING_NODE" ), numGroup, LightApp_Preferences::Color, "SMESH", "numbering_node_color" );
+ addVtkFontPref( tr( "PREF_NUMBERING_FONT" ), numGroup, "numbering_node_font", true );
+
+ addPreference( tr( "PREF_NUMBERING_ELEM" ), numGroup, LightApp_Preferences::Color, "SMESH", "numbering_elem_color" );
+ addVtkFontPref( tr( "PREF_NUMBERING_FONT" ), numGroup, "numbering_elem_font", true );
+
+ int orientGroup = addPreference( tr( "PREF_GROUP_FACES_ORIENTATION" ), meshTab );
+ setPreferenceProperty( orientGroup, "columns", 1 );
+
+ addPreference( tr( "PREF_ORIENTATION_COLOR" ), orientGroup, LightApp_Preferences::Color, "SMESH", "orientation_color" );
+ int orientScale = addPreference( tr( "PREF_ORIENTATION_SCALE" ), orientGroup, LightApp_Preferences::DblSpin, "SMESH", "orientation_scale" );
+
+ setPreferenceProperty( orientScale, "min", 0.05 );
+ setPreferenceProperty( orientScale, "max", 0.5 );
+ setPreferenceProperty( orientScale, "step", 0.05 );
+
+ addPreference( tr( "PREF_ORIENTATION_3D_VECTORS" ), orientGroup, LightApp_Preferences::Bool, "SMESH", "orientation_3d_vectors" );
+
+ // Selection tab ------------------------------------------------------------------------
+ int selTab = addPreference( tr( "PREF_TAB_SELECTION" ) );
+
+ int selGroup = addPreference( tr( "PREF_GROUP_SELECTION" ), selTab );
+ setPreferenceProperty( selGroup, "columns", 2 );
+
+ addPreference( tr( "PREF_OBJECT_COLOR" ), selGroup, LightApp_Preferences::Color, "SMESH", "selection_object_color" );
+ addPreference( tr( "PREF_ELEMENT_COLOR" ), selGroup, LightApp_Preferences::Color, "SMESH", "selection_element_color" );
+
+ int preGroup = addPreference( tr( "PREF_GROUP_PRESELECTION" ), selTab );
+ setPreferenceProperty( preGroup, "columns", 2 );
+
+ addPreference( tr( "PREF_HIGHLIGHT_COLOR" ), preGroup, LightApp_Preferences::Color, "SMESH", "highlight_color" );
+
+ int precSelGroup = addPreference( tr( "PREF_GROUP_PRECISION" ), selTab );
+ setPreferenceProperty( precSelGroup, "columns", 2 );
+
+ 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" );
+
+ // Scalar Bar tab ------------------------------------------------------------------------
+ int sbarTab = addPreference( tr( "SMESH_SCALARBAR" ) );
+ int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab );
+ setPreferenceProperty( fontGr, "columns", 2 );
+
+ addVtkFontPref( tr( "SMESH_TITLE" ), fontGr, "scalar_bar_title_font" );
+ addPreference( tr( "PREF_TITLE_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_title_color" );
+
+ addVtkFontPref( tr( "SMESH_LABELS" ), fontGr, "scalar_bar_label_font" );
+ addPreference( tr( "PREF_LABELS_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_label_color" );
+
+ int colorsLabelsGr = addPreference( tr( "SMESH_LABELS_COLORS_SCALARBAR" ), sbarTab );
+ setPreferenceProperty( colorsLabelsGr, "columns", 2 );
+
+ int numcol = addPreference( tr( "SMESH_NUMBEROFCOLORS" ), colorsLabelsGr, LightApp_Preferences::IntSpin, "SMESH", "scalar_bar_num_colors" );
+ setPreferenceProperty( numcol, "min", 2 );
+ setPreferenceProperty( numcol, "max", 256 );
+
+ int numlab = addPreference( tr( "SMESH_NUMBEROFLABELS" ), colorsLabelsGr, LightApp_Preferences::IntSpin, "SMESH", "scalar_bar_num_labels" );
+ setPreferenceProperty( numlab, "min", 2 );
+ setPreferenceProperty( numlab, "max", 65 );
+
+ int orientGr = addPreference( tr( "SMESH_ORIENTATION" ), sbarTab );
+ setPreferenceProperty( orientGr, "columns", 2 );
+ int orient = addPreference( tr( "SMESH_ORIENTATION" ), orientGr, LightApp_Preferences::Selector, "SMESH", "scalar_bar_orientation" );
+ QStringList orients;
+ orients.append( tr( "SMESH_VERTICAL" ) );
+ orients.append( tr( "SMESH_HORIZONTAL" ) );
+ indices.clear(); indices.append( 0 ); indices.append( 1 );
+ setPreferenceProperty( orient, "strings", orients );
+ setPreferenceProperty( orient, "indexes", indices );
+
+ int posVSizeGr = addPreference( tr( "SMESH_POSITION_SIZE_SCALARBAR" ) + " " + tr( "SMESH_VERTICAL" ), sbarTab );
+ setPreferenceProperty( posVSizeGr, "columns", 2 );
+ int xv = addPreference( tr( "SMESH_X_SCALARBAR" ), posVSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_x" );
+ int yv = addPreference( tr( "SMESH_Y_SCALARBAR" ), posVSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_y" );
+ int wv = addPreference( tr( "SMESH_WIDTH" ), posVSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_width" );
+ int hv = addPreference( tr( "SMESH_HEIGHT" ), posVSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_height" );
+ setPreferenceProperty( xv, "step", 0.1 );
+ setPreferenceProperty( xv, "min", 0.0 );
+ setPreferenceProperty( xv, "max", 1.0 );
+ setPreferenceProperty( yv, "step", 0.1 );
+ setPreferenceProperty( yv, "min", 0.0 );
+ setPreferenceProperty( yv, "max", 1.0 );
+ setPreferenceProperty( wv, "step", 0.1 );
+ setPreferenceProperty( wv, "min", 0.0 );
+ setPreferenceProperty( wv, "max", 1.0 );
+ setPreferenceProperty( hv, "min", 0.0 );
+ setPreferenceProperty( hv, "max", 1.0 );
+ setPreferenceProperty( hv, "step", 0.1 );
+
+ int posHSizeGr = addPreference( tr( "SMESH_POSITION_SIZE_SCALARBAR" ) + " " + tr( "SMESH_HORIZONTAL" ), sbarTab );
+ setPreferenceProperty( posHSizeGr, "columns", 2 );
+ int xh = addPreference( tr( "SMESH_X_SCALARBAR" ), posHSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_x" );
+ int yh = addPreference( tr( "SMESH_Y_SCALARBAR" ), posHSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_y" );
+ int wh = addPreference( tr( "SMESH_WIDTH" ), posHSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_width" );
+ int hh = addPreference( tr( "SMESH_HEIGHT" ), posHSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_height" );
+ setPreferenceProperty( xv, "min", 0.0 );
+ setPreferenceProperty( xv, "max", 1.0 );
+ setPreferenceProperty( xv, "step", 0.1 );
+ setPreferenceProperty( xh, "min", 0.0 );
+ setPreferenceProperty( xh, "max", 1.0 );
+ setPreferenceProperty( xh, "step", 0.1 );
+ setPreferenceProperty( yh, "min", 0.0 );
+ setPreferenceProperty( yh, "max", 1.0 );
+ setPreferenceProperty( yh, "step", 0.1 );
+ setPreferenceProperty( wh, "min", 0.0 );
+ setPreferenceProperty( wh, "max", 1.0 );
+ setPreferenceProperty( wh, "step", 0.1 );
+ setPreferenceProperty( hh, "min", 0.0 );
+ setPreferenceProperty( hh, "max", 1.0 );
+ setPreferenceProperty( hh, "step", 0.1 );
+
+ int distributionGr = addPreference( tr( "SMESH_DISTRIBUTION_SCALARBAR" ), sbarTab, LightApp_Preferences::Auto, "SMESH", "distribution_visibility" );
+ int coloringType = addPreference( tr( "SMESH_DISTRIBUTION_COLORING_TYPE" ), distributionGr, LightApp_Preferences::Selector, "SMESH", "distribution_coloring_type" );
+ setPreferenceProperty( distributionGr, "columns", 3 );
+ QStringList types;
+ types.append( tr( "SMESH_MONOCOLOR" ) );
+ types.append( tr( "SMESH_MULTICOLOR" ) );
+ indices.clear(); indices.append( 0 ); indices.append( 1 );
+ setPreferenceProperty( coloringType, "strings", types );
+ setPreferenceProperty( coloringType, "indexes", indices );
+ addPreference( tr( "SMESH_DISTRIBUTION_COLOR" ), distributionGr, LightApp_Preferences::Color, "SMESH", "distribution_color" );
+
+}
+
+void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
+{
+ if ( sect=="SMESH" ) {
+ float sbX1 = 0.01, sbY1 = 0.01, sbW = 0.08, sbH = 0.08;
+ float aTol = 1.00000009999999;
+ std::string aWarning;
+ SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
+
+ if ( name== "selection_object_color" ||
+ name=="selection_element_color" ||
+ name== "highlight_color" ||
+ name=="selection_precision_node" ||
+ name=="selection_precision_element" ||
+ name=="selection_precision_object" )
+ {
+ SMESH::UpdateSelectionProp( this );
+ }
+ else if (name == "scalar_bar_vertical_x" || name == "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";
+ sbX1 = 0.01;
+ sbW = 0.08;
+ aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1);
+ aResourceMgr->setValue("SMESH", "scalar_bar_vertical_width", sbW);
+ }
+ }
+ else if (name == "scalar_bar_vertical_y" || name == "scalar_bar_vertical_height" )
+ {
+ sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_y", sbY1);
+ sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_height",sbH);
+ if ( sbY1 + sbH > aTol ) {
+ aWarning = "Origin and Size Vertical: Y+Height > 1\n";
+ aResourceMgr->setValue("SMESH", "scalar_bar_vertical_y", sbY1);
+ aResourceMgr->setValue("SMESH", "scalar_bar_vertical_height",sbH);
+ }
+ }
+ else if (name == "scalar_bar_horizontal_x" || name == "scalar_bar_horizontal_width")
+ {
+ sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_x", sbX1);
+ sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_width", sbW);
+ if ( sbX1 + sbW > aTol ) {
+ aWarning = "Origin and Size Horizontal: X+Width > 1\n";
+ sbX1=0.1;
+ sbW =0.08;
+ aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_x", sbX1);
+ aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_width", sbW);
+ }
+ }
+ else if (name == "scalar_bar_horizontal_y" || name == "scalar_bar_horizontal_height")
+ {
+ sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_y", sbY1);
+ sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_height",sbH);
+ if ( sbY1 + sbH > aTol ) {
+ aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
+ sbY1=0.01;
+ sbH =0.08;
+ aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_y", sbY1);
+ aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH);
+ }
+ }
+ else if ( name == "segmentation" )
+ {
+ int nbSeg = aResourceMgr->integerValue( "SMESH", "segmentation", 10 );
+ myComponentSMESH->SetBoundaryBoxSegmentation( nbSeg );
+ }
+ else if ( name == "nb_segments_per_edge" )
+ {
+ int nbSeg = aResourceMgr->integerValue( "SMESH", "nb_segments_per_edge", 15 );
+ myComponentSMESH->SetDefaultNbSegments( nbSeg );
+ }
+ else if ( name == "historical_python_dump" || name == "forget_mesh_on_hyp_modif" || name == "default_grp_color" )
+ {
+ QString val = aResourceMgr->stringValue( "SMESH", name );
+ myComponentSMESH->SetOption( name.toLatin1().constData(), val.toLatin1().constData() );
+ }
+ else if ( name == "numbering_node_color" || name == "numbering_node_font" )
+ {
+ SMESH::UpdateFontProp( this );
+ }
+ else if ( name == "numbering_elem_color" || name == "numbering_elem_font" )
+ {
+ SMESH::UpdateFontProp( this );
+ }
+
+ if ( aWarning.size() != 0 ) {
+ aWarning += "The default values are applied instead.";
+ SUIT_MessageBox::warning(SMESHGUI::desktop(),
+ QObject::tr("SMESH_ERR_SCALARBAR_PARAMS"),
+ QObject::tr(aWarning.c_str()));
+ }
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Update something in accordance with update flags
+ * \param theFlags - update flags
+*
+* Update viewer or/and object browser etc. in accordance with update flags ( see
+* LightApp_UpdateFlags enumeration ).
+*/
+//================================================================================
+void SMESHGUI::update( const int flags )
+{
+ if ( (flags & UF_Viewer) | (flags & UF_Forced) )
+ SMESH::UpdateView();
+ else
+ SalomeApp_Module::update( flags );
+}
+
+//================================================================================
+/*!
+ * \brief Set default selection mode
+*
+* SLOT called when operation commited. Sets default selection mode
+*/
+//================================================================================
+void SMESHGUI::onOperationCommited( SUIT_Operation* )
+{
+ SVTK_ViewWindow* vtkWnd =
+ dynamic_cast<SVTK_ViewWindow*>( application()->desktop()->activeWindow() );
+ if ( vtkWnd )
+ vtkWnd->SetSelectionMode( ActorSelection );
+}
+
+//================================================================================
+/*!
+ * \brief Set default selection mode
+*
+* SLOT called when operation aborted. Sets default selection mode
+*/
+//================================================================================
+void SMESHGUI::onOperationAborted( SUIT_Operation* )
+{
+ SVTK_ViewWindow* vtkWnd =
+ dynamic_cast<SVTK_ViewWindow*>( application()->desktop()->activeWindow() );
+ if ( vtkWnd )
+ vtkWnd->SetSelectionMode( ActorSelection );
+}
+
+//================================================================================
+/*!
+ * \brief Creates operation with given identifier
+ * \param id - identifier of operation to be started
+ * \return Pointer on created operation or NULL if operation is not created
+*
+* Virtual method redefined from the base class creates operation with given id.
+* It is called called automatically from startOperation method of base class.
+*/
+//================================================================================
+LightApp_Operation* SMESHGUI::createOperation( const int id ) const
+{
+ LightApp_Operation* op = 0;
+ // to do : create operation here
+ switch( id )
+ {
+ case SMESHOp::OpSplitBiQuadratic:
+ op = new SMESHGUI_SplitBiQuadOp();
+ break;
+ case SMESHOp::OpConvertMeshToQuadratic:
+ op = new SMESHGUI_ConvToQuadOp();
+ break;
+ case SMESHOp::OpCreateBoundaryElements: // create 2D mesh as boundary on 3D
+ op = new SMESHGUI_Make2DFrom3DOp();
+ break;
+ case SMESHOp::OpReorientFaces:
+ op = new SMESHGUI_ReorientFacesOp();
+ break;
+ case SMESHOp::OpCreateMesh:
+ op = new SMESHGUI_MeshOp( true, true );
+ break;
+ case SMESHOp::OpCreateSubMesh:
+ op = new SMESHGUI_MeshOp( true, false );
+ break;
+ case SMESHOp::OpEditMeshOrSubMesh:
+ op = new SMESHGUI_MeshOp( false );
+ break;
+ case SMESHOp::OpCompute:
+ op = new SMESHGUI_ComputeOp();
+ break;
+ case SMESHOp::OpPreCompute:
+ op = new SMESHGUI_PrecomputeOp();
+ break;
+ case SMESHOp::OpEvaluate:
+ op = new SMESHGUI_EvaluateOp();
+ break;
+ case SMESHOp::OpMeshOrder:
+ op = new SMESHGUI_MeshOrderOp();
+ break;
+ case SMESHOp::OpCreateGeometryGroup:
+ op = new SMESHGUI_GroupOnShapeOp();
+ break;
+ case SMESHOp::OpFindElementByPoint:
+ op = new SMESHGUI_FindElemByPointOp();
+ break;
+ case SMESHOp::OpMoveNode: // Make mesh pass through point
+ op = new SMESHGUI_MakeNodeAtPointOp();
+ break;
+ case SMESHOp::OpElem0DOnElemNodes: // Create 0D elements on all nodes
+ op = new SMESHGUI_Add0DElemsOnAllNodesOp();
+ break;
+ default:
+ break;
+ }
+
+ if( !op )
+ op = SalomeApp_Module::createOperation( id );
+ return op;
+}
+
+//================================================================================
+/*!
+ * \brief Stops current operations and starts a given one
+ * \param id - The id of the operation to start
+ */
+//================================================================================
+
+void SMESHGUI::switchToOperation(int id)
+{
+ if ( _PTR(Study) aStudy = SMESH::GetActiveStudyDocument() )
+ activeStudy()->abortAllOperations();
+ startOperation( id );
+}
+
+LightApp_Displayer* SMESHGUI::displayer()
+{
+ if( !myDisplayer )
+ myDisplayer = new SMESHGUI_Displayer( getApp() );
+ return myDisplayer;
+}
+
+SALOMEDS::Color SMESHGUI::getUniqueColor( const QList<SALOMEDS::Color>& theReservedColors )
+{
+ int aHue = -1;
+ int aTolerance = 64;
+ int anIterations = 0;
+ int aPeriod = 5;