本文分析SALOME GEOM模块,涉及的知识点包括,
- MDF框架
- 插件系统
注1:限于研究水平,分析难免不当,欢迎批评指正。
注2:文章内容会不定期更新。
一、核心组件
1.1 GeometryGUI
在<SALOME源码分析:MDF框架>一文中已就SALOME 插件系统做了分析,GeometryGUI本质上就是SALOME 插件,定义了Module接口,
// geom\src\GEOMGUI\GeometryGUI.cxx
extern "C" {
Standard_EXPORT CAM_Module* createModule() {
return new GeometryGUI();
}
Standard_EXPORT char* getModuleVersion() {
return (char*)GEOM_VERSION_STR;
}
}
1.2 GEOMGUI
出于扩展性的考虑,SALOME GEOM模块又实现了一套插件系统,而GEOMGUI则定义了相应的插件接口。
在SALOME GEOM模块中,以GEOMGUI为插件接口实现的插件如下表,
插件 | 命令 | 描述 |
BasicGUI |
||
BlocksGUI |
||
BooleanGUI |
||
BuildGUI |
||
DisplayGUI |
||
EntityGUI |
||
GenerationGUI |
||
GEOMToolsGUI | ||
GroupGUI |
||
MeasureGUI |
||
OperationGUI |
||
PrimitiveGUI |
||
RepairGUI |
||
TransformationGUI |
以BasicGUI为例,派生于GEOMGUI,其提供了Point、Line、Plane、Arc、Circle等基本几何体创建的功能,
// geom\src\BasicGUI\BasicGUI.cxx
extern "C"
{
#ifdef WIN32
__declspec( dllexport )
#endif
GEOMGUI* GetLibGUI( GeometryGUI* parent )
{
return new BasicGUI( parent );
}
}
二、关键流程
2.1 接收命令
作为SALOME Module, 在GeometryGUI初始化时会将命令响应关联到槽函数GeometryGUI::OnGUIEvent,这可通过GeometryGUI::initialize与GeometryGUI::createGeomAction的实现看出。
void GeometryGUI::initialize( CAM_Application* app )
{
SalomeApp_Module::initialize( app );
setActionLoggingEnabled( true ); // enable action logging
// ----- create actions --------------
createGeomAction( GEOMOp::OpDelete, {"DELETE", "Edit"} );
createGeomAction( GEOMOp::OpPoint, {"POINT", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpLine, {"LINE", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpCircle, {"CIRCLE", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpEllipse, {"ELLIPSE", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpArc, {"ARC", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpCurve, {"CURVE", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpIsoline, {"ISOLINE", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpVector, {"VECTOR", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpPlane, {"PLANE", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpLCS, {"LOCAL_CS", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpOriginAndVectors, {"ORIGIN_AND_VECTORS", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpSurfaceFromFace, {"SURFACE_FROM_FACE", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpBox, {"BOX", "NewEntity/Primitives"} );
createGeomAction( GEOMOp::OpCylinder, {"CYLINDER", "NewEntity/Primitives"} );
createGeomAction( GEOMOp::OpSphere, {"SPHERE", "NewEntity/Primitives"} );
createGeomAction( GEOMOp::OpTorus, {"TORUS", "NewEntity/Primitives"} );
createGeomAction( GEOMOp::OpCone, {"CONE", "NewEntity/Primitives"} );
createGeomAction( GEOMOp::OpRectangle, {"RECTANGLE", "NewEntity/Primitives"} );
createGeomAction( GEOMOp::OpDisk, {"DISK", "NewEntity/Primitives"} );
createGeomAction( GEOMOp::OpPrism, {"EXTRUSION", "NewEntity/Generation"} );
createGeomAction( GEOMOp::OpRevolution, {"REVOLUTION", "NewEntity/Generation"} );
createGeomAction( GEOMOp::OpFilling, {"FILLING", "NewEntity/Generation"} );
createGeomAction( GEOMOp::OpPipe, {"PIPE", "NewEntity/Generation"} );
createGeomAction( GEOMOp::OpPipePath, {"PIPE_PATH", "NewEntity/Generation"} );
createGeomAction( GEOMOp::OpThickness, {"THICKNESS", "NewEntity/Generation"} );
createGeomAction( GEOMOp::OpGroupCreate, {"GROUP_CREATE", "NewEntity/Group"} );
createGeomAction( GEOMOp::OpGroupEdit, {"GROUP_EDIT", "NewEntity/Group"} );
createGeomAction( GEOMOp::OpGroupUnion, {"GROUP_UNION", "NewEntity/Group"} );
createGeomAction( GEOMOp::OpGroupIntersect, {"GROUP_INTERSECT", "NewEntity/Group"} );
createGeomAction( GEOMOp::OpGroupCut, {"GROUP_CUT", "NewEntity/Group"} );
createGeomAction( GEOMOp::OpCreateField, {"FIELD_CREATE", "NewEntity/Field"} );
createGeomAction( GEOMOp::OpEditField, {"FIELD_EDIT", "NewEntity/Field"} );
createGeomAction( GEOMOp::OpReimport, {"RELOAD_IMPORTED", "Selection"} );
createGeomAction( GEOMOp::OpQuadFace, {"Q_FACE", "NewEntity/Blocks"} );
createGeomAction( GEOMOp::OpHexaSolid, {"HEX_SOLID", "NewEntity/Blocks"} );
createGeomAction( GEOMOp::Op2dSketcher, {"SKETCH", "NewEntity/Basic"} );
createGeomAction( GEOMOp::Op3dSketcher, {"3DSKETCH", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpExplode, {"EXPLODE", "NewEntity"} );
#ifdef WITH_OPENCV
createGeomAction( GEOMOp::OpFeatureDetect, {"FEATURE_DETECTION", "NewEntity"} );
#endif
createGeomAction( GEOMOp::OpPictureImport, {"PICTURE_IMPORT", "NewEntity"} );
createGeomAction( GEOMOp::Op2dPolylineEditor, {"CURVE_CREATOR", "NewEntity/Basic"} );
createGeomAction( GEOMOp::OpEdge, {"EDGE", "NewEntity/Build"} );
createGeomAction( GEOMOp::OpWire, {"WIRE", "NewEntity/Build"} );
createGeomAction( GEOMOp::OpFace, {"FACE", "NewEntity/Build"} );
createGeomAction( GEOMOp::OpShell, {"SHELL", "NewEntity/Build"} );
createGeomAction( GEOMOp::OpSolid, {"SOLID", "NewEntity/Build"} );
createGeomAction( GEOMOp::OpCompound, {"COMPOUND", "NewEntity/Build"} );
createGeomAction( GEOMOp::OpFuse, {"FUSE", "Operations/Boolean"} );
createGeomAction( GEOMOp::OpCommon, {"COMMON", "Operations/Boolean"} );
createGeomAction( GEOMOp::OpCut, {"CUT", "Operations/Boolean"} );
createGeomAction( GEOMOp::OpSection, {"SECTION", "Operations/Boolean"} );
createGeomAction( GEOMOp::OpTranslate, {"TRANSLATION", "Operations/Transformation"} );
createGeomAction( GEOMOp::OpRotate, {"ROTATION", "Operations/Transformation"} );
createGeomAction( GEOMOp::OpChangeLoc, {"MODIFY_LOCATION", "Operations/Transformation"} );
createGeomAction( GEOMOp::OpMirror, {"MIRROR", "Operations/Transformation"} );
createGeomAction( GEOMOp::OpScale, {"SCALE", "Operations/Transformation"} );
createGeomAction( GEOMOp::OpOffset, {"OFFSET", "Operations/Transformation"} );
createGeomAction( GEOMOp::OpProjection, {"PROJECTION", "Operations/Transformation"} );
createGeomAction( GEOMOp::OpProjOnCyl, {"PROJ_ON_CYL", "Operations/Transformation"} );
createGeomAction( GEOMOp::OpMultiTranslate, {"MUL_TRANSLATION", "Operations/Transformation"} );
createGeomAction( GEOMOp::OpMultiRotate, {"MUL_ROTATION", "Operations/Transformation"} );
createGeomAction( GEOMOp::OpExtension, {"EXTENSION", "Operations/Transformation"} );
createGeomAction( GEOMOp::OpPartition, {"PARTITION", "Operations"} );
createGeomAction( GEOMOp::OpArchimede, {"ARCHIMEDE", "Operations"} );
createGeomAction( GEOMOp::OpFillet3d, {"FILLET", "Operations"} );
createGeomAction( GEOMOp::OpChamfer, {"CHAMFER", "Operations"} );
createGeomAction( GEOMOp::OpShapesOnShape, {"GET_SHAPES_ON_SHAPE", "Operations"} );
createGeomAction( GEOMOp::OpSharedShapes, {"GET_SHARED_SHAPES", "Operations"} );
createGeomAction( GEOMOp::OpTransferData, {"TRANSFER_DATA", "Operations"} );
createGeomAction( GEOMOp::OpExtraction, {"EXTRACTION", "Operations"} );
createGeomAction( GEOMOp::OpExtrudedCut, {"EXTRUDED_CUT", "Operations"} );
createGeomAction( GEOMOp::OpExtrudedBoss, {"EXTRUDED_BOSS", "Operations"} );
createGeomAction( GEOMOp::OpFillet1d, {"FILLET_1D", "Operations"} );
createGeomAction( GEOMOp::OpFillet2d, {"FILLET_2D", "Operations"} );
createGeomAction( GEOMOp::OpMultiTransform, {"MUL_TRANSFORM", "Operations/Blocks"} );
createGeomAction( GEOMOp::OpExplodeBlock, {"EXPLODE_BLOCKS", "Operations/Blocks"} );
createGeomAction( GEOMOp::OpPropagate, {"PROPAGATE", "Operations/Blocks"} );
createGeomAction( GEOMOp::OpSewing, {"SEWING", "Repair"} );
createGeomAction( GEOMOp::OpGlueFaces, {"GLUE_FACES", "Repair"} );
createGeomAction( GEOMOp::OpGlueEdges, {"GLUE_EDGES", "Repair"} );
createGeomAction( GEOMOp::OpLimitTolerance, {"LIMIT_TOLERANCE", "Repair"} );
createGeomAction( GEOMOp::OpSuppressFaces, {"SUPPRESS_FACES", "Repair"} );
createGeomAction( GEOMOp::OpSuppressHoles, {"SUPPERSS_HOLES", "Repair"} );
createGeomAction( GEOMOp::OpShapeProcess, {"SHAPE_PROCESS", "Repair"} );
createGeomAction( GEOMOp::OpCloseContour, {"CLOSE_CONTOUR", "Repair"} );
createGeomAction( GEOMOp::OpRemoveIntWires, {"SUPPRESS_INT_WIRES", "Repair"} );
createGeomAction( GEOMOp::OpAddPointOnEdge, {"POINT_ON_EDGE", "Repair"} );
createGeomAction( GEOMOp::OpFreeBoundaries, {"CHECK_FREE_BNDS", "Repair"} );
createGeomAction( GEOMOp::OpFreeFaces, {"CHECK_FREE_FACES", "Repair"} );
createGeomAction( GEOMOp::OpOrientation, {"CHANGE_ORIENTATION", "Repair"} );
createGeomAction( GEOMOp::OpRemoveWebs, {"REMOVE_WEBS", "Repair"} );
createGeomAction( GEOMOp::OpRemoveExtraEdges, {"REMOVE_EXTRA_EDGES", "Repair"} );
createGeomAction( GEOMOp::OpFuseEdges, {"FUSE_EDGES", "Repair"} );
createGeomAction( GEOMOp::OpUnionFaces, {"UNION_FACES", "Repair"} );
createGeomAction( GEOMOp::OpInspectObj, {"INSPECT_OBJECT", "Repair"} );
createGeomAction( GEOMOp::OpPointCoordinates, {"POINT_COORDS", "Inspection"} );
createGeomAction( GEOMOp::OpProperties, {"BASIC_PROPS", "Inspection"} );
createGeomAction( GEOMOp::OpCenterMass, {"MASS_CENTER", "Inspection"} );
createGeomAction( GEOMOp::OpInertia, {"INERTIA", "Inspection"} );
createGeomAction( GEOMOp::OpNormale, {"NORMALE", "Inspection"} );
createGeomAction( GEOMOp::OpBoundingBox, {"BND_BOX", "Inspection/Dimensions"} );
createGeomAction( GEOMOp::OpMinDistance, {"MIN_DIST", "Inspection/Dimensions"} );
createGeomAction( GEOMOp::OpAngle, {"MEASURE_ANGLE", "Inspection/Dimensions"} );
createGeomAction( GEOMOp::OpManageDimensions, {"MANAGE_DIMENSIONS", "Inspection/Dimensions"} );
createGeomAction( GEOMOp::OpAnnotation, {"ANNOTATION", "Inspection"} );
createGeomAction( GEOMOp::OpEditAnnotation, {"EDIT_ANNOTATION", "Inspection/ANNOTATION"} );
createGeomAction( GEOMOp::OpDeleteAnnotation, {"DELETE_ANNOTATION", "Inspection/ANNOTATION"} );
createGeomAction( GEOMOp::OpTolerance, {"TOLERANCE", "Inspection"} );
createGeomAction( GEOMOp::OpWhatIs, {"WHAT_IS", "Inspection"} );
createGeomAction( GEOMOp::OpCheckShape, {"CHECK", "Inspection"} );
createGeomAction( GEOMOp::OpCheckCompound, {"CHECK_COMPOUND", "Inspection"} );
createGeomAction( GEOMOp::OpGetNonBlocks, {"GET_NON_BLOCKS", "Inspection"} );
createGeomAction( GEOMOp::OpCheckSelfInters, {"CHECK_SELF_INTERSECTIONS", "Inspection"} );
createGeomAction( GEOMOp::OpFastCheckInters, {"FAST_CHECK_INTERSECTIONS", "Inspection"} );
#ifndef DISABLE_PLOT2DVIEWER
createGeomAction( GEOMOp::OpShapeStatistics, {"SHAPE_STATISTICS", "Inspection"} );
#endif
#ifndef DISABLE_PYCONSOLE
#ifdef _DEBUG_ // PAL16821
createGeomAction( GEOMOp::OpCheckGeom, {"CHECK_GEOMETRY", "Tools"} );
#endif
#endif
createGeomAction( GEOMOp::OpMaterialsLibrary, {"MATERIALS_LIBRARY", "Tools"} );
createGeomAction( GEOMOp::OpDMWireframe, {"WIREFRAME", "View/DisplayMode"} );
createGeomAction( GEOMOp::OpDMShading, {"SHADING", "View/DisplayMode"} );
createGeomAction( GEOMOp::OpDMShadingWithEdges, {"SHADING_WITH_EDGES", "View/DisplayMode"} );
createGeomAction( GEOMOp::OpDMTexture, {"TEXTURE", "View/DisplayMode"} );
createGeomAction( GEOMOp::OpShowAll, {"DISPLAY_ALL", "View"} );
createGeomAction( GEOMOp::OpHideAll, {"ERASE_ALL", "View"} );
createGeomAction( GEOMOp::OpShow, {"DISPLAY", "View"} );
createGeomAction( GEOMOp::OpSwitchVectors, {"VECTOR_MODE", "View/DisplayMode"});
createGeomAction( GEOMOp::OpSwitchVertices, {"VERTICES_MODE", "View/DisplayMode"});
createGeomAction( GEOMOp::OpSwitchName, {"NAME_MODE", "View/DisplayMode"});
createGeomAction( GEOMOp::OpSelectVertex, {"VERTEX_SEL_ONLY", "Selection"}, "", true );
createGeomAction( GEOMOp::OpSelectEdge, {"EDGE_SEL_ONLY", "Selection"}, "", true );
createGeomAction( GEOMOp::OpSelectWire, {"WIRE_SEL_ONLY", "Selection"}, "", true );
createGeomAction( GEOMOp::OpSelectFace, {"FACE_SEL_ONLY", "Selection"}, "", true );
createGeomAction( GEOMOp::OpSelectShell, {"SHELL_SEL_ONLY", "Selection"}, "", true );
createGeomAction( GEOMOp::OpSelectSolid, {"SOLID_SEL_ONLY", "Selection"}, "", true );
createGeomAction( GEOMOp::OpSelectCompound, {"COMPOUND_SEL_ONLY", "Selection"}, "", true );
createGeomAction( GEOMOp::OpSelectAll, {"ALL_SEL_ONLY", "Selection"}, "", true );
createGeomAction( GEOMOp::OpShowOnly, {"DISPLAY_ONLY", "View"} );
createGeomAction( GEOMOp::OpShowOnlyChildren, {"SHOW_ONLY_CHILDREN", "View"} );
createGeomAction( GEOMOp::OpBringToFront, {"BRING_TO_FRONT", "View"}, "", true );
createGeomAction( GEOMOp::OpClsBringToFront, {"CLS_BRING_TO_FRONT", "View"} );
createGeomAction( GEOMOp::OpHide, {"ERASE", "View"} );
createGeomAction( GEOMOp::OpWireframe, {"POP_WIREFRAME", "Selection/DisplayMode"}, "", true );
createGeomAction( GEOMOp::OpShading, {"POP_SHADING", "Selection/DisplayMode"}, "", true );
createGeomAction( GEOMOp::OpShadingWithEdges, {"POP_SHADING_WITH_EDGES", "Selection/DisplayMode"}, "", true );
createGeomAction( GEOMOp::OpTexture, {"POP_TEXTURE", "Selection/DisplayMode"}, "", true );
createGeomAction( GEOMOp::OpEdgeWidth, {"EDGE_WIDTH", "Selection"});
createGeomAction( GEOMOp::OpIsosWidth, {"ISOS_WIDTH", "Selection"});
createGeomAction( GEOMOp::OpVectors, {"POP_VECTORS", "Selection/DisplayMode"}, "", true );
createGeomAction( GEOMOp::OpVertices, {"POP_VERTICES", "Selection/DisplayMode"}, "", true );
createGeomAction( GEOMOp::OpShowName, {"POP_SHOW_NAME", "Selection/DisplayMode"}, "", true );
createGeomAction( GEOMOp::OpDeflection, {"POP_DEFLECTION", "Selection"} );
createGeomAction( GEOMOp::OpColor, {"POP_COLOR", "Selection"} );
createGeomAction( GEOMOp::OpSetTexture, {"POP_SETTEXTURE", "Selection"} );
createGeomAction( GEOMOp::OpTransparency, {"POP_TRANSPARENCY", "Selection"} );
createGeomAction( GEOMOp::OpIsos, {"POP_ISOS", "Selection"} );
createGeomAction( GEOMOp::OpAutoColor, {"POP_AUTO_COLOR", "Selection"} );
createGeomAction( GEOMOp::OpNoAutoColor, {"POP_DISABLE_AUTO_COLOR", "Selection"} );
createGeomAction( GEOMOp::OpGroupCreatePopup, {"POP_CREATE_GROUP", "Selection"} );
createGeomAction( GEOMOp::OpEditFieldPopup, {"POP_EDIT_FIELD", "Selection"} );
createGeomAction( GEOMOp::OpDiscloseChildren, {"POP_DISCLOSE_CHILDREN", "Selection"} );
createGeomAction( GEOMOp::OpConcealChildren, {"POP_CONCEAL_CHILDREN", "Selection"} );
createGeomAction( GEOMOp::OpUnpublishObject, {"POP_UNPUBLISH_OBJ", "Selection"} );
createGeomAction( GEOMOp::OpPublishObject, {"POP_PUBLISH_OBJ", "Selection"} );
createGeomAction( GEOMOp::OpPointMarker, {"POP_POINT_MARKER", "Selection"} );
createGeomAction( GEOMOp::OpMaterialProperties, {"POP_MATERIAL_PROPERTIES", "Selection"} );
createGeomAction( GEOMOp::OpPredefMaterCustom, {"POP_PREDEF_MATER_CUSTOM", "Selection"} );
createGeomAction( GEOMOp::OpMaterialMenu, {"POP_MATERIAL_PROPERTIES", "Selection"});
action(GEOMOp::OpMaterialMenu)->setMenu( new QMenu() );
createGeomAction( GEOMOp::OpCreateFolder, {"POP_CREATE_FOLDER", "Selection"} );
createGeomAction( GEOMOp::OpSortChildren, {"POP_SORT_CHILD_ITEMS", "Selection"} );
#ifndef DISABLE_GRAPHICSVIEW
createGeomAction( GEOMOp::OpShowDependencyTree, {"POP_SHOW_DEPENDENCY_TREE", "Selection"} );
#endif
createGeomAction( GEOMOp::OpReduceStudy, {"POP_REDUCE_STUDY", "Selection"} );
createGeomAction( GEOMOp::OpShowAllDimensions, {"POP_SHOW_ALL_DIMENSIONS", "Selection"} );
createGeomAction( GEOMOp::OpHideAllDimensions, {"POP_HIDE_ALL_DIMENSIONS", "Selection"} );
createGeomAction( GEOMOp::OpShowAllAnnotations, {"POP_SHOW_ALL_ANNOTATIONS", "Selection"} );
createGeomAction( GEOMOp::OpHideAllAnnotations, {"POP_HIDE_ALL_ANNOTATIONS", "Selection"} );
// Create actions for increase/decrease transparency shortcuts
createGeomAction( GEOMOp::OpIncrTransparency, "", "", 0, false,
"Selection/POP_TRANSPARENCY/Increase");
createGeomAction( GEOMOp::OpDecrTransparency, "", "", 0, false,
"Selection/POP_TRANSPARENCY/Decrease");
// Create actions for increase/decrease number of isolines
createGeomAction( GEOMOp::OpIncrNbIsos, "", "", 0, false,
"Selection/POP_ISOS/Increase number");
createGeomAction( GEOMOp::OpDecrNbIsos, "", "", 0, false,
"Selection/POP_ISOS/Decrease number");
//createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
//createGeomAction( GEOMOp::OpDividedDisk, "DIVIDEDDISK" );
//createGeomAction( GEOMOp::OpDividedCylinder, "DIVIDEDCYLINDER" );
//createGeomAction( GEOMOp::OpSmoothingSurface, "SMOOTHINGSURFACE" );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create menus --------------------------
/*int fileId =*/ createMenu( tr( "MEN_FILE" ), -1, -1 );
int editId = createMenu( tr( "MEN_EDIT" ), -1, -1 );
createMenu( GEOMOp::OpDelete, editId, -1 );
int newEntId = createMenu( tr( "MEN_NEW_ENTITY" ), -1, -1, 10 );
int basicId = createMenu( tr( "MEN_BASIC" ), newEntId, -1 );
createMenu( GEOMOp::OpPoint, basicId, -1 );
createMenu( GEOMOp::OpLine, basicId, -1 );
createMenu( GEOMOp::OpCircle, basicId, -1 );
createMenu( GEOMOp::OpEllipse, basicId, -1 );
createMenu( GEOMOp::OpArc, basicId, -1 );
createMenu( GEOMOp::OpCurve, basicId, -1 );
createMenu( GEOMOp::Op2dSketcher, basicId, -1 );
createMenu( GEOMOp::Op2dPolylineEditor, basicId, -1 );
createMenu( GEOMOp::Op3dSketcher, basicId, -1 );
createMenu( GEOMOp::OpIsoline, basicId, -1 );
createMenu( GEOMOp::OpSurfaceFromFace, basicId, -1 );
createMenu( separator(), basicId, -1 );
createMenu( GEOMOp::OpVector, basicId, -1 );
createMenu( GEOMOp::OpPlane, basicId, -1 );
createMenu( GEOMOp::OpLCS, basicId, -1 );
createMenu( GEOMOp::OpOriginAndVectors, basicId, -1 );
int primId = createMenu( tr( "MEN_PRIMITIVES" ), newEntId, -1 );
createMenu( GEOMOp::OpBox, primId, -1 );
createMenu( GEOMOp::OpCylinder, primId, -1 );
createMenu( GEOMOp::OpSphere, primId, -1 );
createMenu( GEOMOp::OpTorus, primId, -1 );
createMenu( GEOMOp::OpCone, primId, -1 );
createMenu( GEOMOp::OpRectangle, primId, -1 );
createMenu( GEOMOp::OpDisk, primId, -1 );
//createMenu( GEOMOp::OpPipeTShape,primId, -1 );
int genId = createMenu( tr( "MEN_GENERATION" ), newEntId, -1 );
createMenu( GEOMOp::OpPrism, genId, -1 );
createMenu( GEOMOp::OpRevolution, genId, -1 );
createMenu( GEOMOp::OpFilling, genId, -1 );
createMenu( GEOMOp::OpPipe, genId, -1 );
createMenu( GEOMOp::OpPipePath, genId, -1 );
createMenu( GEOMOp::OpThickness, genId, -1 );
//int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
//createMenu( GEOMOp::OpSmoothingSurface, advId, -1 );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
createMenu( separator(), newEntId, -1 );
int groupId = createMenu( tr( "MEN_GROUP" ), newEntId, -1 );
createMenu( GEOMOp::OpGroupCreate, groupId, -1 );
createMenu( GEOMOp::OpGroupEdit, groupId, -1 );
createMenu( GEOMOp::OpGroupUnion, groupId, -1 );
createMenu( GEOMOp::OpGroupIntersect, groupId, -1 );
createMenu( GEOMOp::OpGroupCut, groupId, -1 );
createMenu( separator(), newEntId, -1 );
int fieldId = createMenu( tr( "MEN_FIELD" ), newEntId, -1 );
createMenu( GEOMOp::OpCreateField, fieldId, -1 );
createMenu( GEOMOp::OpEditField, fieldId, -1 );
createMenu( separator(), newEntId, -1 );
int blocksId = createMenu( tr( "MEN_BLOCKS" ), newEntId, -1 );
createMenu( GEOMOp::OpQuadFace, blocksId, -1 );
createMenu( GEOMOp::OpHexaSolid, blocksId, -1 );
//createMenu( GEOMOp::OpDividedDisk, blocksId, -1 );
//createMenu( GEOMOp::OpDividedCylinder, blocksId, -1 );
createMenu( separator(), newEntId, -1 );
createMenu( GEOMOp::OpExplode, newEntId, -1 );
int buildId = createMenu( tr( "MEN_BUILD" ), newEntId, -1 );
createMenu( GEOMOp::OpEdge, buildId, -1 );
createMenu( GEOMOp::OpWire, buildId, -1 );
createMenu( GEOMOp::OpFace, buildId, -1 );
createMenu( GEOMOp::OpShell, buildId, -1 );
createMenu( GEOMOp::OpSolid, buildId, -1 );
createMenu( GEOMOp::OpCompound, buildId, -1 );
createMenu( separator(), newEntId, -1 );
createMenu( GEOMOp::OpPictureImport, newEntId, -1 );
#ifdef WITH_OPENCV
createMenu( GEOMOp::OpFeatureDetect, newEntId, -1 );
#endif
int operId = createMenu( tr( "MEN_OPERATIONS" ), -1, -1, 10 );
int boolId = createMenu( tr( "MEN_BOOLEAN" ), operId, -1 );
createMenu( GEOMOp::OpFuse, boolId, -1 );
createMenu( GEOMOp::OpCommon, boolId, -1 );
createMenu( GEOMOp::OpCut, boolId, -1 );
createMenu( GEOMOp::OpSection, boolId, -1 );
int transId = createMenu( tr( "MEN_TRANSFORMATION" ), operId, -1 );
createMenu( GEOMOp::OpTranslate, transId, -1 );
createMenu( GEOMOp::OpRotate, transId, -1 );
createMenu( GEOMOp::OpChangeLoc, transId, -1 );
createMenu( GEOMOp::OpMirror, transId, -1 );
createMenu( GEOMOp::OpScale, transId, -1 );
createMenu( GEOMOp::OpOffset, transId, -1 );
createMenu( GEOMOp::OpProjection, transId, -1 );
createMenu( GEOMOp::OpExtension, transId, -1 );
createMenu( GEOMOp::OpProjOnCyl, transId, -1 );
createMenu( separator(), transId, -1 );
createMenu( GEOMOp::OpMultiTranslate, transId, -1 );
createMenu( GEOMOp::OpMultiRotate, transId, -1 );
int blockId = createMenu( tr( "MEN_BLOCKS" ), operId, -1 );
createMenu( GEOMOp::OpMultiTransform, blockId, -1 );
createMenu( GEOMOp::OpExplodeBlock, blockId, -1 );
createMenu( GEOMOp::OpPropagate, blockId, -1 );
createMenu( separator(), operId, -1 );
createMenu( GEOMOp::OpPartition, operId, -1 );
createMenu( GEOMOp::OpArchimede, operId, -1 );
createMenu( GEOMOp::OpShapesOnShape, operId, -1 );
createMenu( GEOMOp::OpSharedShapes, operId, -1 );
createMenu( GEOMOp::OpTransferData, operId, -1 );
createMenu( GEOMOp::OpExtraction, operId, -1 );
createMenu( separator(), operId, -1 );
createMenu( GEOMOp::OpFillet1d, operId, -1 );
createMenu( GEOMOp::OpFillet2d, operId, -1 );
createMenu( GEOMOp::OpFillet3d, operId, -1 );
createMenu( GEOMOp::OpChamfer, operId, -1 );
createMenu( GEOMOp::OpExtrudedBoss, operId, -1 );
createMenu( GEOMOp::OpExtrudedCut, operId, -1 );
int repairId = createMenu( tr( "MEN_REPAIR" ), -1, -1, 10 );
createMenu( GEOMOp::OpShapeProcess, repairId, -1 );
createMenu( GEOMOp::OpSuppressFaces, repairId, -1 );
createMenu( GEOMOp::OpCloseContour, repairId, -1 );
createMenu( GEOMOp::OpRemoveIntWires, repairId, -1 );
createMenu( GEOMOp::OpSuppressHoles, repairId, -1 );
createMenu( GEOMOp::OpSewing, repairId, -1 );
createMenu( GEOMOp::OpGlueFaces, repairId, -1 );
createMenu( GEOMOp::OpGlueEdges, repairId, -1 );
createMenu( GEOMOp::OpLimitTolerance, repairId, -1 );
createMenu( GEOMOp::OpAddPointOnEdge, repairId, -1 );
//createMenu( GEOMOp::OpFreeBoundaries, repairId, -1 );
//createMenu( GEOMOp::OpFreeFaces, repairId, -1 );
createMenu( GEOMOp::OpOrientation, repairId, -1 );
createMenu( GEOMOp::OpRemoveWebs, repairId, -1 );
createMenu( GEOMOp::OpRemoveExtraEdges, repairId, -1 );
createMenu( GEOMOp::OpFuseEdges, repairId, -1 );
createMenu( GEOMOp::OpUnionFaces, repairId, -1 );
int measurId = createMenu( tr( "MEN_MEASURES" ), -1, -1, 10 );
createMenu( GEOMOp::OpPointCoordinates, measurId, -1 );
createMenu( GEOMOp::OpProperties, measurId, -1 );
createMenu( separator(), measurId, -1 );
createMenu( GEOMOp::OpCenterMass, measurId, -1 );
createMenu( GEOMOp::OpInertia, measurId, -1 );
createMenu( GEOMOp::OpNormale, measurId, -1 );
createMenu( separator(), measurId, -1 );
createMenu( GEOMOp::OpFreeBoundaries, measurId, -1 );
createMenu( GEOMOp::OpFreeFaces, measurId, -1 );
createMenu( separator(), measurId, -1 );
int dimId = createMenu( tr( "MEN_DIMENSIONS" ), measurId, -1 );
createMenu( GEOMOp::OpBoundingBox, dimId, -1 );
createMenu( GEOMOp::OpMinDistance, dimId, -1 );
createMenu( GEOMOp::OpAngle, dimId, -1 );
createMenu( GEOMOp::OpManageDimensions, dimId, -1 );
createMenu( GEOMOp::OpAnnotation, measurId, -1 );
createMenu( separator(), measurId, -1 );
createMenu( GEOMOp::OpTolerance, measurId, -1 );
createMenu( separator(), measurId, -1 );
createMenu( GEOMOp::OpWhatIs, measurId, -1 );
createMenu( GEOMOp::OpCheckShape, measurId, -1 );
createMenu( GEOMOp::OpCheckCompound, measurId, -1 );
createMenu( GEOMOp::OpGetNonBlocks, measurId, -1 );
createMenu( GEOMOp::OpCheckSelfInters, measurId, -1 );
createMenu( GEOMOp::OpFastCheckInters, measurId, -1 );
createMenu( GEOMOp::OpInspectObj, measurId, -1 );
#ifndef DISABLE_PLOT2DVIEWER
createMenu( GEOMOp::OpShapeStatistics, measurId, -1 );
#endif
int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
#ifndef DISABLE_PYCONSOLE
#if defined(_DEBUG_) || defined(_DEBUG) // PAL16821
createMenu( separator(), toolsId, -1 );
createMenu( GEOMOp::OpCheckGeom, toolsId, -1 );
#endif
#endif
createMenu( separator(), toolsId, -1 );
createMenu( GEOMOp::OpMaterialsLibrary, toolsId, -1 );
createMenu( separator(), toolsId, -1 );
int viewId = createMenu( tr( "MEN_VIEW" ), -1, -1 );
createMenu( separator(), viewId, -1 );
int dispmodeId = createMenu( tr( "MEN_DISPLAY_MODE" ), viewId, -1 );
createMenu( GEOMOp::OpDMWireframe, dispmodeId, -1 );
createMenu( GEOMOp::OpDMShading, dispmodeId, -1 );
createMenu( GEOMOp::OpDMShadingWithEdges, dispmodeId, -1 );
createMenu( GEOMOp::OpDMTexture, dispmodeId, -1 );
createMenu( separator(), dispmodeId, -1 );
createMenu( GEOMOp::OpSwitchVectors, dispmodeId, -1 );
createMenu( GEOMOp::OpSwitchVertices, dispmodeId, -1 );
createMenu( GEOMOp::OpSwitchName, dispmodeId, -1 );
createMenu( separator(), viewId, -1 );
createMenu( GEOMOp::OpShowAll, viewId, -1 );
createMenu( GEOMOp::OpHideAll, viewId, -1 );
createMenu( separator(), viewId, -1 );
createMenu( GEOMOp::OpPublishObject, 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( GEOMOp::OpShow, viewId, -1 );
createMenu( GEOMOp::OpShowOnly, viewId, -1 );
createMenu( GEOMOp::OpHide, viewId, -1 );
*/
// ---- create toolbars --------------------------
int basicTbId = createTool( tr( "TOOL_BASIC" ), QString( "GEOMBasic" ) );
createTool( GEOMOp::OpPoint, basicTbId );
createTool( GEOMOp::OpLine, basicTbId );
createTool( GEOMOp::OpCircle, basicTbId );
createTool( GEOMOp::OpEllipse, basicTbId );
createTool( GEOMOp::OpArc, basicTbId );
createTool( GEOMOp::OpCurve, basicTbId );
createTool( GEOMOp::OpVector, basicTbId );
createTool( GEOMOp::Op2dSketcher, basicTbId ); //rnc
createTool( GEOMOp::Op2dPolylineEditor, basicTbId );
createTool( GEOMOp::Op3dSketcher, basicTbId ); //rnc
createTool( GEOMOp::OpIsoline, basicTbId );
createTool( GEOMOp::OpSurfaceFromFace, basicTbId );
createTool( GEOMOp::OpPlane, basicTbId );
createTool( GEOMOp::OpLCS, basicTbId );
createTool( GEOMOp::OpOriginAndVectors, basicTbId );
// int sketchTbId = createTool( tr( "TOOL_SKETCH" ), QString( "GEOMSketch" ) );
// createTool( GEOMOp::Op2dSketcher, sketchTbId );
// createTool( GEOMOp::Op3dSketcher, sketchTbId );
int primTbId = createTool( tr( "TOOL_PRIMITIVES" ), QString( "GEOMPrimitives" ) );
createTool( GEOMOp::OpBox, primTbId );
createTool( GEOMOp::OpCylinder, primTbId );
createTool( GEOMOp::OpSphere, primTbId );
createTool( GEOMOp::OpTorus, primTbId );
createTool( GEOMOp::OpCone, primTbId );
createTool( GEOMOp::OpRectangle, primTbId );
createTool( GEOMOp::OpDisk, primTbId );
//createTool( GEOMOp::OpPipeTShape, primTbId ); //rnc
//int blocksTbId = createTool( tr( "TOOL_BLOCKS" ), QString( "GEOMBlocks" ) );
//createTool( GEOMOp::OpDividedDisk, blocksTbId );
//createTool( GEOMOp::OpDividedCylinder, blocksTbId );
int boolTbId = createTool( tr( "TOOL_BOOLEAN" ), QString( "GEOMBooleanOperations" ) );
createTool( GEOMOp::OpFuse, boolTbId );
createTool( GEOMOp::OpCommon, boolTbId );
createTool( GEOMOp::OpCut, boolTbId );
createTool( GEOMOp::OpSection, boolTbId );
int genTbId = createTool( tr( "TOOL_GENERATION" ), QString( "GEOMGeneration" ) );
createTool( GEOMOp::OpPrism, genTbId );
createTool( GEOMOp::OpRevolution, genTbId );
createTool( GEOMOp::OpFilling, genTbId );
createTool( GEOMOp::OpPipe, genTbId );
createTool( GEOMOp::OpPipePath, genTbId );
createTool( GEOMOp::OpThickness, genTbId );
int transTbId = createTool( tr( "TOOL_TRANSFORMATION" ), QString( "GEOMTransformation" ) );
createTool( GEOMOp::OpTranslate, transTbId );
createTool( GEOMOp::OpRotate, transTbId );
createTool( GEOMOp::OpChangeLoc, transTbId );
createTool( GEOMOp::OpMirror, transTbId );
createTool( GEOMOp::OpScale, transTbId );
createTool( GEOMOp::OpOffset, transTbId );
createTool( GEOMOp::OpProjection, transTbId );
createTool( GEOMOp::OpExtension, transTbId );
createTool( GEOMOp::OpProjOnCyl, transTbId );
createTool( separator(), transTbId );
createTool( GEOMOp::OpMultiTranslate, transTbId );
createTool( GEOMOp::OpMultiRotate, transTbId );
int operTbId = createTool( tr( "TOOL_OPERATIONS" ), QString( "GEOMOperations" ) );
createTool( GEOMOp::OpExplode, operTbId );
createTool( GEOMOp::OpPartition, operTbId );
createTool( GEOMOp::OpArchimede, operTbId );
createTool( GEOMOp::OpShapesOnShape, operTbId );
createTool( GEOMOp::OpSharedShapes, operTbId );
createTool( GEOMOp::OpTransferData, operTbId );
createTool( GEOMOp::OpExtraction, operTbId );
int featTbId = createTool( tr( "TOOL_FEATURES" ), QString( "GEOMModification" ) );
createTool( GEOMOp::OpFillet1d, featTbId );
createTool( GEOMOp::OpFillet2d, featTbId );
createTool( GEOMOp::OpFillet3d, featTbId );
createTool( GEOMOp::OpChamfer, featTbId );
createTool( GEOMOp::OpExtrudedBoss, featTbId );
createTool( GEOMOp::OpExtrudedCut, featTbId );
int buildTbId = createTool( tr( "TOOL_BUILD" ), QString( "GEOMBuild" ) );
createTool( GEOMOp::OpEdge, buildTbId );
createTool( GEOMOp::OpWire, buildTbId );
createTool( GEOMOp::OpFace, buildTbId );
createTool( GEOMOp::OpShell, buildTbId );
createTool( GEOMOp::OpSolid, buildTbId );
createTool( GEOMOp::OpCompound, buildTbId );
int measureTbId = createTool( tr( "TOOL_MEASURES" ), QString( "GEOMMeasures" ) );
createTool( GEOMOp::OpPointCoordinates, measureTbId );
createTool( GEOMOp::OpProperties, measureTbId );
createTool( GEOMOp::OpCenterMass, measureTbId );
createTool( GEOMOp::OpInertia, measureTbId );
createTool( GEOMOp::OpNormale, measureTbId );
createTool( separator(), measureTbId );
createTool( GEOMOp::OpBoundingBox, measureTbId );
createTool( GEOMOp::OpMinDistance, measureTbId );
createTool( GEOMOp::OpAngle, measureTbId );
createTool( GEOMOp::OpAnnotation, measureTbId );
createTool( GEOMOp::OpTolerance , measureTbId );
createTool( separator(), measureTbId );
createTool( GEOMOp::OpFreeBoundaries, measureTbId );
createTool( GEOMOp::OpFreeFaces, measureTbId );
createTool( separator(), measureTbId );
createTool( GEOMOp::OpWhatIs, measureTbId );
createTool( GEOMOp::OpCheckShape, measureTbId );
createTool( GEOMOp::OpCheckCompound, measureTbId );
createTool( GEOMOp::OpGetNonBlocks, measureTbId );
createTool( GEOMOp::OpCheckSelfInters, measureTbId );
createTool( GEOMOp::OpFastCheckInters, measureTbId );
int picturesTbId = createTool( tr( "TOOL_PICTURES" ), QString( "GEOMPictures" ) );
createTool( GEOMOp::OpPictureImport, picturesTbId );
#ifdef WITH_OPENCV
createTool( GEOMOp::OpFeatureDetect, picturesTbId );
#endif
//int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
//createTool( GEOMOp::OpSmoothingSurface, advancedTbId );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create popup menus --------------------------
QString clientOCCorVTK = "(client='OCCViewer' or client='VTKViewer')";
QString clientOCC = "(client='OCCViewer')";
QString clientOCCorVTK_AndSomeVisible = clientOCCorVTK + " and selcount>0 and isVisible";
QString clientOCC_AndSomeVisible = clientOCC + " and selcount>0 and isVisible";
QString clientOCCorOB = "(client='ObjectBrowser' or client='OCCViewer')";
QString clientOCCorVTKorOB = "(client='ObjectBrowser' or client='OCCViewer' or client='VTKViewer')";
QString clientOCCorVTKorOB_AndSomeVisible = clientOCCorVTKorOB + " and selcount>0 and isVisible";
QString clientOCCorOB_AndSomeVisible = clientOCCorOB + " and selcount>0 and isVisible";
QString notGEOMShape = "(not ($component={'GEOM'}) and ($displayer={'Geometry'}))";
QString autoColorPrefix =
"(client='ObjectBrowser' or client='OCCViewer' or client='VTKViewer') and type='Shape' and selcount=1";
QtxPopupMgr* mgr = popupMgr();
mgr->insert( action( GEOMOp::OpDelete ), -1, -1 ); // delete
mgr->setRule( action( GEOMOp::OpDelete ), QString("$type in {'Shape' 'Group' 'Folder' 'Field' 'FieldStep'} and selcount>0"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpGroupCreatePopup ), -1, -1 ); // create group
mgr->setRule( action( GEOMOp::OpGroupCreatePopup ), QString("type='Shape' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpEditFieldPopup ), -1, -1 ); // edit field
mgr->setRule( action( GEOMOp::OpEditFieldPopup ), QString("(type='Field' or type='FieldStep') and isOCC=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpDiscloseChildren ), -1, -1 ); // disclose child items
mgr->setRule( action( GEOMOp::OpDiscloseChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasConcealedChildren=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpConcealChildren ), -1, -1 ); // conceal child items
mgr->setRule( action( GEOMOp::OpConcealChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasDisclosedChildren=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpGroupEdit ), -1, -1 ); // edit group
mgr->setRule( action( GEOMOp::OpGroupEdit ), QString("client='ObjectBrowser' and type='Group' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
//QString bringRule = clientOCCorOB + " and ($component={'GEOM'}) and (selcount>0) and isOCC=true and topLevel=false";
QString bringRule = clientOCCorOB + " and ($displayer={'Geometry'}) and isFolder=false and (selcount>0) and isOCC=true";
mgr->insert( action(GEOMOp::OpBringToFront ), -1, -1 ); // bring to front
mgr->setRule(action(GEOMOp::OpBringToFront), bringRule + " and autoBringToFront = false", QtxPopupMgr::VisibleRule );
mgr->setRule(action(GEOMOp::OpBringToFront), "topLevel=true", QtxPopupMgr::ToggleRule );
mgr->insert( action(GEOMOp::OpClsBringToFront ), -1, -1 ); // clear bring to front
mgr->setRule( action(GEOMOp::OpClsBringToFront ), clientOCC + " and autoBringToFront = false", QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
dispmodeId = mgr->insert( tr( "MEN_DISPLAY_MODE" ), -1, -1 ); // display mode menu
mgr->insert( action( GEOMOp::OpWireframe ), dispmodeId, -1 ); // wireframe
//mgr->setRule( action( GEOMOp::OpWireframe ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpWireframe ), clientOCCorVTK_AndSomeVisible + " and ($displayer={'Geometry'})", QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpWireframe ), clientOCCorVTK + " and displaymode='Wireframe'", QtxPopupMgr::ToggleRule );
mgr->insert( action( GEOMOp::OpShading ), dispmodeId, -1 ); // shading
// mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK_AndSomeVisible + " and ($displayer={'Geometry'})", QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK + " and displaymode='Shading'", QtxPopupMgr::ToggleRule );
mgr->insert( action( GEOMOp::OpShadingWithEdges ), dispmodeId, -1 ); // shading with edges
mgr->setRule( action( GEOMOp::OpShadingWithEdges ), clientOCCorVTK_AndSomeVisible + " and ($displayer={'Geometry'})", QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpShadingWithEdges ), clientOCCorVTK + " and displaymode='ShadingWithEdges'", QtxPopupMgr::ToggleRule );
mgr->insert( action( GEOMOp::OpTexture ), dispmodeId, -1 ); // wireframe
mgr->setRule( action( GEOMOp::OpTexture ), clientOCC_AndSomeVisible, QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpTexture), clientOCC + " and displaymode='Texture'", QtxPopupMgr::ToggleRule );
mgr->insert( separator(), dispmodeId, -1 );
mgr->insert( action( GEOMOp::OpVectors ), dispmodeId, -1 ); // vectors
mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK_AndSomeVisible + " and ($displayer={'Geometry'})", QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK + " and isVectorsMode", QtxPopupMgr::ToggleRule );
mgr->insert( action( GEOMOp::OpVertices ), dispmodeId, -1 ); // vertices
mgr->setRule( action( GEOMOp::OpVertices ), clientOCCorVTK_AndSomeVisible + " and ($displayer={'Geometry'})", QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpVertices ), clientOCCorVTK + " and isVerticesMode", QtxPopupMgr::ToggleRule );
mgr->insert( action( GEOMOp::OpShowName ), dispmodeId, -1 ); // show name
mgr->setRule( action( GEOMOp::OpShowName ), clientOCCorVTK_AndSomeVisible + " and ($displayer={'Geometry'})", QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpShowName ), clientOCCorVTK + " and isNameMode", QtxPopupMgr::ToggleRule );
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpColor ), -1, -1 ); // color
mgr->setRule( action( GEOMOp::OpColor ), clientOCCorVTKorOB_AndSomeVisible + " and ($displayer={'Geometry'})" + "and isPhysicalMaterial=false", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpTransparency ), -1, -1 ); // transparency
mgr->setRule( action( GEOMOp::OpTransparency ), clientOCCorVTK_AndSomeVisible + " and ($displayer={'Geometry'})", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpIsos ), -1, -1 ); // isos
mgr->setRule( action( GEOMOp::OpIsos ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible" + " and ($displayer={'Geometry'})", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpDeflection ), -1, -1 ); // deflection
mgr->setRule( action( GEOMOp::OpDeflection ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible" + " and ($displayer={'Geometry'})", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpPointMarker ), -1, -1 ); // point marker
mgr->setRule( action( GEOMOp::OpPointMarker ), clientOCCorOB + " and ($type in {'Shape' 'Group' 'Field' 'FieldStep'} or " + notGEOMShape + ") and selcount>0 and isOCC=true", QtxPopupMgr::VisibleRule );
// material properties
mgr->insert( action( GEOMOp::OpMaterialProperties ), -1, -1 );
mgr->setRule( action( GEOMOp::OpMaterialProperties ), clientOCCorVTK_AndSomeVisible + " and ($displayer={'Geometry'}) and matMenu=false", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpMaterialMenu ), -1, -1 );
mgr->setRule( action( GEOMOp::OpMaterialMenu ), clientOCCorVTK_AndSomeVisible + " and ($displayer={'Geometry'}) and matMenu=true", QtxPopupMgr::VisibleRule );
// texture
mgr->insert( action( GEOMOp::OpSetTexture ), -1, -1 );
mgr->setRule( action( GEOMOp::OpSetTexture ), clientOCCorOB_AndSomeVisible + " and ($displayer={'Geometry'})", QtxPopupMgr::VisibleRule );
int lineW = mgr->insert( tr( "MEN_LINE_WIDTH" ), -1, -1 ); // line width menu
mgr->insert( action( GEOMOp::OpEdgeWidth ), lineW, -1 ); // edge width
mgr->setRule( action( GEOMOp::OpEdgeWidth ), clientOCCorVTK_AndSomeVisible + " and ($displayer={'Geometry'})", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpIsosWidth ), lineW, -1 ); // isos width
mgr->setRule( action( GEOMOp::OpIsosWidth ), clientOCCorVTK_AndSomeVisible + " and ($displayer={'Geometry'})", QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpAutoColor ), -1, -1 ); // auto color
mgr->setRule( action( GEOMOp::OpAutoColor ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpNoAutoColor ), -1, -1 ); // disable auto color
mgr->setRule( action( GEOMOp::OpNoAutoColor ), autoColorPrefix + " and isAutoColor=true", QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpEditAnnotation ), -1, -1 ); // edit annotation
mgr->setRule( action( GEOMOp::OpEditAnnotation ), clientOCC + " and annotationsCount=1", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpDeleteAnnotation ), -1, -1 ); // delete annotation
mgr->setRule( action( GEOMOp::OpDeleteAnnotation ), clientOCC + " and annotationsCount>0", 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' 'FieldStep'";
QString canDisplay = "($displayer={'Geometry'}) and (selcount>0) and ({true} in $canBeDisplayed) ",
onlyComponent = "((type='Component') and ($component={'GEOM'}) and selcount=1)",
rule = canDisplay + "and ((($type in {%1} or " + notGEOMShape + ") and( %2 )) or " + onlyComponent + ")",
types = "'Shape' 'Group' 'FieldStep'";
mgr->insert( action( GEOMOp::OpShow ), -1, -1 ); // display
mgr->setRule( action( GEOMOp::OpShow ), rule.arg( types ).arg( "not isVisible" ), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpHide ), -1, -1 ); // erase
mgr->setRule( action( GEOMOp::OpHide ), rule.arg( types ).arg( "isVisible" ), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpHideAll ), -1, -1 ); // erase All
mgr->setRule( action( GEOMOp::OpHideAll ), clientOCCorVTK, QtxPopupMgr::VisibleRule );
QString selectOnly = "(client='OCCViewer' or client='VTKViewer') and (selcount=0)";
int selectonlyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1); //select only menu
mgr->insert( action(GEOMOp::OpSelectVertex), selectonlyId, -1); //Vertex
mgr->setRule(action(GEOMOp::OpSelectVertex), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectVertex), selectOnly + " and selectionmode='VERTEX'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpSelectEdge), selectonlyId, -1); //Edge
mgr->setRule(action(GEOMOp::OpSelectEdge), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectEdge), selectOnly + " and selectionmode='EDGE'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpSelectWire), selectonlyId, -1); //Wire
mgr->setRule(action(GEOMOp::OpSelectWire), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectWire), selectOnly + " and selectionmode='WIRE'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpSelectFace), selectonlyId, -1); //Face
mgr->setRule(action(GEOMOp::OpSelectFace), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectFace), selectOnly + " and selectionmode='FACE'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpSelectShell), selectonlyId, -1); //Shell
mgr->setRule(action(GEOMOp::OpSelectShell), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectShell), selectOnly + " and selectionmode='SHELL'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpSelectSolid), selectonlyId, -1); //Solid
mgr->setRule(action(GEOMOp::OpSelectSolid), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectSolid), selectOnly + " and selectionmode='SOLID'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpSelectCompound), selectonlyId, -1); //Compound
mgr->setRule(action(GEOMOp::OpSelectCompound), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectCompound), selectOnly + " and selectionmode='COMPOUND'", QtxPopupMgr::ToggleRule);
mgr->insert( separator(), selectonlyId, -1);
mgr->insert( action(GEOMOp::OpSelectAll), selectonlyId, -1); //Clear selection filter
mgr->setRule(action(GEOMOp::OpSelectAll), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectAll), selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpShowOnly ), -1, -1 ); // display only
mgr->setRule(action(GEOMOp::OpShowOnly ), rule.arg( types ).arg( "true" ), QtxPopupMgr::VisibleRule );
mgr->insert( action(GEOMOp::OpShowOnlyChildren ), -1, -1 ); // display only children
mgr->setRule(action(GEOMOp::OpShowOnlyChildren ), (canDisplay + "and ($type in {%1}) and client='ObjectBrowser' and hasChildren=true").arg( types ), QtxPopupMgr::VisibleRule );
QString aDimensionRule = "($component={'GEOM'}) and selcount=1 and isVisible and type='Shape' and %1";
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpShowAllDimensions ), -1, -1 ); // show all dimensions
mgr->setRule( action( GEOMOp::OpShowAllDimensions ), aDimensionRule.arg( "hasHiddenDimensions" ), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpHideAllDimensions ), -1, -1 ); // hide all dimensions
mgr->setRule( action( GEOMOp::OpHideAllDimensions ), aDimensionRule.arg( "hasVisibleDimensions" ), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpShowAllAnnotations ), -1, -1 ); // show all annotations
mgr->setRule( action( GEOMOp::OpShowAllAnnotations ), aDimensionRule.arg( "hasHiddenAnnotations" ), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpHideAllAnnotations ), -1, -1 ); // hide all annotations
mgr->setRule( action( GEOMOp::OpHideAllAnnotations ), aDimensionRule.arg( "hasVisibleAnnotations" ), QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpUnpublishObject ), -1, -1 ); // Unpublish object
mgr->setRule( action( GEOMOp::OpUnpublishObject ), QString("client='ObjectBrowser' and $type in {'Shape' 'Group' 'Field' 'FieldStep'} and selcount>0"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpPublishObject ), -1, -1 ); // Publish object
mgr->setRule( action( GEOMOp::OpPublishObject ), QString("client='ObjectBrowser' and isComponent=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpReimport ), -1, -1 ); // delete
mgr->setRule( action( GEOMOp::OpReimport ), QString("$imported in {'true'} and selcount>0"), QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpCreateFolder ), -1, -1 ); // Create Folder
mgr->setRule( action( GEOMOp::OpCreateFolder ), QString("client='ObjectBrowser' and $component={'GEOM'} and (isComponent=true or isFolder=true)"), QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpSortChildren ), -1, -1 ); // Sort child items
mgr->setRule( action( GEOMOp::OpSortChildren ), QString("client='ObjectBrowser' and $component={'GEOM'} and nbChildren>1"), QtxPopupMgr::VisibleRule );
#ifndef DISABLE_GRAPHICSVIEW
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpShowDependencyTree ), -1, -1 ); // Show dependency tree
mgr->setRule( action( GEOMOp::OpShowDependencyTree ), clientOCCorVTKorOB + " and selcount>0 and ($component={'GEOM'}) and type='Shape'", QtxPopupMgr::VisibleRule );
#endif
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpReduceStudy ), -1, -1 ); // Reduce Study
mgr->setRule( action( GEOMOp::OpReduceStudy ), clientOCCorVTKorOB + " and selcount>0 and ($component={'GEOM'}) and type='Shape'", QtxPopupMgr::VisibleRule );
mgr->hide( mgr->actionId( action( myEraseAll ) ) );
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
if (resMgr) {
GEOM_AISShape::setTopLevelDisplayMode((GEOM_AISShape::TopLevelDispMode)resMgr->integerValue("Geometry", "toplevel_dm", 0));
QColor c = resMgr->colorValue( "Geometry", "toplevel_color", QColor( 170, 85, 0 ) );
GEOM_AISShape::setTopLevelColor(SalomeApp_Tools::color(c));
}
// create plugin actions and menus
addPluginActions();
}
void GeometryGUI::createGeomAction( const int id, const QString& label, const QString& icolabel,
const int accel, const bool toggle, const QString& inModuleActionID )
{
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
QPixmap icon = icolabel.isEmpty() ? resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+label).toLatin1().constData() ), false )
: resMgr->loadPixmap( "GEOM", tr( icolabel.toLatin1().constData() ) );
createAction( id,
tr( QString( "TOP_%1" ).arg( label ).toLatin1().constData() ),
icon,
tr( QString( "MEN_%1" ).arg( label ).toLatin1().constData() ),
tr( QString( "STB_%1" ).arg( label ).toLatin1().constData() ),
accel,
application()->desktop(),
toggle,
this, SLOT( OnGUIEvent() ),
inModuleActionID );
}
也就是说,GeometryGUI将所有命令响应汇总到了GeometryGUI::OnGUIEvent函数。
2.2 执行命令
而在GeometryGUI::OnGUIEvent函数,通过加载以GEOMGUI为插件接口定义的插件接口来执行实际命令,
void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
{
SUIT_Application* anApp = application();
if (!anApp) return;
SUIT_Desktop* desk = anApp->desktop();
// check type of the active viewframe
SUIT_ViewWindow* window = desk->activeWindow();
bool ViewOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
bool ViewVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
#ifndef DISABLE_GRAPHICSVIEW
bool ViewDep = ( window && window->getViewManager()->getType() == GraphicsView_Viewer::Type() );
#else
bool ViewDep = 0;
#endif
// if current viewframe is not of OCC and not of VTK type - return immediately
// fix for IPAL8958 - allow some commands to execute even when NO viewer is active (rename for example)
QList<int> NotViewerDependentCommands;
NotViewerDependentCommands << GEOMOp::OpDelete
<< GEOMOp::OpShow
<< GEOMOp::OpShowOnly
<< GEOMOp::OpShowOnlyChildren
<< GEOMOp::OpDiscloseChildren
<< GEOMOp::OpConcealChildren
<< GEOMOp::OpUnpublishObject
<< GEOMOp::OpPublishObject
<< GEOMOp::OpPointMarker
<< GEOMOp::OpCreateFolder
<< GEOMOp::OpSortChildren;
if ( !ViewOCC && !ViewVTK && !ViewDep && !NotViewerDependentCommands.contains( id ) ) {
// activate OCC viewer
getApp()->getViewManager(OCCViewer_Viewer::Type(), /*create=*/true);
}
// fix for IPAL9103, point 2
if ( CORBA::is_nil( GetGeomGen() ) ) {
SUIT_MessageBox::critical( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_GET_ENGINE" ), tr( "GEOM_BUT_OK" ) );
return;
}
QString libName;
// find corresponding GUI library
switch ( id ) {
case GEOMOp::OpOriginAndVectors: // MENU BASIC - ORIGIN AND BASE VECTORS
createOriginAndBaseVectors(); // internal operation
return;
case GEOMOp::OpSelectVertex: // POPUP MENU - SELECT ONLY - VERTEX
case GEOMOp::OpSelectEdge: // POPUP MENU - SELECT ONLY - EDGE
case GEOMOp::OpSelectWire: // POPUP MENU - SELECT ONLY - WIRE
case GEOMOp::OpSelectFace: // POPUP MENU - SELECT ONLY - FACE
case GEOMOp::OpSelectShell: // POPUP MENU - SELECT ONLY - SHELL
case GEOMOp::OpSelectSolid: // POPUP MENU - SELECT ONLY - SOLID
case GEOMOp::OpSelectCompound: // POPUP MENU - SELECT ONLY - COMPOUND
case GEOMOp::OpSelectAll: // POPUP MENU - SELECT ONLY - SELECT ALL
case GEOMOp::OpDelete: // MENU EDIT - DELETE
#ifndef DISABLE_PYCONSOLE
case GEOMOp::OpCheckGeom: // MENU TOOLS - CHECK GEOMETRY
#endif
case GEOMOp::OpMaterialsLibrary: // MENU TOOLS - MATERIALS LIBRARY
case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT
case GEOMOp::OpColor: // POPUP MENU - COLOR
case GEOMOp::OpSetTexture: // POPUP MENU - SETTEXTURE
case GEOMOp::OpTransparency: // POPUP MENU - TRANSPARENCY
case GEOMOp::OpIncrTransparency: // SHORTCUT - INCREASE TRANSPARENCY
case GEOMOp::OpDecrTransparency: // SHORTCUT - DECREASE TRANSPARENCY
case GEOMOp::OpIsos: // POPUP MENU - ISOS
case GEOMOp::OpIncrNbIsos: // SHORTCUT - INCREASE NB ISOS
case GEOMOp::OpDecrNbIsos: // SHORTCUT - DECREASE NB ISOS
case GEOMOp::OpAutoColor: // POPUP MENU - AUTO COLOR
case GEOMOp::OpNoAutoColor: // POPUP MENU - DISABLE AUTO COLOR
case GEOMOp::OpDiscloseChildren: // POPUP MENU - DISCLOSE CHILD ITEMS
case GEOMOp::OpConcealChildren: // POPUP MENU - CONCEAL CHILD ITEMS
case GEOMOp::OpUnpublishObject: // POPUP MENU - UNPUBLISH
case GEOMOp::OpPublishObject: // ROOT GEOM OBJECT - POPUP MENU - PUBLISH
case GEOMOp::OpPointMarker: // POPUP MENU - POINT MARKER
case GEOMOp::OpMaterialProperties: // POPUP MENU - MATERIAL PROPERTIES
case GEOMOp::OpMaterialMenu: // POPUP MENU - MATERIAL PROPERTIES (sub-menu)
case GEOMOp::OpPredefMaterial: // POPUP MENU - MATERIAL PROPERTIES (sub-menu) - <SOME MATERIAL>
case GEOMOp::OpPredefMaterCustom: // POPUP MENU - MATERIAL PROPERTIES (sub-menu) - CUSTOM...
case GEOMOp::OpEdgeWidth: // POPUP MENU - LINE WIDTH - EDGE WIDTH
case GEOMOp::OpIsosWidth: // POPUP MENU - LINE WIDTH - ISOS WIDTH
case GEOMOp::OpBringToFront: // POPUP MENU - BRING TO FRONT
case GEOMOp::OpClsBringToFront: //
case GEOMOp::OpCreateFolder: // POPUP MENU - CREATE FOLDER
case GEOMOp::OpSortChildren: // POPUP MENU - SORT CHILD ITEMS
#ifndef DISABLE_GRAPHICSVIEW
case GEOMOp::OpShowDependencyTree: // POPUP MENU - SHOW DEPENDENCY TREE
#endif
case GEOMOp::OpReduceStudy: // POPUP MENU - REDUCE STUDY
libName = "GEOMToolsGUI";
break;
case GEOMOp::OpDMWireframe: // MENU VIEW - WIREFRAME
case GEOMOp::OpDMShading: // MENU VIEW - SHADING
case GEOMOp::OpDMShadingWithEdges: // MENU VIEW - SHADING
case GEOMOp::OpDMTexture: // MENU VIEW - TEXTURE
case GEOMOp::OpShowAll: // MENU VIEW - SHOW ALL
case GEOMOp::OpShowOnly: // MENU VIEW - DISPLAY ONLY
case GEOMOp::OpShowOnlyChildren: // MENU VIEW - SHOW ONLY CHILDREN
case GEOMOp::OpHideAll: // MENU VIEW - ERASE ALL
case GEOMOp::OpHide: // MENU VIEW - ERASE
case GEOMOp::OpShow: // MENU VIEW - DISPLAY
case GEOMOp::OpSwitchVectors: // MENU VIEW - VECTOR MODE
case GEOMOp::OpSwitchVertices: // MENU VIEW - VERTICES MODE
case GEOMOp::OpSwitchName: // MENU VIEW - VERTICES MODE
case GEOMOp::OpWireframe: // POPUP MENU - WIREFRAME
case GEOMOp::OpShading: // POPUP MENU - SHADING
case GEOMOp::OpShadingWithEdges: // POPUP MENU - SHADING WITH EDGES
case GEOMOp::OpTexture: // POPUP MENU - TEXTURE
case GEOMOp::OpVectors: // POPUP MENU - VECTORS
case GEOMOp::OpVertices: // POPUP MENU - VERTICES
case GEOMOp::OpShowName: // POPUP MENU - SHOW NAME
libName = "DisplayGUI";
break;
case GEOMOp::OpPoint: // MENU BASIC - POINT
case GEOMOp::OpLine: // MENU BASIC - LINE
case GEOMOp::OpCircle: // MENU BASIC - CIRCLE
case GEOMOp::OpEllipse: // MENU BASIC - ELLIPSE
case GEOMOp::OpArc: // MENU BASIC - ARC
case GEOMOp::OpVector: // MENU BASIC - VECTOR
case GEOMOp::OpPlane: // MENU BASIC - PLANE
case GEOMOp::OpCurve: // MENU BASIC - CURVE
case GEOMOp::OpLCS: // MENU BASIC - LOCAL COORDINATE SYSTEM
libName = "BasicGUI";
break;
case GEOMOp::OpBox: // MENU PRIMITIVE - BOX
case GEOMOp::OpCylinder: // MENU PRIMITIVE - CYLINDER
case GEOMOp::OpSphere: // MENU PRIMITIVE - SPHERE
case GEOMOp::OpTorus: // MENU PRIMITIVE - TORUS
case GEOMOp::OpCone: // MENU PRIMITIVE - CONE
case GEOMOp::OpRectangle: // MENU PRIMITIVE - FACE
case GEOMOp::OpDisk: // MENU PRIMITIVE - DISK
libName = "PrimitiveGUI";
break;
case GEOMOp::OpPrism: // MENU GENERATION - PRISM
case GEOMOp::OpRevolution: // MENU GENERATION - REVOLUTION
case GEOMOp::OpFilling: // MENU GENERATION - FILLING
case GEOMOp::OpPipe: // MENU GENERATION - PIPE
case GEOMOp::OpPipePath: // MENU GENERATION - RESTORE PATH
case GEOMOp::OpThickness: // MENU GENERATION - THICKNESS
libName = "GenerationGUI";
break;
case GEOMOp::Op2dSketcher: // MENU ENTITY - SKETCHER
case GEOMOp::Op3dSketcher: // MENU ENTITY - 3D SKETCHER
case GEOMOp::OpIsoline: // MENU BASIC - ISOLINE
case GEOMOp::OpExplode: // MENU ENTITY - EXPLODE
case GEOMOp::OpSurfaceFromFace: // MENU ENTITY - SURFACE FROM FACE
#ifdef WITH_OPENCV
case GEOMOp::OpFeatureDetect: // MENU ENTITY - FEATURE DETECTION
#endif
case GEOMOp::OpPictureImport: // MENU ENTITY - IMPORT PICTURE IN VIEWER
case GEOMOp::OpCreateField: // MENU FIELD - CREATE FIELD
case GEOMOp::OpEditField: // MENU FIELD - EDIT FIELD
case GEOMOp::OpEditFieldPopup: // POPUP MENU - EDIT FIELD
case GEOMOp::Op2dPolylineEditor: // MENU BASIC - POLYLINE EDITOR
libName = "EntityGUI";
break;
case GEOMOp::OpEdge: // MENU BUILD - EDGE
case GEOMOp::OpWire: // MENU BUILD - WIRE
case GEOMOp::OpFace: // MENU BUILD - FACE
case GEOMOp::OpShell: // MENU BUILD - SHELL
case GEOMOp::OpSolid: // MENU BUILD - SOLID
case GEOMOp::OpCompound: // MENU BUILD - COMPOUND
libName = "BuildGUI";
break;
case GEOMOp::OpFuse: // MENU BOOLEAN - FUSE
case GEOMOp::OpCommon: // MENU BOOLEAN - COMMON
case GEOMOp::OpCut: // MENU BOOLEAN - CUT
case GEOMOp::OpSection: // MENU BOOLEAN - SECTION
libName = "BooleanGUI";
break;
case GEOMOp::OpTranslate: // MENU TRANSFORMATION - TRANSLATION
case GEOMOp::OpRotate: // MENU TRANSFORMATION - ROTATION
case GEOMOp::OpChangeLoc: // MENU TRANSFORMATION - LOCATION
case GEOMOp::OpMirror: // MENU TRANSFORMATION - MIRROR
case GEOMOp::OpScale: // MENU TRANSFORMATION - SCALE
case GEOMOp::OpOffset: // MENU TRANSFORMATION - OFFSET
case GEOMOp::OpProjection: // MENU TRANSFORMATION - PROJECTION
case GEOMOp::OpProjOnCyl: // MENU TRANSFORMATION - PROJECTION ON CYLINDER
case GEOMOp::OpMultiTranslate: // MENU TRANSFORMATION - MULTI-TRANSLATION
case GEOMOp::OpMultiRotate: // MENU TRANSFORMATION - MULTI-ROTATION
case GEOMOp::OpReimport: // CONTEXT(POPUP) MENU - RELOAD_IMPORTED
case GEOMOp::OpExtension: // MENU TRANSFORMATION - EXTENSION
libName = "TransformationGUI";
break;
case GEOMOp::OpPartition: // MENU OPERATION - PARTITION
case GEOMOp::OpArchimede: // MENU OPERATION - ARCHIMEDE
case GEOMOp::OpFillet3d: // MENU OPERATION - FILLET
case GEOMOp::OpChamfer: // MENU OPERATION - CHAMFER
case GEOMOp::OpShapesOnShape: // MENU OPERATION - GET SHAPES ON SHAPE
case GEOMOp::OpFillet2d: // MENU OPERATION - FILLET 2D
case GEOMOp::OpFillet1d: // MENU OPERATION - FILLET 1D
case GEOMOp::OpSharedShapes: // MENU OPERATION - GET SHARED SHAPES
case GEOMOp::OpExtrudedBoss: // MENU OPERATION - EXTRUDED BOSS
case GEOMOp::OpExtrudedCut: // MENU OPERATION - EXTRUDED CUT
case GEOMOp::OpTransferData: // MENU OPERATION - TRANSFER DATA
case GEOMOp::OpExtraction: // MENU OPERATION - EXTRACT AND REBUILD
libName = "OperationGUI";
break;
case GEOMOp::OpSewing: // MENU REPAIR - SEWING
case GEOMOp::OpSuppressFaces: // MENU REPAIR - SUPPRESS FACES
case GEOMOp::OpSuppressHoles: // MENU REPAIR - SUPPRESS HOLE
case GEOMOp::OpShapeProcess: // MENU REPAIR - SHAPE PROCESSING
case GEOMOp::OpCloseContour: // MENU REPAIR - CLOSE CONTOUR
case GEOMOp::OpRemoveIntWires: // MENU REPAIR - REMOVE INTERNAL WIRES
case GEOMOp::OpAddPointOnEdge: // MENU REPAIR - ADD POINT ON EDGE
case GEOMOp::OpFreeBoundaries: // MENU MEASURE - FREE BOUNDARIES
case GEOMOp::OpFreeFaces: // MENU MEASURE - FREE FACES
case GEOMOp::OpOrientation: // MENU REPAIR - CHANGE ORIENTATION
case GEOMOp::OpGlueFaces: // MENU REPAIR - GLUE FACES
case GEOMOp::OpGlueEdges: // MENU REPAIR - GLUE EDGES
case GEOMOp::OpLimitTolerance: // MENU REPAIR - LIMIT TOLERANCE
case GEOMOp::OpRemoveWebs: // MENU REPAIR - REMOVE INTERNAL FACES
case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES
case GEOMOp::OpFuseEdges: // MENU REPAIR - FUSE COLLINEAR EDGES
case GEOMOp::OpUnionFaces: // MENU REPAIR - UNION FACES
case GEOMOp::OpInspectObj: // MENU REPAIR - INSPECT OBJECT
libName = "RepairGUI";
break;
case GEOMOp::OpProperties: // MENU MEASURE - PROPERTIES
case GEOMOp::OpCenterMass: // MENU MEASURE - CDG
case GEOMOp::OpInertia: // MENU MEASURE - INERTIA
case GEOMOp::OpNormale: // MENU MEASURE - NORMALE
case GEOMOp::OpBoundingBox: // MENU MEASURE - BOUNDING BOX
case GEOMOp::OpMinDistance: // MENU MEASURE - MIN DISTANCE
case GEOMOp::OpAngle: // MENU MEASURE - ANGLE
case GEOMOp::OpTolerance: // MENU MEASURE - TOLERANCE
case GEOMOp::OpWhatIs: // MENU MEASURE - WHATIS
case GEOMOp::OpCheckShape: // MENU MEASURE - CHECK
case GEOMOp::OpCheckCompound: // MENU MEASURE - CHECK COMPOUND OF BLOCKS
case GEOMOp::OpGetNonBlocks: // MENU MEASURE - Get NON BLOCKS
case GEOMOp::OpPointCoordinates: // MENU MEASURE - POINT COORDINATES
case GEOMOp::OpCheckSelfInters: // MENU MEASURE - CHECK SELF INTERSECTIONS
case GEOMOp::OpFastCheckInters: // MENU MEASURE - FAST CHECK INTERSECTIONS
case GEOMOp::OpManageDimensions: // MENU MEASURE - MANAGE DIMENSIONS
case GEOMOp::OpAnnotation: // MENU MEASURE - ANNOTATION
case GEOMOp::OpEditAnnotation: // POPUP MENU - EDIT ANNOTATION
case GEOMOp::OpDeleteAnnotation: // POPUP MENU - DELETE ANNOTATION
#ifndef DISABLE_PLOT2DVIEWER
case GEOMOp::OpShapeStatistics: // MENU MEASURE - SHAPE STATISTICS
#endif
case GEOMOp::OpShowAllDimensions: // POPUP MENU - SHOW ALL DIMENSIONS
case GEOMOp::OpHideAllDimensions: // POPUP MENU - HIDE ALL DIMENSIONS
case GEOMOp::OpShowAllAnnotations: // POPUP MENU - SHOW ALL ANNOTATIONS
case GEOMOp::OpHideAllAnnotations: // POPUP MENU - HIDE ALL ANNOTATIONS
libName = "MeasureGUI";
break;
case GEOMOp::OpGroupCreate: // MENU GROUP - CREATE
case GEOMOp::OpGroupCreatePopup: // POPUP MENU - CREATE GROUP
case GEOMOp::OpGroupEdit: // MENU GROUP - EDIT
case GEOMOp::OpGroupUnion: // MENU GROUP - UNION
case GEOMOp::OpGroupIntersect: // MENU GROUP - INTERSECT
case GEOMOp::OpGroupCut: // MENU GROUP - CUT
libName = "GroupGUI";
break;
case GEOMOp::OpHexaSolid: // MENU BLOCKS - HEXAHEDRAL SOLID
case GEOMOp::OpMultiTransform: // MENU BLOCKS - MULTI-TRANSFORMATION
case GEOMOp::OpQuadFace: // MENU BLOCKS - QUADRANGLE FACE
case GEOMOp::OpPropagate: // MENU BLOCKS - PROPAGATE
case GEOMOp::OpExplodeBlock: // MENU BLOCKS - EXPLODE ON BLOCKS
libName = "BlocksGUI";
break;
//case GEOMOp::OpAdvancedNoOp: // NO OPERATION (advanced operations base)
//case GEOMOp::OpPipeTShape: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
//case GEOMOp::OpPipeTShapeGroups: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
//case GEOMOp::OpDividedDisk: // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK
//case GEOMOp::OpDividedCylinder: // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER
//case GEOMOp::OpSmoothingSurface: // MENU NEW ENTITY - ADVANCED - SMOOTHINGSURFACE
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
//libName = "AdvancedGUI";
//break;
default:
if (myPluginActions.contains(id)) {
libName = myPluginActions[id].first;
GEOMPluginGUI* library = 0;
if ( !libName.isEmpty() ) {
#if defined(WIN32)
libName = libName + ".dll";
#elif defined(__APPLE__)
libName = QString( "lib" ) + libName + ".dylib";
#else
libName = QString( "lib" ) + libName + ".so";
#endif
library = getPluginLibrary( libName );
}
// call method of corresponding GUI library
if ( library ) {
//QString action ("%1");
//action = action.arg(id);
//if( !theParam.isValid() )
library->OnGUIEvent( myPluginActions[id].second, desk );
//else
// library->OnGUIEvent( id, desk, theParam);
}
else
SUIT_MessageBox::critical( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_LIB_NOT_FOUND" ), tr( "GEOM_BUT_OK" ) );
updateCreationInfo();
return;
}
break;
}
GEOMGUI* library = 0;
if ( !libName.isEmpty() ) {
#if defined(WIN32)
libName = libName + ".dll";
#elif defined(__APPLE__)
libName = QString( "lib" ) + libName + ".dylib";
#else
libName = QString( "lib" ) + libName + ".so";
#endif
library = getLibrary( libName );
}
// call method of corresponding GUI library
if ( library ) {
if( !theParam.isValid() )
library->OnGUIEvent( id, desk );
else
library->OnGUIEvent( id, desk, theParam);
}
else
SUIT_MessageBox::critical( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_LIB_NOT_FOUND" ), tr( "GEOM_BUT_OK" ) );
updateCreationInfo();
}
网络资料
SALOME: Introduction to Geometryhttps://docs.salome-platform.org/latest/gui/GEOM/index.html
SALOME源码分析:MDF框架https://blog.csdn.net/qq_26221775/article/details/139268234