+//=======================================================================
+// function : GeometryGUI::initialize()
+// purpose : Called when GEOM module is created
+//=======================================================================
+void GeometryGUI::initialize( CAM_Application* app )
+{
+ SalomeApp_Module::initialize( app );
+
+ // ----- create actions --------------
+
+ createGeomAction( 111, "IMPORT", "", (CTRL + Key_I) );
+ createGeomAction( 121, "EXPORT", "", (CTRL + Key_E) );
+
+ createGeomAction( 33, "DELETE", "", Qt::Key_Delete );
+
+ createGeomAction( 4011, "POINT" );
+ createGeomAction( 4012, "LINE" );
+ createGeomAction( 4013, "CIRCLE" );
+ createGeomAction( 4014, "ELLIPSE" );
+ createGeomAction( 4015, "ARC" );
+ createGeomAction( 4019, "CURVE" );
+ createGeomAction( 4016, "VECTOR" );
+ createGeomAction( 4017, "PLANE" );
+ createGeomAction( 4018, "WORK_PLANE" );
+ createGeomAction( 4020, "LOCAL_CS" );
+
+ createGeomAction( 4021, "BOX" );
+ createGeomAction( 4022, "CYLINDER" );
+ createGeomAction( 4023, "SPHERE" );
+ createGeomAction( 4024, "TORUS" );
+ createGeomAction( 4025, "CONE" );
+
+ createGeomAction( 4031, "EXTRUSION" );
+ createGeomAction( 4032, "REVOLUTION" );
+ createGeomAction( 4033, "FILLING" );
+ createGeomAction( 4034, "PIPE" );
+
+ createGeomAction( 800, "GROUP_CREATE" );
+ createGeomAction( 801, "GROUP_EDIT" );
+
+ createGeomAction( 9997, "Q_FACE" );
+ createGeomAction( 9999, "HEX_SOLID" );
+
+ createGeomAction( 404, "SKETCH" );
+ createGeomAction( 407, "EXPLODE" );
+
+ createGeomAction( 4081, "EDGE" );
+ createGeomAction( 4082, "WIRE" );
+ createGeomAction( 4083, "FACE" );
+ createGeomAction( 4084, "SHELL" );
+ createGeomAction( 4085, "SOLID" );
+ createGeomAction( 4086, "COMPOUND" );
+
+ createGeomAction( 5011, "FUSE" );
+ createGeomAction( 5012, "COMMON" );
+ createGeomAction( 5013, "CUT" );
+ createGeomAction( 5014, "SECTION" );
+
+ createGeomAction( 5021, "TRANSLATION" );
+ createGeomAction( 5022, "ROTATION" );
+ createGeomAction( 5023, "MODIFY_LOCATION" );
+ createGeomAction( 5024, "MIRROR" );
+ createGeomAction( 5025, "SCALE" );
+ createGeomAction( 5026, "OFFSET" );
+ createGeomAction( 5027, "MUL_TRANSLATION" );
+ createGeomAction( 5028, "MUL_ROTATION" );
+
+ createGeomAction( 503, "PARTITION" );
+ createGeomAction( 504, "ARCHIMEDE" );
+ createGeomAction( 505, "FILLET" );
+ createGeomAction( 506, "CHAMFER" );
+ //createGeomAction( 507, "CLIPPING" );
+
+ createGeomAction( 9998, "MUL_TRANSFORM" );
+ createGeomAction( 9995, "EXPLODE_BLOCKS" );
+ createGeomAction( 99991, "PROPAGATE" );
+
+ createGeomAction( 601, "SEWING" );
+ createGeomAction( 602, "GLUE_FACES" );
+ createGeomAction( 603, "SUPPRESS_FACES" );
+ createGeomAction( 604, "SUPPERSS_HOLES" );
+ createGeomAction( 605, "SHAPE_PROCESS" );
+ createGeomAction( 606, "CLOSE_CONTOUR" );
+ createGeomAction( 607, "SUPPRESS_INT_WIRES" );
+ createGeomAction( 608, "POINT_ON_EDGE" );
+ createGeomAction( 609, "CHECK_FREE_BNDS" );
+ createGeomAction( 610, "CHECK_FREE_FACES" );
+ createGeomAction( 611, "CHANGE_ORIENTATION" );
+ createGeomAction( 612, "REMOVE_EXTRA_EDGES" );
+
+ createGeomAction( 708, "POINT_COORDS" );
+ createGeomAction( 701, "BASIC_PROPS" );
+ createGeomAction( 702, "MASS_CENTER" );
+ createGeomAction( 703, "INERTIA" );
+ createGeomAction( 704, "NORMALE" );
+ createGeomAction( 7041, "BND_BOX" );
+ createGeomAction( 7042, "MIN_DIST" );
+ createGeomAction( 7043, "MEASURE_ANGLE" );
+
+ createGeomAction( 705, "TOLERANCE" );
+ createGeomAction( 706, "WHAT_IS" );
+ createGeomAction( 707, "CHECK" );
+ createGeomAction( 7072, "CHECK_COMPOUND" );
+
+#ifdef _DEBUG_ // PAL16821
+ createGeomAction( 5103, "CHECK_GEOMETRY" );
+#endif
+ createGeomAction( 412, "SHADING_COLOR" );
+
+ createGeomAction( 211, "SHADING" );
+ createGeomAction( 212, "DISPLAY_ALL" );
+ createGeomAction( 214, "ERASE_ALL" );
+ createGeomAction( 216, "DISPLAY" );
+ createGeomAction( 2171, "VERTEX_SEL_ONLY" ,"", 0, true );
+ createGeomAction( 2172, "EDGE_SEL_ONLY", "", 0, true );
+ createGeomAction( 2173, "WIRE_SEL_ONLY", "", 0, true );
+ createGeomAction( 2174, "FACE_SEL_ONLY", "", 0, true );
+ createGeomAction( 2175, "SHELL_SEL_ONLY", "", 0, true );
+ createGeomAction( 2176, "SOLID_SEL_ONLY", "", 0, true );
+ createGeomAction( 2177, "COMPOUND_SEL_ONLY", "", 0, true );
+ createGeomAction( 2178, "ALL_SEL_ONLY", "", 0, true );
+ createGeomAction( 213, "DISPLAY_ONLY" );
+ createGeomAction( 215, "ERASE" );
+
+ createGeomAction( 901, "POP_RENAME", "", Qt::Key_F2 );
+ createGeomAction( 80311, "POP_WIREFRAME", "", 0, true );
+ createGeomAction( 80312, "POP_SHADING", "", 0, true );
+ createGeomAction( 8032, "POP_COLOR" );
+ createGeomAction( 8033, "POP_TRANSPARENCY" );
+ createGeomAction( 8034, "POP_ISOS" );
+ createGeomAction( 8035, "POP_AUTO_COLOR" );
+ createGeomAction( 8036, "POP_DISABLE_AUTO_COLOR" );
+ createGeomAction( 8001, "POP_CREATE_GROUP" );
+
+ // make wireframe-shading items to be exclusive (only one at a time is selected)
+ //QActionGroup* dispModeGr = new QActionGroup( this, "", true );
+ //dispModeGr->add( action( 80311 ) );
+ //dispModeGr->add( action( 80312 ) );
+ // ---- create menu --------------------------
+
+ int fileId = createMenu( tr( "MEN_FILE" ), -1, -1 );
+ createMenu( separator(), fileId, 10 );
+ createMenu( 111, fileId, 10 );
+ createMenu( 121, fileId, 10 );
+ createMenu( separator(), fileId, -1 );
+
+ int editId = createMenu( tr( "MEN_EDIT" ), -1, -1 );
+ createMenu( 33, editId, -1 );
+
+ int newEntId = createMenu( tr( "MEN_NEW_ENTITY" ), -1, -1, 10 );
+
+ int basicId = createMenu( tr( "MEN_BASIC" ), newEntId, -1 );
+ createMenu( 4011, basicId, -1 );
+ createMenu( 4012, basicId, -1 );
+ createMenu( 4013, basicId, -1 );
+ createMenu( 4014, basicId, -1 );
+ createMenu( 4015, basicId, -1 );
+ createMenu( 4019, basicId, -1 );
+ createMenu( separator(), basicId, -1 );
+ createMenu( 4016, basicId, -1 );
+ createMenu( 4017, basicId, -1 );
+ createMenu( 4018, basicId, -1 );
+ createMenu( 4020, basicId, -1 );
+
+ int primId = createMenu( tr( "MEN_PRIMITIVES" ), newEntId, -1 );
+ createMenu( 4021, primId, -1 );
+ createMenu( 4022, primId, -1 );
+ createMenu( 4023, primId, -1 );
+ createMenu( 4024, primId, -1 );
+ createMenu( 4025, primId, -1 );
+
+ int genId = createMenu( tr( "MEN_GENERATION" ), newEntId, -1 );
+ createMenu( 4031, genId, -1 );
+ createMenu( 4032, genId, -1 );
+ createMenu( 4033, genId, -1 );
+ createMenu( 4034, genId, -1 );
+ createMenu( separator(), newEntId, -1 );
+
+ int groupId = createMenu( tr( "MEN_GROUP" ), newEntId, -1 );
+ createMenu( 800, groupId, -1 );
+ createMenu( 801, groupId, -1 );
+ createMenu( separator(), newEntId, -1 );
+
+ int blocksId = createMenu( tr( "MEN_BLOCKS" ), newEntId, -1 );
+ createMenu( 9997, blocksId, -1 );
+ createMenu( 9999, blocksId, -1 );
+
+ createMenu( separator(), newEntId, -1 );
+ createMenu( 404, newEntId, -1 );
+ createMenu( separator(), newEntId, -1 );
+ createMenu( 407, newEntId, -1 );
+
+ int buildId = createMenu( tr( "MEN_BUILD" ), newEntId, -1 );
+ createMenu( 4081, buildId, -1 );
+ createMenu( 4082, buildId, -1 );
+ createMenu( 4083, buildId, -1 );
+ createMenu( 4084, buildId, -1 );
+ createMenu( 4085, buildId, -1 );
+ createMenu( 4086, buildId, -1 );
+
+ int operId = createMenu( tr( "MEN_OPERATIONS" ), -1, -1, 10 );
+
+ int boolId = createMenu( tr( "MEN_BOOLEAN" ), operId, -1 );
+ createMenu( 5011, boolId, -1 );
+ createMenu( 5012, boolId, -1 );
+ createMenu( 5013, boolId, -1 );
+ createMenu( 5014, boolId, -1 );
+
+ int transId = createMenu( tr( "MEN_TRANSFORMATION" ), operId, -1 );
+ createMenu( 5021, transId, -1 );
+ createMenu( 5022, transId, -1 );
+ createMenu( 5023, transId, -1 );
+ createMenu( 5024, transId, -1 );
+ createMenu( 5025, transId, -1 );
+ createMenu( 5026, transId, -1 );
+ createMenu( separator(), transId, -1 );
+ createMenu( 5027, transId, -1 );
+ createMenu( 5028, transId, -1 );
+
+ createMenu( 503, operId, -1 );
+ createMenu( 504, operId, -1 );
+ createMenu( separator(), operId, -1 );
+ createMenu( 505, transId, -1 );
+ createMenu( 506, transId, -1 );
+ //createMenu( 507, transId, -1 );
+
+ int blockId = createMenu( tr( "MEN_BLOCKS" ), operId, -1 );
+ createMenu( 9998, blockId, -1 );
+ createMenu( 9995, blockId, -1 );
+ createMenu( 99991, blockId, -1 );
+
+ int repairId = createMenu( tr( "MEN_REPAIR" ), -1, -1, 10 );
+ createMenu( 605, repairId, -1 );
+ createMenu( 603, repairId, -1 );
+ createMenu( 606, repairId, -1 );
+ createMenu( 607, repairId, -1 );
+ createMenu( 604, repairId, -1 );
+ createMenu( 601, repairId, -1 );
+ createMenu( 602, repairId, -1 );
+ createMenu( 608, repairId, -1 );
+ //createMenu( 609, repairId, -1 );
+ //createMenu( 610, repairId, -1 );
+ createMenu( 611, repairId, -1 );
+ createMenu( 612, repairId, -1 );
+
+ int measurId = createMenu( tr( "MEN_MEASURES" ), -1, -1, 10 );
+ createMenu( 708, measurId, -1 );
+ createMenu( 701, measurId, -1 );
+ createMenu( separator(), measurId, -1 );
+ createMenu( 702, measurId, -1 );
+ createMenu( 703, measurId, -1 );
+ createMenu( 704, measurId, -1 );
+ // NPAL16572: move "Check free boundaries" and "Check free faces" from "Repair" to "Measure"
+ createMenu( separator(), measurId, -1 );
+ createMenu( 609, measurId, -1 );
+ createMenu( 610, measurId, -1 );
+ // NPAL16572 END
+ createMenu( separator(), measurId, -1 );
+
+ int dimId = createMenu( tr( "MEN_DIMENSIONS" ), measurId, -1 );
+ createMenu( 7041, dimId, -1 );
+ createMenu( 7042, dimId, -1 );
+ createMenu( 7043, dimId, -1 );
+ createMenu( separator(), measurId, -1 );
+
+ createMenu( 705, measurId, -1 );
+ createMenu( separator(), measurId, -1 );
+ createMenu( 706, measurId, -1 );
+ createMenu( 707, measurId, -1 );
+ createMenu( 7072, measurId, -1 );
+
+#ifdef _DEBUG_ // PAL16821
+ int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
+ createMenu( separator(), toolsId, -1 );
+ createMenu( 5103, toolsId, -1 );
+#endif
+ //int prefId = createMenu( tr( "MEN_PREFERENCES" ), -1, -1, 50 );
+ //createMenu( separator(), prefId, -1 );
+ //int geomId = createMenu( tr( "MEN_PREFERENCES_GEOM" ), prefId, -1 );
+ //createMenu( 412, geomId, -1 );
+ //createMenu( separator(), prefId, -1 );
+
+ int viewId = createMenu( tr( "MEN_VIEW" ), -1, -1 );
+ createMenu( separator(), viewId, -1 );
+
+ int dispmodeId = createMenu( tr( "MEN_DISPLAY_MODE" ), viewId, -1 );
+ createMenu( 211, dispmodeId, -1 );
+
+ createMenu( separator(), viewId, -1 );
+ createMenu( 212, viewId, -1 );
+ createMenu( 214, viewId, -1 );
+ createMenu( separator(), viewId, -1 );
+
+/*
+ PAL9111:
+ because of these items are accessible through object browser and viewers
+ we have removed they from main menu
+
+ createMenu( 216, viewId, -1 );
+ createMenu( 213, viewId, -1 );
+ createMenu( 215, viewId, -1 );
+*/
+
+ // ---- create toolbars --------------------------
+
+ int basicTbId = createTool( tr( "TOOL_BASIC" ) );
+ createTool( 4011, basicTbId );
+ createTool( 4012, basicTbId );
+ createTool( 4013, basicTbId );
+ createTool( 4014, basicTbId );
+ createTool( 4015, basicTbId );
+ createTool( 4019, basicTbId );
+ createTool( 4016, basicTbId );
+ createTool( 4017, basicTbId );
+ createTool( 4018, basicTbId );
+ createTool( 4020, basicTbId );
+
+ int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) );
+ createTool( 4021, primTbId );
+ createTool( 4022, primTbId );
+ createTool( 4023, primTbId );
+ createTool( 4024, primTbId );
+ createTool( 4025, primTbId );
+
+ int boolTbId = createTool( tr( "TOOL_BOOLEAN" ) );
+ createTool( 5011, boolTbId );
+ createTool( 5012, boolTbId );
+ createTool( 5013, boolTbId );
+ createTool( 5014, boolTbId );
+
+ int genTbId = createTool( tr( "TOOL_GENERATION" ) );
+ createTool( 4031, genTbId );
+ createTool( 4032, genTbId );
+ createTool( 4033, genTbId );
+ createTool( 4034, genTbId );
+
+ int transTbId = createTool( tr( "TOOL_TRANSFORMATION" ) );
+ createTool( 5021, transTbId );
+ createTool( 5022, transTbId );
+ createTool( 5023, transTbId );
+ createTool( 5024, transTbId );
+ createTool( 5025, transTbId );
+ createTool( 5026, transTbId );
+ createTool( separator(), transTbId );
+ createTool( 5027, transTbId );
+ createTool( 5028, transTbId );
+
+ // ---- create popup menus --------------------------
+
+ QString clientOCCorVTK = "(client='OCCViewer' or client='VTKViewer')";
+ QString clientOCCorVTK_AndSomeVisible = clientOCCorVTK + " and selcount>0 and isVisible";
+
+ QString clientOCCorVTKorOB = "(client='ObjectBrowser' or client='OCCViewer' or client='VTKViewer')";
+ QString clientOCCorVTKorOB_AndSomeVisible = clientOCCorVTKorOB + " and selcount>0 and isVisible";
+
+ QString autoColorPrefix =
+ "(client='ObjectBrowser' or client='OCCViewer') and type='Shape' and selcount=1 and isOCC=true";
+
+ QtxPopupMgr* mgr = popupMgr();
+ mgr->insert( action( 901 ), -1, -1 ); // rename
+ mgr->setRule( action( 901 ), QString("$type in {'Shape' 'Group'} and selcount=1"), QtxPopupMgr::VisibleRule );
+ mgr->insert( action( 33 ), -1, -1 ); // delete
+ mgr->setRule( action( 33 ), QString("$type in {'Shape' 'Group'} and selcount>0"), QtxPopupMgr::VisibleRule );
+ mgr->insert( action( 8001 ), -1, -1 ); // create group
+ mgr->setRule( action( 8001 ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
+ mgr->insert( action( 801 ), -1, -1 ); // edit group
+ mgr->setRule( action( 801 ), QString("client='ObjectBrowser' and type='Group' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
+ mgr->insert( separator(), -1, -1 ); // -----------
+ dispmodeId = mgr->insert( tr( "MEN_DISPLAY_MODE" ), -1, -1 ); // display mode menu
+ mgr->insert( action( 80311 ), dispmodeId, -1 ); // wireframe
+ mgr->setRule( action( 80311 ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( 80311 ), clientOCCorVTK + " and displaymode='Wireframe'", QtxPopupMgr::ToggleRule );
+ mgr->insert( action( 80312 ), dispmodeId, -1 ); // shading
+ mgr->setRule( action( 80312 ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( 80312 ), clientOCCorVTK + " and displaymode='Shading'", QtxPopupMgr::ToggleRule );
+ mgr->insert( separator(), -1, -1 ); // -----------
+ mgr->insert( action( 8032 ), -1, -1 ); // color
+ mgr->setRule( action( 8032 ), clientOCCorVTKorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
+ mgr->insert( action( 8033 ), -1, -1 ); // transparency
+ mgr->setRule( action( 8033 ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
+ mgr->insert( action( 8034 ), -1, -1 ); // isos
+ mgr->setRule( action( 8034 ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
+ mgr->insert( separator(), -1, -1 ); // -----------
+ mgr->insert( action( 8035 ), -1, -1 ); // auto color
+ mgr->setRule( action( 8035 ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule );
+ mgr->insert( action( 8036 ), -1, -1 ); // disable auto color
+ mgr->setRule( action( 8036 ), autoColorPrefix + " and isAutoColor=true", QtxPopupMgr::VisibleRule );
+ mgr->insert( separator(), -1, -1 ); // -----------
+
+
+ QString canDisplay = "($component={'GEOM'}) and (selcount>0) and ({true} in $canBeDisplayed) ",
+ onlyComponent = "((type='Component') and selcount=1)",
+ rule = canDisplay + "and ((($type in {%1}) and( %2 )) or " + onlyComponent + ")",
+ types = "'Shape' 'Group'";
+
+ mgr->insert( action( 216 ), -1, -1 ); // display
+ mgr->setRule( action( 216 ), rule.arg( types ).arg( "not isVisible" ), QtxPopupMgr::VisibleRule );
+
+ mgr->insert( action( 215 ), -1, -1 ); // erase
+ mgr->setRule( action( 215 ), rule.arg( types ).arg( "isVisible" ), QtxPopupMgr::VisibleRule );
+
+ mgr->insert( action( 214 ), -1, -1 ); // erase All
+ mgr->setRule( action( 214 ), clientOCCorVTK, QtxPopupMgr::VisibleRule );
+
+ QString selectOnly = "(client='OCCViewer' or client='VTKViewer') and (selcount=0)";
+
+ int selectolnyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1); //select only menu
+ mgr->insert( action(2171), selectolnyId, -1); //Vertex
+ mgr->setRule(action(2171), selectOnly, QtxPopupMgr::VisibleRule);
+ mgr->setRule(action(2171), selectOnly + " and selectionmode='VERTEX'", QtxPopupMgr::ToggleRule);
+ mgr->insert( action(2172), selectolnyId, -1); //Edge
+ mgr->setRule(action(2172), selectOnly, QtxPopupMgr::VisibleRule);
+ mgr->setRule(action(2172), selectOnly + " and selectionmode='EDGE'", QtxPopupMgr::ToggleRule);
+ mgr->insert( action(2173), selectolnyId, -1); //Wire
+ mgr->setRule(action(2173), selectOnly, QtxPopupMgr::VisibleRule);
+ mgr->setRule(action(2173), selectOnly + " and selectionmode='WIRE'", QtxPopupMgr::ToggleRule);
+ mgr->insert( action(2174), selectolnyId, -1); //Face
+ mgr->setRule(action(2174), selectOnly, QtxPopupMgr::VisibleRule);
+ mgr->setRule(action(2174), selectOnly + " and selectionmode='FACE'", QtxPopupMgr::ToggleRule);
+ mgr->insert( action(2175), selectolnyId, -1); //Shell
+ mgr->setRule(action(2175), selectOnly, QtxPopupMgr::VisibleRule);
+ mgr->setRule(action(2175), selectOnly + " and selectionmode='SHELL'", QtxPopupMgr::ToggleRule);
+ mgr->insert( action(2176), selectolnyId, -1); //Solid
+ mgr->setRule(action(2176), selectOnly, QtxPopupMgr::VisibleRule);
+ mgr->setRule(action(2176), selectOnly + " and selectionmode='SOLID'", QtxPopupMgr::ToggleRule);
+ mgr->insert( action(2177), selectolnyId, -1); //Compound
+ mgr->setRule(action(2177), selectOnly, QtxPopupMgr::VisibleRule);
+ mgr->setRule(action(2177), selectOnly + " and selectionmode='COMPOUND'", QtxPopupMgr::ToggleRule);
+ mgr->insert( separator(), selectolnyId, -1);
+ mgr->insert( action(2178), selectolnyId, -1); //Clear selection filter
+ mgr->setRule(action(2178), selectOnly, QtxPopupMgr::VisibleRule);
+ mgr->setRule(action(2178), selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule);
+ mgr->insert( action( 213 ), -1, -1 ); // display only
+ mgr->setRule( action( 213 ), rule.arg( types ).arg( "true" ), QtxPopupMgr::VisibleRule );
+ mgr->insert( separator(), -1, -1 );
+
+ mgr->hide( mgr->actionId( action( myEraseAll ) ) );