From ebc2144ffc9595a2cfa64512e0cb4c950993be0c Mon Sep 17 00:00:00 2001 From: dcq Date: Tue, 4 May 2004 14:19:44 +0000 Subject: [PATCH] DCQ : new Sketcher + merge --- src/GEOMGUI/GeometryGUI.cxx | 299 ++++++++++++++---------------------- 1 file changed, 114 insertions(+), 185 deletions(-) diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index ed8e12e72..fd961ec3d 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -103,7 +103,6 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) return false; Mb->setItemEnabled(404, ViewOCC);//SKETCHER - Mb->setItemEnabled(406, ViewOCC);//SKETCHER Mb->setItemEnabled(603, ViewOCC);//SuppressFace Mb->setItemEnabled(604, ViewOCC);//SuppressHole @@ -111,149 +110,122 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings Mb->setItemEnabled(414, ViewOCC);// Isos Settings - if(theCommandID == 4041 || // SKETCHER - POPUP VIEWER - SEGMENT - theCommandID == 4042 || // SKETCHER - POPUP VIEWER - ARC - theCommandID == 4043 || // SKETCHER - POPUP VIEWER - SET ANGLE - theCommandID == 4044 || // SKETCHER - POPUP VIEWER - SET X - theCommandID == 4045 || // SKETCHER - POPUP VIEWER - SET Y - theCommandID == 4046 || // SKETCHER - POPUP VIEWER - DELETE - theCommandID == 4047 || // SKETCHER - POPUP VIEWER - END - theCommandID == 4048 || // SKETCHER - POPUP VIEWER - CLOSE - theCommandID == 4051 || // SKETCHER - MENU - SET PLANE - theCommandID == 4052 || // SKETCHER - MENU - TANGENT - theCommandID == 4053 || // SKETCHER - MENU - PERPENDICULAR - theCommandID == 4061 || // SKETCHER - MENU - LENGTH - theCommandID == 4062 || // SKETCHER - MENU - ANGLE - theCommandID == 4063 || // SKETCHER - MENU - RADIUS - theCommandID == 4064 || // SKETCHER - MENU - X - theCommandID == 4065) { // SKETCHER - MENU - Y + if(theCommandID == 111 || // MENU FILE - IMPORT BREP + theCommandID == 112 || // MENU FILE - IMPORT IGES + theCommandID == 113 || // MENU FILE - IMPORT STEP + theCommandID == 121 || // MENU FILE - EXPORT BREP + theCommandID == 122 || // MENU FILE - EXPORT IGES + theCommandID == 123 || // MENU FILE - EXPORT STEP + theCommandID == 31 || // MENU EDIT - COPY + theCommandID == 33 || // MENU EDIT - DELETE + theCommandID == 411 || // MENU SETTINGS - ADD IN STUDY + theCommandID == 412 || // MENU SETTINGS - SHADING COLOR + theCommandID == 413 || // MENU SETTINGS - ISOS + theCommandID == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES + theCommandID == 5103 || // MENU TOOLS - CHECK GEOMETRY + theCommandID == 5104 || // MENU TOOLS - LOAD SCRIPT + theCommandID == 8032 || // POPUP VIEWER - COLOR + theCommandID == 8033 || // POPUP VIEWER - TRANSPARENCY + theCommandID == 8034 || // POPUP VIEWER - ISOS + theCommandID == 804 || // POPUP VIEWER - ADD IN STUDY + theCommandID == 901 || // OBJECT BROWSER - RENAME + theCommandID == 9024) { // OBJECT BROWSER - OPEN + if(!GeomGUI->LoadLibrary("libGEOMToolsGUI.so")) + return false; + } + else if(theCommandID == 211 || // MENU VIEW - WIREFRAME/SHADING + theCommandID == 212 || // MENU VIEW - DISPLAY ALL + theCommandID == 213 || // MENU VIEW - DISPLAY ONLY + theCommandID == 214 || // MENU VIEW - ERASE ALL + theCommandID == 215 || // MENU VIEW - ERASE ONLY + theCommandID == 8031) { // POPUP VIEWER - WIREFRAME/SHADING + if(!GeomGUI->LoadLibrary("libDisplayGUI.so")) + return false; + } + else if(theCommandID == 4011 || // MENU BASIC - POINT + theCommandID == 4012 || // MENU BASIC - LINE + theCommandID == 4013 || // MENU BASIC - CIRCLE + theCommandID == 4014 || // MENU BASIC - ELLIPSE + theCommandID == 4015 || // MENU BASIC - ARC + theCommandID == 4016 || // MENU BASIC - VECTOR + theCommandID == 4017 || // MENU BASIC - PLANE + theCommandID == 4018) { // MENU BASIC - WPLANE + if(!GeomGUI->LoadLibrary("libBasicGUI.so")) + return false; + } + else if(theCommandID == 4021 || // MENU PRIMITIVE - BOX + theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER + theCommandID == 4023 || // MENU PRIMITIVE - SPHERE + theCommandID == 4024 || // MENU PRIMITIVE - TORUS + theCommandID == 4025) { // MENU PRIMITIVE - CONE + if(!GeomGUI->LoadLibrary("libPrimitiveGUI.so")) + return false; + } + else if(theCommandID == 4031 || // MENU GENERATION - PRISM + theCommandID == 4032 || // MENU GENERATION - REVOLUTION + theCommandID == 4033 || // MENU GENERATION - FILLING + theCommandID == 4034) { // MENU GENERATION - PIPE + if(!GeomGUI->LoadLibrary("libGenerationGUI.so")) + return false; + } + else if(theCommandID == 404 || // MENU ENTITY - SKETCHER + theCommandID == 407) { // MENU ENTITY - EXPLODE if(!GeomGUI->LoadLibrary("libEntityGUI.so")) return false; } - else { - if(GeomGUI->myState == 2) { - Mb->setItemEnabled(405, false);//SKETCHER - GeomGUI->GetSketcher().Clear(); - GeomGUI->myState = -1; - } - - if(theCommandID == 111 || // MENU FILE - IMPORT BREP - theCommandID == 112 || // MENU FILE - IMPORT IGES - theCommandID == 113 || // MENU FILE - IMPORT STEP - theCommandID == 121 || // MENU FILE - EXPORT BREP - theCommandID == 122 || // MENU FILE - EXPORT IGES - theCommandID == 123 || // MENU FILE - EXPORT STEP - theCommandID == 31 || // MENU EDIT - COPY - theCommandID == 33 || // MENU EDIT - DELETE - theCommandID == 411 || // MENU SETTINGS - ADD IN STUDY - theCommandID == 412 || // MENU SETTINGS - SHADING COLOR - theCommandID == 413 || // MENU SETTINGS - ISOS - theCommandID == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES - theCommandID == 5103 || // MENU TOOLS - CHECK GEOMETRY - theCommandID == 5104 || // MENU TOOLS - LOAD SCRIPT - theCommandID == 8032 || // POPUP VIEWER - COLOR - theCommandID == 8033 || // POPUP VIEWER - TRANSPARENCY - theCommandID == 8034 || // POPUP VIEWER - ISOS - theCommandID == 804 || // POPUP VIEWER - ADD IN STUDY - theCommandID == 901 || // OBJECT BROWSER - RENAME - theCommandID == 9024) { // OBJECT BROWSER - OPEN - if(!GeomGUI->LoadLibrary("libGEOMToolsGUI.so")) - return false; - } - else if(theCommandID == 211 || // MENU VIEW - WIREFRAME/SHADING - theCommandID == 212 || // MENU VIEW - DISPLAY ALL - theCommandID == 213 || // MENU VIEW - DISPLAY ONLY - theCommandID == 214 || // MENU VIEW - ERASE ALL - theCommandID == 215 || // MENU VIEW - ERASE ONLY - theCommandID == 8031) { // POPUP VIEWER - WIREFRAME/SHADING - if(!GeomGUI->LoadLibrary("libDisplayGUI.so")) - return false; - } - else if(theCommandID == 4011 || // MENU BASIC - POINT - theCommandID == 4012 || // MENU BASIC - LINE - theCommandID == 4013 || // MENU BASIC - CIRCLE - theCommandID == 4014 || // MENU BASIC - ELLIPSE - theCommandID == 4015 || // MENU BASIC - ARC - theCommandID == 4016 || // MENU BASIC - VECTOR - theCommandID == 4017 || // MENU BASIC - PLANE - theCommandID == 4018) { // MENU BASIC - WPLANE - if(!GeomGUI->LoadLibrary("libBasicGUI.so")) - return false; - } - else if(theCommandID == 4021 || // MENU PRIMITIVE - BOX - theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER - theCommandID == 4023 || // MENU PRIMITIVE - SPHERE - theCommandID == 4024 || // MENU PRIMITIVE - TORUS - theCommandID == 4025) { // MENU PRIMITIVE - CONE - if(!GeomGUI->LoadLibrary("libPrimitiveGUI.so")) - return false; - } - else if(theCommandID == 4031 || // MENU GENERATION - PRISM - theCommandID == 4032 || // MENU GENERATION - REVOLUTION - theCommandID == 4033 || // MENU GENERATION - FILLING - theCommandID == 4034) { // MENU GENERATION - PIPE - if(!GeomGUI->LoadLibrary("libGenerationGUI.so")) - return false; - } - else if(theCommandID == 404 || // SKETCHER - theCommandID == 407) { // MENU ENTITY - EXPLODE - if(!GeomGUI->LoadLibrary("libEntityGUI.so")) - return false; - } - else if(theCommandID == 4081 || // MENU BUILD - EDGE - theCommandID == 4082 || // MENU BUILD - WIRE - theCommandID == 4083 || // MENU BUILD - FACE - theCommandID == 4084 || // MENU BUILD - SHELL - theCommandID == 4085 || // MENU BUILD - SOLID - theCommandID == 4086) { // MENU BUILD - COMPUND - if(!GeomGUI->LoadLibrary("libBuildGUI.so")) - return false; - } - else if(theCommandID == 5011 || // MENU BOOLEAN - FUSE - theCommandID == 5012 || // MENU BOOLEAN - COMMON - theCommandID == 5013 || // MENU BOOLEAN - CUT - theCommandID == 5014) { // MENU BOOLEAN - SECTION - if(!GeomGUI->LoadLibrary("libBooleanGUI.so")) - return false; - } - else if(theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION - theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION - theCommandID == 5023 || // MENU TRANSFORMATION - MIRROR - theCommandID == 5024 || // MENU TRANSFORMATION - SCALE - theCommandID == 5025 || // MENU TRANSFORMATION - MULTI-TRANSLATION - theCommandID == 5026) { // MENU TRANSFORMATION - MULTI-ROTATION - if(!GeomGUI->LoadLibrary("libTransformationGUI.so")) - return false; - } - else if(theCommandID == 503 || // MENU OPERATION - PARTITION - theCommandID == 504 || // MENU OPERATION - ARCHIMEDE - theCommandID == 505 || // MENU OPERATION - FILLET - theCommandID == 506) { // MENU OPERATION - CHAMFER - if(!GeomGUI->LoadLibrary("libOperationGUI.so")) - return false; - } - else if(theCommandID == 601 || // MENU REPAIR - SEWING - theCommandID == 602 || // MENU REPAIR - ORIENTATION - theCommandID == 603 || // MENU REPAIR - SUPPRESS FACES - theCommandID == 604) { // MENU REPAIR - SUPPRESS HOLE - if(!GeomGUI->LoadLibrary("libRepairGUI.so")) - return false; - } - else if(theCommandID == 701 || // MENU MEASURE - PROPERTIES - theCommandID == 702 || // MENU MEASURE - CDG - theCommandID == 703 || // MENU MEASURE - INERTIA - theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX - theCommandID == 7042 || // MENU MEASURE - MIN DISTANCE - theCommandID == 705 || // MENU MEASURE - TOLERANCE - theCommandID == 706 || // MENU MEASURE - WHATIS - theCommandID == 707) { // MENU MEASURE - CHECK - if(!GeomGUI->LoadLibrary("libMeasureGUI.so")) - return false; - } - else + else if(theCommandID == 4081 || // MENU BUILD - EDGE + theCommandID == 4082 || // MENU BUILD - WIRE + theCommandID == 4083 || // MENU BUILD - FACE + theCommandID == 4084 || // MENU BUILD - SHELL + theCommandID == 4085 || // MENU BUILD - SOLID + theCommandID == 4086) { // MENU BUILD - COMPUND + if(!GeomGUI->LoadLibrary("libBuildGUI.so")) return false; } - + else if(theCommandID == 5011 || // MENU BOOLEAN - FUSE + theCommandID == 5012 || // MENU BOOLEAN - COMMON + theCommandID == 5013 || // MENU BOOLEAN - CUT + theCommandID == 5014) { // MENU BOOLEAN - SECTION + if(!GeomGUI->LoadLibrary("libBooleanGUI.so")) + return false; + } + else if(theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION + theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION + theCommandID == 5023 || // MENU TRANSFORMATION - MIRROR + theCommandID == 5024 || // MENU TRANSFORMATION - SCALE + theCommandID == 5025 || // MENU TRANSFORMATION - MULTI-TRANSLATION + theCommandID == 5026) { // MENU TRANSFORMATION - MULTI-ROTATION + if(!GeomGUI->LoadLibrary("libTransformationGUI.so")) + return false; + } + else if(theCommandID == 503 || // MENU OPERATION - PARTITION + theCommandID == 504 || // MENU OPERATION - ARCHIMEDE + theCommandID == 505 || // MENU OPERATION - FILLET + theCommandID == 506) { // MENU OPERATION - CHAMFER + if(!GeomGUI->LoadLibrary("libOperationGUI.so")) + return false; + } + else if(theCommandID == 601 || // MENU REPAIR - SEWING + theCommandID == 602 || // MENU REPAIR - ORIENTATION + theCommandID == 603 || // MENU REPAIR - SUPPRESS FACES + theCommandID == 604) { // MENU REPAIR - SUPPRESS HOLE + if(!GeomGUI->LoadLibrary("libRepairGUI.so")) + return false; + } + else if(theCommandID == 701 || // MENU MEASURE - PROPERTIES + theCommandID == 702 || // MENU MEASURE - CDG + theCommandID == 703 || // MENU MEASURE - INERTIA + theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX + theCommandID == 7042 || // MENU MEASURE - MIN DISTANCE + theCommandID == 705 || // MENU MEASURE - TOLERANCE + theCommandID == 706 || // MENU MEASURE - WHATIS + theCommandID == 707) { // MENU MEASURE - CHECK + if(!GeomGUI->LoadLibrary("libMeasureGUI.so")) + return false; + } + else + return false; + //Load Function OnGUIEvent OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("OnGUIEvent"); OGE (*f1) = NULL; @@ -293,12 +265,7 @@ bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFra if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - - if(GeomGUI->myState == 2) { - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort(); - GeomGUI->GetSketcher().MakeCurrentEdge(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView()); - } - + else return true; } @@ -314,14 +281,7 @@ bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFr if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - if(GeomGUI->myState == 2) { - GeomGUI->GetSketcher().ValidateEdge(); - if(GeomGUI->GetSketcher().GetmyEdgesNumber() == 1) { - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemEnabled(405, true); // SKETCH CONTRAINTS - } - } - else if(GeomGUI->myState == 0) { + if(GeomGUI->myState == 0) { if(!GeomGUI->LoadLibrary("libBasicGUI.so")) return false; @@ -425,8 +385,6 @@ bool GeometryGUI::SetSettings(QAD_Desktop* parent) } Mb->setItemEnabled(404, ViewOCC);//SKETCHER - Mb->setItemEnabled(405, false);//SKETCHER - Mb->setItemEnabled(406, ViewOCC);//SKETCHER Mb->setItemEnabled(603, ViewOCC);//SuppressFace Mb->setItemEnabled(604, ViewOCC);//SuppressHole @@ -454,11 +412,8 @@ void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString theObject = ""; theContext = ""; - if((theParent.compare("Viewer") == 0)) { - if(GeomGUI->myState == 2) - theContext = "Sketch"; - else if(Sel->IObjectCount() == 0) + if(Sel->IObjectCount() == 0) theContext = "NothingSelected"; } @@ -489,24 +444,6 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr { GeometryGUI::GetOrCreateGeometryGUI(parent); - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - if(theParent.compare("Viewer") == 0) { - if(theContext.compare("Sketch") == 0) { - SketchStatus myCS = GeomGUI->GetSketcher().GetCurrentStatus(); - popup->setCheckable(TRUE); - if(myCS == SEGMENT) { - popup->setItemChecked(4041, true); //Sketch Segment Menu - popup->setItemChecked(4042, false); //Sketch Arc Menu - } - else if(myCS == ARC_CHORD) { - popup->setItemChecked(4041, false); //Sketch Segment Menu - popup->setItemChecked(4042, true); //Sketch Arc Menu - } - return true; - } - } - } - if(!GeomGUI->LoadLibrary("libGEOMBase.so")) return false; @@ -535,19 +472,11 @@ bool GeometryGUI::ActiveStudyChanged(QAD_Desktop* parent) if(GeomGUI != 0) { QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - GeomGUI->myNbGeom = GeomGUI->myComponentGeom->NbLabels(); - if(GeomGUI->myState == 2) { - Mb->setItemEnabled(405, false);//SKETCHER - GeomGUI->GetSketcher().Clear(); - GeomGUI->myState = -1; - } - bool ViewOCC = false; if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) ViewOCC = true; Mb->setItemEnabled(404, ViewOCC);//SKETCHER - Mb->setItemEnabled(406, ViewOCC);//SKETCHER Mb->setItemEnabled(603, ViewOCC);//SuppressFace Mb->setItemEnabled(604, ViewOCC);//SuppressHole -- 2.39.2