+ QIconSet icon;
+ QWidget* parent = application()->desktop();
+ SUIT_ResourceMgr* resMgr = resourceMgr();
+ QPixmap pix;
+ if ( icon_id.length() )
+ pix = resMgr->loadPixmap( "SMESH", tr( icon_id ) );
+ else
+ pix = resMgr->loadPixmap( "SMESH", tr( QString( "ICO_" )+po_id ) );
+ if ( !pix.isNull() )
+ icon = QIconSet( pix );
+
+ QString tooltip = tr( QString( "TOP_" )+po_id ),
+ menu = tr( QString( "MEN_" )+po_id ),
+ status_bar = tr( QString( "STB_" )+po_id );
+
+ createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() ) );
+}
+
+//=======================================================================
+// function : createPopupItem
+// purpose :
+//=======================================================================
+void SMESHGUI::createPopupItem( const int id,
+ const QString& clients,
+ const QString& types,
+ const QString& theRule,
+ const int pId )
+{
+ int parentId = pId;
+ if( pId!=-1 )
+ parentId = popupMgr()->actionId( action( pId ) );
+
+ if( !popupMgr()->contains( popupMgr()->actionId( action( id ) ) ) )
+ popupMgr()->insert( action( id ), parentId, 0 );
+
+ QChar lc = QtxPopupMgr::Selection::defEquality();
+ QString rule = "(%1) and (%2) and (%3)";
+ rule = rule.arg( QString( "%1>0" ).arg( QtxPopupMgr::Selection::defSelCountParam() ) );
+ 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, true );
+ myRules[ id ] = QString( cont ? "%1" : "(%1)" ).arg( rule );
+}
+
+//=======================================================================
+// function : initialize
+// purpose :
+//=======================================================================
+void SMESHGUI::initialize( CAM_Application* app )
+{
+ SalomeApp_Module::initialize( app );
+
+ // ----- create actions --------------
+
+ createSMESHAction( 111, "DAT", "", (CTRL+Key_B) );
+ createSMESHAction( 112, "UNV", "", (CTRL+Key_U) );
+ createSMESHAction( 113, "MED", "", (CTRL+Key_M) );
+ createSMESHAction( 114, "NUM" );
+ createSMESHAction( 121, "DAT" );
+ createSMESHAction( 122, "MED" );
+ createSMESHAction( 123, "UNV" );
+ createSMESHAction( 124, "EXPORT_DAT" );
+ createSMESHAction( 125, "EXPORT_MED" );
+ createSMESHAction( 126, "EXPORT_UNV" );
+ createSMESHAction( 33, "DELETE", "ICON_DELETE" );
+ createSMESHAction( 5105, "SEL_FILTER_LIB" );
+ createSMESHAction( 5000, "CREATE_HYPO", "ICON_HYPO" );
+ createSMESHAction( 5010, "CREATE_ALG", "ICON_PATTERN_2d" );
+ createSMESHAction( 701, "COMPUTE", "ICON_COMPUTE" );
+ createSMESHAction( 702, "LOCAL_HYPO", "ICON_DLG_ADD_SUBMESH" );
+ createSMESHAction( 703, "GLOBAL_HYPO", "ICON_DLG_INIT_MESH" );
+ createSMESHAction( 704, "EDIT_HYPO", "ICON_DLG_EDIT_MESH" );
+ createSMESHAction( 705, "EDIT_GLOBAL_HYPO","ICON_DLG_EDIT_MESH" );
+ createSMESHAction( 706, "EDIT_LOCAL_HYPO", "ICON_DLG_EDIT_MESH" );
+ createSMESHAction( 801, "CREATE_GROUP", "ICON_SMESH_TREE_GROUP" );
+ createSMESHAction( 802, "CONSTRUCT_GROUP", "ICON_CONSTRUCT_GROUP" );
+ createSMESHAction( 803, "EDIT_GROUP", "ICON_EDIT_GROUP" );
+ createSMESHAction( 804, "ADD" );
+ createSMESHAction( 805, "REMOVE" );
+ createSMESHAction( 810, "UN_GROUP", "ICON_UNION" );
+ createSMESHAction( 811, "INT_GROUP", "ICON_INTERSECT" );
+ createSMESHAction( 812, "CUT_GROUP", "ICON_CUT" );
+ createSMESHAction( 813, "DEL_GROUP", "ICON_DEL_GROUP" );
+ createSMESHAction( 900, "ADV_INFO", "ICON_ADV_INFO" );
+ createSMESHAction( 902, "STD_INFO", "ICON_STD_INFO" );
+ createSMESHAction( 6001, "LENGTH", "ICON_LENGTH" , 0, true );
+ createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE" , 0, true );
+ createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D" , 0, true );
+ createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION" , 0, true );
+ createSMESHAction( 6011, "AREA", "ICON_AREA" , 0, true );
+ createSMESHAction( 6012, "TAPER", "ICON_TAPER" , 0, true );
+ createSMESHAction( 6013, "ASPECT", "ICON_ASPECT" , 0, true );
+ createSMESHAction( 6014, "MIN_ANG", "ICON_ANGLE" , 0, true );
+ createSMESHAction( 6015, "WRAP", "ICON_WRAP" , 0, true );
+ createSMESHAction( 6016, "SKEW", "ICON_SKEW", 0, true );
+ createSMESHAction( 6017, "ASPECT_3D", "ICON_ASPECT_3D", 0, true );
+ createSMESHAction( 6018, "LENGTH_2D", "ICON_LENGTH_2D", 0, true );
+ createSMESHAction( 6019, "CONNECTION_2D", "ICON_CONNECTION_2D", 0, true );
+ createSMESHAction( 400, "NODE", "ICON_DLG_NODE" );
+ createSMESHAction( 401, "EDGE", "ICON_DLG_EDGE" );
+ createSMESHAction( 4021, "TRIANGLE", "ICON_DLG_TRIANGLE" );
+ createSMESHAction( 4022, "QUAD", "ICON_DLG_QUADRANGLE" );
+ createSMESHAction( 4031, "TETRA", "ICON_DLG_TETRAS" );
+ createSMESHAction( 4032, "HEXA", "ICON_DLG_HEXAS" );
+ createSMESHAction( 4041, "NODES", "ICON_DLG_REM_NODE" );
+ createSMESHAction( 4042, "ELEMENTS", "ICON_DLG_REM_ELEMENT" );
+ createSMESHAction( 4051, "NODES", "ICON_DLG_RENUMBERING_NODES" );
+ createSMESHAction( 4052, "ELEMENTS", "ICON_DLG_RENUMBERING_ELEMENTS" );
+ createSMESHAction( 4061, "TRANS", "ICON_SMESH_TRANSLATION_VECTOR" );
+ createSMESHAction( 4062, "ROT", "ICON_DLG_ROTATION" );
+ createSMESHAction( 4063, "SYM", "ICON_SMESH_SYMMETRY_PLANE" );
+ createSMESHAction( 4064, "SEW", "ICON_SMESH_SEWING_FREEBORDERS" );
+ createSMESHAction( 4065, "MERGE", "ICON_SMESH_MERGE_NODES" );
+ createSMESHAction( 406, "MOVE", "ICON_DLG_MOVE_NODE" );
+ createSMESHAction( 407, "INV", "ICON_DLG_MESH_DIAGONAL" );
+ createSMESHAction( 408, "UNION2", "ICON_UNION2TRI" );
+ createSMESHAction( 409, "ORIENT", "ICON_DLG_MESH_ORIENTATION" );
+ createSMESHAction( 410, "UNION", "ICON_UNIONTRI" );
+ createSMESHAction( 411, "CUT", "ICON_CUTQUAD" );
+ createSMESHAction( 412, "SMOOTH", "ICON_DLG_SMOOTHING" );
+ createSMESHAction( 413, "EXTRUSION", "ICON_EXTRUSION" );
+ createSMESHAction( 414, "REVOLUTION", "ICON_REVOLUTION" );
+ createSMESHAction( 415, "MAP", "ICON_MAP" );
+ createSMESHAction( 416, "EXTRUSION_ALONG", "ICON_EXTRUSION_ALONG" );
+ createSMESHAction( 10001, "WIRE", "ICON_WIRE", 0, true );
+ createSMESHAction( 10002, "SHADE", "ICON_SHADE", 0, true );
+ createSMESHAction( 10003, "SHRINK", "ICON_SHRINK", 0, true );
+ createSMESHAction( 10004, "NODES", "ICON_POINTS", 0, true );
+ createSMESHAction( 1001, "AUTO_UPD", "", 0, true );
+ createSMESHAction( 1003, "COLORS" );
+ createSMESHAction( 1005, "SCALAR_BAR" );
+ createSMESHAction( 1006, "SELECTION" );
+ createSMESHAction( 10070, "PRECISION", "", 0, true );
+ createSMESHAction( 10071, "DISP_ENT", "", 0, true );
+ createSMESHAction( 200, "RESET" );
+ createSMESHAction( 201, "SCALAR_BAR_PROP" );
+ createSMESHAction( 211, "WIRE", "ICON_WIRE", 0, true );
+ createSMESHAction( 212, "SHADE", "ICON_SHADE", 0, true );
+ createSMESHAction( 213, "SHRINK", "ICON_SHRINK", 0, true );
+ createSMESHAction( 214, "UPDATE", "ICON_UPDATE" );
+ createSMESHAction( 215, "NODES", "ICON_POINTS", 0, true );
+ createSMESHAction( 217, "EDGES", "ICON_DLG_EDGE", 0, true );
+ createSMESHAction( 218, "FACES", "ICON_DLG_TRIANGLE", 0, true );
+ createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS", 0, true );
+ createSMESHAction( 220, "ALL" );
+ createSMESHAction( 1100, "EDIT_HYPO" );
+ createSMESHAction( 1101, "RENAME" );
+ createSMESHAction( 9010, "NUM_NODES", "", 0, true );
+ createSMESHAction( 9011, "NUM_ELEMENTS", "", 0, true );
+ createSMESHAction( 1131, "DISPMODE" );
+ createSMESHAction( 1132, "COLORS" );
+ createSMESHAction( 1133, "TRANSP" );
+ createSMESHAction( 1134, "CLIP" );
+ createSMESHAction( 1135, "DISP_ENT" );
+ createSMESHAction( 2000, "CTRL" );
+
+ createSMESHAction( 300, "ERASE" );
+ createSMESHAction( 301, "DISPLAY" );
+ createSMESHAction( 302, "DISPLAY_ONLY" );
+
+ // ----- create menu --------------
+ int fileId = createMenu( tr( "MEN_FILE" ), -1, 1 ),
+ editId = createMenu( tr( "MEN_EDIT" ), -1, 3 ),
+ toolsId = createMenu( tr( "MEN_TOOLS" ), -1, 5, 10 ),
+ hypoId = createMenu( tr( "MEN_HYPO" ), -1, 50, 10 ),
+ meshId = createMenu( tr( "MEN_MESH" ), -1, 70, 10 ),
+ ctrlId = createMenu( tr( "MEN_CTRL" ), -1, 60, 10 ),
+ modifyId = createMenu( tr( "MEN_MODIFY" ), -1, 40, 10 ),
+ prefId = createMenu( tr( "MEN_PREF" ), -1, 4, 10 ),
+ viewId = createMenu( tr( "MEN_VIEW" ), -1, 2 );
+
+ createMenu( separator(), fileId );
+
+ int importId = createMenu( tr( "MEN_IMPORT" ), fileId, 11, 10 ),
+ exportId = createMenu( tr( "MEN_EXPORT" ), fileId, 12, 10 ),
+
+ 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 ),
+
+ meshPrefId = createMenu( tr( "MEN_MESH" ), prefId, 100 ),
+
+ dispModeId = createMenu( tr( "MEN_DISPMODE" ), meshPrefId, 1000 ),
+ qualityId = createMenu( tr( "MEN_QUALITY" ), meshPrefId, 1007 );
+
+ createMenu( 111, importId, -1 );
+ createMenu( 112, importId, -1 );
+ createMenu( 113, importId, -1 );
+
+ createMenu( 121, exportId, -1 );
+ createMenu( 122, exportId, -1 );
+ createMenu( 123, exportId, -1 );
+
+ createMenu( separator(), fileId, 10 );
+
+ createMenu( 33, editId, -1 );
+
+ createMenu( 5105, toolsId, -1 );
+
+ createMenu( 5000, hypoId, -1 );
+ createMenu( 5010, hypoId, -1 );
+
+ createMenu( 703, meshId, -1 );
+ createMenu( 702, meshId, -1 );
+ createMenu( 704, meshId, -1 );
+ createMenu( separator(), meshId, -1 );
+ createMenu( 701, meshId, -1 );
+ createMenu( separator(), meshId, -1 );
+ createMenu( 801, meshId, -1 );
+ createMenu( 802, meshId, -1 );
+ createMenu( 803, meshId, -1 );
+ createMenu( separator(), meshId, -1 );
+ createMenu( 810, meshId, -1 );
+ createMenu( 811, meshId, -1 );
+ createMenu( 812, meshId, -1 );
+ createMenu( separator(), meshId, -1 );
+ createMenu( 813, meshId, -1 );
+ createMenu( separator(), meshId, -1 );
+ createMenu( 900, meshId, -1 );
+ createMenu( 902, meshId, -1 );
+ createMenu( separator(), meshId, -1 );
+
+ createMenu( 6003, ctrlId, -1 );
+ createMenu( 6001, ctrlId, -1 );
+ createMenu( 6004, ctrlId, -1 );
+ createMenu( separator(), ctrlId, -1 );
+ createMenu( 6002, ctrlId, -1 );
+ createMenu( 6018, ctrlId, -1 );
+ createMenu( 6019, ctrlId, -1 );
+ createMenu( 6011, ctrlId, -1 );
+ createMenu( 6012, ctrlId, -1 );
+ createMenu( 6013, ctrlId, -1 );
+ createMenu( 6014, ctrlId, -1 );
+ createMenu( 6015, ctrlId, -1 );
+ createMenu( 6016, ctrlId, -1 );
+ createMenu( separator(), ctrlId, -1 );
+ createMenu( 6017, ctrlId, -1 );
+ createMenu( separator(), ctrlId, -1 );
+
+ createMenu( 400, addId, -1 );
+ createMenu( 401, addId, -1 );
+ createMenu( 4021, addId, -1 );
+ createMenu( 4022, addId, -1 );
+ createMenu( 4031, addId, -1 );
+ createMenu( 4032, addId, -1 );
+
+ createMenu( 4041, removeId, -1 );
+ createMenu( 4042, removeId, -1 );
+
+ createMenu( 4051, renumId, -1 );
+ createMenu( 4052, renumId, -1 );
+
+ createMenu( 4061, transfId, -1 );
+ createMenu( 4062, transfId, -1 );
+ createMenu( 4063, transfId, -1 );
+ createMenu( 4064, transfId, -1 );
+ createMenu( 4065, transfId, -1 );
+
+ createMenu( 406, modifyId, -1 );
+ createMenu( 407, modifyId, -1 );
+ createMenu( 408, modifyId, -1 );
+ createMenu( 409, modifyId, -1 );
+ createMenu( 410, modifyId, -1 );
+ createMenu( 411, modifyId, -1 );
+ createMenu( 412, modifyId, -1 );
+ createMenu( 413, modifyId, -1 );
+ createMenu( 416, modifyId, -1 );
+ createMenu( 414, modifyId, -1 );
+ createMenu( 415, modifyId, -1 );
+
+ createMenu( 10001, dispModeId, -1 );
+ createMenu( 10002, dispModeId, -1 );
+ createMenu( 10004, dispModeId, -1 );
+ createMenu( 10003, dispModeId, -1 );
+
+ createMenu( 1001, prefId, -1 );
+ createMenu( separator(), prefId, -1 );
+ createMenu( 1003, prefId, -1 );
+ createMenu( separator(), prefId, -1 );
+ createMenu( 1005, prefId, -1 );
+ createMenu( separator(), prefId, -1 );
+ createMenu( 1006, prefId, -1 );
+ createMenu( separator(), prefId, -1 );
+
+ createMenu( 10070, qualityId, -1 );
+ createMenu( 10071, qualityId, -1 );
+
+ createMenu( separator(), prefId, -1 );
+
+ createMenu( 214, viewId, -1 );
+
+ // ----- create toolbars --------------
+ int meshTb = createTool( tr( "TB_MESH" ) ),
+ hypoTb = createTool( tr( "TB_HYPO" ) ),
+ ctrlTb = createTool( tr( "TB_CTRL" ) ),
+ addRemTb = createTool( tr( "TB_ADD_REMOVE" ) ),
+ modifyTb = createTool( tr( "TB_MODIFY" ) ),
+ dispModeTb = createTool( tr( "TB_DISP_MODE" ) );
+
+ createTool( 703, meshTb );
+ createTool( 702, meshTb );
+ createTool( 704, meshTb );
+ createTool( separator(), meshTb );
+ createTool( 701, meshTb );
+ createTool( separator(), meshTb );
+ createTool( 801, meshTb );
+ createTool( 802, meshTb );
+ createTool( 803, meshTb );
+ createTool( separator(), meshTb );
+ createTool( 900, meshTb );
+ createTool( 902, meshTb );
+ createTool( separator(), meshTb );
+
+ createTool( 5000, hypoTb );
+ createTool( 5010, hypoTb );
+
+ createTool( 6001, ctrlTb );
+ createTool( 6003, ctrlTb );
+ createTool( 6004, ctrlTb );
+ createTool( separator(), ctrlTb );
+ createTool( 6002, ctrlTb );
+ createTool( 6018, ctrlTb );
+ createTool( 6019, ctrlTb );
+ createTool( 6011, ctrlTb );
+ createTool( 6012, ctrlTb );
+ createTool( 6013, ctrlTb );
+ createTool( 6014, ctrlTb );
+ createTool( 6015, ctrlTb );
+ createTool( 6016, ctrlTb );
+ createTool( separator(), ctrlTb );
+ createTool( 6017, ctrlTb );
+ createTool( separator(), ctrlTb );
+
+ createTool( 400, addRemTb );
+ createTool( 401, addRemTb );
+ createTool( 4021, addRemTb );
+ createTool( 4022, addRemTb );
+ createTool( 4031, addRemTb );
+ createTool( 4032, addRemTb );
+ createTool( separator(), addRemTb );
+ createTool( 4041, addRemTb );
+ createTool( 4042, addRemTb );
+ createTool( separator(), addRemTb );
+ createTool( 4051, addRemTb );
+ createTool( 4052, addRemTb );
+ createTool( separator(), addRemTb );
+ createTool( 4061, addRemTb );
+ createTool( 4062, addRemTb );
+ createTool( 4063, addRemTb );
+ createTool( 4064, addRemTb );
+ createTool( 4065, addRemTb );
+ createTool( separator(), addRemTb );
+
+ createTool( 406, modifyTb );
+ createTool( 407, modifyTb );
+ createTool( 408, modifyTb );
+ createTool( 409, modifyTb );
+ createTool( 410, modifyTb );
+ createTool( 411, modifyTb );
+ createTool( 412, modifyTb );
+ createTool( 413, modifyTb );
+ createTool( 416, modifyTb );
+ createTool( 414, modifyTb );
+ createTool( 415, modifyTb );
+
+ createTool( 214, dispModeTb );
+
+
+ myRules.clear();
+ QString OB = "'ObjectBrowser'",
+ View = "'" + SVTK_Viewer::Type() + "'",
+ pat = "'%1'",
+ mesh = pat.arg( SMESHGUI_Selection::typeName( MESH ) ),
+ group = pat.arg( SMESHGUI_Selection::typeName( GROUP ) ),
+ hypo = pat.arg( SMESHGUI_Selection::typeName( HYPOTHESIS ) ),
+ algo = pat.arg( SMESHGUI_Selection::typeName( ALGORITHM ) ),
+ elems = QString( "'%1' '%2' '%3' '%4' '%5'" ).
+ arg( SMESHGUI_Selection::typeName( SUBMESH_VERTEX ) ).
+ arg( SMESHGUI_Selection::typeName( SUBMESH_EDGE ) ).
+ arg( SMESHGUI_Selection::typeName( SUBMESH_FACE ) ).
+ arg( SMESHGUI_Selection::typeName( SUBMESH_SOLID ) ).
+ arg( SMESHGUI_Selection::typeName( SUBMESH_COMPOUND ) ),
+ subMesh = elems,
+ mesh_group = mesh + " " + subMesh + " " + group,
+ hyp_alg = hypo + " " + algo;
+
+ // popup for object browser
+
+ createPopupItem( 705, OB, mesh, "&& isComputable"); // EDIT_GLOBAL_HYPO
+ createPopupItem( 706, OB, subMesh, "&& isComputable" ); // EDIT_LOCAL_HYPO
+ createPopupItem( 803, OB, group ); // EDIT_GROUP
+ popupMgr()->insert( separator(), -1, 0 );
+ createPopupItem( 701, OB, mesh, "&& isComputable" ); // COMPUTE
+ createPopupItem( 214, OB, mesh_group ); // UPDATE
+ createPopupItem( 900, OB, mesh_group ); // ADV_INFO
+ createPopupItem( 902, OB, mesh ); // STD_INFO
+ popupMgr()->insert( separator(), -1, 0 );
+ createPopupItem( 801, OB, mesh ); // CREATE_GROUP
+ createPopupItem( 802, OB, subMesh ); // CONSTRUCT_GROUP
+ popupMgr()->insert( separator(), -1, 0 );
+ createPopupItem( 1100, OB, hypo ); // EDIT HYPOTHESIS
+ createPopupItem( 1102, OB, hyp_alg, "&& hasReference" ); // REMOVE HYPOTHESIS / ALGORITHMS
+ createPopupItem( 1101, OB, mesh_group + " " + hyp_alg ); // RENAME
+ popupMgr()->insert( separator(), -1, 0 );
+ createPopupItem( 125, OB, mesh ); // EXPORT_MED
+ createPopupItem( 126, OB, mesh ); // EXPORT_UNV
+ createPopupItem( 33, OB, subMesh + " " + group ); // DELETE
+ popupMgr()->insert( separator(), -1, 0 );
+
+ // popup for viewer
+ createPopupItem( 803, View, group ); // EDIT_GROUP
+ createPopupItem( 804, View, elems ); // ADD
+ createPopupItem( 805, View, elems ); // REMOVE
+ popupMgr()->insert( separator(), -1, 0 );
+ createPopupItem( 214, View, mesh_group ); // UPDATE
+ createPopupItem( 900, View, mesh_group ); // ADV_INFO
+ createPopupItem( 902, View, mesh ); // STD_INFO
+ popupMgr()->insert( separator(), -1, 0 );
+
+ int anId;
+ 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"),
+ hasEdges("{'Edge'} in elemTypes"),
+ hasFaces("{'Face'} in elemTypes"),
+ hasVolumes("{'Volume'} in elemTypes");
+
+ QString aSelCount = QString( "%1 = 1" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
+ QString aClient = QString( "%1client in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( View );
+ QString aType = QString( "%1type in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( mesh_group );
+ QString aMeshInVTK = aClient + "&&" + aType + "&&" + aSelCount;