X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMGUI%2FGeometryGUI.cxx;h=09aa1abf1c776624b53af80092835db8c370a201;hb=205001b2a059a58d6d8bcf43d30bc281a516c131;hp=674eb2869a32886c6f0a327e5cdbf75808c7a180;hpb=e74a97e6fc434c7205417e5f4557a8519e8df443;p=modules%2Fgeom.git diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 674eb2869..09aa1abf1 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -512,6 +512,8 @@ void GeometryGUI::OnGUIEvent( int id ) 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 libName = "OperationGUI"; break; case GEOMOp::OpSewing: // MENU REPAIR - SEWING @@ -785,6 +787,8 @@ void GeometryGUI::initialize( CAM_Application* app ) //createGeomAction( GEOMOp::OpClipping, "CLIPPING" ); createGeomAction( GEOMOp::OpShapesOnShape, "GET_SHAPES_ON_SHAPE" ); createGeomAction( GEOMOp::OpSharedShapes, "GET_SHARED_SHAPES" ); + createGeomAction( GEOMOp::OpExtrudedCut, "EXTRUDED_CUT" ); + createGeomAction( GEOMOp::OpExtrudedBoss, "EXTRUDED_BOSS" ); createGeomAction( GEOMOp::OpFillet1d, "FILLET_1D" ); createGeomAction( GEOMOp::OpFillet2d, "FILLET_2D" ); @@ -902,6 +906,8 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( GEOMOp::OpArc, basicId, -1 ); createMenu( GEOMOp::OpCurve, basicId, -1 ); createMenu( separator(), basicId, -1 ); + createMenu( GEOMOp::Op2dSketcher, basicId, -1 ); + createMenu( GEOMOp::Op3dSketcher, basicId, -1 ); createMenu( GEOMOp::OpVector, basicId, -1 ); createMenu( GEOMOp::OpPlane, basicId, -1 ); createMenu( GEOMOp::OpLCS, basicId, -1 ); @@ -915,6 +921,7 @@ void GeometryGUI::initialize( CAM_Application* app ) 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 ); @@ -922,8 +929,8 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( GEOMOp::OpFilling, genId, -1 ); createMenu( GEOMOp::OpPipe, genId, -1 ); - int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 ); - createMenu( GEOMOp::OpPipeTShape, advId, -1 ); +// int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 ); +// createMenu( GEOMOp::OpPipeTShape, advId, -1 ); // createMenu( GEOMOp::OpPipeTShapeGroups, 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 @@// @@ -941,11 +948,6 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( separator(), newEntId, -1 ); - createMenu( GEOMOp::Op2dSketcher, newEntId, -1 ); - createMenu( GEOMOp::Op3dSketcher, newEntId, -1 ); - - createMenu( separator(), newEntId, -1 ); - createMenu( GEOMOp::OpExplode, newEntId, -1 ); int buildId = createMenu( tr( "MEN_BUILD" ), newEntId, -1 ); @@ -1001,6 +1003,8 @@ void GeometryGUI::initialize( CAM_Application* app ) 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 ); //createMenu( GEOMOp::OpClipping, operId, -1 ); int repairId = createMenu( tr( "MEN_REPAIR" ), -1, -1, 10 ); @@ -1076,40 +1080,50 @@ void GeometryGUI::initialize( CAM_Application* app ) */ // ---- create toolbars -------------------------- - + int basicTbId = createTool( tr( "TOOL_BASIC" ) ); - 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::OpPlane, basicTbId ); - createTool( GEOMOp::OpLCS, basicTbId ); + 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::Op3dSketcher, basicTbId ); //rnc + createTool( GEOMOp::OpPlane, basicTbId ); + createTool( GEOMOp::OpLCS, basicTbId ); createTool( GEOMOp::OpOriginAndVectors, basicTbId ); - + +// int sketchTbId = createTool( tr( "TOOL_SKETCH" ) ); +// createTool( GEOMOp::Op2dSketcher, sketchTbId ); +// createTool( GEOMOp::Op3dSketcher, sketchTbId ); + int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) ); - 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::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 advancedTbId = createTool( tr( "TOOL_ADVANCED" ) ); //rnc +// createTool( GEOMOp::OpPipeTShape, advancedTbId ); + int boolTbId = createTool( tr( "TOOL_BOOLEAN" ) ); - createTool( GEOMOp::OpFuse, boolTbId ); - createTool( GEOMOp::OpCommon, boolTbId ); - createTool( GEOMOp::OpCut, boolTbId ); - createTool( GEOMOp::OpSection, boolTbId ); - - int genTbId = createTool( tr( "TOOL_GENERATION" ) ); + createTool( GEOMOp::OpFuse, boolTbId ); + createTool( GEOMOp::OpCommon, boolTbId ); + createTool( GEOMOp::OpCut, boolTbId ); + createTool( GEOMOp::OpSection, boolTbId ); + + int genTbId = createTool( tr( "TOOL_GENERATION" ) ); createTool( GEOMOp::OpPrism, genTbId ); createTool( GEOMOp::OpRevolution, genTbId ); createTool( GEOMOp::OpFilling, genTbId ); createTool( GEOMOp::OpPipe, genTbId ); - + int transTbId = createTool( tr( "TOOL_TRANSFORMATION" ) ); createTool( GEOMOp::OpTranslate, transTbId ); createTool( GEOMOp::OpRotate, transTbId ); @@ -1121,29 +1135,22 @@ void GeometryGUI::initialize( CAM_Application* app ) createTool( separator(), transTbId ); createTool( GEOMOp::OpMultiTranslate, transTbId ); createTool( GEOMOp::OpMultiRotate, transTbId ); - + int operTbId = createTool( tr( "TOOL_OPERATIONS" ) ); - createTool( GEOMOp::Op2dSketcher, operTbId ); - createTool( GEOMOp::Op3dSketcher, operTbId ); - createTool( separator(), operTbId ); createTool( GEOMOp::OpExplode, operTbId ); - createTool( separator(), operTbId ); -#ifdef WITH_OPENCV - createTool( GEOMOp::OpFeatureDetect, operTbId ); -#endif - createTool( GEOMOp::OpPictureImport, operTbId ); - createTool( separator(), operTbId ); - createTool( GEOMOp::OpPartition, operTbId ); createTool( GEOMOp::OpArchimede, operTbId ); createTool( GEOMOp::OpShapesOnShape, operTbId ); createTool( GEOMOp::OpSharedShapes, operTbId ); - createTool( separator(), operTbId ); - createTool( GEOMOp::OpFillet1d, operTbId ); - createTool( GEOMOp::OpFillet2d, operTbId ); - createTool( GEOMOp::OpFillet3d, operTbId ); - createTool( GEOMOp::OpChamfer, operTbId ); - + + int featTbId = createTool( tr( "TOOL_FEATURES" ) ); + 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" ) ); createTool( GEOMOp::OpEdge, buildTbId ); createTool( GEOMOp::OpWire, buildTbId ); @@ -1171,9 +1178,13 @@ void GeometryGUI::initialize( CAM_Application* app ) createTool( GEOMOp::OpCheckShape, measureTbId ); createTool( GEOMOp::OpCheckCompound, measureTbId ); createTool( GEOMOp::OpCheckSelfInters, measureTbId ); + + int picturesTbId = createTool( tr( "TOOL_PICTURES" ) ); + createTool( GEOMOp::OpPictureImport, picturesTbId ); + #ifdef WITH_OPENCV + createTool( GEOMOp::OpFeatureDetect, picturesTbId ); + #endif - int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) ); - createTool( GEOMOp::OpPipeTShape, 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 -------------------------- @@ -2168,6 +2179,25 @@ void GeometryGUI::onViewAboutToShow() } } +/*! + \brief Check if this object is can't be renamed in place + + This method can be re-implemented in the subclasses. + Return true in case if object isn't reference or component (module root). + + \param id column id + \return \c true if the item can be renamed by the user in place (e.g. in the Object browser) +*/ +bool GeometryGUI::renameAllowed( const QString& entry) const { + + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + SalomeApp_Study* appStudy = app ? dynamic_cast( app->activeStudy() ) : 0; + SalomeApp_DataObject* obj = appStudy ? dynamic_cast(appStudy->findObjectByEntry(entry)) : 0; + + return (app && appStudy && obj && !appStudy->isComponent(entry) && !obj->isReference()); +} + + /*! Rename object by entry. \param entry entry of the object @@ -2175,24 +2205,26 @@ void GeometryGUI::onViewAboutToShow() \brief Return \c true if rename operation finished successfully, \c false otherwise. */ bool GeometryGUI::renameObject( const QString& entry, const QString& name) { - - bool appRes = SalomeApp_Module::renameObject(entry,name); - if( !appRes ) - return false; - + bool result = false; - + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication()); SalomeApp_Study* appStudy = app ? dynamic_cast( app->activeStudy() ) : 0; - + if(!appStudy) return result; - + _PTR(Study) aStudy = appStudy->studyDS(); - + if(!aStudy) return result; + bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked(); + if ( aLocked ) { + SUIT_MessageBox::warning ( app->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED") ); + return result; + } + _PTR(SObject) obj ( aStudy->FindObjectID(qPrintable(entry)) ); _PTR(GenericAttribute) anAttr; if ( obj ) { @@ -2209,3 +2241,4 @@ bool GeometryGUI::renameObject( const QString& entry, const QString& name) { } return result; } +