From d8cfb81717503056987bd5d9f47631f16425fee6 Mon Sep 17 00:00:00 2001 From: dcq Date: Mon, 17 Nov 2003 13:37:55 +0000 Subject: [PATCH] DCQ: New architecture... --- resources/GEOM_en.xml | 38 +- src/BasicGUI/BasicGUI.cxx | 44 +- src/BasicGUI/BasicGUI_ArcDlg.cxx | 2 +- src/BasicGUI/BasicGUI_CircleDlg.cxx | 4 +- src/BasicGUI/BasicGUI_EllipseDlg.cxx | 8 +- src/BasicGUI/BasicGUI_LineDlg.cxx | 2 +- src/BasicGUI/BasicGUI_PlaneDlg.cxx | 2 +- src/BasicGUI/BasicGUI_PointDlg.cxx | 38 +- src/BasicGUI/BasicGUI_VectorDlg.cxx | 2 +- src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx | 2 +- src/BasicGUI/Makefile.in | 14 +- src/BooleanGUI/BooleanGUI.cxx | 6 +- src/BooleanGUI/BooleanGUI_CommonDlg.cxx | 2 +- src/BooleanGUI/BooleanGUI_CutDlg.cxx | 2 +- src/BooleanGUI/BooleanGUI_FuseDlg.cxx | 2 +- src/BooleanGUI/BooleanGUI_SectionDlg.cxx | 2 +- src/BooleanGUI/Makefile.in | 14 +- src/BuildGUI/BuildGUI.cxx | 74 +- src/BuildGUI/BuildGUI.h | 1 + src/BuildGUI/BuildGUI_CompoundDlg.cxx | 2 +- src/BuildGUI/BuildGUI_EdgeDlg.cxx | 2 +- src/BuildGUI/BuildGUI_FaceDlg.cxx | 2 +- src/BuildGUI/BuildGUI_ShellDlg.cxx | 2 +- src/BuildGUI/BuildGUI_SolidDlg.cxx | 2 +- src/BuildGUI/BuildGUI_SubShapeDlg.cxx | 39 +- src/BuildGUI/BuildGUI_WireDlg.cxx | 2 +- src/BuildGUI/Makefile.in | 14 +- src/DisplayGUI/DisplayGUI.cxx | 158 +++-- src/DisplayGUI/Makefile.in | 14 +- src/DlgRef/DlgRef_1Sel1Spin1Check.cxx | 54 ++ src/DlgRef/DlgRef_1Sel1Spin1Check.h | 47 ++ src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.cxx | 95 +++ src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.h | 48 ++ src/DlgRef/DlgRef_1Sel3Check_QTD.cxx | 89 +++ src/DlgRef/DlgRef_1Sel3Check_QTD.h | 46 ++ src/DlgRef/Makefile.in | 21 +- .../UIFiles/DlgRef_1Sel1Spin1Check_QTD.ui | 173 +++++ src/DlgRef/UIFiles/DlgRef_1Sel3Check_QTD.ui | 144 ++++ src/DlgRef/UIFiles/ui_to_cxx | 10 +- src/GEOMBase/GEOMBase.cxx | 591 ++++++++++++++-- src/GEOMBase/GEOMBase.h | 29 +- src/GEOMBase/GEOMBase_Skeleton.cxx | 4 +- src/GEOMBase/Makefile.in | 15 +- src/GEOMGUI/GeometryGUI.cxx | 544 ++------------ src/GEOMGUI/Makefile.in | 12 +- src/GEOMToolsGUI/GEOMToolsGUI.cxx | 258 ++----- src/GEOMToolsGUI/GEOMToolsGUI.h | 10 +- .../GEOMToolsGUI_TransparencyDlg.cxx | 7 +- .../GEOMToolsGUI_TransparencyDlg.h | 8 +- src/GEOMToolsGUI/Makefile.in | 14 +- src/GenerationGUI/GenerationGUI.cxx | 20 +- .../GenerationGUI_FillingDlg.cxx | 2 +- src/GenerationGUI/GenerationGUI_PipeDlg.cxx | 4 +- src/GenerationGUI/GenerationGUI_PrismDlg.cxx | 2 +- src/GenerationGUI/GenerationGUI_RevolDlg.cxx | 3 +- src/GenerationGUI/Makefile.in | 14 +- src/Makefile.in | 2 +- src/MeasureGUI/Makefile.in | 14 +- src/MeasureGUI/MeasureGUI.cxx | 6 +- src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx | 8 +- src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx | 2 +- src/MeasureGUI/MeasureGUI_CenterMassDlg.h | 2 + src/MeasureGUI/MeasureGUI_DistanceDlg.cxx | 12 +- src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx | 3 + src/MeasureGUI/MeasureGUI_Skeleton.cxx | 4 +- src/MeasureGUI/MeasureGUI_WhatisDlg.cxx | 3 + src/OperationGUI/Makefile.in | 14 +- src/OperationGUI/OperationGUI.cxx | 63 +- .../OperationGUI_ArchimedeDlg.cxx | 2 +- src/OperationGUI/OperationGUI_ChamferDlg.cxx | 177 +++-- src/OperationGUI/OperationGUI_ChamferDlg.h | 3 - src/OperationGUI/OperationGUI_FilletDlg.cxx | 166 ++--- src/OperationGUI/OperationGUI_FilletDlg.h | 2 - .../OperationGUI_PartitionDlg.cxx | 2 +- src/PrimitiveGUI/Makefile.in | 14 +- src/PrimitiveGUI/PrimitiveGUI.cxx | 18 +- src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx | 2 +- src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx | 3 +- src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx | 3 +- src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx | 2 +- src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx | 3 +- src/RepairGUI/Makefile.in | 14 +- src/RepairGUI/RepairGUI.cxx | 38 +- src/RepairGUI/RepairGUI_FillingHoleDlg.cxx | 14 +- src/RepairGUI/RepairGUI_OrientationDlg.cxx | 668 ++++++------------ src/RepairGUI/RepairGUI_OrientationDlg.h | 87 +-- src/RepairGUI/RepairGUI_SewingDlg.cxx | 2 +- src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx | 487 +++++-------- src/RepairGUI/RepairGUI_SuppressFacesDlg.h | 102 +-- src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx | 70 +- src/TransformationGUI/Makefile.in | 14 +- src/TransformationGUI/TransformationGUI.cxx | 34 +- src/TransformationGUI/TransformationGUI.h | 1 + .../TransformationGUI_MirrorDlg.cxx | 2 +- .../TransformationGUI_MultiRotationDlg.cxx | 6 +- .../TransformationGUI_MultiTranslationDlg.cxx | 6 +- .../TransformationGUI_RotationDlg.cxx | 3 +- .../TransformationGUI_ScaleDlg.cxx | 2 +- .../TransformationGUI_TranslationDlg.cxx | 2 +- 99 files changed, 2485 insertions(+), 2357 deletions(-) create mode 100644 src/DlgRef/DlgRef_1Sel1Spin1Check.cxx create mode 100644 src/DlgRef/DlgRef_1Sel1Spin1Check.h create mode 100644 src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.cxx create mode 100644 src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.h create mode 100644 src/DlgRef/DlgRef_1Sel3Check_QTD.cxx create mode 100644 src/DlgRef/DlgRef_1Sel3Check_QTD.h create mode 100644 src/DlgRef/UIFiles/DlgRef_1Sel1Spin1Check_QTD.ui create mode 100644 src/DlgRef/UIFiles/DlgRef_1Sel3Check_QTD.ui diff --git a/resources/GEOM_en.xml b/resources/GEOM_en.xml index 3b15e0d46..92191a138 100644 --- a/resources/GEOM_en.xml +++ b/resources/GEOM_en.xml @@ -71,21 +71,6 @@ - - - - - - - - - - - - - - - @@ -164,12 +149,11 @@ - - + - - - + + + @@ -257,19 +241,5 @@ - - - - - - - - - - - - - - diff --git a/src/BasicGUI/BasicGUI.cxx b/src/BasicGUI/BasicGUI.cxx index 21f117bb7..c34ef9979 100644 --- a/src/BasicGUI/BasicGUI.cxx +++ b/src/BasicGUI/BasicGUI.cxx @@ -78,15 +78,15 @@ bool BasicGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { BasicGUI* myBasicGUI = new BasicGUI(); myBasicGUI->myGeomGUI->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(myBasicGUI->myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); switch (theCommandID) { case 4011: // POINT { Handle(AIS_InteractiveContext) ic; - if(myBasicGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myBasicGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); ic = v3d->getAISContext(); } BasicGUI_PointDlg *aDlg = new BasicGUI_PointDlg(parent, "", myBasicGUI, Sel, ic); @@ -145,10 +145,10 @@ bool BasicGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame { BasicGUI* myBasicGUI = new BasicGUI(); - if(myBasicGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myBasicGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort(); @@ -176,7 +176,7 @@ bool BasicGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame if(DialogPt != 0) DialogPt->PointIntoCoordinates(thePoint, true); /* display point */ else - myBasicGUI->myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return false; } @@ -219,7 +219,7 @@ void BasicGUI::MakePointAndDisplay(const double x, const double y, const double GEOM::GEOM_Shape_var P = myGeom->MakeVertex(x, y, z); P->NameType(tr("GEOM_VERTEX")); if (myGeomBase->Display(P)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -239,7 +239,7 @@ void BasicGUI::MakeLineAndDisplay(const gp_Pnt InitPoint, const gp_Pnt LastPoint myGeomBase->GetBipointDxDyDz(InitPoint, LastPoint, dx, dy, dz); Standard_Real length = InitPoint.Distance(LastPoint); if(length <= Precision::Confusion()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } @@ -262,13 +262,13 @@ void BasicGUI::MakeLineAndDisplay(const gp_Pnt InitPoint, const gp_Pnt LastPoint GEOM::GEOM_Shape_ptr result = myGeom->MakeLine(pstruct, dstruct); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } result->NameType(tr("GEOM_LINE")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_READY")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -290,12 +290,12 @@ void BasicGUI::MakeCircleAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir, GEOM::GEOM_Shape_var result = myGeom->MakeCircle(pstruct, dstruct, Radius); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } result->NameType(tr("GEOM_CIRCLE")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -318,12 +318,12 @@ void BasicGUI::MakeEllipseAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir, GEOM::GEOM_Shape_var result = myGeom->MakeEllipse(pstruct, dstruct, Major_Radius, Minor_Radius); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } result->NameType(tr("GEOM_ELLIPSE")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -349,12 +349,12 @@ void BasicGUI::MakeArcAndDisplay(gp_Pnt InitPoint, gp_Pnt CirclePoint, gp_Pnt En GEOM::PointStruct pE = myGeom->MakePointStruct(EndPoint.X(), EndPoint.Y(), EndPoint.Z()); GEOM::GEOM_Shape_var result = myGeom->MakeArc(pI, pC, pE); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } result->NameType(tr("GEOM_ARC")); if (myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -375,7 +375,7 @@ void BasicGUI::MakeVectorAndDisplay(const gp_Pnt P1, const gp_Pnt P2) GEOM::GEOM_Shape_var Vector = myGeom->MakeVector(pstruct1, pstruct2); Vector->NameType(tr("GEOM_VECTOR")); if(myGeomBase->Display(Vector)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -402,7 +402,7 @@ void BasicGUI::MakePlaneAndDisplay(const gp_Pnt P1, const Standard_Real dx, cons GEOM::GEOM_Shape_ptr plane = myGeom->MakePlane(pstruct, dstruct, TrimSize); plane->NameType(tr("GEOM_PLANE")); if(myGeomBase->Display(plane)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -417,16 +417,16 @@ void BasicGUI::MakePlaneAndDisplay(const gp_Pnt P1, const Standard_Real dx, cons //======================================================================= void BasicGUI::MakeWorkingPlane(const gp_Pnt P, const gp_Dir D) { - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER")); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER")); return; } - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort(); + OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort(); Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)vp)->getView(); view3d->SetAt(P.X(), P.Y(), P.Z()); view3d->SetProj(D.X(), D.Y(), D.Z()); - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); return; } diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index 4304ca724..33f929e3d 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -137,7 +137,7 @@ void BasicGUI_ArcDlg::ClickOnOk() //================================================================================= void BasicGUI_ArcDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index e9044dacb..b29e778fe 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -29,6 +29,8 @@ using namespace std; #include "BasicGUI_CircleDlg.h" +#include +#include #include #include #include "QAD_Config.h" @@ -145,7 +147,7 @@ void BasicGUI_CircleDlg::ClickOnOk() //================================================================================= void BasicGUI_CircleDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index f62e96fa7..6093d492b 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -28,11 +28,11 @@ using namespace std; #include "BasicGUI_EllipseDlg.h" -#include "gp_Elips.hxx" -#include "QAD_Config.h" - +#include +#include #include #include +#include "QAD_Config.h" //================================================================================= // class : BasicGUI_EllipseDlg() @@ -153,7 +153,7 @@ void BasicGUI_EllipseDlg::ClickOnOk() //================================================================================= void BasicGUI_EllipseDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx index 52573dda3..b5b649821 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.cxx +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -135,7 +135,7 @@ void BasicGUI_LineDlg::ClickOnOk() //================================================================================= void BasicGUI_LineDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index c90a6279e..cd429b1bc 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -273,7 +273,7 @@ void BasicGUI_PlaneDlg::ClickOnOk() //================================================================================= void BasicGUI_PlaneDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 10d0bd6f1..e219f498f 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -37,8 +37,6 @@ using namespace std; #include #include -#include "QAD_Config.h" - //================================================================================= // class : BasicGUI_PointDlg() // purpose : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the @@ -108,7 +106,7 @@ void BasicGUI_PointDlg::Init(const Handle(AIS_InteractiveContext)& ic) myPoint.SetCoord(0.0, 0.0, 0.0); myOkEdge = false; - myGeomGUI->SetState(POINT_METHOD); + myGeomGUI->myState = 0; /* Vertices Filter for all arguments */ myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom); @@ -128,9 +126,9 @@ void BasicGUI_PointDlg::Init(const Handle(AIS_InteractiveContext)& ic) GroupPoints->SpinBox_DY->SetValue(0.0); GroupPoints->SpinBox_DZ->SetValue(0.0); - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { myLocalContextId = myIC->OpenLocalContext(); - myGeomBase->SetDisplayedObjectList(); + //myGeomBase->SetDisplayedObjectList(); /* sub shapes selection */ myLocalContextMode = TopAbs_VERTEX; myIC->ActivateStandardMode(myLocalContextMode); @@ -197,9 +195,9 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) { case 0: { - if(myUseLocalContext == false && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + if(myUseLocalContext == false && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { myLocalContextId = myIC->OpenLocalContext(); - myGeomBase->SetDisplayedObjectList(); + //myGeomBase->SetDisplayedObjectList(); /* sub shapes selection */ myLocalContextMode = TopAbs_VERTEX; myIC->ActivateStandardMode(myLocalContextMode); @@ -216,7 +214,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) } case 1: { - if(myUseLocalContext == true && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + if(myUseLocalContext == true && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { myIC->CloseLocalContext(myLocalContextId); myUseLocalContext = false; } @@ -257,14 +255,14 @@ void BasicGUI_PointDlg::ClickOnOk() //================================================================================= void BasicGUI_PointDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); /* Close local context */ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { myIC->CloseLocalContext(myLocalContextId); myUseLocalContext = false; } @@ -279,10 +277,10 @@ void BasicGUI_PointDlg::ClickOnApply() double z = GroupPoints->SpinBox_DZ->GetValue(); myBasicGUI->MakePointAndDisplay(x,y,z); /* WARNING : no display if a local context is opened */ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { /* no display if a local context is opened */ myLocalContextId = myIC->OpenLocalContext(); - myGeomBase->SetDisplayedObjectList(); + //myGeomBase->SetDisplayedObjectList(); /* sub shapes selection */ myLocalContextMode = TopAbs_VERTEX; myIC->ActivateStandardMode(myLocalContextMode); @@ -309,8 +307,8 @@ void BasicGUI_PointDlg::ClickOnApply() //======================================================================= void BasicGUI_PointDlg::ClickOnCancel() { - if(myConstructorId == 0 && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(myConstructorId == 0 && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); myIC = v3d->getAISContext(); if(myIC->HasOpenedContext()) { myIC->CloseLocalContext(myLocalContextId); @@ -318,6 +316,7 @@ void BasicGUI_PointDlg::ClickOnCancel() } } + myGeomGUI->myState = -1; GEOMBase_Skeleton::ClickOnCancel(); return; } @@ -426,12 +425,12 @@ void BasicGUI_PointDlg::ActivateThisDialog( ) GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - myGeomGUI->SetState(POINT_METHOD); - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myGeomGUI->myState = 0; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); myIC = v3d->getAISContext(); myLocalContextId = myIC->OpenLocalContext(); - myGeomBase->SetDisplayedObjectList(); + //myGeomBase->SetDisplayedObjectList(); /* sub shapes selection */ myLocalContextMode = TopAbs_VERTEX; myIC->ActivateStandardMode(myLocalContextMode); @@ -453,10 +452,11 @@ void BasicGUI_PointDlg::ActivateThisDialog( ) //================================================================================= void BasicGUI_PointDlg::DeactivateActiveDialog() { - if(myConstructorId == 0 && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + if(myConstructorId == 0 && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { myIC->CloseLocalContext(myLocalContextId); myUseLocalContext = false; } + myGeomGUI->myState = -1; GEOMBase_Skeleton::DeactivateActiveDialog(); return; } diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index c5d97be42..5c35ded60 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -237,7 +237,7 @@ void BasicGUI_VectorDlg::ClickOnOk() //================================================================================= void BasicGUI_VectorDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx index d2d5e5978..1403f8f02 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx @@ -127,7 +127,7 @@ void BasicGUI_WorkingPlaneDlg::ClickOnOk() //================================================================================= void BasicGUI_WorkingPlaneDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(myOkPlane) myBasicGUI->MakeWorkingPlane(myLoc, myDir); diff --git a/src/BasicGUI/Makefile.in b/src/BasicGUI/Makefile.in index c2b6e2f19..2dc8edf1b 100644 --- a/src/BasicGUI/Makefile.in +++ b/src/BasicGUI/Makefile.in @@ -61,21 +61,15 @@ LIB_MOC = \ BasicGUI_PlaneDlg.h \ BasicGUI_WorkingPlaneDlg.h -LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ +LIB_CLIENT_IDL = LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lGEOMFiltersSelection -lGEOMBase @CONCLUDE@ diff --git a/src/BooleanGUI/BooleanGUI.cxx b/src/BooleanGUI/BooleanGUI.cxx index 74e4d4942..da6531ff2 100644 --- a/src/BooleanGUI/BooleanGUI.cxx +++ b/src/BooleanGUI/BooleanGUI.cxx @@ -66,7 +66,7 @@ bool BooleanGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { BooleanGUI* myBooleanGUI = new BooleanGUI(); myBooleanGUI->myGeomGUI->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(myBooleanGUI->myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); switch (theCommandID) { @@ -109,7 +109,7 @@ void BooleanGUI::MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_S try { GEOM::GEOM_Shape_ptr result = myGeom->MakeBoolean(Shape1, Shape2, operation); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } @@ -119,7 +119,7 @@ void BooleanGUI::MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_S result->NameType(type); if (myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch (const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); diff --git a/src/BooleanGUI/BooleanGUI_CommonDlg.cxx b/src/BooleanGUI/BooleanGUI_CommonDlg.cxx index 789f8dd49..7e881536f 100644 --- a/src/BooleanGUI/BooleanGUI_CommonDlg.cxx +++ b/src/BooleanGUI/BooleanGUI_CommonDlg.cxx @@ -128,7 +128,7 @@ void BooleanGUI_CommonDlg::ClickOnOk() //================================================================================= void BooleanGUI_CommonDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(myOkShape1 && myOkShape2) myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 1); diff --git a/src/BooleanGUI/BooleanGUI_CutDlg.cxx b/src/BooleanGUI/BooleanGUI_CutDlg.cxx index a86224f88..d3aaf9785 100644 --- a/src/BooleanGUI/BooleanGUI_CutDlg.cxx +++ b/src/BooleanGUI/BooleanGUI_CutDlg.cxx @@ -127,7 +127,7 @@ void BooleanGUI_CutDlg::ClickOnOk() //================================================================================= void BooleanGUI_CutDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(myOkShape1 && myOkShape2) myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 2); diff --git a/src/BooleanGUI/BooleanGUI_FuseDlg.cxx b/src/BooleanGUI/BooleanGUI_FuseDlg.cxx index 8b667f3ac..14a741cc3 100644 --- a/src/BooleanGUI/BooleanGUI_FuseDlg.cxx +++ b/src/BooleanGUI/BooleanGUI_FuseDlg.cxx @@ -127,7 +127,7 @@ void BooleanGUI_FuseDlg::ClickOnOk() //================================================================================= void BooleanGUI_FuseDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(myOkShape1 && myOkShape2) myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 3); diff --git a/src/BooleanGUI/BooleanGUI_SectionDlg.cxx b/src/BooleanGUI/BooleanGUI_SectionDlg.cxx index 5ef65a739..d2c1c6a4a 100644 --- a/src/BooleanGUI/BooleanGUI_SectionDlg.cxx +++ b/src/BooleanGUI/BooleanGUI_SectionDlg.cxx @@ -128,7 +128,7 @@ void BooleanGUI_SectionDlg::ClickOnOk() //================================================================================= void BooleanGUI_SectionDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(myOkShape1 && myOkShape2) myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 4); diff --git a/src/BooleanGUI/Makefile.in b/src/BooleanGUI/Makefile.in index 37080c48d..92de526ff 100644 --- a/src/BooleanGUI/Makefile.in +++ b/src/BooleanGUI/Makefile.in @@ -53,21 +53,15 @@ LIB_MOC = \ BooleanGUI_CutDlg.h \ BooleanGUI_SectionDlg.h -LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ +LIB_CLIENT_IDL = LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lDlgRef -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lGEOMBase @CONCLUDE@ diff --git a/src/BuildGUI/BuildGUI.cxx b/src/BuildGUI/BuildGUI.cxx index 085b80773..39c0ee47e 100644 --- a/src/BuildGUI/BuildGUI.cxx +++ b/src/BuildGUI/BuildGUI.cxx @@ -80,15 +80,15 @@ bool BuildGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { BuildGUI* myBuildGUI = new BuildGUI(); myBuildGUI->myGeomGUI->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(myBuildGUI->myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); switch (theCommandID) { case 407: // EXPLODE : use ic { Handle(AIS_InteractiveContext) ic; - if(myBuildGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myBuildGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); ic = v3d->getAISContext(); } BuildGUI_SubShapeDlg *aDlg = new BuildGUI_SubShapeDlg(parent, "", myBuildGUI, Sel, ic); @@ -145,12 +145,12 @@ void BuildGUI::MakeLinearEdgeAndDisplay(const gp_Pnt P1, const gp_Pnt P2) GEOM::PointStruct ps2 = myGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z()); GEOM::GEOM_Shape_var result = myGeom->MakeEdge(ps1, ps2); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } result->NameType(tr("GEOM_EDGE")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -168,12 +168,12 @@ void BuildGUI::MakeWireAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) try { GEOM::GEOM_Shape_var result = myGeom->MakeWire(listShapesIOR); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } result->NameType(tr("GEOM_WIRE")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -191,7 +191,7 @@ void BuildGUI::MakeFaceAndDisplay(GEOM::GEOM_Shape_ptr aWire, const Standard_Boo try { GEOM::GEOM_Shape_var result = myGeom->MakeFace(aWire, wantPlanar); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } if (wantPlanar) @@ -199,7 +199,7 @@ void BuildGUI::MakeFaceAndDisplay(GEOM::GEOM_Shape_ptr aWire, const Standard_Boo else result->NameType(tr("GEOM_FACE")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -217,12 +217,12 @@ void BuildGUI::MakeShellAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) try { GEOM::GEOM_Shape_var result = myGeom->MakeShell(listShapesIOR); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } result->NameType(tr("GEOM_SHELL")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -240,12 +240,12 @@ void BuildGUI::MakeSolidAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) try { GEOM::GEOM_Shape_var result = myGeom->MakeSolid(listShapesIOR); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } result->NameType(tr("GEOM_SOLID")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -263,12 +263,12 @@ void BuildGUI::MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) try { GEOM::GEOM_Shape_var result = myGeom->MakeCompound(listShapesIOR); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } result->NameType(tr("GEOM_COMPOUND")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -285,7 +285,7 @@ void BuildGUI::MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) //===================================================================================== bool BuildGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(theFatherObject); SALOMEDS::SObject_var RefSO; SALOMEDS::GenericAttribute_var anAttr; @@ -315,15 +315,15 @@ bool BuildGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* I //===================================================================================== bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); if(theObj->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); return false; } SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeName_var aName; SALOMEDS::AttributeIOR_var anIOR; @@ -338,7 +338,7 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape try { listGeomShapes = myGeom->SubShapeAll(aShape, SubShapeType); if(listGeomShapes->length() < 1) { - myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT")); return false; } } @@ -347,7 +347,7 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape } /* open transaction */ - QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); op->start(); TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); @@ -370,7 +370,7 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); if (S.IsNull()) { - myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT")); return false; } @@ -389,8 +389,8 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape bool allreadyexist = false; - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); Handle(GEOM_AISShape) result = new GEOM_AISShape(S, nameG); @@ -451,11 +451,11 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape ic->Display(result); } - else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); int themode = myRenderInter->GetDisplayMode(); - vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); @@ -520,8 +520,8 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape /* commit transaction */ op->finish(); - myGeomGUI->GetActiveStudy()->updateObjBrowser(); - myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_READY")); + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY")); return true; } @@ -533,17 +533,17 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape bool BuildGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext) { //* Test the type of viewer */ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); if(theObj->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); return false; } - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); if( myUseLocalContext == false ) { @@ -639,11 +639,11 @@ bool BuildGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name()); /* open transaction */ - QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); op->start(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeName_var aName; SALOMEDS::AttributeIOR_var anIOR; @@ -708,8 +708,8 @@ bool BuildGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true); - myGeomGUI->GetActiveStudy()->updateObjBrowser(); - myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_READY")); + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY")); return true; } diff --git a/src/BuildGUI/BuildGUI.h b/src/BuildGUI/BuildGUI.h index 198f1fa78..828b3afb2 100644 --- a/src/BuildGUI/BuildGUI.h +++ b/src/BuildGUI/BuildGUI.h @@ -30,6 +30,7 @@ #define BUILDGUI_H #include "GEOMBase.h" +#include //================================================================================= // class : BuildGUI diff --git a/src/BuildGUI/BuildGUI_CompoundDlg.cxx b/src/BuildGUI/BuildGUI_CompoundDlg.cxx index 69b6fb046..73f0ac1a3 100644 --- a/src/BuildGUI/BuildGUI_CompoundDlg.cxx +++ b/src/BuildGUI/BuildGUI_CompoundDlg.cxx @@ -116,7 +116,7 @@ void BuildGUI_CompoundDlg::ClickOnOk() //================================================================================= void BuildGUI_CompoundDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(myOkListShapes) myBuildGUI->MakeCompoundAndDisplay(myListShapes); return; diff --git a/src/BuildGUI/BuildGUI_EdgeDlg.cxx b/src/BuildGUI/BuildGUI_EdgeDlg.cxx index c75c1dd44..f5b403f0d 100644 --- a/src/BuildGUI/BuildGUI_EdgeDlg.cxx +++ b/src/BuildGUI/BuildGUI_EdgeDlg.cxx @@ -134,7 +134,7 @@ void BuildGUI_EdgeDlg::ClickOnOk() //================================================================================= void BuildGUI_EdgeDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/BuildGUI/BuildGUI_FaceDlg.cxx b/src/BuildGUI/BuildGUI_FaceDlg.cxx index d08b1b254..340519af3 100644 --- a/src/BuildGUI/BuildGUI_FaceDlg.cxx +++ b/src/BuildGUI/BuildGUI_FaceDlg.cxx @@ -123,7 +123,7 @@ void BuildGUI_FaceDlg::ClickOnOk() //================================================================================= void BuildGUI_FaceDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(myOkShape) myBuildGUI->MakeFaceAndDisplay(myGeomShape, GroupPoints->CheckButton1->isChecked()); return; diff --git a/src/BuildGUI/BuildGUI_ShellDlg.cxx b/src/BuildGUI/BuildGUI_ShellDlg.cxx index 45608b3a3..8a33f4cf6 100644 --- a/src/BuildGUI/BuildGUI_ShellDlg.cxx +++ b/src/BuildGUI/BuildGUI_ShellDlg.cxx @@ -125,7 +125,7 @@ void BuildGUI_ShellDlg::ClickOnOk() //================================================================================= void BuildGUI_ShellDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(myOkListShapes) myBuildGUI->MakeShellAndDisplay(myListShapes); diff --git a/src/BuildGUI/BuildGUI_SolidDlg.cxx b/src/BuildGUI/BuildGUI_SolidDlg.cxx index 710b95161..d47526194 100644 --- a/src/BuildGUI/BuildGUI_SolidDlg.cxx +++ b/src/BuildGUI/BuildGUI_SolidDlg.cxx @@ -124,7 +124,7 @@ void BuildGUI_SolidDlg::ClickOnOk() //================================================================================= void BuildGUI_SolidDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(myOkListShapes) myBuildGUI->MakeSolidAndDisplay(myListShapes); diff --git a/src/BuildGUI/BuildGUI_SubShapeDlg.cxx b/src/BuildGUI/BuildGUI_SubShapeDlg.cxx index b54a5e7d4..375bb75f4 100644 --- a/src/BuildGUI/BuildGUI_SubShapeDlg.cxx +++ b/src/BuildGUI/BuildGUI_SubShapeDlg.cxx @@ -34,6 +34,7 @@ using namespace std; #include "OCCViewer_Viewer3d.h" #include +#include #include @@ -112,7 +113,7 @@ void BuildGUI_SubShapeDlg::Init(Handle(AIS_InteractiveContext) ic) myShapeType = GroupPoints->ComboBox1->currentItem(); myOkSelectSubMode = GroupPoints->CheckButton1->isChecked(); - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC) GroupPoints->CheckButton1->setEnabled(false); /* signals and slots connections */ @@ -163,7 +164,7 @@ void BuildGUI_SubShapeDlg::ClickOnOk() //================================================================================= void BuildGUI_SubShapeDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); bool testResult = false; myAbort = false; /* Not aborted by default */ @@ -190,11 +191,11 @@ void BuildGUI_SubShapeDlg::ClickOnApply() testResult = myBuildGUI->OnSubShapeGetSelected(myShape, myShapeIOR, myShapeType, myLocalContextId, myUseLocalContext); if(!testResult) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); myAbort = true; } else - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); /* Reset all arguments and local context to allow user a new selection ...*/ this->ResetStateOfDialog(); @@ -208,8 +209,8 @@ void BuildGUI_SubShapeDlg::ClickOnApply() //================================================================================= void BuildGUI_SubShapeDlg::ClickOnCancel() { - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); myIC = v3d->getAISContext(); if(myUseLocalContext) { myIC->CloseLocalContext(myLocalContextId); @@ -247,7 +248,7 @@ void BuildGUI_SubShapeDlg::SelectionIntoArgument() return; if(!IO->hasEntry()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); return; } @@ -260,7 +261,7 @@ void BuildGUI_SubShapeDlg::SelectionIntoArgument() myOkShape = true; } else { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeIOR_var anIOR; @@ -382,7 +383,7 @@ void BuildGUI_SubShapeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) GroupPoints->CheckButton1->setEnabled(true); else GroupPoints->CheckButton1->setEnabled(false); @@ -452,8 +453,8 @@ void BuildGUI_SubShapeDlg::ResetStateOfDialog() GroupPoints->CheckButton1->setChecked(FALSE); /* Close its local contact if opened */ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); myIC = v3d->getAISContext(); if(myUseLocalContext) { myIC->CloseLocalContext(myLocalContextId); @@ -476,7 +477,7 @@ void BuildGUI_SubShapeDlg::AllOrNotAll() /* No sub shape selection if main shape not selected */ if(!myOkShape) { this->ResetStateOfDialog(); - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")); return; } @@ -486,14 +487,14 @@ void BuildGUI_SubShapeDlg::AllOrNotAll() GroupPoints->CheckButton1->setChecked( FALSE ); //no meaning to allow user selection for type = shape //TODO - add another message - //myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ; + //QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ; return; } myOkSelectSubMode = GroupPoints->CheckButton1->isChecked(); - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); myIC = v3d->getAISContext(); if(myUseLocalContext) { @@ -504,7 +505,7 @@ void BuildGUI_SubShapeDlg::AllOrNotAll() myDisplayGUI->OnDisplayAll(true); } else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER")); return; } @@ -513,7 +514,7 @@ void BuildGUI_SubShapeDlg::AllOrNotAll() DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->PrepareSubShapeSelection(myShapeType, myLocalContextId); myUseLocalContext = true; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")); } return; } @@ -534,8 +535,8 @@ void BuildGUI_SubShapeDlg::ComboTextChanged() GroupPoints->CheckButton1->setChecked(FALSE); myOkSelectSubMode = FALSE; - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); myIC = v3d->getAISContext(); if(myUseLocalContext) { diff --git a/src/BuildGUI/BuildGUI_WireDlg.cxx b/src/BuildGUI/BuildGUI_WireDlg.cxx index c469331e6..8b2ea49f9 100644 --- a/src/BuildGUI/BuildGUI_WireDlg.cxx +++ b/src/BuildGUI/BuildGUI_WireDlg.cxx @@ -116,7 +116,7 @@ void BuildGUI_WireDlg::ClickOnOk() //================================================================================= void BuildGUI_WireDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(myOkListShapes) myBuildGUI->MakeWireAndDisplay(myListShapes); return; diff --git a/src/BuildGUI/Makefile.in b/src/BuildGUI/Makefile.in index 1a56bf51e..c37be075c 100644 --- a/src/BuildGUI/Makefile.in +++ b/src/BuildGUI/Makefile.in @@ -59,21 +59,15 @@ LIB_MOC = \ BuildGUI_SolidDlg.h \ BuildGUI_CompoundDlg.h -LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ +LIB_CLIENT_IDL = LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase -lDisplayGUI -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lGEOMFiltersSelection -lDisplayGUI @CONCLUDE@ diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx index 00fba79f2..bd7cec6c3 100644 --- a/src/DisplayGUI/DisplayGUI.cxx +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -73,27 +73,27 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { case 211: // MENU VIEW - WIREFRAME/SHADING { - if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { QApplication::setOverrideCursor(waitCursor); - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); int themode = myRenderInter->GetDisplayMode(); if(themode==0) { myRenderInter->SetDisplayMode(1); - myDisplayGUI->myGeomGUI->GetDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME")); + QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME")); } else { myRenderInter->SetDisplayMode(0); - myDisplayGUI->myGeomGUI->GetDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING")); + QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING")); } QApplication::restoreOverrideCursor(); } - else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { QApplication::setOverrideCursor(Qt::waitCursor); - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); AIS_DisplayMode mode = (AIS_DisplayMode)ic->DisplayMode(); AIS_DisplayMode newmode = (mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame); @@ -115,9 +115,9 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) ic->SetDisplayMode(newmode, Standard_False); if(newmode == 1) - myDisplayGUI->myGeomGUI->GetDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME")); + QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME")); else - myDisplayGUI->myGeomGUI->GetDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING")); + QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING")); QApplication::restoreOverrideCursor(); } @@ -125,26 +125,26 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } case 212: // MENU VIEW - DISPLAY ALL { - if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) - ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll(); - else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) + ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll(); + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) myDisplayGUI->OnDisplayAll(); break; } case 213: // MENU VIEW - DISPLAY ONLY { - if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) myDisplayGUI->OnVTKDisplayOnly(); - else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) myDisplayGUI->OnDisplayOnly(); break; } case 214: // MENU VIEW - ERASE ALL { - if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) - ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->EraseAll(); - else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) + ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->EraseAll(); + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); ic->EraseAll(Standard_True, Standard_False); @@ -159,11 +159,11 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } case 8031: // POPUP VIEWER - WIREFRAME/SHADING { - if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { // VTK - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - SALOME_Selection* Sel = SALOME_Selection::Selection(myDisplayGUI->myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); QApplication::setOverrideCursor(Qt::waitCursor); @@ -174,10 +174,10 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) myRenderInter->Render(); QApplication::restoreOverrideCursor(); } - else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { QApplication::setOverrideCursor(Qt::waitCursor); - SALOME_Selection* Sel = SALOME_Selection::Selection(myDisplayGUI->myGeomGUI->GetActiveStudy()->getSelection()); - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); for(;It.More();It.Next()) { @@ -217,19 +217,19 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO { DisplayGUI* myDisplayGUI = new DisplayGUI(); - SALOMEDS::Study_var aStudy = myDisplayGUI->myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); OCCViewer_Viewer3d* v3d; Handle(AIS_InteractiveContext) ic; vtkRenderer* Renderer; - if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - v3d = ((OCCViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); ic = v3d->getAISContext(); } - else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - Renderer = ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + Renderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); } else return; @@ -237,14 +237,14 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO if(theIO.IsNull()) MESSAGE("BuildPresentation(): null SALOME_InteractiveObject passed") - if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { // VTK - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); SALOMEDS::SObject_var obj = aStudy->FindObjectID(theIO->getEntry()); - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeName_var aName; @@ -260,7 +260,7 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO // this SObject may be GEOM module root SObject bool useSubItems = false; - SALOMEDS::ChildIterator_var anIter = myDisplayGUI->myGeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); + SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj); if(myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) { while (anIter->More() && !useSubItems) { SALOMEDS::SObject_var subobj = anIter->Value(); @@ -287,7 +287,7 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO if(obj->FindAttribute(anAttr, "AttributeName")) { aName = SALOMEDS::AttributeName::_narrow(anAttr); - vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); vtkActorCollection* theAllActors = theRenderer->GetActors(); theAllActors->InitTraversal(); vtkActor* actor = (vtkActor*)theAllActors->GetNextActor(); @@ -309,7 +309,7 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO } if(!isDisplayed) { // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( myDisplayGUI->myGeomGUI->GetActiveStudy() ); + QAD_Operation* op = new SALOMEGUI_ImportOperation( QAD_Application::getDesktop()->getActiveStudy() ); op->start(); SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); @@ -360,10 +360,10 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO } // No viewer update should be done here! //myRenderInter->Render(); - //myDisplayGUI->myGeomGUI->GetActiveStudy()->updateObjBrowser( true ); + //QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser( true ); } - else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeName_var aName; SALOMEDS::AttributeIOR_var anIOR; @@ -386,7 +386,7 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO // this SObject may be GEOM module root SObject bool useSubItems = false; - SALOMEDS::ChildIterator_var anIter = myDisplayGUI->myGeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); + SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj); if(myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) { while(anIter->More() && !useSubItems) { SALOMEDS::SObject_var subobj = anIter->Value(); @@ -434,7 +434,7 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO else { if(!useSubItems) { // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( myDisplayGUI->myGeomGUI->GetActiveStudy() ); + QAD_Operation* op = new SALOMEGUI_ImportOperation( QAD_Application::getDesktop()->getActiveStudy() ); op->start(); if (fatherSF->_is_nil()) MESSAGE("BuildPresentation(): fatherSF is nil!") @@ -444,7 +444,7 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO op->finish(); } Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value()); - aSh->SetShadingColor(myDisplayGUI->myGeomGUI->GetShadingColor()); + aSh->SetShadingColor(myDisplayGUI->myGeomBase->myShadingColor); Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myDisplayGUI->myGeomGUI->GetFatherior(), "GEOM"); IO->setEntry(obj->GetID()); aSh->setIO(IO); @@ -476,7 +476,7 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO } } // No viewer update should be done here! - //myDisplayGUI->myGeomGUI->GetActiveStudy()->updateObjBrowser( true ); + //QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser( true ); //ic->UpdateCurrentViewer(); } } @@ -488,10 +488,10 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO //===================================================================================== void DisplayGUI::OnDisplayAll(bool onlyPreviousDisplayedObject) { - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); myContext->Display(v3d->getTrihedron()); @@ -514,7 +514,9 @@ void DisplayGUI::OnDisplayAll(bool onlyPreviousDisplayedObject) } } else { - AIS_ListIteratorOfListOfInteractive ite(myGeomGUI->GetListDisplayedObject()); + AIS_ListOfInteractive aListDisplayedObject; + myContext->DisplayedObjects(aListDisplayedObject); + AIS_ListIteratorOfListOfInteractive ite(aListDisplayedObject); while(ite.More()) { if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); @@ -541,7 +543,7 @@ void DisplayGUI::OnVTKDisplayOnly() QApplication::setOverrideCursor(Qt::waitCursor); // Erase all not selected actors - vtkRenderer* aren = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkRenderer* aren = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); vtkActorCollection* theActors = aren->GetActors(); theActors->InitTraversal(); vtkActor *ac = theActors->GetNextActor(); @@ -555,21 +557,21 @@ void DisplayGUI::OnVTKDisplayOnly() } // Display selection - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeName_var aName; SALOMEDS::AttributeIOR_var anIOR; - SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); for(;It.More();It.Next()) { Handle(SALOME_InteractiveObject) IObject = It.Value(); SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); if(myRenderInter->isInViewer(IObject)) { myRenderInter->Display(IObject); @@ -580,7 +582,7 @@ void DisplayGUI::OnVTKDisplayOnly() if(!obj->FindAttribute(anAttr, "AttributeIOR")) break; // If selected object contains displayable subobjects, then do nothing - SALOMEDS::ChildIterator_var anIter = myGeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); + SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj); SALOMEDS::GenericAttribute_var aTmpAttr; anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); @@ -591,7 +593,7 @@ void DisplayGUI::OnVTKDisplayOnly() if(obj->FindAttribute(anAttr, "AttributeName")) { aName = SALOMEDS::AttributeName::_narrow(anAttr); // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); op->start(); SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); @@ -599,7 +601,7 @@ void DisplayGUI::OnVTKDisplayOnly() // commit transaction op->finish(); - vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); int themode = myRenderInter->GetDisplayMode(); vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(Shape, 0, themode, Standard_True); theActors->InitTraversal(); @@ -610,7 +612,7 @@ void DisplayGUI::OnVTKDisplayOnly() GActor->setName(IObject->getName()); theRenderer->AddActor(GActor); - vtkRenderWindow *renWin = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer()->GetRenderWindow(); + vtkRenderWindow *renWin = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer()->GetRenderWindow(); renWin->Render(); anActor = (vtkActor*)theActors->GetNextActor(); } @@ -618,7 +620,7 @@ void DisplayGUI::OnVTKDisplayOnly() } } } - myGeomGUI->GetActiveStudy()->updateObjBrowser(true); + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(true); QApplication::restoreOverrideCursor(); return; @@ -631,11 +633,11 @@ void DisplayGUI::OnVTKDisplayOnly() //===================================================================================== void DisplayGUI::OnDisplayOnly() { - if (myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); AIS_ListOfInteractive List; @@ -652,14 +654,14 @@ void DisplayGUI::OnDisplayOnly() } SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); SALOME_ListIteratorOfListIO It1(Sel->StoredIObjects()); for(;It1.More();It1.Next()) { Handle(SALOME_InteractiveObject) IObject = It1.Value(); SALOMEDS::SObject_var fatherSF = - aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); if(v3d->isInViewer(IObject, true)) { AIS_ListOfInteractive List1; ic->ObjectsInCollector(List1); @@ -697,7 +699,7 @@ void DisplayGUI::OnDisplayOnly() if(obj->FindAttribute(anAttr, "AttributeName")) { aName = SALOMEDS::AttributeName::_narrow(anAttr); // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); op->start(); SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); @@ -728,15 +730,15 @@ void DisplayGUI::OnDisplayOnly() //===================================================================================== void DisplayGUI::OnErase() { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); - SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { // VTK SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); Handle(SALOME_InteractiveObject) anIObject; for(;It.More();It.Next()) { anIObject = It.Value(); - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); if(myRenderInter->isInViewer(anIObject)) { myRenderInter->Erase(anIObject); @@ -748,7 +750,7 @@ void DisplayGUI::OnErase() if(!obj->_is_nil()) { if(obj->FindAttribute(anAttr, "AttributeIOR")) { // this SObject may be GEOM module root SObject - SALOMEDS::ChildIterator_var anIter = myGeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); + SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj); bool useSubItems = false; while(anIter->More() && !useSubItems) { SALOMEDS::SObject_var subobj = anIter->Value(); @@ -768,7 +770,7 @@ void DisplayGUI::OnErase() TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); if(obj->FindAttribute(anAttr, "AttributeName")) { // searchin for already displayed objects with the same shape - vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); vtkActorCollection* theAllActors = theRenderer->GetActors(); theAllActors->InitTraversal(); vtkActor* actor = (vtkActor*)theAllActors->GetNextActor(); @@ -812,9 +814,9 @@ void DisplayGUI::OnErase() } } } - else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { // OCC - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); Handle(SALOME_InteractiveObject) anIObject; @@ -835,7 +837,7 @@ void DisplayGUI::OnErase() if(!obj->_is_nil()) { if(obj->FindAttribute(anAttr, "AttributeIOR")) { // this SObject may be GEOM module root SObject - SALOMEDS::ChildIterator_var anIter = myGeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); + SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj); bool useSubItems = false; while(anIter->More() && !useSubItems) { SALOMEDS::SObject_var subobj = anIter->Value(); @@ -905,18 +907,18 @@ void DisplayGUI::OnErase() bool DisplayGUI::PrepareSubShapeSelection(const int SubShapeType, Standard_Integer& returnLocalContextId) { //* Test the type of viewer */ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); /* local context opening */ - myGeomBase->SetDisplayedObjectList(); + //myGeomBase->SetDisplayedObjectList(); this->OnDisplayOnly(); returnLocalContextId = ic->OpenLocalContext(Standard_False, Standard_True, Standard_False, Standard_False); - SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); for(;It.More();It.Next()) { Handle(SALOME_InteractiveObject) IObject = It.Value(); @@ -927,7 +929,7 @@ bool DisplayGUI::PrepareSubShapeSelection(const int SubShapeType, Standard_Integ ic->HilightWithColor(Shape, Quantity_NOC_RED); } } - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_SUBSHAPES")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_SUBSHAPES")); return true; } @@ -939,17 +941,17 @@ bool DisplayGUI::PrepareSubShapeSelection(const int SubShapeType, Standard_Integ bool DisplayGUI::PrepareSubShapeSelectionArgumentShape(const TopoDS_Shape& aShape,const int SubShapeType, Standard_Integer& returnLocalContextId) { //* Test the type of viewer */ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; if(aShape.IsNull()) return false ; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); /* local context opening */ - myGeomBase->SetDisplayedObjectList(); + //myGeomBase->SetDisplayedObjectList(); this->OnDisplayOnly(); returnLocalContextId = ic->OpenLocalContext(Standard_False, Standard_True, Standard_False, Standard_False) ; @@ -961,7 +963,7 @@ bool DisplayGUI::PrepareSubShapeSelectionArgumentShape(const TopoDS_Shape& aShap // ic->Load(Shape, (8 - SubShapeType), Standard_True); ic->HilightWithColor(Shape, Quantity_NOC_RED); - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_SUBSHAPES")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_SUBSHAPES")); return true; } diff --git a/src/DisplayGUI/Makefile.in b/src/DisplayGUI/Makefile.in index d49c3f64c..d1cd6aa6a 100644 --- a/src/DisplayGUI/Makefile.in +++ b/src/DisplayGUI/Makefile.in @@ -45,21 +45,15 @@ LIB_SRC = DisplayGUI.cxx LIB_MOC = \ DisplayGUI.h -LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ +LIB_CLIENT_IDL = SALOME_Exception.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lGEOMBase @CONCLUDE@ diff --git a/src/DlgRef/DlgRef_1Sel1Spin1Check.cxx b/src/DlgRef/DlgRef_1Sel1Spin1Check.cxx new file mode 100644 index 000000000..89196c2fc --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin1Check.cxx @@ -0,0 +1,54 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DlgRef_1Sel1Spin1Check.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_1Sel1Spin1Check.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel1Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_1Sel1Spin1Check::DlgRef_1Sel1Spin1Check(QWidget* parent, const char* name, WFlags fl) + :DlgRef_1Sel1Spin1Check_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout2->addWidget(SpinBox_DX, 0, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel1Spin1Check::~DlgRef_1Sel1Spin1Check() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_1Sel1Spin1Check.h b/src/DlgRef/DlgRef_1Sel1Spin1Check.h new file mode 100644 index 000000000..6d0b2d6e4 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin1Check.h @@ -0,0 +1,47 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DlgRef_1Sel1Spin1Check.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_1SEL1SPIN1CHECK_H +#define DLGREF_1SEL1SPIN1CHECK_H + +#include "DlgRef_1Sel1Spin1Check_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_1Sel1Spin1Check : public DlgRef_1Sel1Spin1Check_QTD +{ + Q_OBJECT + +public: + DlgRef_1Sel1Spin1Check(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_1Sel1Spin1Check(); + + DlgRef_SpinBox* SpinBox_DX; + +}; + +#endif // DLGREF_1SEL1SPIN1CHECK_H diff --git a/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.cxx b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.cxx new file mode 100644 index 000000000..12fc89820 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.cxx @@ -0,0 +1,95 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel1Spin1Check_QTD.ui' +** +** Created: lun nov 17 14:16:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel1Spin1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel1Spin1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel1Spin1Check_QTD::DlgRef_1Sel1Spin1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel1Spin1Check_QTD" ); + resize( 129, 106 ); + setCaption( trUtf8( "DlgRef_1Sel1Spin1Check_QTD" ) ); + DlgRef_1Sel1Spin1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel1Spin1Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + QSpacerItem* spacer = new QSpacerItem( 0, 120, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout2->addWidget( TextLabel2, 0, 0 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton1, 2, 2, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel1Spin1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel1Spin1Check_QTD::~DlgRef_1Sel1Spin1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.h b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.h new file mode 100644 index 000000000..cf3722b32 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel1Spin1Check_QTD.ui' +** +** Created: lun nov 17 14:16:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL1SPIN1CHECK_QTD_H +#define DLGREF_1SEL1SPIN1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QSpinBox; + +class DlgRef_1Sel1Spin1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel1Spin1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel1Spin1Check_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QPushButton* PushButton1; + QSpinBox* SpinBox1; + QLabel* TextLabel2; + QLineEdit* LineEdit1; + QRadioButton* CheckButton1; + + +protected: + QGridLayout* DlgRef_1Sel1Spin1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_1SEL1SPIN1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel3Check_QTD.cxx b/src/DlgRef/DlgRef_1Sel3Check_QTD.cxx new file mode 100644 index 000000000..3778dd33e --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel3Check_QTD.cxx @@ -0,0 +1,89 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel3Check_QTD.ui' +** +** Created: lun nov 17 11:32:21 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel3Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel3Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel3Check_QTD::DlgRef_1Sel3Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel3Check_QTD" ); + resize( 129, 114 ); + setCaption( trUtf8( "DlgRef_1Sel3Check_QTD" ) ); + DlgRef_1Sel3Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel3Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + CheckButton2 = new QRadioButton( GroupBox1, "CheckButton2" ); + CheckButton2->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton2, 2, 2, 0, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 60, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 4, 2 ); + + CheckButton3 = new QRadioButton( GroupBox1, "CheckButton3" ); + CheckButton3->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton3, 3, 3, 0, 2 ); + + CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton1, 1, 1, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel3Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel3Check_QTD::~DlgRef_1Sel3Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel3Check_QTD.h b/src/DlgRef/DlgRef_1Sel3Check_QTD.h new file mode 100644 index 000000000..248f7f773 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel3Check_QTD.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel3Check_QTD.ui' +** +** Created: lun nov 17 11:32:20 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL3CHECK_QTD_H +#define DLGREF_1SEL3CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; + +class DlgRef_1Sel3Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel3Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel3Check_QTD(); + + QGroupBox* GroupBox1; + QRadioButton* CheckButton2; + QLabel* TextLabel1; + QPushButton* PushButton1; + QRadioButton* CheckButton3; + QRadioButton* CheckButton1; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* DlgRef_1Sel3Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_1SEL3CHECK_QTD_H diff --git a/src/DlgRef/Makefile.in b/src/DlgRef/Makefile.in index d8f32ca58..c6ed3784e 100644 --- a/src/DlgRef/Makefile.in +++ b/src/DlgRef/Makefile.in @@ -42,6 +42,7 @@ LIB_SRC = DlgRef_Skeleton_QTD.cxx \ DlgRef_2Sel_QTD.cxx \ DlgRef_3Sel_QTD.cxx \ DlgRef_1Sel1Check_QTD.cxx \ + DlgRef_1Sel3Check_QTD.cxx \ DlgRef_1Sel1Check1List_QTD.cxx \ DlgRef_1Sel1Spin_QTD.cxx \ DlgRef_1Sel2Spin_QTD.cxx \ @@ -51,6 +52,7 @@ LIB_SRC = DlgRef_Skeleton_QTD.cxx \ DlgRef_2Sel1Spin_QTD.cxx \ DlgRef_2Sel2Spin_QTD.cxx \ DlgRef_2Sel3Spin_QTD.cxx \ + DlgRef_1Sel1Spin1Check_QTD.cxx \ DlgRef_2Sel1Spin1Check_QTD.cxx \ DlgRef_2Sel2Spin1Check_QTD.cxx \ DlgRef_2Sel4Spin1Check_QTD.cxx \ @@ -69,6 +71,7 @@ LIB_SRC = DlgRef_Skeleton_QTD.cxx \ DlgRef_2Sel1Spin.cxx \ DlgRef_2Sel2Spin.cxx \ DlgRef_2Sel3Spin.cxx \ + DlgRef_1Sel1Spin1Check.cxx \ DlgRef_2Sel1Spin1Check.cxx \ DlgRef_2Sel2Spin1Check.cxx \ DlgRef_2Sel4Spin1Check.cxx \ @@ -84,6 +87,7 @@ LIB_MOC = \ DlgRef_2Sel_QTD.h \ DlgRef_3Sel_QTD.h \ DlgRef_1Sel1Check_QTD.h \ + DlgRef_1Sel3Check_QTD.h \ DlgRef_1Sel1Check1List_QTD.h \ DlgRef_1Sel1Spin_QTD.h \ DlgRef_1Sel2Spin_QTD.h \ @@ -93,6 +97,7 @@ LIB_MOC = \ DlgRef_2Sel1Spin_QTD.h \ DlgRef_2Sel2Spin_QTD.h \ DlgRef_2Sel3Spin_QTD.h \ + DlgRef_1Sel1Spin1Check_QTD.h \ DlgRef_2Sel1Spin1Check_QTD.h \ DlgRef_2Sel2Spin1Check_QTD.h \ DlgRef_2Sel4Spin1Check_QTD.h \ @@ -111,6 +116,7 @@ LIB_MOC = \ DlgRef_2Sel1Spin.h \ DlgRef_2Sel2Spin.h \ DlgRef_2Sel3Spin.h \ + DlgRef_1Sel1Spin1Check.h \ DlgRef_2Sel1Spin1Check.h \ DlgRef_2Sel2Spin1Check.h \ DlgRef_2Sel4Spin1Check.h \ @@ -123,19 +129,14 @@ LIB_MOC = \ # header files EXPORT_HEADERS= $(LIB_MOC) -LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ +LIB_CLIENT_IDL = LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lSalomeGUI -L${KERNEL_ROOT_DIR}/lib/salome +CPPFLAGS += $(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += @CONCLUDE@ diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel1Spin1Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel1Spin1Check_QTD.ui new file mode 100644 index 000000000..27b1ad9e3 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_1Sel1Spin1Check_QTD.ui @@ -0,0 +1,173 @@ + +DlgRef_1Sel1Spin1Check_QTD + + + DlgRef_1Sel1Spin1Check_QTD + + + + 0 + 0 + 129 + 106 + + + + DlgRef_1Sel1Spin1Check_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 120 + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + + + LineEdit1 + + + + + CheckButton1 + + + + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel3Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel3Check_QTD.ui new file mode 100644 index 000000000..113ad786c --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_1Sel3Check_QTD.ui @@ -0,0 +1,144 @@ + +DlgRef_1Sel3Check_QTD + + + DlgRef_1Sel3Check_QTD + + + + 0 + 0 + 129 + 114 + + + + DlgRef_1Sel3Check_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + CheckButton2 + + + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 60 + + + + + + CheckButton3 + + + + + + + + CheckButton1 + + + + + + + + LineEdit1 + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/ui_to_cxx b/src/DlgRef/UIFiles/ui_to_cxx index be4eb4389..160c37412 100755 --- a/src/DlgRef/UIFiles/ui_to_cxx +++ b/src/DlgRef/UIFiles/ui_to_cxx @@ -9,6 +9,9 @@ #uic -o DlgRef_1Sel1Spin_QTD.h DlgRef_1Sel1Spin_QTD.ui #uic -o DlgRef_1Sel1Spin_QTD.cxx -impl DlgRef_1Sel1Spin_QTD.h DlgRef_1Sel1Spin_QTD.ui +uic -o DlgRef_1Sel1Spin1Check_QTD.h DlgRef_1Sel1Spin1Check_QTD.ui +uic -o DlgRef_1Sel1Spin1Check_QTD.cxx -impl DlgRef_1Sel1Spin1Check_QTD.h DlgRef_1Sel1Spin1Check_QTD.ui + #uic -o DlgRef_1Sel2Spin_QTD.h DlgRef_1Sel2Spin_QTD.ui #uic -o DlgRef_1Sel2Spin_QTD.cxx -impl DlgRef_1Sel2Spin_QTD.h DlgRef_1Sel2Spin_QTD.ui @@ -24,6 +27,9 @@ #uic -o DlgRef_1Sel1Check_QTD.h DlgRef_1Sel1Check_QTD.ui #uic -o DlgRef_1Sel1Check_QTD.cxx -impl DlgRef_1Sel1Check_QTD.h DlgRef_1Sel1Check_QTD.ui +#uic -o DlgRef_1Sel3Check_QTD.h DlgRef_1Sel3Check_QTD.ui +#uic -o DlgRef_1Sel3Check_QTD.cxx -impl DlgRef_1Sel3Check_QTD.h DlgRef_1Sel3Check_QTD.ui + #uic -o DlgRef_1Sel1Check1List_QTD.h DlgRef_1Sel1Check1List_QTD.ui #uic -o DlgRef_1Sel1Check1List_QTD.cxx -impl DlgRef_1Sel1Check1List_QTD.h DlgRef_1Sel1Check1List_QTD.ui @@ -48,8 +54,8 @@ #uic -o DlgRef_2Sel4Spin1Check_QTD.h DlgRef_2Sel4Spin1Check_QTD.ui #uic -o DlgRef_2Sel4Spin1Check_QTD.cxx -impl DlgRef_2Sel4Spin1Check_QTD.h DlgRef_2Sel4Spin1Check_QTD.ui -uic -o DlgRef_4Sel1List_QTD.h DlgRef_4Sel1List_QTD.ui -uic -o DlgRef_4Sel1List_QTD.cxx -impl DlgRef_4Sel1List_QTD.h DlgRef_4Sel1List_QTD.ui +#uic -o DlgRef_4Sel1List_QTD.h DlgRef_4Sel1List_QTD.ui +#uic -o DlgRef_4Sel1List_QTD.cxx -impl DlgRef_4Sel1List_QTD.h DlgRef_4Sel1List_QTD.ui #uic -o DlgRef_3Sel_QTD.h DlgRef_3Sel_QTD.ui #uic -o DlgRef_3Sel_QTD.cxx -impl DlgRef_3Sel_QTD.h DlgRef_3Sel_QTD.ui diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index 38735d1d2..cf1f54375 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -35,6 +35,7 @@ using namespace std; #include "QAD_RightFrame.h" #include "QAD_MessageBox.h" +#include "QAD_Resource.h" #include "GEOM_AssemblyBuilder.h" #include "VTKViewer_ViewFrame.h" @@ -69,6 +70,36 @@ using namespace std; #include "GEOMBase_aParameterDlg.h" +//================================================================================= +// class : CustomItem +// purpose : Set Font to a text. +//================================================================================= +class CustomItem : public QCustomMenuItem +{ +public: + CustomItem(const QString& s, const QFont& f) + :string(s), font(f){}; + ~CustomItem(){} + + void paint(QPainter* p, const QColorGroup& /*cg*/, bool /*act*/, + bool /*enabled*/, int x, int y, int w, int h) + { + p->setFont(font); + p->drawText(x, y, w, h, AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string); + } + + QSize sizeHint() + { + return QFontMetrics(font).size(AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string); + } + +private: + QString string; + QFont font; + +}; + + //======================================================================= // function : GEOMBase() // purpose : Constructor @@ -78,6 +109,21 @@ GEOMBase::GEOMBase() : { myGeomGUI = GEOMContext::GetGeomGUI(); myGeom = myGeomGUI->myComponentGeom; + + /* Shading Color */ + QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed"); + QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen"); + QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue"); + if(!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty()) + myShadingColor = Quantity_Color(SCr.toInt()/255., SCg.toInt()/255., SCb.toInt()/255., Quantity_TOC_RGB); + else + myShadingColor = Quantity_Color(Quantity_NOC_GOLDENROD); + + QString AddInStudy = QAD_CONFIG->getSetting("Geometry:SettingsAddInStudy"); + if(!AddInStudy.isEmpty()) + mySettings_AddInStudy = AddInStudy.toInt(); + else + mySettings_AddInStudy = 1; } @@ -90,6 +136,319 @@ GEOMBase::~GEOMBase() } +//================================================================================= +// function : CustomPopup() +// purpose : [static] +//================================================================================= +bool GEOMBase::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, + const QString& theParent, const QString& theObject) +{ + GEOMBase* myGeomBase = new GEOMBase(); + QAD_Study* ActiveStudy = parent->getActiveStudy(); + + /* Deactivate any non modal dialog box to get the neutral point */ + myGeomBase->myGeomGUI->EmitSignalDeactivateDialog(); + + SALOME_Selection* Sel = SALOME_Selection::Selection(ActiveStudy->getSelection()); + int nbSel = Sel->IObjectCount(); + + if((nbSel == 0)) + return false; + + if(ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + if(theParent.compare("Viewer") == 0) { + if(theObject.compare("Component") == 0) { + popup->removeItem(QAD_DisplayOnly_Popup_ID); + return true; + } + else { + QFont f = QApplication::font(); + f.setBold(TRUE); + if(nbSel == 1) { + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + popup->removeItem(QAD_TopLabel_Popup_ID); + popup->insertItem(new CustomItem (QString(IObject->getName()), f), QAD_TopLabel_Popup_ID, 0); + if(IObject->hasEntry()) + popup->setItemEnabled(804, false); //Add in Study Menu + else + popup->setItemEnabled(804, true); //Add in Study Menu + + if(IObject->IsKind(STANDARD_TYPE(GEOM_InteractiveObject))) { + Standard_Boolean found; + Handle(GEOM_AISShape) Result = myGeomBase->ConvertIOinGEOMAISShape(IObject, found, true); + + if(found) { + if(Result->DisplayMode() == 1) + popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu + else + popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu + } + } + + if(!(v3d->isInViewer(IObject) && v3d->isVisible(IObject))) + popup->removeItem(QAD_Erase_Popup_ID); + else + popup->removeItem(QAD_Display_Popup_ID); + } + else { + popup->removeItem(QAD_DisplayOnly_Popup_ID); + popup->removeItem(QAD_TopLabel_Popup_ID); + popup->insertItem(new CustomItem (tr("GEOM_MEN_POPUP_NAME").arg(nbSel), f), QAD_TopLabel_Popup_ID, 0); + popup->setItemEnabled(804, false); //Add in Study Menu + } + } + return true; + } + else if(theParent.compare("ObjectBrowser") == 0) { + popup->removeItem(QAD_TopLabel_Popup_ID); + int id = popup->idAt(0); // separator + if(id < 0) + popup->removeItem(id); + + // checking for GEOM label in the selected list + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + Handle(SALOME_InteractiveObject) anIObject; + + bool useSubItems = false; + bool needOpen = false; + bool needDisplay = false; + bool needErase = false; + SALOMEDS::GenericAttribute_var aTmpAttr; + for(;It.More();It.Next()) { + anIObject = It.Value(); + if(!anIObject->hasEntry()) + continue; + + if(v3d->isInViewer(anIObject) && v3d->isVisible(anIObject)) + needErase = true; + else + needDisplay = true; + SALOMEDS::SObject_var obj = ActiveStudy->getStudyDocument()->FindObjectID(anIObject->getEntry()); + if(!obj->_is_nil()) { + GEOM::GEOM_Shape_var aShape; + if(obj->FindAttribute(aTmpAttr, "AttributeIOR")) { + char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value(); + if(str && strlen(str)) + aShape = myGeomBase->myGeom->GetIORFromString(str); + } + else if(obj->FindAttribute(aTmpAttr, "AttributePersistentRef")) + needOpen = true; + + if(aShape->_is_nil()) { + SALOMEDS::ChildIterator_var anIter = ActiveStudy->getStudyDocument()->NewChildIterator(obj); + while(anIter->More()) { + SALOMEDS::SObject_var subobj = anIter->Value(); + if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { + useSubItems = true; + needErase = true; + needDisplay = true; + } + else if(subobj->FindAttribute(aTmpAttr, "AttributePersistentRef")) { + needOpen = true; + useSubItems = true; + } + anIter->Next(); + } + } + } + } + // remove useless popup items + if(nbSel != 1) + popup->removeItem(901); // rename + if(useSubItems) + popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only + + if(!needOpen) { + int index = popup->indexOf(9024); // open + popup->removeItem(9024); + popup->removeItemAt(index); // separator under Open + + if (!needDisplay) + popup->removeItem(QAD_Display_Popup_ID); + if (!needErase) + popup->removeItem(QAD_Erase_Popup_ID); + + if(!needDisplay && !needErase) { + int id = popup->idAt(popup->count()-1); // last item + popup->removeItem(id); // separator + } + } + else { + popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only + popup->removeItem(QAD_Display_Popup_ID); + popup->removeItem(QAD_Erase_Popup_ID); + if (nbSel != 1) { + int id = popup->idAt(popup->count()-1); // last item + popup->removeItem(id); // separator + } + } + return true; + } + } + else if(ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + // MESSAGE ( " CUSTOM POPUP VIEWER VTK ") + if((theParent.compare("Viewer") == 0)) { + popup->setItemEnabled(8034, false); //Isos Menu + if(theObject.compare("Component") == 0) { + popup->removeItem(QAD_DisplayOnly_Popup_ID); + return true; + } + + //int id = popup->idAt(0); + QFont f = QApplication::font(); + f.setBold(TRUE); + + if(nbSel == 1) { + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + popup->removeItem(QAD_TopLabel_Popup_ID); + popup->insertItem(new CustomItem (QString(IObject->getName()), f), QAD_TopLabel_Popup_ID, 0); + if(IObject->hasEntry()) { + popup->setItemEnabled(804, false); //Add in Study Menu + SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument(); + SALOMEDS::SObject_var SO = aStudy->FindObjectID(IObject->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!SO->_is_nil()) { + if(SO->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + Standard_Boolean found; + GEOM_Actor* Result = myGeomBase->ConvertIORinGEOMActor(anIOR->Value(), found, true); + if(found) { + if(Result->getDisplayMode() == 1) + popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu + else + popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu + + if(!Result->GetVisibility()) + popup->removeItem(QAD_Erase_Popup_ID); + else + popup->removeItem(QAD_Display_Popup_ID); + } + else + popup->removeItem(QAD_Erase_Popup_ID); + } + } + } + else + popup->setItemEnabled(804, true); //Add in Study Menu + } + else { + popup->removeItem(QAD_DisplayOnly_Popup_ID); + popup->removeItem(QAD_TopLabel_Popup_ID); + popup->insertItem( new CustomItem (tr("GEOM_MEN_POPUP_NAME").arg(nbSel), f), QAD_TopLabel_Popup_ID, 0); + popup->setItemEnabled(804, false); //Add in Study Menu + } + return true; + } + else if(theParent.compare("ObjectBrowser") == 0) { + popup->removeItem(QAD_TopLabel_Popup_ID); + int id = popup->idAt(0); // separator + if(id < 0) + popup->removeItem(id); + + // checking for GEOM label in the selected list + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + Handle(SALOME_InteractiveObject) anIObject; + + bool useSubItems = false; + bool needOpen = false; + bool needDisplay = false; + bool needErase = false; + SALOMEDS::GenericAttribute_var aTmpAttr; + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + for(;It.More();It.Next()) { + anIObject = It.Value(); + if(!anIObject->hasEntry()) + continue; + + if(myRenderInter->isInViewer(anIObject) && myRenderInter->isVisible(anIObject)) + needErase = true; + else + needDisplay = true; + + SALOMEDS::SObject_var obj = ActiveStudy->getStudyDocument()->FindObjectID(anIObject->getEntry()); + if(!obj->_is_nil()) { + GEOM::GEOM_Shape_var aShape; + if(obj->FindAttribute(aTmpAttr, "AttributeIOR")) { + char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value(); + if(str && strlen(str)) + aShape = myGeomBase->myGeom->GetIORFromString(str); + } + else if(obj->FindAttribute(aTmpAttr, "AttributePersistentRef")) + needOpen = true; + + if(aShape->_is_nil()) { + SALOMEDS::ChildIterator_var anIter = ActiveStudy->getStudyDocument()->NewChildIterator(obj); + while(anIter->More()) { + SALOMEDS::SObject_var subobj = anIter->Value(); + if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { + useSubItems = true; + needDisplay = true; + needErase = true; + } + else if(subobj->FindAttribute(aTmpAttr, "AttributePersistentRef")) { + needOpen = true; + useSubItems = true; + } + anIter->Next(); + } + } + } + } + // remove useless popup items + if(nbSel != 1) + popup->removeItem(901); // rename + if(useSubItems) + popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only + + if(!needOpen) { + int index = popup->indexOf(9024); // open + popup->removeItem(9024); + popup->removeItemAt(index); // separator under Open + + if(!needDisplay) + popup->removeItem(QAD_Display_Popup_ID); + if(!needErase) + popup->removeItem(QAD_Erase_Popup_ID); + if(!needDisplay && !needErase) { + int id = popup->idAt(popup->count()-1); // last item + popup->removeItem(id); // separator + } + } + else { + popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only + popup->removeItem(QAD_Display_Popup_ID); + popup->removeItem(QAD_Erase_Popup_ID); + if(nbSel!=1) { + int id = popup->idAt(popup->count()-1); // last item + popup->removeItem(id); // separator + } + } + return true; + } + } + else { // other viewer types not supported. + while(1) { + int id = popup->idAt(0); + if(id <= QAD_TopLabel_Popup_ID && id != -1) + popup->removeItemAt(0); + else + break; + } + popup->removeItem(QAD_DisplayOnly_Popup_ID); + popup->removeItem(QAD_Display_Popup_ID); + popup->removeItem(QAD_Erase_Popup_ID); + int id = popup->idAt(popup->count() - 1); // last item + if(id < 0 && id != -1) + popup->removeItem(id); // separator + return false; + } + return false; +} + + //===================================================================================== // function : Display() // purpose : Displays a CORBA shape @@ -98,7 +457,7 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name) { // MESSAGE ( "GEOMBase::Display init ") Handle(GEOM_InteractiveObject) IO; - SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); Sel->ClearIObjects(); if(aShape->_is_nil()) { @@ -110,7 +469,7 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name) if(shape.IsNull()) return false; - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeName_var aName; @@ -119,7 +478,7 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name) SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM"); int aLocked = false; if(father->_is_nil()) { - QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); op->start(); aLocked = aStudy->GetProperties()->IsLocked(); if(aLocked) @@ -131,7 +490,7 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name) anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); aPixmap->SetPixMap("ICON_OBJBROWSER_Geometry"); - myGeomGUI->GetActiveStudy()->updateObjBrowser(); + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); if(aLocked) aStudy->GetProperties()->SetLocked(true); op->finish(); @@ -156,10 +515,10 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name) nameG = TCollection_AsciiString(name); // VTK - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); int themode = myRenderInter->GetDisplayMode(); vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(shape, 0, themode, Standard_True); @@ -177,11 +536,11 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name) } } // OCC - else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); Handle(GEOM_AISShape) theResult = new GEOM_AISShape(shape, nameG.ToCString()); - theResult->SetShadingColor(myGeomGUI->GetShadingColor()); + theResult->SetShadingColor(myShadingColor); IO = new GEOM_InteractiveObject(aShape->Name(), myGeomGUI->GetFatherior(), "GEOM"); theResult->setIO(IO); theResult->setName(nameG.ToCString()); @@ -194,8 +553,8 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name) } Sel->AddIObject(IO, false); - myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Repaint(); - if(myGeomGUI->GetSettings_AddInStudy()) + QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Repaint(); + if(mySettings_AddInStudy) AddInStudy(false, IO); return true; @@ -208,12 +567,12 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name) //===================================================================================== bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject)& anIO) { - SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); - if (!(!myGeomGUI->GetSettings_AddInStudy() || selection)) { + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + if (!(!mySettings_AddInStudy || selection)) { Sel->ClearIObjects(); } - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeName_var aName; @@ -224,7 +583,7 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject) SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM"); int aLocked = false; if(father->_is_nil()) { - QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); op->start(); aLocked = aStudy->GetProperties()->IsLocked(); if(aLocked) @@ -244,7 +603,7 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject) aStudyBuilder->DefineComponentInstance(father, myGeom); father->ComponentIOR(myGeomGUI->GetFatherior()); - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); Handle(GEOM_AISShape) GAISShape; GEOM_Actor* GActor; @@ -252,8 +611,8 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject) bool found = false; // VTK - if (myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - vtkRenderer *Renderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + vtkRenderer *Renderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); vtkActorCollection* theActors = Renderer->GetActors(); theActors->InitTraversal(); @@ -280,8 +639,8 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject) return false; } // OCC - else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); AIS_ListOfInteractive List; @@ -309,14 +668,14 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject) return false; } - if(!myGeomGUI->GetSettings_AddInStudy() || selection) { + if(!mySettings_AddInStudy || selection) { QString Name = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), anIO->getName()); if(!Name.isEmpty()) { // VTK - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) GActor->setName(strdup(Name.latin1())); // OCC - else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) GAISShape->setName(strdup(Name.latin1())); } else @@ -324,7 +683,7 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject) } // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); op->start(); SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(father); @@ -364,12 +723,12 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject) aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); // VTK - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { GActor->setIO(GIO); aName->SetValue(GActor->getName()); } // OCC - else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { GAISShape->setIO(GIO); aName->SetValue(GAISShape->getName()); } @@ -405,10 +764,10 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject) } op->finish(); - if(!myGeomGUI->GetSettings_AddInStudy() || selection) - myGeomGUI->GetActiveStudy()->updateObjBrowser(); + if(!mySettings_AddInStudy || selection) + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); else { - myGeomGUI->GetActiveStudy()->updateObjBrowser(false); + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(false); Sel->AddIObject(GIO); } return true; @@ -491,7 +850,7 @@ bool GEOMBase::GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds) Handle(SALOME_InteractiveObject) IO = Sel->firstIObject(); /* case SObject */ if(IO->hasEntry()) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeIOR_var anIOR; @@ -642,6 +1001,101 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& } +//======================================================================= +// function : ConvertIORinGEOMAISShape() +// purpose : +//======================================================================= +Handle(GEOM_AISShape) GEOMBase::ConvertIORinGEOMAISShape(const char * IOR, Standard_Boolean& testResult, bool onlyInActiveView) +{ + Handle(GEOM_AISShape) resultShape; + testResult = false; + int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); + for(int i = 0; i < nbSf; i++) { + QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); + if(sf->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + AIS_ListOfInteractive List; + ic->DisplayedObjects(List); + AIS_ListOfInteractive List1; + ic->ObjectsInCollector(List1); + List.Append(List1); + + AIS_ListIteratorOfListOfInteractive ite(List); + while(ite.More()) { + if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + if(aSh->hasIO()) { + Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); + Standard_CString theIOR = GIO->getIOR(); + if(strcmp(IOR, theIOR) == 0) { + if(onlyInActiveView) { + if(sf == QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()) { + testResult = true; + resultShape = aSh; + return resultShape; + } + } + else { + testResult = true; + resultShape = aSh; + return resultShape; + } + } + } + } + ite.Next(); + } + } + } + return resultShape; +} + + +//======================================================================= +// function : ConvertIORinGEOMActor() +// purpose : +//======================================================================= +GEOM_Actor* GEOMBase::ConvertIORinGEOMActor(const char* IOR, Standard_Boolean& testResult, bool onlyInActiveView) +{ + int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); + for(int i = 0; i < nbSf; i++) { + QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); + if(sf->getTypeView() == VIEW_VTK) { + vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* theActors = Renderer->GetActors(); + theActors->InitTraversal(); + vtkActor *ac = theActors->GetNextActor(); + while(!(ac==NULL)) { + if( ac->IsA("GEOM_Actor")) { + GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(ac); + if(anActor->hasIO()) { + Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(anActor->getIO()); + Standard_CString theIOR = GIO->getIOR(); + if(strcmp(IOR, theIOR) == 0) { + if(onlyInActiveView) { + if(sf == QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()) { + testResult = true; + return anActor; + } + } + else { + testResult = true; + return anActor; + } + } + } + } + ac = theActors->GetNextActor(); + } + } + } + testResult = false; + return GEOM_Actor::New(); +} + + //======================================================================= // function : ConvertIOinGEOMAISShape() // purpose : @@ -649,9 +1103,9 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult, bool onlyInActiveView) { Handle(GEOM_AISShape) res; - int nbSf = myGeomGUI->GetActiveStudy()->getStudyFramesCount(); + int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); for(int i = 0; i < nbSf; i++) { - QAD_StudyFrame* sf = myGeomGUI->GetActiveStudy()->getStudyFrame(i); + QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); if(sf->getTypeView() == VIEW_OCC) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); @@ -670,7 +1124,7 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_Inte Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); if(GIO->isSame(IO)) { if(onlyInActiveView) { - if(sf == myGeomGUI->GetActiveStudy()->getActiveStudyFrame()) { + if(sf == QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()) { testResult = true; return aSh; } @@ -702,7 +1156,7 @@ GEOM::GEOM_Shape_ptr GEOMBase::ConvertIOinGEOMShape(const Handle(SALOME_Interact /* case SObject */ if(IO->hasEntry()) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeIOR_var anIOR; @@ -740,7 +1194,7 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM for(int i=0; It.More(); It.Next(), i++) { Handle(SALOME_InteractiveObject) IObject = It.Value(); if(IObject->hasEntry()) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry()); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeIOR_var anIOR; @@ -771,17 +1225,17 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM // function : SetDisplayedObjectList() // purpose : //================================================================================ -void GEOMBase::SetDisplayedObjectList() -{ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) - return; +// void GEOMBase::SetDisplayedObjectList() +// { +// if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) +// return; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myGeomGUI->GetListDisplayedObject().Clear(); +// OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); +// myGeomGUI->GetListDisplayedObject().Clear(); - Handle (AIS_InteractiveContext) aContext = v3d->getAISContext(); - aContext->DisplayedObjects(myGeomGUI->GetListDisplayedObject()); -} +// Handle (AIS_InteractiveContext) aContext = v3d->getAISContext(); +// aContext->DisplayedObjects(myGeomGUI->GetListDisplayedObject()); +// } //===================================================================================== @@ -794,26 +1248,26 @@ void GEOMBase::DisplaySimulationShape(const TopoDS_Shape& S) return; //NRI DEBUG : 14/02/2002 - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); try { /* erase any previous */ - ic->Erase(myGeomGUI->mySimulationShape, Standard_True, Standard_False); - ic->ClearPrs(myGeomGUI->mySimulationShape); - myGeomGUI->mySimulationShape = new AIS_Shape(TopoDS_Shape()); - myGeomGUI->mySimulationShape->Set(S); - myGeomGUI->mySimulationShape->SetColor(Quantity_NOC_VIOLET); - ic->Deactivate(myGeomGUI->mySimulationShape); - ic->Display(myGeomGUI->mySimulationShape, Standard_False); + ic->Erase(mySimulationShape, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape); + mySimulationShape = new AIS_Shape(TopoDS_Shape()); + mySimulationShape->Set(S); + mySimulationShape->SetColor(Quantity_NOC_VIOLET); + ic->Deactivate(mySimulationShape); + ic->Display(mySimulationShape, Standard_False); ic->UpdateCurrentViewer(); } catch(Standard_Failure) { MESSAGE("Exception catched in GEOMBase::DisplaySimulationShape "); } - myGeomGUI->mySimulationShape->UnsetColor(); + mySimulationShape->UnsetColor(); return; } @@ -824,13 +1278,13 @@ void GEOMBase::DisplaySimulationShape(const TopoDS_Shape& S) //================================================================================== void GEOMBase::EraseSimulationShape() { - int count = myGeomGUI->GetActiveStudy()->getStudyFramesCount(); + int count = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); for(int i = 0; i < count; i++) { - if(myGeomGUI->GetActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - ic->Erase(myGeomGUI->mySimulationShape, Standard_True, Standard_False); - ic->ClearPrs(myGeomGUI->mySimulationShape); + ic->Erase(mySimulationShape, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape); ic->UpdateCurrentViewer(); } } @@ -844,10 +1298,10 @@ void GEOMBase::EraseSimulationShape() //================================================================================= bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone) { - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC || tds.ShapeType() != TopAbs_EDGE) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC || tds.ShapeType() != TopAbs_EDGE) return false; - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort(); + OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort(); Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)vp)->getView(); Standard_Real Width, Height; view3d->Size(Width, Height); @@ -972,7 +1426,7 @@ double GEOMBase::Parameter(Standard_Boolean& res, const char* aValue1, const cha bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectUserName, SALOME_Selection* Sel) { /* Find SObject with name in component GEOM */ - SALOMEDS::Study_var ST = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var ST = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::Study::ListOfSObject_var listSO = new SALOMEDS::Study::ListOfSObject; listSO = ST->FindObjectByName(objectUserName, "GEOM"); @@ -1018,3 +1472,14 @@ bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y) y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10); return true; } + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext, + const QString & theParent, const QString & theObject) + {return GEOMBase::CustomPopup(parent, popup, theContext, theParent, theObject);} +} diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h index 70040df31..db3bb1daa 100644 --- a/src/GEOMBase/GEOMBase.h +++ b/src/GEOMBase/GEOMBase.h @@ -30,7 +30,21 @@ #define GEOMBASE_H #include "GEOMContext.h" + +// SALOME Includes +#include "QAD_Config.h" #include "SALOME_Selection.h" +#include "GEOM_Actor.h" +#include "GEOM_AISShape.hxx" +#include "GEOM_InteractiveObject.hxx" + +// Open CASCADE Includes +#include + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) //================================================================================= // class : GEOMBase @@ -44,6 +58,9 @@ public : GEOMBase(); ~GEOMBase(); + static bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, + const QString& theParent, const QString& theObject); + bool Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name = ""); bool AddInStudy(bool selection = false, const Handle(SALOME_InteractiveObject)& anIO = 0); @@ -63,6 +80,12 @@ public : void ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM_Gen::ListOfIOR& listIOR); + Handle(GEOM_AISShape) ConvertIORinGEOMAISShape(const char * IOR, + Standard_Boolean& testResult, + bool onlyInActiveView = false); + GEOM_Actor* ConvertIORinGEOMActor(const char * IOR, Standard_Boolean& testResult, + bool onlyInActiveView = false); + /* Geometry */ bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P); @@ -76,7 +99,7 @@ public : const char* aTitle = 0, const double bottom = -1E6, const double top = +1E6, const int decimals = 6); - void SetDisplayedObjectList(); + //void SetDisplayedObjectList(); /* Simulation management */ bool CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone); @@ -90,6 +113,10 @@ public : GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + Quantity_Color myShadingColor; + Handle(AIS_Shape) mySimulationShape; /* AIS shape used only during topo/geom simulations */ + bool mySettings_AddInStudy; + }; #endif diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index c4b3297b9..85b4f326f 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -107,7 +107,7 @@ void GEOMBase_Skeleton::ClickOnCancel() mySelection->ClearFilters(); disconnect(mySelection, 0, this, 0); - myGeomGUI->ResetState(); + //myGeomGUI->ResetState(); reject(); return; @@ -140,7 +140,7 @@ void GEOMBase_Skeleton::DeactivateActiveDialog() { this->setEnabled(false); mySelection->ClearFilters(); - myGeomGUI->ResetState(); + //myGeomGUI->ResetState(); disconnect(mySelection, 0, this, 0); myGeomBase->EraseSimulationShape(); myGeomGUI->SetActiveDialogBox(0); diff --git a/src/GEOMBase/Makefile.in b/src/GEOMBase/Makefile.in index 69defe499..42082e5fe 100644 --- a/src/GEOMBase/Makefile.in +++ b/src/GEOMBase/Makefile.in @@ -39,35 +39,28 @@ LIB = libGEOMBase.la # header files EXPORT_HEADERS= GEOMBase.h \ - GEOMBase_Sketcher.h \ GEOMBase_Skeleton.h LIB_SRC = GEOMBase.cxx \ GEOMBase_Skeleton.cxx \ - GEOMBase_Sketcher.cxx \ GEOMBase_aParameterDlg.cxx LIB_MOC = \ GEOMBase.h \ GEOMBase_Skeleton.h \ - GEOMBase_Sketcher.h \ GEOMBase_aParameterDlg.h LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ + SALOMEDS_Attributes.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lGEOMSketcher -lDlgRef -lGEOMContext -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lDlgRef -lGEOMContext @CONCLUDE@ diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 1f3f61d4f..853ab3e2b 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -35,16 +35,12 @@ using namespace std; // SALOME Includes #include "QAD_RightFrame.h" -#include "QAD_Resource.h" #include "QAD_Config.h" -#include "OCCViewer_ViewPort.h" -#include "OCCViewer_ViewPort3d.h" #include "OCCViewer_Viewer3d.h" #include "VTKViewer_ViewFrame.h" #include "SALOME_Selection.h" -#include "SALOME_ListIteratorOfListIO.hxx" /* The object itself created in the static method 'GetOrCreateGEOMBase()' */ static GEOMContext* GeomGUI = 0; @@ -52,36 +48,8 @@ static GEOMContext* GeomGUI = 0; typedef bool OGE(int, QAD_Desktop*); typedef bool OMP(QMouseEvent*, QAD_Desktop*, QAD_StudyFrame*); typedef void BP(const Handle(SALOME_InteractiveObject)&); - -//================================================================================= -// class : CustomItem -// purpose : Set Font to a text. -//================================================================================= -class CustomItem : public QCustomMenuItem -{ -public: - CustomItem(const QString& s, const QFont& f) - :string(s), font(f){}; - ~CustomItem(){} - - void paint(QPainter* p, const QColorGroup& /*cg*/, bool /*act*/, - bool /*enabled*/, int x, int y, int w, int h) - { - p->setFont(font); - p->drawText(x, y, w, h, AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string); - } - - QSize sizeHint() - { - return QFontMetrics(font).size(AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string); - } - -private: - QString string; - QFont font; - -}; - +typedef bool CP(QAD_Desktop*, QPopupMenu*, const QString&, + const QString&, const QString&); //======================================================================= // function : GeometryGUI() @@ -122,28 +90,23 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { GeometryGUI::GetOrCreateGeometryGUI(parent); - QMenuBar* Mb = GeomGUI->GetDesktop()->getMainMenuBar(); + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); bool ViewOCC; - if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) ViewOCC = true; - else if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) ViewOCC = false; else return false; - Mb->setItemEnabled(404, ViewOCC);//Sketch - Mb->setItemEnabled(405, ViewOCC);//Sketch - Mb->setItemEnabled(406, ViewOCC);//Sketch + Mb->setItemEnabled(404, ViewOCC);//SKETCHER Mb->setItemEnabled(603, ViewOCC);//SuppressFace Mb->setItemEnabled(604, ViewOCC);//SuppressHole Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings Mb->setItemEnabled(414, ViewOCC);// Isos Settings - - if (GeomGUI->GetState() == CURRENT_SKETCH && theCommandID != 404 && theCommandID != 4041 && theCommandID != 4042 && theCommandID != 4043 && theCommandID != 4044 && theCommandID != 4045 && theCommandID != 4046 && theCommandID != 4047 && theCommandID != 4048 && theCommandID != 4051 && theCommandID != 4052 && theCommandID != 4053 && theCommandID != 4061 && theCommandID != 4062 && theCommandID != 4063 && theCommandID != 4064 && theCommandID != 4065) - return false; if(theCommandID == 111 || // MENU FILE - IMPORT BREP theCommandID == 112 || // MENU FILE - IMPORT IGES @@ -153,11 +116,10 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) theCommandID == 123 || // MENU FILE - EXPORT STEP theCommandID == 31 || // MENU EDIT - COPY theCommandID == 33 || // MENU EDIT - DELETE - theCommandID == 411 || // MENU SETTINGS - COPY - theCommandID == 412 || // MENU SETTINGS - ADD IN STUDY - theCommandID == 413 || // MENU SETTINGS - SHADING COLOR - theCommandID == 414 || // MENU SETTINGS - ISOS - theCommandID == 415 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES + 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 == 8032 || // POPUP VIEWER - COLOR theCommandID == 8033 || // POPUP VIEWER - TRANSPARENCY @@ -177,27 +139,6 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) if(!GeomGUI->LoadLibrary("libDisplayGUI.so")) return false; } - else if(theCommandID == 404 || // SKETCHER - 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 - // GEOMBase_Sketcher* mySketcherGUI = new GEOMBase_Sketcher(); - // mySketcherGUI->OnGUIEvent(theCommandID, parent); - return true; - } else if(theCommandID == 4011 || // MENU BASIC - POINT theCommandID == 4012 || // MENU BASIC - LINE theCommandID == 4013 || // MENU BASIC - CIRCLE @@ -224,6 +165,10 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) if(!GeomGUI->LoadLibrary("libGenerationGUI.so")) return false; } + else if(theCommandID == 404) { // SKETCHER + if(!GeomGUI->LoadLibrary("libSketcherGUI.so")) + return false; + } else if(theCommandID == 407 || // MENU BUILD - EXPLODE theCommandID == 4081 || // MENU BUILD - EDGE theCommandID == 4082 || // MENU BUILD - WIRE @@ -300,8 +245,24 @@ bool GeometryGUI::OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* { GeometryGUI::GetOrCreateGeometryGUI(parent); - if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + else + return true; +} + + +//================================================================================= +// function : OnMouseMove() +// purpose : [static] manage mouse events +//================================================================================= +bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) +{ + GeometryGUI::GetOrCreateGeometryGUI(parent); + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; + else return true; } @@ -314,19 +275,10 @@ bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFr { GeometryGUI::GetOrCreateGeometryGUI(parent); - if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - if(GeomGUI->GetState() == CURRENT_SKETCH) { - GeomGUI->GetSketcher().ValidateEdge(); - if(GeomGUI->GetSketcher().GetmyEdgesNumber() == 1) { - QMenuBar* Mb = GeomGUI->GetDesktop()->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(405, &pp); - pp->setItemEnabled(405, true); // SKETCH CONTRAINTS - } - } - else if(GeomGUI->GetState() == POINT_METHOD) { + if(GeomGUI->myState == 0) { if(!GeomGUI->LoadLibrary("libBasicGUI.so")) return false; @@ -343,28 +295,6 @@ bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFr } -//================================================================================= -// function : OnMouseMove() -// purpose : [static] manage mouse events -//================================================================================= -bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) -{ - GeometryGUI::GetOrCreateGeometryGUI(parent); - - if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) - return false; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort(); - - if(GeomGUI->GetState() == CURRENT_SKETCH) - GeomGUI->GetSketcher().MakeCurrentEdge(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView()); - - return true; -} - - //================================================================================= // function : SetSettings() // purpose : [static] @@ -372,51 +302,44 @@ bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFra bool GeometryGUI::SetSettings(QAD_Desktop* parent) { GeometryGUI::GetOrCreateGeometryGUI(parent); - - /* Shading Color */ - QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed"); - QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen"); - QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue"); - if(!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty()) - GeomGUI->GetShadingColor() = Quantity_Color (SCr.toInt()/255., SCg.toInt()/255., SCb.toInt()/255., Quantity_TOC_RGB); + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); + QAD_Study* ActiveStudy = parent->getActiveStudy(); /* Wireframe or Shading */ int DisplayMode = 0; - if(parent->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)parent->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); DisplayMode = ic->DisplayMode(); } - else if(parent->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)parent->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + else if(ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); DisplayMode = myRenderInter->GetDisplayMode(); } if(DisplayMode == 1) - parent->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME")); + Mb->changeItem(211, tr("GEOM_MEN_WIREFRAME")); else - parent->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING")); + Mb->changeItem(211, tr("GEOM_MEN_SHADING")); - QMenuData* pp; - if(parent->menuBar()->findItem(411, &pp)) - pp->removeItem(411); /* Add in Study */ QString AddInStudy = QAD_CONFIG->getSetting("Geometry:SettingsAddInStudy"); + int Settings_AddInStudy; if(!AddInStudy.isEmpty()) - GeomGUI->GetSettings_AddInStudy() = AddInStudy.toInt(); + Settings_AddInStudy = AddInStudy.toInt(); else - GeomGUI->GetSettings_AddInStudy() = 1; - parent->menuBar()->findItem(412, &pp); - pp->setItemChecked(412, GeomGUI->GetSettings_AddInStudy()); + Settings_AddInStudy = 1; + Mb->setItemChecked(411, Settings_AddInStudy); + /* step value */ QString S = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); if(S.isEmpty()) QAD_CONFIG->addSetting("Geometry:SettingsGeomStep", "100"); - + + /* isos */ - QAD_Study* ActiveStudy = parent->getActiveStudy(); int count = ActiveStudy->getStudyFramesCount(); bool ViewOCC = false; @@ -436,11 +359,7 @@ bool GeometryGUI::SetSettings(QAD_Desktop* parent) } } - QMenuBar* Mb = GeomGUI->GetDesktop()->getMainMenuBar(); - - Mb->setItemEnabled(404, ViewOCC);//Sketch - Mb->setItemEnabled(405, ViewOCC);//Sketch - Mb->setItemEnabled(406, ViewOCC);//Sketch + Mb->setItemEnabled(404, ViewOCC);//SKETCHER Mb->setItemEnabled(603, ViewOCC);//SuppressFace Mb->setItemEnabled(604, ViewOCC);//SuppressHole @@ -460,13 +379,20 @@ void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString { GeometryGUI::GetOrCreateGeometryGUI(QAD_Application::getDesktop()); - SALOME_Selection* Sel = SALOME_Selection::Selection(GeomGUI->GetActiveStudy()->getSelection()); + QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy(); + SALOME_Selection* Sel = SALOME_Selection::Selection(ActiveStudy->getSelection()); theObject = ""; + theContext = ""; + + if((theParent.compare("Viewer") == 0)) { + if(Sel->IObjectCount() == 0) + theContext = "NothingSelected"; + } if(Sel->IObjectCount() == 1) { Handle(SALOME_InteractiveObject) IO = Sel->firstIObject(); if(IO->hasEntry()) { - SALOMEDS::SObject_var sobj = GeomGUI->GetActiveStudy()->getStudyDocument()->FindObjectID(IO->getEntry()); + SALOMEDS::SObject_var sobj = ActiveStudy->getStudyDocument()->FindObjectID(IO->getEntry()); if(!sobj->_is_nil()) { SALOMEDS::SComponent_var scomp = sobj->GetFatherComponent(); if(strcmp(scomp->GetID(), IO->getEntry()) == 0) { @@ -477,19 +403,6 @@ void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString } } - if((theParent.compare("Viewer")==0)) { - if(GeomGUI->GetState() == CURRENT_SKETCH) - theContext = "Sketch"; - else { - if(Sel->IObjectCount() > 0) - theContext = ""; - else - theContext = "NothingSelected"; - } - } - else - theContext = ""; - return; } @@ -500,325 +413,24 @@ void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString //================================================================================= bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, const QString& theParent, const QString& theObject) -{ +{ GeometryGUI::GetOrCreateGeometryGUI(parent); - /* Deactivate any non modal dialog box to get the neutral point */ - GeomGUI->EmitSignalDeactivateDialog(); - - Engines::Component_var comp = GeomGUI->GetDesktop()->getEngine("FactoryServer", "GEOM"); - GEOM::GEOM_Gen_var myComponentGeom = GEOM::GEOM_Gen::_narrow(comp); - - SALOME_Selection* Sel = SALOME_Selection::Selection(GeomGUI->GetActiveStudy()->getSelection()); - int nbSel = Sel->IObjectCount(); - - if((nbSel == 0) && (theContext.compare("Sketch")!=0)) + if(!GeomGUI->LoadLibrary("libGEOMBase.so")) return false; - if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - 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; - } - else if(theObject.compare("Component") == 0) { - popup->removeItem(QAD_DisplayOnly_Popup_ID); - return true; - } - else { - QFont f = QApplication::font(); - f.setBold( TRUE ); - if(nbSel==1) { - Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); - popup->removeItem(QAD_TopLabel_Popup_ID); - popup->insertItem(new CustomItem (QString(IObject->getName()), f), QAD_TopLabel_Popup_ID, 0); - if(IObject->hasEntry()) - popup->setItemEnabled(804, false); //Add in Study Menu - else - popup->setItemEnabled(804, true); //Add in Study Menu - -// if(IObject->IsKind(STANDARD_TYPE(GEOM_InteractiveObject))) { -// Standard_Boolean found; -// Handle(GEOM_AISShape) Result = GeomGUI->ConvertIOinGEOMAISShape(IObject, found, true); - -// if(found) { -// if(Result->DisplayMode() == 1) -// popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu -// else -// popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu -// } -// } - - if(!(v3d->isInViewer(IObject) && v3d->isVisible(IObject))) - popup->removeItem(QAD_Erase_Popup_ID); - else - popup->removeItem(QAD_Display_Popup_ID); - } - else { - popup->removeItem(QAD_DisplayOnly_Popup_ID); - popup->removeItem(QAD_TopLabel_Popup_ID); - popup->insertItem(new CustomItem (tr("GEOM_MEN_POPUP_NAME").arg(nbSel), f), QAD_TopLabel_Popup_ID, 0); - popup->setItemEnabled(804, false); //Add in Study Menu - } - } - return true; - } - else if(theParent.compare("ObjectBrowser")==0) { - popup->removeItem(QAD_TopLabel_Popup_ID); - int id = popup->idAt(0); // separator - if(id < 0) - popup->removeItem(id); - - // checking for GEOM label in the selected list - SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); - Handle(SALOME_InteractiveObject) anIObject; - - bool useSubItems = false; - bool needOpen = false; - bool needDisplay = false; - bool needErase = false; - SALOMEDS::GenericAttribute_var aTmpAttr; - for(;It.More();It.Next()) { - anIObject = It.Value(); - if(!anIObject->hasEntry()) - continue; - - if(v3d->isInViewer(anIObject) && v3d->isVisible(anIObject)) - needErase = true; - else - needDisplay = true; - SALOMEDS::SObject_var obj = GeomGUI->GetActiveStudy()->getStudyDocument()->FindObjectID(anIObject->getEntry()); - if(!obj->_is_nil()) { - GEOM::GEOM_Shape_var aShape; - if(obj->FindAttribute(aTmpAttr, "AttributeIOR")) { - char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value(); - if(str && strlen(str)) - aShape = myComponentGeom->GetIORFromString(str); - } - else if(obj->FindAttribute(aTmpAttr, "AttributePersistentRef")) - needOpen = true; - - if(aShape->_is_nil()) { - SALOMEDS::ChildIterator_var anIter = GeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); - while(anIter->More()) { - SALOMEDS::SObject_var subobj = anIter->Value(); - if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { - useSubItems = true; - needErase = true; - needDisplay = true; - } - else if(subobj->FindAttribute(aTmpAttr, "AttributePersistentRef")) { - needOpen = true; - useSubItems = true; - } - anIter->Next(); - } - } - } - } - // remove useless popup items - if(nbSel != 1) - popup->removeItem(901); // rename - if(useSubItems) - popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only - - if(!needOpen) { - int index = popup->indexOf(9024); // open - popup->removeItem(9024); - popup->removeItemAt(index); // separator under Open - - if (!needDisplay) - popup->removeItem(QAD_Display_Popup_ID); - if (!needErase) - popup->removeItem(QAD_Erase_Popup_ID); - - if(!needDisplay && !needErase) { - int id = popup->idAt(popup->count()-1); // last item - popup->removeItem(id); // separator - } - } - else { - popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only - popup->removeItem(QAD_Display_Popup_ID); - popup->removeItem(QAD_Erase_Popup_ID); - if (nbSel!=1) { - int id = popup->idAt(popup->count()-1); // last item - popup->removeItem(id); // separator - } - } - return true; - } + //Load Function BuildPresentation + OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("CustomPopup"); + CP (*f1) = NULL; + if(osdF != NULL) { + f1 = (bool (*) (QAD_Desktop*, QPopupMenu*, const QString&, + const QString&, const QString&)) osdF; + (*f1)(parent, popup, theContext, theParent, theObject); } - else if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - // MESSAGE ( " CUSTOM POPUP VIEWER VTK ") - if((theParent.compare("Viewer")==0)) { - popup->setItemEnabled(8034, false); //Isos Menu - if(theObject.compare("Component") == 0) { - popup->removeItem(QAD_DisplayOnly_Popup_ID); - return true; - } - - //int id = popup->idAt(0); - QFont f = QApplication::font(); - f.setBold( TRUE ); - - if(nbSel==1) { - Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); - popup->removeItem(QAD_TopLabel_Popup_ID); - popup->insertItem(new CustomItem (QString(IObject->getName()), f), QAD_TopLabel_Popup_ID, 0); - if(IObject->hasEntry()) { - popup->setItemEnabled(804, false); //Add in Study Menu - SALOMEDS::Study_var aStudy = GeomGUI->GetActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var SO = aStudy->FindObjectID(IObject->getEntry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; -// if(!SO->_is_nil()) { -// if(SO->FindAttribute(anAttr, "AttributeIOR")) { -// anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); -// Standard_Boolean found; -// GEOM_Actor* Result = GeomGUI->ConvertIORinGEOMActor(anIOR->Value(), found, true); -// if(found) { -// if(Result->getDisplayMode() == 1) -// popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu -// else -// popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu - -// if(!Result->GetVisibility()) -// popup->removeItem(QAD_Erase_Popup_ID); -// else -// popup->removeItem(QAD_Display_Popup_ID); -// } -// else -// popup->removeItem(QAD_Erase_Popup_ID); -// } -// } - } - else - popup->setItemEnabled(804, true); //Add in Study Menu - } - else { - popup->removeItem(QAD_DisplayOnly_Popup_ID); - popup->removeItem(QAD_TopLabel_Popup_ID); - popup->insertItem( new CustomItem (tr("GEOM_MEN_POPUP_NAME").arg(nbSel), f), QAD_TopLabel_Popup_ID, 0); - popup->setItemEnabled(804, false); //Add in Study Menu - } - return true; - } - else if(theParent.compare("ObjectBrowser")==0) { - popup->removeItem(QAD_TopLabel_Popup_ID); - int id = popup->idAt(0); // separator - if(id < 0) - popup->removeItem(id); - - // checking for GEOM label in the selected list - SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); - Handle(SALOME_InteractiveObject) anIObject; - - bool useSubItems = false; - bool needOpen = false; - bool needDisplay = false; - bool needErase = false; - SALOMEDS::GenericAttribute_var aTmpAttr; - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - for(;It.More();It.Next()) { - anIObject = It.Value(); - if(!anIObject->hasEntry()) - continue; - - if(myRenderInter->isInViewer(anIObject) && myRenderInter->isVisible(anIObject)) - needErase = true; - else - needDisplay = true; - - SALOMEDS::SObject_var obj = GeomGUI->GetActiveStudy()->getStudyDocument()->FindObjectID( anIObject->getEntry()); - if(!obj->_is_nil()) { - GEOM::GEOM_Shape_var aShape; - if(obj->FindAttribute(aTmpAttr, "AttributeIOR")) { - char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value(); - if(str && strlen(str)) - aShape = myComponentGeom->GetIORFromString(str); - } - else if(obj->FindAttribute(aTmpAttr, "AttributePersistentRef")) - needOpen = true; - - if(aShape->_is_nil()) { - SALOMEDS::ChildIterator_var anIter = GeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); - while(anIter->More()) { - SALOMEDS::SObject_var subobj = anIter->Value(); - if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { - useSubItems = true; - needDisplay = true; - needErase = true; - } - else if(subobj->FindAttribute(aTmpAttr, "AttributePersistentRef")) { - needOpen = true; - useSubItems = true; - } - anIter->Next(); - } - } - } - } - // remove useless popup items - if(nbSel != 1) - popup->removeItem(901); // rename - if(useSubItems) - popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only - - if(!needOpen) { - int index = popup->indexOf(9024); // open - popup->removeItem(9024); - popup->removeItemAt(index); // separator under Open - - if(!needDisplay) - popup->removeItem(QAD_Display_Popup_ID); - if(!needErase) - popup->removeItem(QAD_Erase_Popup_ID); - if(!needDisplay && !needErase) { - int id = popup->idAt(popup->count()-1); // last item - popup->removeItem(id); // separator - } - } - else { - popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only - popup->removeItem(QAD_Display_Popup_ID); - popup->removeItem(QAD_Erase_Popup_ID); - if(nbSel!=1) { - int id = popup->idAt(popup->count()-1); // last item - popup->removeItem(id); // separator - } - } - return true; - } - } - else { // other viewer types not supported. - while(1) { - int id = popup->idAt(0); - if(id <= QAD_TopLabel_Popup_ID && id != -1) - popup->removeItemAt(0); - else - break; - } - popup->removeItem(QAD_DisplayOnly_Popup_ID); - popup->removeItem(QAD_Display_Popup_ID); - popup->removeItem(QAD_Erase_Popup_ID); - int id = popup->idAt(popup->count()-1); // last item - if(id < 0 && id != -1) - popup->removeItem(id); // separator + else return false; - } - return false; + + return true; } @@ -831,19 +443,12 @@ void GeometryGUI::activeStudyChanged(QAD_Desktop* parent) GeometryGUI::GetOrCreateGeometryGUI(parent); if(GeomGUI != 0) { - if(GeomGUI->GetState() == CURRENT_SKETCH) { - GeomGUI->GetSketcher().Clear(); - GeomGUI->ResetState(); - } - - QMenuBar* Mb = GeomGUI->GetDesktop()->getMainMenuBar(); + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); bool ViewOCC = false; - if(GeomGUI->GetDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) ViewOCC = true; - Mb->setItemEnabled(404, ViewOCC);//Sketch - Mb->setItemEnabled(405, ViewOCC);//Sketch - Mb->setItemEnabled(406, ViewOCC);//Sketch + Mb->setItemEnabled(404, ViewOCC);//SKETCHER Mb->setItemEnabled(603, ViewOCC);//SuppressFace Mb->setItemEnabled(604, ViewOCC);//SuppressHole @@ -851,7 +456,6 @@ void GeometryGUI::activeStudyChanged(QAD_Desktop* parent) Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings Mb->setItemEnabled(414, ViewOCC);// Isos Settings - //GeomGUI->EraseSimulationShape(); GeomGUI->EmitSignalCloseAllDialogs(); GeomGUI = 0; } @@ -877,8 +481,6 @@ void GeometryGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theI f1 = (void (*) (const Handle(SALOME_InteractiveObject)&)) osdF; (*f1)(theIO); } - else - return; return; } diff --git a/src/GEOMGUI/Makefile.in b/src/GEOMGUI/Makefile.in index a1330313c..9576c2d35 100644 --- a/src/GEOMGUI/Makefile.in +++ b/src/GEOMGUI/Makefile.in @@ -47,20 +47,16 @@ LIB_MOC = \ GeometryGUI.h \ LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ + SALOMEDS_Attributes.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMSketcher -lGEOMContext -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lGEOMContext @CONCLUDE@ diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index cc9e680e8..ccef0fed6 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -83,9 +83,9 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { GEOMToolsGUI* myGEOMToolsGUI = new GEOMToolsGUI(); myGEOMToolsGUI->myGeomGUI->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); - SALOMEDS::Study_var aStudy = myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); switch (theCommandID) { case 31: // COPY @@ -100,74 +100,51 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } case 111: // IMPORT BREP { - myGEOMToolsGUI->myGeomGUI->SetState(111); - myGEOMToolsGUI->Import(); - myGEOMToolsGUI->myGeomGUI->ResetState(); + myGEOMToolsGUI->Import(theCommandID); break; } case 112: // IMPORT IGES { - myGEOMToolsGUI->myGeomGUI->SetState(112); - myGEOMToolsGUI->Import(); - myGEOMToolsGUI->myGeomGUI->ResetState(); + myGEOMToolsGUI->Import(theCommandID); break; } case 113: // IMPORT STEP { - myGEOMToolsGUI->myGeomGUI->SetState(113); - myGEOMToolsGUI->Import(); - myGEOMToolsGUI->myGeomGUI->ResetState(); + myGEOMToolsGUI->Import(theCommandID); break; } case 121: // EXPORT BREP { - myGEOMToolsGUI->myGeomGUI->SetState(121); - myGEOMToolsGUI->Export(); - myGEOMToolsGUI->myGeomGUI->ResetState(); + myGEOMToolsGUI->Export(theCommandID); break; } case 122: // EXPORT IGES { - myGEOMToolsGUI->myGeomGUI->SetState(122); - myGEOMToolsGUI->Export(); - myGEOMToolsGUI->myGeomGUI->ResetState(); + myGEOMToolsGUI->Export(theCommandID); break; } case 123: // EXPORT STEP { - myGEOMToolsGUI->myGeomGUI->SetState(123); - myGEOMToolsGUI->Export(); - myGEOMToolsGUI->myGeomGUI->ResetState(); + myGEOMToolsGUI->Export(theCommandID); break; } - case 411: // SETTINGS - COPY + case 411: // SETTINGS - ADD IN STUDY { - QMenuBar* Mb = myGEOMToolsGUI->myGeomGUI->GetDesktop()->getMainMenuBar(); + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); QMenuData* pp; QMenuItem* item = parent->menuBar()->findItem(411, &pp); bool check = !pp->isItemChecked(411); - pp->setItemChecked(411, check); - myGEOMToolsGUI->myGeomGUI->GetSettings_Copy() = check; - QAD_CONFIG->addSetting("Geometry:SettingsCopy", myGEOMToolsGUI->myGeomGUI->GetSettings_Copy()); + pp->setItemChecked(411,check); + //myGEOMToolsGUI->myGeomGUI->GetSettings_AddInStudy() = check; + QAD_CONFIG->addSetting("Geometry:SettingsAddInStudy", check); break; } - case 412: // SETTINGS - ADD IN STUDY + case 412: // SETTINGS - SHADING COLOR { - QMenuBar* Mb = myGEOMToolsGUI->myGeomGUI->GetDesktop()->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = parent->menuBar()->findItem(412, &pp); - bool check = !pp->isItemChecked(412); - pp->setItemChecked(412,check); - myGEOMToolsGUI->myGeomGUI->GetSettings_AddInStudy() = check; - QAD_CONFIG->addSetting("Geometry:SettingsAddInStudy", myGEOMToolsGUI->myGeomGUI->GetSettings_AddInStudy()); - break; - } - case 413: // SETTINGS - SHADING COLOR - { - if(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) break; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed"); @@ -182,9 +159,9 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) color = QColor ((int)Default.Red() * 255.0, (int)Default.Green()* 255.0, (int)Default.Blue() * 255.0); } - QColor c = QColorDialog::getColor(color, myGEOMToolsGUI->myGeomGUI->GetDesktop()); + QColor c = QColorDialog::getColor(color, QAD_Application::getDesktop()); if(c.isValid()) { - myGEOMToolsGUI->myGeomGUI->GetShadingColor() = Quantity_Color(c.red() / 255.0, c.green() / 255.0, c.blue() / 255.0, Quantity_TOC_RGB); + //myGEOMToolsGUI->myGeomGUI->GetShadingColor() = Quantity_Color(c.red() / 255.0, c.green() / 255.0, c.blue() / 255.0, Quantity_TOC_RGB); AIS_ListOfInteractive List; ic->DisplayedObjects(List); @@ -196,7 +173,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) while(ite.More()) { if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); - aSh->SetShadingColor(myGEOMToolsGUI->myGeomGUI->GetShadingColor()); + aSh->SetShadingColor(Quantity_Color(c.red() / 255.0, c.green() / 255.0, c.blue() / 255.0, Quantity_TOC_RGB)); ic->Redisplay(aSh, Standard_True, Standard_True); } ite.Next(); @@ -210,12 +187,12 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } break; } - case 414: // SETTINGS - ISOS + case 413: // SETTINGS - ISOS { - if(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) break; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU"); @@ -229,7 +206,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) else IsoV = "1"; - GEOMBase_NbIsosDlg* NbIsosDlg = new GEOMBase_NbIsosDlg(myGEOMToolsGUI->myGeomGUI->GetDesktop(), tr("GEOM_MEN_ISOS"), TRUE); + GEOMBase_NbIsosDlg* NbIsosDlg = new GEOMBase_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE); int UIso = IsoU.toInt(); int VIso = IsoV.toInt(); @@ -270,7 +247,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) ic->UpdateCurrentViewer(); break; } - case 415: // SETTINGS : STEP VALUE FOR SPIN BOXES + case 414: // SETTINGS : STEP VALUE FOR SPIN BOXES { QString step = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); if(step.isEmpty()) @@ -314,10 +291,10 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) aName = SALOMEDS::AttributeName::_narrow(anAttr); QString nm = QString(aName->Value()); - nm = SALOMEGUI_NameDlg::getName(myGEOMToolsGUI->myGeomGUI->GetDesktop(), nm); + nm = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), nm); if(!nm.isEmpty()) { QApplication::setOverrideCursor(Qt::waitCursor); - myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->renameIObject(IObject, nm); + QAD_Application::getDesktop()->getActiveStudy()->renameIObject(IObject, nm); QApplication::restoreOverrideCursor(); } } @@ -327,7 +304,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } case 5103: // CHECK GEOMETRY { - QAD_PyEditor* PyEditor = myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor(); + QAD_PyEditor* PyEditor = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor(); PyEditor->setText("from GEOM_usinggeom import *\n"); PyEditor->setText(">>> "); PyEditor->handleReturn(); @@ -335,15 +312,15 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } case 8032: // COLOR - POPUP VIEWER { - if(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { // VTK - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); Handle(SALOME_InteractiveObject) FirstIOS = Sel->firstIObject(); if(!FirstIOS.IsNull()) { QColor initcolor = myRenderInter->GetColor(FirstIOS); - QColor c = QColorDialog::getColor( initcolor, myGEOMToolsGUI->myGeomGUI->GetDesktop()); + QColor c = QColorDialog::getColor( initcolor, QAD_Application::getDesktop()); if(c.isValid()) { QApplication::setOverrideCursor(Qt::waitCursor); @@ -355,7 +332,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) QApplication::restoreOverrideCursor(); } } - else if(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { Handle(SALOME_InteractiveObject) IO = Sel->firstIObject(); Standard_Boolean found; Handle(GEOM_AISShape) Shape = myGEOMToolsGUI->myGeomBase->ConvertIOinGEOMAISShape(IO, found, true); @@ -363,7 +340,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) Quantity_Color CSFColor; Shape->Color(CSFColor); - QColor c = QColorDialog::getColor(QColor(CSFColor.Red() * 255.0, CSFColor.Green()* 255.0, CSFColor.Blue() * 255.0), myGEOMToolsGUI->myGeomGUI->GetDesktop()); + QColor c = QColorDialog::getColor(QColor(CSFColor.Red() * 255.0, CSFColor.Green()* 255.0, CSFColor.Blue() * 255.0), QAD_Application::getDesktop()); if(c.isValid()) { CSFColor = Quantity_Color (c.red()/255., c.green()/255., c.blue()/255., Quantity_TOC_RGB); @@ -389,8 +366,8 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { OCCViewer_Viewer3d* v3d; Handle(AIS_InteractiveContext) ic; - if(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); } GEOMBase_TransparencyDlg *aDlg = new GEOMBase_TransparencyDlg(parent, "", Sel, ic); @@ -398,10 +375,10 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } case 8034: // ISOS - POPUP VIEWER { - if(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) break; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); ic->InitCurrent(); @@ -420,7 +397,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) IsoV = "1"; GEOMBase_NbIsosDlg * NbIsosDlg = - new GEOMBase_NbIsosDlg(myGEOMToolsGUI->myGeomGUI->GetDesktop(), tr("GEOM_MEN_ISOS"), TRUE); + new GEOMBase_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE); NbIsosDlg->SpinBoxU->setValue(IsoU.toInt()); NbIsosDlg->SpinBoxV->setValue(IsoV.toInt()); @@ -471,7 +448,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) if(!obj->FindAttribute(anAttr, "AttributeIOR") && obj->FindAttribute(anAttr, "AttributePersistentRef")) { // load - Engines::Component_var comp = myGEOMToolsGUI->myGeomGUI->GetDesktop()->getEngine("FactoryServer","GEOM"); + Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer","GEOM"); if (!CORBA::is_nil(comp)) { SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); @@ -502,101 +479,6 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } -//======================================================================= -// function : ConvertIORinGEOMAISShape() -// purpose : -//======================================================================= -Handle(GEOM_AISShape) GEOMToolsGUI::ConvertIORinGEOMAISShape(const char * IOR, Standard_Boolean& testResult, bool onlyInActiveView) -{ - Handle(GEOM_AISShape) resultShape; - testResult = false; - int nbSf = myGeomGUI->GetActiveStudy()->getStudyFramesCount(); - for(int i = 0; i < nbSf; i++) { - QAD_StudyFrame* sf = myGeomGUI->GetActiveStudy()->getStudyFrame(i); - if(sf->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - AIS_ListOfInteractive List; - ic->DisplayedObjects(List); - AIS_ListOfInteractive List1; - ic->ObjectsInCollector(List1); - List.Append(List1); - - AIS_ListIteratorOfListOfInteractive ite(List); - while(ite.More()) { - if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); - if(aSh->hasIO()) { - Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); - Standard_CString theIOR = GIO->getIOR(); - if(strcmp(IOR, theIOR) == 0) { - if(onlyInActiveView) { - if(sf == myGeomGUI->GetActiveStudy()->getActiveStudyFrame()) { - testResult = true; - resultShape = aSh; - return resultShape; - } - } - else { - testResult = true; - resultShape = aSh; - return resultShape; - } - } - } - } - ite.Next(); - } - } - } - return resultShape; -} - - -//======================================================================= -// function : ConvertIORinGEOMActor() -// purpose : -//======================================================================= -GEOM_Actor* GEOMToolsGUI::ConvertIORinGEOMActor(const char* IOR, Standard_Boolean& testResult, bool onlyInActiveView) -{ - int nbSf = myGeomGUI->GetActiveStudy()->getStudyFramesCount(); - for(int i = 0; i < nbSf; i++) { - QAD_StudyFrame* sf = myGeomGUI->GetActiveStudy()->getStudyFrame(i); - if(sf->getTypeView() == VIEW_VTK) { - vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer(); - vtkActorCollection* theActors = Renderer->GetActors(); - theActors->InitTraversal(); - vtkActor *ac = theActors->GetNextActor(); - while(!(ac==NULL)) { - if( ac->IsA("GEOM_Actor")) { - GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(ac); - if(anActor->hasIO()) { - Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(anActor->getIO()); - Standard_CString theIOR = GIO->getIOR(); - if(strcmp(IOR, theIOR) == 0) { - if(onlyInActiveView) { - if(sf == myGeomGUI->GetActiveStudy()->getActiveStudyFrame()) { - testResult = true; - return anActor; - } - } - else { - testResult = true; - return anActor; - } - } - } - } - ac = theActors->GetNextActor(); - } - } - } - testResult = false; - return GEOM_Actor::New(); -} - - //=============================================================================== // function : OnEditDelete() // purpose : @@ -604,26 +486,26 @@ GEOM_Actor* GEOMToolsGUI::ConvertIORinGEOMActor(const char* IOR, Standard_Boolea void GEOMToolsGUI::OnEditDelete() { if ( QAD_MessageBox::warn2 - ( myGeomGUI->GetDesktop(), + ( QAD_Application::getDesktop(), tr ("GEOM_WRN_WARNING"), tr ("GEOM_REALLY_DELETE"), tr ("GEOM_BUT_YES"), tr ("GEOM_BUT_NO"), 1, 0, 0) != 1 ) return; - int nbSf = myGeomGUI->GetActiveStudy()->getStudyFramesCount(); + int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); Standard_Boolean found; - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeIOR_var anIOR; - SALOME_Selection* Sel = SALOME_Selection::Selection( myGeomGUI->GetActiveStudy()->getSelection() ); + SALOME_Selection* Sel = SALOME_Selection::Selection( QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); for(;It.More();It.Next()) { Handle(SALOME_InteractiveObject) IObject = It.Value(); if ( IObject->hasEntry() ) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var SO = aStudy->FindObjectID( IObject->getEntry() ); /* Erase child graphical objects */ @@ -637,17 +519,17 @@ void GEOMToolsGUI::OnEditDelete() myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( ASCior ) ; for ( int i = 0; i < nbSf; i++ ) { - QAD_StudyFrame* sf = myGeomGUI->GetActiveStudy()->getStudyFrame(i); + QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); if ( sf->getTypeView() == VIEW_OCC ) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); - Handle(GEOM_AISShape) Result = this->ConvertIORinGEOMAISShape( anIOR->Value(), found ); + Handle(GEOM_AISShape) Result = myGeomBase->ConvertIORinGEOMAISShape(anIOR->Value(), found); if ( found ) myContext->Erase( Result, true, false ); } else if ( sf->getTypeView() == VIEW_VTK ) { //vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer(); VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor(); - GEOM_Actor* ac = this->ConvertIORinGEOMActor( anIOR->Value(), found ); + GEOM_Actor* ac = myGeomBase->ConvertIORinGEOMActor(anIOR->Value(), found); if ( found ) { //Renderer->RemoveActor(ac); if ( ac->hasIO() ) @@ -660,7 +542,7 @@ void GEOMToolsGUI::OnEditDelete() /* Erase main graphical object */ for ( int i = 0; i < nbSf; i++ ) { - QAD_StudyFrame* sf = myGeomGUI->GetActiveStudy()->getStudyFrame(i); + QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); if ( sf->getTypeView() == VIEW_OCC ) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); @@ -683,7 +565,7 @@ void GEOMToolsGUI::OnEditDelete() /* Erase objects in Study */ SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); if ( !obj->_is_nil() ) { - QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); op->start(); aStudyBuilder->RemoveObject(obj); op->finish(); @@ -694,7 +576,7 @@ void GEOMToolsGUI::OnEditDelete() /* Clear any previous selection */ Sel->ClearIObjects() ; - myGeomGUI->GetActiveStudy()->updateObjBrowser(); + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); } @@ -704,7 +586,7 @@ void GEOMToolsGUI::OnEditDelete() //============================================================================== void GEOMToolsGUI::OnEditCopy() { - SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection() ); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); GEOM::GEOM_Gen::ListOfIOR_var listIOR = new GEOM::GEOM_Gen::ListOfIOR; const SALOME_ListIO& List = Sel->StoredIObjects(); @@ -725,7 +607,7 @@ void GEOMToolsGUI::OnEditCopy() } } - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_READY")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY")); } @@ -733,23 +615,23 @@ void GEOMToolsGUI::OnEditCopy() // function : Import // purpose : BRep, Iges, Step //===================================================================================== -bool GEOMToolsGUI::Import() +bool GEOMToolsGUI::Import(int aState) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); GEOM::GEOM_Shape_var aShape; QString file; QStringList filtersList; - switch(myGeomGUI->GetState()) + switch(aState) { case 111 : // Import BREP { filtersList.append(tr("GEOM_MEN_IMPORT_BREP")); filtersList.append(tr("GEOM_MEN_ALL_FILES")); - file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(), "", filtersList, tr("GEOM_MEN_IMPORT"), true); + file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), "", filtersList, tr("GEOM_MEN_IMPORT"), true); if(!file.isEmpty()) { QApplication::setOverrideCursor(Qt::waitCursor); try { @@ -766,7 +648,7 @@ bool GEOMToolsGUI::Import() filtersList.append( tr("GEOM_MEN_IMPORT_IGES") ) ; filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ; - file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(), + file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), "", filtersList, tr("GEOM_MEN_IMPORT"), @@ -787,7 +669,7 @@ bool GEOMToolsGUI::Import() filtersList.append( tr("GEOM_MEN_IMPORT_STEP") ) ; filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ; - file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(), + file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), "", filtersList, tr("GEOM_MEN_IMPORT"), @@ -806,16 +688,16 @@ bool GEOMToolsGUI::Import() } if ( !file.isEmpty() ) { - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_LOADING").arg(QAD_Tools::getFileNameFromPath( file )) ); + QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_LOADING").arg(QAD_Tools::getFileNameFromPath( file )) ); SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM"); - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeName_var aName; SALOMEDS::AttributePixMap_var aPixmap; int aLocked = false; if (father->_is_nil()) { - QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy() ); + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy() ); op->start(); aLocked = aStudy->GetProperties()->IsLocked(); if (aLocked) aStudy->GetProperties()->SetLocked(false); @@ -823,7 +705,7 @@ bool GEOMToolsGUI::Import() anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName"); aName = SALOMEDS::AttributeName::_narrow(anAttr); // aName->SetValue( tr("GEOM_MEN_COMPONENT") ); - aName->SetValue(myGeomGUI->GetDesktop()->getComponentUserName( "GEOM" ) ); + aName->SetValue(QAD_Application::getDesktop()->getComponentUserName( "GEOM" ) ); anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" ); @@ -837,8 +719,8 @@ bool GEOMToolsGUI::Import() QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(myGeomGUI->GetNbGeom()++); if(myGeomBase->Display(aShape, strdup(nameShape.latin1()))) { - myGeomGUI->GetActiveStudy()->setMessage( tr("GEOM_INF_LOADED").arg(QAD_Tools::getFileNameFromPath( file )) ); - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_READY")); + QAD_Application::getDesktop()->getActiveStudy()->setMessage( tr("GEOM_INF_LOADED").arg(QAD_Tools::getFileNameFromPath( file )) ); + QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_READY")); } } QApplication::restoreOverrideCursor(); @@ -850,9 +732,9 @@ bool GEOMToolsGUI::Import() // function : Export // purpose : BRep, Iges, Step //===================================================================================== -bool GEOMToolsGUI::Export() +bool GEOMToolsGUI::Export(int aState) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); GEOM::GEOM_Shape_var aShape; @@ -861,10 +743,10 @@ bool GEOMToolsGUI::Export() tr("GEOM_MEN_IMPORT_IGES"), tr("GEOM_MEN_IMPORT_STEP") }; - SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - switch (myGeomGUI->GetState()) + switch (aState) { case 121 : { @@ -875,7 +757,7 @@ bool GEOMToolsGUI::Export() GEOM::GEOM_Shape_var aShape = myGeomBase->ConvertIOinGEOMShape(IObject, found); // Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found, true); if ( found ) { - QString file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(), + QString file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), QString( IObject->getName() ) + ".brep", tr("GEOM_MEN_IMPORT_BREP"), tr("GEOM_MEN_EXPORT"), @@ -903,7 +785,7 @@ bool GEOMToolsGUI::Export() GEOM::GEOM_Shape_var aShape = myGeomBase->ConvertIOinGEOMShape(IObject, found); // Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found, true); if ( found ) { - QString file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(), + QString file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), QString( IObject->getName() ) + ".igs", tr("GEOM_MEN_IMPORT_IGES"), tr("GEOM_MEN_EXPORT"), @@ -948,7 +830,7 @@ bool GEOMToolsGUI::Export() GEOM::GEOM_Shape_var aShape = myGeomBase->ConvertIOinGEOMShape(IObject, found); // Handle(GEOM_AISShape) Shape = myGeomBase->ConvertIOinGEOMAISShape(IObject, found, true); if ( found ) { - file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(), + file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), QString( IObject->getName() ) + ".stp", tr("GEOM_MEN_IMPORT_STEP"), tr("GEOM_MEN_EXPORT"), diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h index 55093970f..8296fdb69 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI.h @@ -45,15 +45,9 @@ public : static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); - Handle(GEOM_AISShape) ConvertIORinGEOMAISShape(const char * IOR, - Standard_Boolean& testResult, - bool onlyInActiveView = false); - GEOM_Actor* ConvertIORinGEOMActor(const char * IOR, Standard_Boolean& testResult, - bool onlyInActiveView = false); - /* Import and export topology methods */ - bool Import(); - bool Export(); + bool Import(int aState); + bool Export(int aState); void OnEditCopy(); void OnEditDelete(); diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx index 8c3f4d21f..6fab217a5 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx @@ -30,6 +30,7 @@ using namespace std; #include "QAD_RightFrame.h" #include "SALOME_ListIteratorOfListIO.hxx" +#include #include #include @@ -177,9 +178,9 @@ void GEOMBase_TransparencyDlg::ClickOnClose() //================================================================================= void GEOMBase_TransparencyDlg::ValueHasChanged(int newValue) { - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { // VTK - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); SALOME_ListIteratorOfListIO It(this->mySel->StoredIObjects()); Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject(); @@ -200,7 +201,7 @@ void GEOMBase_TransparencyDlg::ValueHasChanged(int newValue) QApplication::restoreOverrideCursor(); } - else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { // OCC SALOME_ListIteratorOfListIO It(this->mySel->StoredIObjects()); Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject(); diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h index 72dd1838e..fbcc4efcd 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h @@ -32,10 +32,10 @@ #include #include -#include "SALOME_Selection.h" -#include "SALOME_InteractiveObject.hxx" -#include "GEOM_InteractiveObject.hxx" -#include "GEOM_AISShape.hxx" +/* #include "SALOME_Selection.h" */ +/* #include "SALOME_InteractiveObject.hxx" */ +/* #include "GEOM_InteractiveObject.hxx" */ +/* #include "GEOM_AISShape.hxx" */ #include "GEOMBase.h" diff --git a/src/GEOMToolsGUI/Makefile.in b/src/GEOMToolsGUI/Makefile.in index 8571b935d..95cc8b8f8 100644 --- a/src/GEOMToolsGUI/Makefile.in +++ b/src/GEOMToolsGUI/Makefile.in @@ -49,21 +49,15 @@ LIB_MOC = \ GEOMToolsGUI_NbIsosDlg.h \ GEOMToolsGUI_TransparencyDlg.h -LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ +LIB_CLIENT_IDL = SALOMEDS_Attributes.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lGEOMFiltersSelection -lGEOMBase @CONCLUDE@ diff --git a/src/GenerationGUI/GenerationGUI.cxx b/src/GenerationGUI/GenerationGUI.cxx index ea904ab92..78bc4fdeb 100644 --- a/src/GenerationGUI/GenerationGUI.cxx +++ b/src/GenerationGUI/GenerationGUI.cxx @@ -66,7 +66,7 @@ bool GenerationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { GenerationGUI* myGenerationGUI = new GenerationGUI(); myGenerationGUI->myGeomGUI->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(myGenerationGUI->myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); switch (theCommandID) { @@ -108,7 +108,7 @@ void GenerationGUI::MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp { try { if(BaseShape->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } @@ -116,7 +116,7 @@ void GenerationGUI::MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp GEOM::PointStruct PS2 = myGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z()); GEOM::GEOM_Shape_ptr result = myGeom->MakePrism(BaseShape, PS1, PS2); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } @@ -126,7 +126,7 @@ void GenerationGUI::MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp result->NameType(type); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -145,7 +145,7 @@ void GenerationGUI::MakeRevolutionAndDisplay(GEOM::GEOM_Shape_ptr Shape, const g GEOM::AxisStruct axis = myGeom->MakeAxisStruct(loc.X(), loc.Y(), loc.Z(), dir.X(), dir.Y(), dir.Z()); GEOM::GEOM_Shape_ptr result = myGeom->MakeRevolution(Shape, axis, revolAngle) ; if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } @@ -155,7 +155,7 @@ void GenerationGUI::MakeRevolutionAndDisplay(GEOM::GEOM_Shape_ptr Shape, const g result->NameType(type); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -176,7 +176,7 @@ void GenerationGUI::MakeFillingAndDisplay(GEOM::GEOM_Shape_ptr SectionShape, con GEOM::GEOM_Shape_ptr result = myGeom->MakeFilling(SectionShape, mindeg, maxdeg, tol3d, tol2d, nbiter); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } @@ -186,7 +186,7 @@ void GenerationGUI::MakeFillingAndDisplay(GEOM::GEOM_Shape_ptr SectionShape, con result->NameType(type); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); return; } catch(const SALOME::SALOME_Exception& S_ex) { @@ -210,10 +210,10 @@ void GenerationGUI::MakePipeAndDisplay(GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Sh myGeomBase->GetShapeTypeString(S,type); result->NameType(type); - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); } } catch (const SALOME::SALOME_Exception& S_ex) { diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx index c6b5c8b59..d073a80da 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -150,7 +150,7 @@ void GenerationGUI_FillingDlg::ClickOnOk() //================================================================================= void GenerationGUI_FillingDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); myMinDeg = GroupPoints->SpinBox_1->value(); myTol2D = GroupPoints->SpinBox_2->value(); diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index 9a2ade98c..ba30db7e1 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -29,6 +29,8 @@ using namespace std; #include "GenerationGUI_PipeDlg.h" +#include +#include #include #include @@ -128,7 +130,7 @@ void GenerationGUI_PipeDlg::ClickOnOk() //================================================================================= void GenerationGUI_PipeDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index f2804f4b9..f2b9ea58f 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -146,7 +146,7 @@ void GenerationGUI_PrismDlg::ClickOnOk() //================================================================================= void GenerationGUI_PrismDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index 0ac989d50..79e7e1bac 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -29,6 +29,7 @@ using namespace std; #include "GenerationGUI_RevolDlg.h" +#include #include #include #include "QAD_Config.h" @@ -144,7 +145,7 @@ void GenerationGUI_RevolDlg::ClickOnOk() //================================================================================= void GenerationGUI_RevolDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/GenerationGUI/Makefile.in b/src/GenerationGUI/Makefile.in index fad3011b9..06eb796c0 100644 --- a/src/GenerationGUI/Makefile.in +++ b/src/GenerationGUI/Makefile.in @@ -53,21 +53,15 @@ LIB_MOC = \ GenerationGUI_FillingDlg.h \ GenerationGUI_PipeDlg.h -LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ +LIB_CLIENT_IDL = LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase $(CAS_LDPATH) -lTKOffset -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lGEOMFiltersSelection -lGEOMBase $(CAS_LDPATH) -lTKOffset @CONCLUDE@ diff --git a/src/Makefile.in b/src/Makefile.in index 27aff7c9b..ca45ef2ce 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -32,6 +32,6 @@ VPATH=.:@srcdir@ @COMMENCE@ -SUBDIRS = OBJECT SKETCHER ARCHIMEDE PARTITION GEOMDS GEOM GEOMClient GEOMFiltersSelection DlgRef GEOMContext GEOMBase DisplayGUI GEOMToolsGUI BasicGUI PrimitiveGUI GenerationGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GEOMGUI GEOM_SWIG +SUBDIRS = OBJECT ARCHIMEDE PARTITION GEOMDS GEOM GEOMClient GEOMFiltersSelection DlgRef GEOMContext GEOMBase DisplayGUI GEOMToolsGUI SketcherGUI BasicGUI PrimitiveGUI GenerationGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GEOMGUI GEOM_SWIG @MODULE@ diff --git a/src/MeasureGUI/Makefile.in b/src/MeasureGUI/Makefile.in index 5e672e22e..2b983be0d 100644 --- a/src/MeasureGUI/Makefile.in +++ b/src/MeasureGUI/Makefile.in @@ -75,21 +75,15 @@ LIB_MOC = \ MeasureGUI_WhatisDlg.h \ MeasureGUI_CheckShapeDlg.h -LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ +LIB_CLIENT_IDL = LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lGEOMBase @CONCLUDE@ diff --git a/src/MeasureGUI/MeasureGUI.cxx b/src/MeasureGUI/MeasureGUI.cxx index 65f60b161..d2a67dac4 100644 --- a/src/MeasureGUI/MeasureGUI.cxx +++ b/src/MeasureGUI/MeasureGUI.cxx @@ -70,7 +70,7 @@ bool MeasureGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { MeasureGUI* myMeasureGUI = new MeasureGUI(); myMeasureGUI->myGeomGUI->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(myMeasureGUI->myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); switch (theCommandID) { @@ -133,12 +133,12 @@ void MeasureGUI::MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape) try { GEOM::GEOM_Shape_var result = myGeom->MakeCDG(Shape); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } result->NameType(tr("GEOM_POINT")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx index 21cb8420f..fc9feffb6 100644 --- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx @@ -227,10 +227,10 @@ void MeasureGUI_BndBoxDlg::CalculateAndDisplayBndBox(const TopoDS_Shape& S) BRepBndLib::Add(S,B); B.Get(axmin, aymin, azmin, axmax, aymax, azmax); GroupC1->LineEdit11->setText(tr("%1").arg(axmin, 12, 'f', 6)); - GroupC1->LineEdit12->setText(tr("%1").arg(aymin, 12, 'f', 6)); - GroupC1->LineEdit21->setText(tr("%1").arg(azmin, 12, 'f', 6)); - GroupC1->LineEdit22->setText(tr("%1").arg(axmax, 12, 'f', 6)); - GroupC1->LineEdit31->setText(tr("%1").arg(aymax, 12, 'f', 6)); + GroupC1->LineEdit12->setText(tr("%1").arg(axmax, 12, 'f', 6)); + GroupC1->LineEdit21->setText(tr("%1").arg(aymin, 12, 'f', 6)); + GroupC1->LineEdit22->setText(tr("%1").arg(aymax, 12, 'f', 6)); + GroupC1->LineEdit31->setText(tr("%1").arg(azmin, 12, 'f', 6)); GroupC1->LineEdit32->setText(tr("%1").arg(azmax, 12, 'f', 6)); mySimulationTopoDs = BRepPrimAPI_MakeBox(gp_Pnt(axmin, aymin, azmin), gp_Pnt(axmax, aymax, azmax)).Shape(); diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx index 4630e6a1e..691fd8694 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx @@ -131,7 +131,7 @@ void MeasureGUI_CenterMassDlg::ClickOnOk() //================================================================================= void MeasureGUI_CenterMassDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.h b/src/MeasureGUI/MeasureGUI_CenterMassDlg.h index 8447c372b..e67a67ccf 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.h +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.h @@ -33,6 +33,8 @@ #include "MeasureGUI.h" +#include + //================================================================================= // class : MeasureGUI_CenterMassDlg // purpose : diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index d70b816fe..d527eee7f 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -32,6 +32,8 @@ using namespace std; #include "QAD_RightFrame.h" #include "OCCViewer_Viewer3d.h" +#include +#include #include #include #include @@ -324,8 +326,8 @@ void MeasureGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape GroupC1->LineEdit3->setText(S); - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); ic->Display(Distance); ic->UpdateCurrentViewer(); @@ -346,10 +348,10 @@ void MeasureGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape //================================================================================= void MeasureGUI_DistanceDlg::EraseDistance() { - int count = myGeomGUI->GetActiveStudy()->getStudyFramesCount(); + int count = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); for(int i = 0; i < count; i++) { - if (myGeomGUI->GetActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); + if (QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC ) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); AIS_ListOfInteractive L; diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx index 8bc1252b3..93f2da25f 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx @@ -29,6 +29,9 @@ using namespace std; #include "MeasureGUI_MaxToleranceDlg.h" +#include +#include +#include #include #include diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.cxx b/src/MeasureGUI/MeasureGUI_Skeleton.cxx index c07c26097..39498d509 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton.cxx +++ b/src/MeasureGUI/MeasureGUI_Skeleton.cxx @@ -103,7 +103,7 @@ void MeasureGUI_Skeleton::ClickOnCancel() mySimulationTopoDs.Nullify(); disconnect(mySelection, 0, this, 0); - myGeomGUI->ResetState(); + //myGeomGUI->ResetState(); reject(); return; @@ -135,7 +135,7 @@ void MeasureGUI_Skeleton::LineEditReturnPressed() void MeasureGUI_Skeleton::DeactivateActiveDialog() { this->setEnabled(false); - myGeomGUI->ResetState(); + //myGeomGUI->ResetState(); disconnect(mySelection, 0, this, 0); myGeomBase->EraseSimulationShape(); myGeomGUI->SetActiveDialogBox(0); diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx index ebd8e5952..e09cdaf94 100644 --- a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx @@ -29,6 +29,9 @@ using namespace std; #include "MeasureGUI_WhatisDlg.h" +#include +#include +#include #include #include diff --git a/src/OperationGUI/Makefile.in b/src/OperationGUI/Makefile.in index ad6e914ec..fe9386d87 100644 --- a/src/OperationGUI/Makefile.in +++ b/src/OperationGUI/Makefile.in @@ -53,21 +53,15 @@ LIB_MOC = \ OperationGUI_FilletDlg.h \ OperationGUI_ChamferDlg.h -LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ +LIB_CLIENT_IDL = LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lDlgRef -lGEOMContext -lGEOMBase -lDisplayGUI $(CAS_LDPATH) -lTKFillet -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lDisplayGUI $(CAS_LDPATH) -lTKFillet @CONCLUDE@ diff --git a/src/OperationGUI/OperationGUI.cxx b/src/OperationGUI/OperationGUI.cxx index 9e35ea407..842a5a12f 100644 --- a/src/OperationGUI/OperationGUI.cxx +++ b/src/OperationGUI/OperationGUI.cxx @@ -36,6 +36,7 @@ using namespace std; #include "OCCViewer_ViewFrame.h" #include "SALOMEGUI_QtCatchCorbaException.hxx" +#include #include #include @@ -74,7 +75,7 @@ bool OperationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { OperationGUI* myOperationGUI = new OperationGUI(); myOperationGUI->myGeomGUI->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(myOperationGUI->myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); switch (theCommandID) { @@ -91,8 +92,8 @@ bool OperationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) case 505: // FILLET { Handle(AIS_InteractiveContext) ic; - if(myOperationGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myOperationGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); ic = v3d->getAISContext(); } OperationGUI_FilletDlg *aDlg = new OperationGUI_FilletDlg(parent, "", myOperationGUI, Sel, ic); @@ -101,8 +102,8 @@ bool OperationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) case 506: // CHAMFER { Handle(AIS_InteractiveContext) ic; - if(myOperationGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myOperationGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); ic = v3d->getAISContext(); } OperationGUI_ChamferDlg *aDlg = new OperationGUI_ChamferDlg(parent, "", myOperationGUI, Sel, ic); @@ -133,12 +134,12 @@ void OperationGUI::MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& list listKeepInsIOR, listRemoveInsIOR, (CORBA::Short) limit); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } result->NameType(tr("GEOM_PARTITION")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); return; } catch(const SALOME::SALOME_Exception& S_ex) { @@ -162,12 +163,12 @@ void OperationGUI::Archimede(const Handle(SALOME_InteractiveObject)& IO, const d GEOM::GEOM_Shape_var Result = myGeom->Archimede(Shape, aWeight, aWaterDensity, aMeshingDeflection); Result->NameType(tr("GEOM_PLANE")); if(myGeomBase->Display(Result)) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } return; } if(IO->hasEntry()) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry()); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeIOR_var anIOR; @@ -178,7 +179,7 @@ void OperationGUI::Archimede(const Handle(SALOME_InteractiveObject)& IO, const d GEOM::GEOM_Shape_var Result = myGeom->Archimede(Shape, aWeight, aWaterDensity, aMeshingDeflection); Result->NameType(tr("GEOM_PLANE")); if (myGeomBase->Display(Result)) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } } } @@ -200,10 +201,10 @@ bool OperationGUI::OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Ra GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; ListOfID->length(0); - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); if(theObj->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); return false; } @@ -214,7 +215,7 @@ bool OperationGUI::OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Ra GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); GEOM::GEOM_Shape_var result = myGeom->MakeFillet(aShape, Radius, SubShapeType, ListOfID); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return false; } TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); @@ -223,7 +224,7 @@ bool OperationGUI::OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Ra result->NameType(type); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch (const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -240,15 +241,15 @@ bool OperationGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char const double Radius, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext) { - if (myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); if(myUseLocalContext == false) { /* No local context opened for fillet method */ - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return false; } @@ -295,7 +296,7 @@ bool OperationGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char aResult->NameType(type); if(myGeomBase->Display(aResult)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -309,8 +310,8 @@ bool OperationGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; - myGeomGUI->GetActiveStudy()->updateObjBrowser(); - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_READY")); + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY")); return true; } @@ -322,13 +323,13 @@ bool OperationGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char //===================================================================================== bool OperationGUI::OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D1, const double D2, const int SubShapeType, const char* ShapeTopoIOR) { - GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; + GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; ListOfID->length(0); - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); if(theObj->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); return false; } @@ -341,7 +342,7 @@ bool OperationGUI::OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); GEOM::GEOM_Shape_var result = myGeom->MakeChamfer(aShape, D1, D2, SubShapeType, ListOfID); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return false; } @@ -351,7 +352,7 @@ bool OperationGUI::OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D result->NameType(type); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch (const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -368,15 +369,15 @@ bool OperationGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, const cha const double D1, const double D2, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext) { - if (myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); if(myUseLocalContext == false) { /* No local context opened for chamfer method */ - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return false; } @@ -423,7 +424,7 @@ bool OperationGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, const cha aResult->NameType(type); if(myGeomBase->Display(aResult)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -437,8 +438,8 @@ bool OperationGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, const cha DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; - myGeomGUI->GetActiveStudy()->updateObjBrowser(); - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_READY")); + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY")); return true; } diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx index ffb19bf50..77468ea95 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx @@ -152,7 +152,7 @@ void OperationGUI_ArchimedeDlg::ClickOnOk() //================================================================================= void OperationGUI_ArchimedeDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(myOkIO) myOperationGUI->Archimede(myIO, myWeight, myWaterDensity, myMeshingDeflection); return; diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx index f5646c54c..92085d229 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.cxx +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -30,14 +30,13 @@ using namespace std; #include "OperationGUI_ChamferDlg.h" #include "DisplayGUI.h" -#include "QAD_Config.h" -#include "QAD_RightFrame.h" -#include "OCCViewer_Viewer3d.h" +#include #include #include #include #include +#include //================================================================================= // class : OperationGUI_ChamferDlg() @@ -114,26 +113,21 @@ void OperationGUI_ChamferDlg::Init(Handle (AIS_InteractiveContext) ic) myConstructorId = 0; myEditCurrentArgument = Group1->LineEdit1; - myD1 = 50.0; - myOkD1 = true; - myD2 = 50.0; - myOkD2 = true; + myD1 = 5.0; + myD2 = 5.0; myOkShape = false; myIC = ic; myLocalContextId = -1; myUseLocalContext = false; - /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - step = St.toDouble(); - + double SpecificStep = 10.0; /* min, max, step and decimals for spin boxes */ - Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); - Group2->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); - Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); - Group1->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); - Group2->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); - Group3->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); + Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group2->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group1->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group2->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group3->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); Group1->SpinBox_DX->SetValue(myD1); Group2->SpinBox_DX->SetValue(myD1); @@ -196,23 +190,17 @@ void OperationGUI_ChamferDlg::ConstructorsClicked(int constructorId) mySimulationTopoDs.Nullify(); disconnect(mySelection, 0, this, 0); myOkShape = false; - myD1 = 50.0; - myD2 = 50.0; - myOkD1 = true; - myOkD2 = true; - - - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if(myUseLocalContext) { - myIC->CloseLocalContext(myLocalContextId); - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true); - myUseLocalContext = false; - } + myD1 = 5.0; + myD2 = 5.0; + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + myUseLocalContext = false; } + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); switch (constructorId) { case 0: /* Chamfer All */ @@ -228,7 +216,6 @@ void OperationGUI_ChamferDlg::ConstructorsClicked(int constructorId) Group1->SpinBox_DX->SetValue(myD1); Group1->SpinBox_DY->SetValue(myD2); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } case 1: /* Chamfer edges */ @@ -244,7 +231,6 @@ void OperationGUI_ChamferDlg::ConstructorsClicked(int constructorId) Group2->SpinBox_DX->SetValue(myD1); Group2->SpinBox_DY->SetValue(myD2); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } case 2: /* Chamfer Faces */ @@ -260,7 +246,6 @@ void OperationGUI_ChamferDlg::ConstructorsClicked(int constructorId) Group3->SpinBox_DX->SetValue(myD1); Group3->SpinBox_DY->SetValue(myD2); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } } @@ -286,7 +271,8 @@ void OperationGUI_ChamferDlg::ClickOnOk() //================================================================================= void OperationGUI_ChamferDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QApplication::setOverrideCursor(Qt::waitCursor); + QAD_Application::getDesktop()->putInfo(tr("")); myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); @@ -295,20 +281,20 @@ void OperationGUI_ChamferDlg::ClickOnApply() { case 0 : /* Chamfer All */ { - if(myOkD1 && myOkD2 && myOkShape) + if(myOkShape) testResult = myOperationGUI->OnChamferGetAll(myShape, myD1, myD2, myShapeType, myShapeIOR); break; } case 1 : /* Chamfer Edge */ { - if(myOkD1 && myOkD2 && myOkShape) + if(myOkShape) testResult = myOperationGUI->OnChamferGetSelected(myShape, myShapeIOR, myD1, myD2, myShapeType, myLocalContextId, myUseLocalContext); break; } case 2 : /* Chamfer Face */ { - if(myOkD1 && myOkD2 && myOkShape) + if(myOkShape) testResult = myOperationGUI->OnChamferGetSelected(myShape, myShapeIOR, myD1, myD2, myShapeType, myLocalContextId, myUseLocalContext); break; @@ -316,11 +302,12 @@ void OperationGUI_ChamferDlg::ClickOnApply() } if(!testResult) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); else - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); /* Reset all arguments and local context to allow user a new selection ...*/ this->ResetStateOfDialog(); + QApplication::restoreOverrideCursor(); return; } @@ -331,17 +318,7 @@ void OperationGUI_ChamferDlg::ClickOnApply() //================================================================================= void OperationGUI_ChamferDlg::ClickOnCancel() { - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - - if(myUseLocalContext) { - myIC->CloseLocalContext(myLocalContextId); - myUseLocalContext = false; - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true); - } - } + this->ResetStateOfDialog(); GEOMBase_Skeleton::ClickOnCancel(); return; } @@ -354,6 +331,7 @@ void OperationGUI_ChamferDlg::ClickOnCancel() void OperationGUI_ChamferDlg::SelectionIntoArgument() { myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); myEditCurrentArgument->setText(""); this->ResetStateOfDialog(); QString aString = ""; /* name of selection */ @@ -365,7 +343,7 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; if(!IO->hasEntry()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); return; } @@ -379,7 +357,7 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() } if(IO->hasEntry()) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeIOR_var anIOR; @@ -394,7 +372,8 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() } } } - this->MakePreview(); + if(myConstructorId == 0) + this->MakePreview(); } else @@ -462,8 +441,6 @@ void OperationGUI_ChamferDlg::SetEditCurrentArgument() void OperationGUI_ChamferDlg::DeactivateActiveDialog() { this->ResetStateOfDialog(); - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true); GEOMBase_Skeleton::DeactivateActiveDialog(); return; } @@ -520,14 +497,14 @@ void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double newValue ) QObject* send = (QObject*)sender(); if(send == Group1->SpinBox_DX || send == Group2->SpinBox_DX || send == Group3->SpinBox_DX) { /* D1 */ myD1 = newValue; - myOkD1 = true; - this->MakePreview(); + if(myConstructorId == 0) + this->MakePreview(); return ; } else if(send == Group1->SpinBox_DY || send == Group2->SpinBox_DY || send == Group3->SpinBox_DY) { /* D2 */ myD2 = newValue; - myOkD2 = true; - this->MakePreview(); + if(myConstructorId == 0) + this->MakePreview(); return; } return; @@ -542,18 +519,14 @@ void OperationGUI_ChamferDlg::ResetStateOfDialog() { myOkShape = false; myEditCurrentArgument->setText(""); + QApplication::restoreOverrideCursor(); /* Close its local contact if opened */ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - - if(myUseLocalContext) { - myIC->CloseLocalContext(myLocalContextId); - myUseLocalContext = false; - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true); - } + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); } return; } @@ -565,33 +538,49 @@ void OperationGUI_ChamferDlg::ResetStateOfDialog() //================================================================================= void OperationGUI_ChamferDlg::MakePreview() { - TopoDS_Shape tds; + QApplication::setOverrideCursor(Qt::waitCursor); + + if(!myOkShape) { + QApplication::restoreOverrideCursor(); + return; + } + + GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; + ListOfID->length(0); + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(myShapeIOR); + if(theObj->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + QApplication::restoreOverrideCursor(); + return; + } + try { - BRepFilletAPI_MakeChamfer MC(myShape); - switch (myConstructorId) - { - case 0: /* Chamfer All */ - { - TopTools_IndexedDataMapOfShapeListOfShape M; - TopExp::MapShapesAndAncestors(myShape,TopAbs_EDGE,TopAbs_FACE,M); - for(int i = 1;i<=M.Extent();i++) { - TopoDS_Edge E = TopoDS::Edge(M.FindKey(i)); - TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First()); - if(!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E)) - MC.Add(myD1, myD2,E,F); - } - tds = MC.Shape(); - break; - } - } - if(!tds.IsNull()) { - mySimulationTopoDs = tds; - myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + if(myD1 <= Precision::Confusion() || myD2 <= Precision::Confusion()) { + QApplication::restoreOverrideCursor(); + return; } + + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(myShapeIOR); + GEOM::GEOM_Shape_var result = myGeom->MakeChamfer(aShape, myD1, myD2, myShapeType, ListOfID); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QApplication::restoreOverrideCursor(); + return; + } + + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); + + mySimulationTopoDs = S; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } catch(Standard_Failure) { - myGeomBase->EraseSimulationShape(); - mySimulationTopoDs.Nullify(); + MESSAGE("Exception catched in MakePreview"); + QApplication::restoreOverrideCursor(); + return; } + QApplication::restoreOverrideCursor(); return; + } diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.h b/src/OperationGUI/OperationGUI_ChamferDlg.h index eeca5c509..46e114443 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.h +++ b/src/OperationGUI/OperationGUI_ChamferDlg.h @@ -57,7 +57,6 @@ private : OperationGUI* myOperationGUI; - double step; int myConstructorId; /* Current constructor id = radio button id */ /* Interactive and local context management see also : bool myUseLocalContext() */ @@ -69,9 +68,7 @@ private : bool myOkShape; char* myShapeIOR; int myShapeType; - bool myOkD1; double myD1; - bool myOkD2; double myD2; DlgRef_1Sel2Spin* Group1; diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx index 40bc2d0d0..746c9eb08 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.cxx +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -30,12 +30,11 @@ using namespace std; #include "OperationGUI_FilletDlg.h" #include "DisplayGUI.h" -#include "QAD_Config.h" -#include "QAD_RightFrame.h" -#include "OCCViewer_Viewer3d.h" +#include #include #include +#include //================================================================================= // class : OperationGUI_FilletDlg() @@ -109,21 +108,17 @@ void OperationGUI_FilletDlg::Init(Handle(AIS_InteractiveContext) ic) myConstructorId = 0; myEditCurrentArgument = Group1->LineEdit1; - myRadius = 50.0; - myOkRadius = true; + myRadius = 5.0; myOkShape = false; myIC = ic; myLocalContextId = -1; myUseLocalContext = false; - /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - step = St.toDouble(); - + double SpecificStep = 10.0; /* min, max, step and decimals for spin boxes */ - Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); - Group2->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); - Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group2->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); Group1->SpinBox_DX->SetValue(myRadius); Group2->SpinBox_DX->SetValue(myRadius); @@ -177,20 +172,16 @@ void OperationGUI_FilletDlg::ConstructorsClicked(int constructorId) mySimulationTopoDs.Nullify(); disconnect(mySelection, 0, this, 0); myOkShape = false; - myRadius = 50.0; - myOkRadius = true; - - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if(myUseLocalContext) { - myIC->CloseLocalContext(myLocalContextId); - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true); - this->myUseLocalContext = false; - } + myRadius = 5.0; + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + myUseLocalContext = false; } + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); switch (constructorId) { case 0: /* Fillet All */ @@ -205,7 +196,6 @@ void OperationGUI_FilletDlg::ConstructorsClicked(int constructorId) myShapeType = -1; Group1->SpinBox_DX->SetValue(myRadius); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } case 1: /* Fillet edges */ @@ -220,7 +210,6 @@ void OperationGUI_FilletDlg::ConstructorsClicked(int constructorId) myShapeType = 6; Group2->SpinBox_DX->SetValue(myRadius); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } case 2: /* Fillet Faces */ @@ -235,7 +224,6 @@ void OperationGUI_FilletDlg::ConstructorsClicked(int constructorId) myShapeType = 4; Group3->SpinBox_DX->SetValue(myRadius); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } } @@ -261,7 +249,8 @@ void OperationGUI_FilletDlg::ClickOnOk() //================================================================================= void OperationGUI_FilletDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QApplication::setOverrideCursor(Qt::waitCursor); + QAD_Application::getDesktop()->putInfo(tr("")); myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); @@ -270,30 +259,31 @@ void OperationGUI_FilletDlg::ClickOnApply() { case 0 : /* Fillet All */ { - if(myOkRadius && myOkShape) + if(myOkShape) testResult = myOperationGUI->OnFilletGetAll(myShape, myRadius, myShapeType, myShapeIOR); break; } case 1 : /* Fillet Edge */ { - if(myOkRadius && myOkShape) + if(myOkShape) testResult = myOperationGUI->OnFilletGetSelected(myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext); break; } case 2 : /* Fillet Face */ { - if(myOkRadius && myOkShape) + if(myOkShape) testResult = myOperationGUI->OnFilletGetSelected(myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext); break; } } if(!testResult) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); else - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); /* Reset all arguments and local context to allow user a new selection ...*/ this->ResetStateOfDialog(); + QApplication::restoreOverrideCursor(); return; } @@ -304,17 +294,7 @@ void OperationGUI_FilletDlg::ClickOnApply() //================================================================================= void OperationGUI_FilletDlg::ClickOnCancel() { - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - - if(myUseLocalContext) { - myIC->CloseLocalContext(myLocalContextId); - myUseLocalContext = false; - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true); - } - } + this->ResetStateOfDialog(); GEOMBase_Skeleton::ClickOnCancel(); return; } @@ -327,6 +307,7 @@ void OperationGUI_FilletDlg::ClickOnCancel() void OperationGUI_FilletDlg::SelectionIntoArgument() { myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); myEditCurrentArgument->setText(""); this->ResetStateOfDialog(); QString aString = ""; /* name of selection */ @@ -338,7 +319,7 @@ void OperationGUI_FilletDlg::SelectionIntoArgument() if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; if(!IO->hasEntry()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); return; } @@ -352,7 +333,7 @@ void OperationGUI_FilletDlg::SelectionIntoArgument() } if(IO->hasEntry()) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeIOR_var anIOR; @@ -367,8 +348,8 @@ void OperationGUI_FilletDlg::SelectionIntoArgument() } } } - this->MakePreview(); - + if(myConstructorId == 0) + this->MakePreview(); } else return; @@ -434,10 +415,9 @@ void OperationGUI_FilletDlg::SetEditCurrentArgument() //================================================================================= void OperationGUI_FilletDlg::DeactivateActiveDialog() { - this->ResetStateOfDialog(); - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true); - GEOMBase_Skeleton::DeactivateActiveDialog(); + this->ResetStateOfDialog(); + GEOMBase_Skeleton::DeactivateActiveDialog(); + return; } @@ -488,18 +468,14 @@ void OperationGUI_FilletDlg::ResetStateOfDialog() { myOkShape = false; myEditCurrentArgument->setText(""); + QApplication::restoreOverrideCursor(); /* Close its local contact if opened */ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - - if(myUseLocalContext) { - myIC->CloseLocalContext(myLocalContextId); - myUseLocalContext = false; - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true); - } + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); } return; } @@ -515,9 +491,9 @@ void OperationGUI_FilletDlg::ValueChangedInSpinBox(double newValue) mySimulationTopoDs.Nullify(); myRadius = newValue; - myOkRadius = true; - MakePreview(); + if(myConstructorId == 0) + this->MakePreview(); return; } @@ -528,33 +504,47 @@ void OperationGUI_FilletDlg::ValueChangedInSpinBox(double newValue) //================================================================================= void OperationGUI_FilletDlg::MakePreview() { - TopoDS_Shape tds; + QApplication::setOverrideCursor(Qt::waitCursor); + + if(!myOkShape) { + QApplication::restoreOverrideCursor(); + return; + } + + GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; + ListOfID->length(0); + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(myShapeIOR); + if(theObj->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + QApplication::restoreOverrideCursor(); + return; + } + try { - BRepFilletAPI_MakeFillet fill(myShape); - switch (myConstructorId) - { - case 0: /* Fillet All */ - { - TopExp_Explorer Exp (myShape, TopAbs_EDGE); - for(Exp; Exp.More(); Exp.Next()) { - TopoDS_Edge E = TopoDS::Edge(Exp.Current()); - fill.Add(E); - } - for(int i = 1;i<=fill.NbContours();i++) - fill.SetRadius(myRadius,i); - - tds = fill.Shape(); - break; - } - } - if(!tds.IsNull()) { - mySimulationTopoDs = tds; - myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + if(myRadius <= Precision::Confusion()) { + QApplication::restoreOverrideCursor(); + return; + } + + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(myShapeIOR); + GEOM::GEOM_Shape_var result = myGeom->MakeFillet(aShape, myRadius, myShapeType, ListOfID); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QApplication::restoreOverrideCursor(); + return; } - } + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); + + mySimulationTopoDs = S; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } catch(Standard_Failure) { - myGeomBase->EraseSimulationShape(); - mySimulationTopoDs.Nullify(); + MESSAGE("Exception catched in MakePreview"); + QApplication::restoreOverrideCursor(); + return; } + QApplication::restoreOverrideCursor(); return; } diff --git a/src/OperationGUI/OperationGUI_FilletDlg.h b/src/OperationGUI/OperationGUI_FilletDlg.h index 2af0f0bb6..76fbab6f5 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.h +++ b/src/OperationGUI/OperationGUI_FilletDlg.h @@ -57,7 +57,6 @@ private : OperationGUI* myOperationGUI; - double step; int myConstructorId; /* Current constructor id = radio button id */ /* Interactive and local context management see also : bool myUseLocalContext() */ @@ -69,7 +68,6 @@ private : bool myOkShape; char* myShapeIOR; int myShapeType; - bool myOkRadius; double myRadius; DlgRef_1Sel1Spin* Group1; diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx index 396b18d81..add70022d 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.cxx +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -148,7 +148,7 @@ void OperationGUI_PartitionDlg::ClickOnOk() //================================================================================= void OperationGUI_PartitionDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(myOkListShapes || myOkListTools || myOkKeepShape || myOkRemoveShape) { GEOM::shape_type limit; diff --git a/src/PrimitiveGUI/Makefile.in b/src/PrimitiveGUI/Makefile.in index 634b377b9..d7407c810 100644 --- a/src/PrimitiveGUI/Makefile.in +++ b/src/PrimitiveGUI/Makefile.in @@ -55,21 +55,15 @@ LIB_MOC = \ PrimitiveGUI_TorusDlg.h \ PrimitiveGUI_ConeDlg.h -LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ +LIB_CLIENT_IDL = LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lGEOMFiltersSelection -lGEOMBase @CONCLUDE@ diff --git a/src/PrimitiveGUI/PrimitiveGUI.cxx b/src/PrimitiveGUI/PrimitiveGUI.cxx index dca1f3a2b..343759a6a 100644 --- a/src/PrimitiveGUI/PrimitiveGUI.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI.cxx @@ -68,7 +68,7 @@ bool PrimitiveGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { PrimitiveGUI* aPrimitiveGUI = new PrimitiveGUI(); aPrimitiveGUI->myGeomGUI->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(aPrimitiveGUI->myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); switch (theCommandID) { case 4021: // BOX @@ -116,7 +116,7 @@ void PrimitiveGUI::MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2) GEOM::GEOM_Shape_var box = myGeom->MakeBox(P1.X(), P1.Y(), P1.Z(), P2.X(), P2.Y(), P2.Z()); box->NameType(tr("GEOM_BOX")); if(myGeomBase->Display(box)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -141,12 +141,12 @@ void PrimitiveGUI::MakeCylinderAndDisplay(const gp_Pnt BasePoint, const gp_Dir a GEOM::GEOM_Shape_var result = myGeom->MakeCylinder(pstruct, dstruct, Radius, aHeight); if (result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } result->NameType(tr("GEOM_CYLINDER")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -168,7 +168,7 @@ void PrimitiveGUI::MakeSphereAndDisplay(const gp_Pnt aCenterPoint, const double GEOM::GEOM_Shape_ptr result = myGeom->MakeSphere(aCenterPoint.X(),aCenterPoint.Y(),aCenterPoint.Z(), aRadius); result->NameType(tr("GEOM_SPHERE")); if (myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch (const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -194,12 +194,12 @@ void PrimitiveGUI::MakeTorusAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir GEOM::GEOM_Shape_var result = myGeom->MakeTorus(pstruct, dstruct, Radius1, Radius2); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } result->NameType(tr("GEOM_TORUS")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -225,12 +225,12 @@ void PrimitiveGUI::MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir, GEOM::GEOM_Shape_var result = myGeom->MakeCone(pstruct, dstruct, Radius1, Radius2, aHeight); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } result->NameType(tr("GEOM_CONE")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index f7eb0458a..39e12f88c 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -221,7 +221,7 @@ void PrimitiveGUI_BoxDlg::ClickOnOk() //================================================================================= void PrimitiveGUI_BoxDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index b7af6b4e3..480eca52d 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -29,6 +29,7 @@ using namespace std; #include "PrimitiveGUI_ConeDlg.h" +#include #include #include #include @@ -246,7 +247,7 @@ void PrimitiveGUI_ConeDlg::ClickOnOk() //================================================================================= void PrimitiveGUI_ConeDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index 4e6b300ed..b1431b950 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -29,6 +29,7 @@ using namespace std; #include "PrimitiveGUI_CylinderDlg.h" +#include #include #include #include @@ -233,7 +234,7 @@ void PrimitiveGUI_CylinderDlg::ClickOnOk() //================================================================================= void PrimitiveGUI_CylinderDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx index fcdad43fc..a26177ca1 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -205,7 +205,7 @@ void PrimitiveGUI_SphereDlg::ClickOnOk() //================================================================================= void PrimitiveGUI_SphereDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index 9a5d1bce2..e67d4ae54 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -29,6 +29,7 @@ using namespace std; #include "PrimitiveGUI_TorusDlg.h" +#include #include #include #include "QAD_Config.h" @@ -229,7 +230,7 @@ void PrimitiveGUI_TorusDlg::ClickOnOk() //================================================================================= void PrimitiveGUI_TorusDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/RepairGUI/Makefile.in b/src/RepairGUI/Makefile.in index 10100b0c2..3b4d328f1 100644 --- a/src/RepairGUI/Makefile.in +++ b/src/RepairGUI/Makefile.in @@ -53,21 +53,15 @@ LIB_MOC = \ RepairGUI_SuppressFacesDlg.h \ RepairGUI_SuppressHoleDlg.h -LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ +LIB_CLIENT_IDL = LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lDlgRef -lGEOMContext -lGEOMBase -lDisplayGUI -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lDisplayGUI @CONCLUDE@ diff --git a/src/RepairGUI/RepairGUI.cxx b/src/RepairGUI/RepairGUI.cxx index 0284c6dcd..0c456bdd7 100644 --- a/src/RepairGUI/RepairGUI.cxx +++ b/src/RepairGUI/RepairGUI.cxx @@ -70,7 +70,7 @@ bool RepairGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { RepairGUI* myRepairGUI = new RepairGUI(); myRepairGUI->myGeomGUI->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(myRepairGUI->myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); switch (theCommandID) { @@ -87,8 +87,8 @@ bool RepairGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) case 603: // SUPPRESS FACES : use ic { Handle(AIS_InteractiveContext) ic; - if(myRepairGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myRepairGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); ic = v3d->getAISContext(); } RepairGUI_SuppressFacesDlg *aDlg = new RepairGUI_SuppressFacesDlg(parent, "", myRepairGUI, Sel, ic); @@ -97,8 +97,8 @@ bool RepairGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) case 604: // SUPPRESS HOLES : use ic { Handle(AIS_InteractiveContext) ic; - if(myRepairGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myRepairGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); ic = v3d->getAISContext(); } RepairGUI_SuppressHoleDlg *aDlg = new RepairGUI_SuppressHoleDlg(parent, "", myRepairGUI, Sel, ic); @@ -124,7 +124,7 @@ void RepairGUI::MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, try { GEOM::GEOM_Shape_var result = myGeom->MakeSewing(listShapesIOR, precision); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } @@ -134,7 +134,7 @@ void RepairGUI::MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, result->NameType(type); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); return; } catch(const SALOME::SALOME_Exception& S_ex) { @@ -153,12 +153,12 @@ void RepairGUI::MakeOrientationChangeAndDisplay(GEOM::GEOM_Shape_ptr Shape) try { GEOM::GEOM_Shape_var result = myGeom->OrientationChange(Shape); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } result->NameType(Shape->NameType()); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); return; } catch(const SALOME::SALOME_Exception& S_ex) { @@ -181,7 +181,7 @@ bool RepairGUI::OnSuppressHole(const char* ShapeTopoIOR, const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace) { /* Test the type of viewer */ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) return false; try { @@ -194,7 +194,7 @@ bool RepairGUI::OnSuppressHole(const char* ShapeTopoIOR, aResult->NameType(type); if(myGeomBase->Display(aResult)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -212,7 +212,7 @@ bool RepairGUI::OnSuppressHolesInFaceOrShell(const char* ShapeTopoIOR, const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires) { /* Test the type of viewer */ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; try { @@ -225,7 +225,7 @@ bool RepairGUI::OnSuppressHolesInFaceOrShell(const char* ShapeTopoIOR, aResult->NameType(type); if(myGeomBase->Display(aResult)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -243,17 +243,17 @@ bool RepairGUI::OnSuppressFaces(const TopoDS_Shape& ShapeTopo, const char* Shape const Standard_Integer& aLocalContextId, bool& myUseLocalContext) { /* Test the type of viewer */ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); if(theObj->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); return false; } - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); if(myUseLocalContext == false) { @@ -320,12 +320,12 @@ bool RepairGUI::OnSuppressFaces(const TopoDS_Shape& ShapeTopo, const char* Shape /* Display with name */ if(!myGeomBase->Display(aShellOrFace, nameG)) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return false; } } - myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_READY")); + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY")); return true; } diff --git a/src/RepairGUI/RepairGUI_FillingHoleDlg.cxx b/src/RepairGUI/RepairGUI_FillingHoleDlg.cxx index 9e26e9498..904e9d156 100644 --- a/src/RepairGUI/RepairGUI_FillingHoleDlg.cxx +++ b/src/RepairGUI/RepairGUI_FillingHoleDlg.cxx @@ -265,7 +265,7 @@ void GeometryGUI_FillingHoleDlg::ClickOnOk() void GeometryGUI_FillingHoleDlg::ClickOnApply() { bool testResult = false ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; + QAD_Application::getDesktop()->putInfo( tr("") ) ; switch(myConstructorId) { @@ -275,10 +275,10 @@ void GeometryGUI_FillingHoleDlg::ClickOnApply() testResult = myGeomGUI->OnFillingHole( myShape, myShapeIOR, myLocalContextId, myUseLocalContext ) ; } if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("Operation aborted")) ; + QAD_Application::getDesktop()->putInfo(tr("Operation aborted")) ; } else { - myGeomGUI->GetDesktop()->putInfo(tr("Operation done")); + QAD_Application::getDesktop()->putInfo(tr("Operation done")); } /* Reset arguments to allow a new selection */ this->ResetStateOfDialog() ; @@ -334,7 +334,7 @@ void GeometryGUI_FillingHoleDlg::SelectionIntoArgument() return ; // if( !IO->hasEntry() ) { -// myGeomGUI->GetDesktop()->putInfo(tr("Main shape must be in the study before")) ; +// QAD_Application::getDesktop()->putInfo(tr("Main shape must be in the study before")) ; // return ; // } @@ -351,7 +351,7 @@ void GeometryGUI_FillingHoleDlg::SelectionIntoArgument() } if ( IO->hasEntry() ) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() ); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeIOR_var anIOR; @@ -492,7 +492,7 @@ void GeometryGUI_FillingHoleDlg::ActivateUserSelection() if( !this->myOkShape ) { this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("Select main shape first")) ; + QAD_Application::getDesktop()->putInfo(tr("Select main shape first")) ; return ; } @@ -509,7 +509,7 @@ void GeometryGUI_FillingHoleDlg::ActivateUserSelection() TopAbs_ShapeEnum aType = TopAbs_EDGE ; myGeomGUI->PrepareSubShapeSelection( int(aType), this->myLocalContextId ) ; myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("Select edges to fill an hole and click on Ok/Apply")) ; + QAD_Application::getDesktop()->putInfo(tr("Select edges to fill an hole and click on Ok/Apply")) ; } return ; } diff --git a/src/RepairGUI/RepairGUI_OrientationDlg.cxx b/src/RepairGUI/RepairGUI_OrientationDlg.cxx index 93c427d4e..7b877f19e 100644 --- a/src/RepairGUI/RepairGUI_OrientationDlg.cxx +++ b/src/RepairGUI/RepairGUI_OrientationDlg.cxx @@ -30,29 +30,12 @@ using namespace std; #include "RepairGUI_OrientationDlg.h" #include -#include "QAD_Config.h" - #include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - //================================================================================= // class : RepairGUI_OrientationDlg() // purpose : Constructs a RepairGUI_OrientationDlg which is a child of 'parent', with the @@ -60,122 +43,43 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_OrientationDlg::RepairGUI_OrientationDlg( QWidget* parent, const char* name, RepairGUI* theRepairGUI, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +RepairGUI_OrientationDlg::RepairGUI_OrientationDlg(QWidget* parent, const char* name, RepairGUI* theRepairGUI, SALOME_Selection* Sel, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_ORIENTATION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - if ( !name ) - setName( "RepairGUI_OrientationDlg" ); - resize( 303, 242 ); - setCaption( tr( "GEOM_ORIENTATION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - RepairGUI_OrientationDlgLayout = new QGridLayout( this ); - RepairGUI_OrientationDlgLayout->setSpacing( 6 ); - RepairGUI_OrientationDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_ORIENTATION" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - RepairGUI_OrientationDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - RepairGUI_OrientationDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - /* Spin box construction */ - SpinBox_C1A2 = new DlgRef_SpinBox( GroupC1, "GeomSpinBox_C1A2" ) ; - GroupC1Layout->addWidget( SpinBox_C1A2, 1, 2 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_VECTOR_LENGTH" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - CheckBoxReverse = new QCheckBox( GroupC1, "CheckBoxReverse" ); - CheckBoxReverse->setText( tr( "GEOM_ORIENTATION_OPT" ) ); - GroupC1Layout->addMultiCellWidget( CheckBoxReverse, 2, 2, 0, 2 ); - RepairGUI_OrientationDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - myRepairGUI = theRepairGUI; - Init(Sel) ; /* Initialisations */ - + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_ORIENTATION"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_ORIENTATION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_ORIENTATION")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel1Spin1Check(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR_LENGTH")); + GroupPoints->CheckButton1->setText(tr("GEOM_ORIENTATION_OPT")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myRepairGUI = theRepairGUI; + Init(); } + //================================================================================= // function : ~RepairGUI_OrientationDlg() // purpose : Destroys the object and frees any allocated resources //================================================================================= RepairGUI_OrientationDlg::~RepairGUI_OrientationDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, Qt does it all for us } @@ -183,254 +87,145 @@ RepairGUI_OrientationDlg::~RepairGUI_OrientationDlg() // function : Init() // purpose : //================================================================================= -void RepairGUI_OrientationDlg::Init( SALOME_Selection* Sel ) +void RepairGUI_OrientationDlg::Init() { + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C1A2->SetValue( 25.0 ) ; /* = myLength */ + myLength = 25.0; + myOkShape = false; - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - CheckBoxReverse->setChecked( FALSE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomBase = new GEOMBase() ; - myGeomGUI = GEOMContext::GetGeomGUI() ; + double SpecificStep = 10; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + GroupPoints->SpinBox_DX->SetValue(myLength); - myLength = 25.0 ; - myOkShape = false ; - myOkLength = true; - mySimulationTopoDs.Nullify() ; - myShape.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - // TODO : previous selection into argument ? + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); - /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( CheckBoxReverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseOrientation(int) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomBase->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} + connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseAngle(int))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + /* displays Dialog */ + GroupPoints->show(); + this->show(); -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void RepairGUI_OrientationDlg::ConstructorsClicked(int constructorId) -{ - return ; + return; } + //================================================================================= // function : ClickOnOk() // purpose : //================================================================================= void RepairGUI_OrientationDlg::ClickOnOk() { - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; + this->ClickOnApply(); + ClickOnCancel(); + return; } + //================================================================================= // function : ClickOnApply() // purpose : //================================================================================= void RepairGUI_OrientationDlg::ClickOnApply() { - /* Leave simulation display in this method ! */ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if(myOkShape && CheckBoxReverse->isChecked() && myOkLength == true ) { - myRepairGUI->MakeOrientationChangeAndDisplay( myGeomShape ) ; - CheckBoxReverse->setChecked( FALSE ); - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void RepairGUI_OrientationDlg::ClickOnCancel() -{ - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void RepairGUI_OrientationDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else - return ; - - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - const QString objectUserName = myEditCurrentArgument->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkShape && GroupPoints->CheckButton1->isChecked()) { + myRepairGUI->MakeOrientationChangeAndDisplay(myGeomShape); + GroupPoints->CheckButton1->setChecked(FALSE); } - return ; + return; } - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection as changed or other case //================================================================================= void RepairGUI_OrientationDlg::SelectionIntoArgument() { - myGeomBase->EraseSimulationShape() ; - this->mySimulationTopoDs.Nullify() ; - - /* Name of future selection */ - QString aString = ""; - - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - this->myOkShape = false ; - } - return ; - } + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ - /* nbSel == 1 ! */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) - return ; - - /* Constructor */ - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - LineEditC1A1->setText(aString) ; - myShape = S ; - myOkShape = true ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkShape = false; + return; } - - if( myOkShape && myOkLength ) { - MakeOrientationSimulationAndDisplay( this->myShape, this->myLength ) ; + + // nbSel == 1 + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myEditCurrentArgument->setText(aString); + myShape = S; + myOkShape = true; } - return ; + + if(myOkShape) + this->MakeOrientationSimulationAndDisplay(); + return; } //================================================================================= -// function : SetEditCurrentArgument() +// function : LineEditReturnPressed() // purpose : //================================================================================= -void RepairGUI_OrientationDlg::SetEditCurrentArgument() +void RepairGUI_OrientationDlg::LineEditReturnPressed() { - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1 ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else + return; -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void RepairGUI_OrientationDlg::ValueChangedInSpinBox( double newValue ) -{ - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QObject* send = (QObject*)sender() ; - if( send == SpinBox_C1A2 ) { - this->myLength = newValue ; - myOkLength = true ; - } - - if ( myConstructorId == 0 && myOkShape && myOkLength == true ) { - MakeOrientationSimulationAndDisplay( this->myShape, this->myLength ) ; - } - return ; + GEOMBase_Skeleton::LineEditReturnPressed(); + return; } //================================================================================= -// function : DeactivateActiveDialog() +// function : SetEditCurrentArgument() // purpose : //================================================================================= -void RepairGUI_OrientationDlg::DeactivateActiveDialog() +void RepairGUI_OrientationDlg::SetEditCurrentArgument() { - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - GroupC1->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomBase->EraseSimulationShape() ; + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; } - return ; + this->SelectionIntoArgument(); + + return; } @@ -440,17 +235,13 @@ void RepairGUI_OrientationDlg::DeactivateActiveDialog() //================================================================================= void RepairGUI_OrientationDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - GroupC1->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; } @@ -460,147 +251,150 @@ void RepairGUI_OrientationDlg::ActivateThisDialog() //================================================================================= void RepairGUI_OrientationDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } - //================================================================================= -// function : closeEvent() +// function : ValueChangedInSpinBox() // purpose : //================================================================================= -void RepairGUI_OrientationDlg::closeEvent( QCloseEvent* e ) +void RepairGUI_OrientationDlg::ValueChangedInSpinBox(double newValue) { - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; + myLength = newValue; + if(myOkShape) + this->MakeOrientationSimulationAndDisplay(); + return; } - -//=========================================================================================== +//================================================================================= // function : ReverseOrientation() // purpose : -//=========================================================================================== -void RepairGUI_OrientationDlg::ReverseOrientation(int state) +//================================================================================= +void RepairGUI_OrientationDlg::ReverseAngle(int state) { - if( this->myOkShape && myOkLength == true ) { - MakeOrientationSimulationAndDisplay( this->myShape, this-> myLength ) ; - } - return ; + if(myOkShape) + this->MakeOrientationSimulationAndDisplay(); + return; } -//=========================================================================================== +//================================================================================== // function : MakeOrientationSimulationAndDisplay() // purpose : Create 'aCompound1' and 'aCompound2' each contains edges oriented // : respectively FORWARD and REVERSE for all faces of 'aTopoDS' // : These edges represent normal vectors on faces of 'aTopoDS' // : For a unique edge an arrow is displayed to show its orientation. -//=========================================================================================== -void RepairGUI_OrientationDlg::MakeOrientationSimulationAndDisplay(const TopoDS_Shape& aTopoDS, Standard_Real length ) +//================================================================================== +void RepairGUI_OrientationDlg::MakeOrientationSimulationAndDisplay() { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); - TopoDS_Compound aCompound1, aCompound2 ; - TopoDS_Compound NullComp ; + TopoDS_Compound aCompound1, aCompound2; + TopoDS_Compound NullComp; BRep_Builder aBuilder1, aBuilder2; - aCompound1 = aCompound2 = NullComp ; - aBuilder1.MakeCompound(aCompound1) ; - aBuilder2.MakeCompound(aCompound2) ; - - if( aTopoDS.IsNull() ) - return ; + aCompound1 = aCompound2 = NullComp; + aBuilder1.MakeCompound(aCompound1); + aBuilder2.MakeCompound(aCompound2); - /* Case of an edge */ - if( aTopoDS.ShapeType() == TopAbs_EDGE ) { - /* Try to display a cone simulation shape to show direction of edge */ - TopoDS_Shape tmpShape = aTopoDS ; - if( this->CheckBoxReverse->isChecked() ) { - if( aTopoDS.Orientation() == TopAbs_FORWARD) - tmpShape.Orientation(TopAbs_REVERSED) ; - else - tmpShape.Orientation(TopAbs_FORWARD) ; - } - if( myGeomBase->CreateArrowForLinearEdge( tmpShape, mySimulationTopoDs ) ) { - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; + if(myShape.IsNull()) + return; + + try { + /* Case of an edge */ + if(myShape.ShapeType() == TopAbs_EDGE) { + /* Try to display a cone simulation shape to show direction of edge */ + TopoDS_Shape tmpShape = myShape ; + if(GroupPoints->CheckButton1->isChecked()) { + if(myShape.Orientation() == TopAbs_FORWARD) + tmpShape.Orientation(TopAbs_REVERSED); + else + tmpShape.Orientation(TopAbs_FORWARD); + } + if(myGeomBase->CreateArrowForLinearEdge(tmpShape, mySimulationTopoDs)) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; } - return ; - } - - gp_Pnt P1, P2 ; - gp_Vec V, V1, V2 ; - TopExp_Explorer ex( aTopoDS, TopAbs_FACE ); - int test = 0 ; - while (ex.More()) { - - const TopoDS_Face& F = TopoDS::Face(ex.Current()); - /* find the center of the minmax */ - BRepAdaptor_Surface SF(F); - Standard_Real u, v, x; + gp_Pnt P1, P2 ; + gp_Vec V, V1, V2; + TopExp_Explorer ex(myShape, TopAbs_FACE); + int test = 0; + while(ex.More()) { + const TopoDS_Face& F = TopoDS::Face(ex.Current()); + /* find the center of the minmax */ + BRepAdaptor_Surface SF(F); + Standard_Real u, v, x; - u = SF.FirstUParameter(); - x = SF.LastUParameter(); - if ( Precision::IsInfinite(u) ) { - if( Precision::IsInfinite(x) ) u = 0.0 ; else u = x ; - } - else if ( !Precision::IsInfinite(x) ) - u = (u+x) / 2.0 ; + u = SF.FirstUParameter(); + x = SF.LastUParameter(); + if(Precision::IsInfinite(u)) { + if(Precision::IsInfinite(x)) + u = 0.0; + else + u = x; + } + else if(!Precision::IsInfinite(x)) + u = (u+x) / 2.0; - v = SF.FirstVParameter(); - x = SF.LastVParameter(); - if ( Precision::IsInfinite(v) ) { - if ( Precision::IsInfinite(x) ) v = 0.0 ; else v = x ; - } - else if ( !Precision::IsInfinite(x) ) - v = (v+x) / 2.0 ; + v = SF.FirstVParameter(); + x = SF.LastVParameter(); + if(Precision::IsInfinite(v)) { + if(Precision::IsInfinite(x)) + v = 0.0; + else + v = x; + } + else if(!Precision::IsInfinite(x)) + v = (v+x) / 2.0; - SF.D1( u, v, P1, V1, V2 ); - V = V1.Crossed(V2); - x = V.Magnitude(); - if ( x > 1.e-10 ) - V.Multiply( length/x ); - else { - V.SetCoord( length/2.0, 0.0, 0.0 ) ; - MESSAGE ("Null normal in Orientation " << endl ) ; - } + SF.D1(u, v, P1, V1, V2); + V = V1.Crossed(V2); + x = V.Magnitude(); + if(x > 1.e-10) + V.Multiply(myLength/x); + else { + V.SetCoord(myLength/2.0, 0.0, 0.0); + MESSAGE ("Null normal in Orientation " << endl); + } - P2 = P1; - /* test orientation of each face and displays forward (aCompound1) */ - if( F.Orientation() == TopAbs_FORWARD ) - P2.Translate(V); - else - P2.Translate(-V) ; - BRepBuilderAPI_MakeEdge anEdge(P1, P2) ; - aBuilder1.Add( aCompound1, anEdge ) ; + P2 = P1; + /* test orientation of each face and displays forward (aCompound1) */ + if(F.Orientation() == TopAbs_FORWARD) + P2.Translate(V); + else + P2.Translate(-V); + BRepBuilderAPI_MakeEdge anEdge(P1, P2); + aBuilder1.Add(aCompound1, anEdge); - P2 = P1; - /* test orientation of each face and displays forward (aCompound2) */ - if( F.Orientation() == TopAbs_FORWARD ) - P2.Translate(-V); - else - P2.Translate(V) ; - anEdge = BRepBuilderAPI_MakeEdge(P1, P2) ; - aBuilder2.Add( aCompound2, anEdge ) ; + P2 = P1; + /* test orientation of each face and displays forward (aCompound2) */ + if(F.Orientation() == TopAbs_FORWARD) + P2.Translate(-V); + else + P2.Translate(V); + anEdge = BRepBuilderAPI_MakeEdge(P1, P2); + aBuilder2.Add(aCompound2, anEdge); - ex.Next(); - test++ ; - } + ex.Next(); + test++; + } - /* display simulation compounds */ - if( test > 0 && this->CheckBoxReverse->isChecked() ) { - mySimulationTopoDs = aCompound1 ; + /* display simulation compounds */ + if(test > 0 && GroupPoints->CheckButton1->isChecked()) + mySimulationTopoDs = aCompound1; + else if(test > 0 && !GroupPoints->CheckButton1->isChecked()) + mySimulationTopoDs = aCompound2; + + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } - else if ( test > 0 && !CheckBoxReverse->isChecked() ) { - mySimulationTopoDs = aCompound2 ; - } - if(!mySimulationTopoDs.IsNull() ) - myGeomBase->DisplaySimulationShape(mySimulationTopoDs) ; - - return ; + catch(Standard_Failure) + MESSAGE("Exception catched in MakeOrientationSimulationAndDisplay"); + return; } diff --git a/src/RepairGUI/RepairGUI_OrientationDlg.h b/src/RepairGUI/RepairGUI_OrientationDlg.h index 79e4f93df..49f54a5da 100644 --- a/src/RepairGUI/RepairGUI_OrientationDlg.h +++ b/src/RepairGUI/RepairGUI_OrientationDlg.h @@ -29,94 +29,47 @@ #ifndef DIALOGBOX_ORIENTATION_H #define DIALOGBOX_ORIENTATION_H -#include "RepairGUI.h" - -#include "DlgRef_SpinBox.h" - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel1Spin1Check.h" +#include "RepairGUI.h" //================================================================================= // class : DialogBox_ORIENTATION // purpose : //================================================================================= -class RepairGUI_OrientationDlg : public QDialog +class RepairGUI_OrientationDlg : public GEOMBase_Skeleton { Q_OBJECT public: - RepairGUI_OrientationDlg( QWidget* parent = 0, const char* name = 0, RepairGUI* theRepairGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + RepairGUI_OrientationDlg(QWidget* parent = 0, const char* name = 0, RepairGUI* theRepairGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~RepairGUI_OrientationDlg(); private : - RepairGUI* myRepairGUI; - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GEOMBase* myGeomBase ; /* Current GeomGUI object */ - GEOMContext* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - SALOME_Selection* mySelection ; /* User shape selection */ - GEOM::GEOM_Shape_var myGeomShape ; /* is myShape */ - TopoDS_Shape myShape ; /* topology used */ - Standard_Real myLength ; /* to simulate normal vector */ - bool myOkShape ; - bool myOkLength ; - QDoubleValidator *myVa ; /* Double validator for numeric input */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ + void Init(); + void enterEvent(QEvent* e); + void MakeOrientationSimulationAndDisplay(); - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeOrientationSimulationAndDisplay( const TopoDS_Shape& aTopoDS, Standard_Real length ) ; + RepairGUI* myRepairGUI; - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - DlgRef_SpinBox* SpinBox_C1A2 ; + GEOM::GEOM_Shape_var myGeomShape; /* is myShape */ + TopoDS_Shape myShape; /* topology used */ + Standard_Real myLength; /* to simulate normal vector */ + bool myOkShape; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QCheckBox* CheckBoxReverse; + DlgRef_1Sel1Spin1Check* GroupPoints; private slots: - - void ConstructorsClicked(int constructorId); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ReverseOrientation(int state) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ReverseAngle(int state); + void ValueChangedInSpinBox(double newValue); - QGridLayout* RepairGUI_OrientationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; }; #endif // DIALOGBOX_ORIENTATION_H diff --git a/src/RepairGUI/RepairGUI_SewingDlg.cxx b/src/RepairGUI/RepairGUI_SewingDlg.cxx index 3404d99ca..2cc0e2066 100644 --- a/src/RepairGUI/RepairGUI_SewingDlg.cxx +++ b/src/RepairGUI/RepairGUI_SewingDlg.cxx @@ -134,7 +134,7 @@ void RepairGUI_SewingDlg::ClickOnOk() //================================================================================= void RepairGUI_SewingDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if(myOkListShapes) myRepairGUI->MakeSewingAndDisplay(myListShapes, myPrecision); return; diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx index 9112eee7a..e7923e8e2 100644 --- a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx @@ -30,21 +30,8 @@ using namespace std; #include "RepairGUI_SuppressFacesDlg.h" #include "DisplayGUI.h" - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "QAD_RightFrame.h" +#include "OCCViewer_Viewer3d.h" //================================================================================= // class : RepairGUI_SuppressFacesDlg() @@ -53,119 +40,32 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_SuppressFacesDlg::RepairGUI_SuppressFacesDlg( QWidget* parent, - const char* name, - RepairGUI* theRepairGUI, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - bool modal, - WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +RepairGUI_SuppressFacesDlg::RepairGUI_SuppressFacesDlg(QWidget* parent, const char* name, RepairGUI* theRepairGUI, SALOME_Selection* Sel, Handle(AIS_InteractiveContext) ic, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SUPRESS_FACE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUPRESS_FACE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); - if ( !name ) - setName( "RepairGUI_SuppressFacesDlg" ); - resize( 322, 203 ); - setCaption( tr( "GEOM_SUPRESSFACE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - RepairGUI_SuppressFacesDlgLayout = new QGridLayout( this ); - RepairGUI_SuppressFacesDlgLayout->setSpacing( 6 ); - RepairGUI_SuppressFacesDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SUPRESSFACE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - RepairGUI_SuppressFacesDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - Layout2 = new QHBoxLayout; - Layout2->setSpacing( 6 ); - Layout2->setMargin( 0 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - Layout2->addWidget( TextLabelC1A1 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - Layout2->addWidget( SelectButtonC1A1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setAlignment( int( QLineEdit::AlignLeft ) ); - Layout2->addWidget( LineEditC1A1 ); - GroupC1Layout->addLayout( Layout2, 0, 0 ); - CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" ); - CheckBox1->setText( tr( "GEOM_SUPRESSFACE_SELECT" ) ); - CheckBox1->setChecked( FALSE ); - GroupC1Layout->addWidget( CheckBox1, 1, 0 ); - RepairGUI_SuppressFacesDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupButtons->sizePolicy().hasHeightForWidth() ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - // - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_2, 0, 2 ); - buttonClose = new QPushButton( GroupButtons, "buttonClose" ); - buttonClose->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonClose->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonClose, 0, 3 ); - RepairGUI_SuppressFacesDlgLayout->addWidget( GroupButtons, 2, 0 ); - myRepairGUI = theRepairGUI; - /* Initialisations */ - Init(Sel, ic) ; - + setCaption(tr("GEOM_SUPRESSFACE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SUPRESSFACE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel1Check_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupPoints->CheckButton1->setText(tr("GEOM_SUPRESSFACE_SELECT")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myRepairGUI = theRepairGUI; + Init(ic); } @@ -175,69 +75,44 @@ RepairGUI_SuppressFacesDlg::RepairGUI_SuppressFacesDlg( QWidget* parent, //================================================================================= RepairGUI_SuppressFacesDlg::~RepairGUI_SuppressFacesDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, Qt does it all for us } - //================================================================================= // function : Init() // purpose : //================================================================================= -void RepairGUI_SuppressFacesDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) +void RepairGUI_SuppressFacesDlg::Init(Handle(AIS_InteractiveContext) ic) { + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myShape.Nullify() ; + myOkSelectSubMode = false; + myOkShape = myUseLocalContext = false; + myIC = ic; + myLocalContextId = -1; - myIC = ic ; - myUseLocalContext = false ; - myOkShape = false ; - myGeomBase = new GEOMBase() ; - myGeomGUI = GEOMContext::GetGeomGUI() ; - - /* Select sub shapes mode not checked */ - CheckBox1->setChecked( FALSE ); - myOkSelectSubMode = false ; + /* signals and slots connections */ + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); - // TODO : previous selection into argument ? + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( buttonClose, SIGNAL( clicked() ), this, SLOT( ClickOnClose() ) ); - connect( GroupConstructors, SIGNAL( clicked(int) ), this, SLOT( ConstructorsClicked(int) )); - - connect( SelectButtonC1A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() )); - connect( CheckBox1, SIGNAL( stateChanged(int) ), this, SLOT( ActivateUserSelection() )); - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() )); - connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnClose() )); - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomBase->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* display Dialog */ - return ; -} + connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ActivateUserSelection())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + /* displays Dialog */ + GroupPoints->show(); + this->show(); -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void RepairGUI_SuppressFacesDlg::ConstructorsClicked(int constructorId) -{ - return ; + return; } @@ -247,10 +122,9 @@ void RepairGUI_SuppressFacesDlg::ConstructorsClicked(int constructorId) //================================================================================= void RepairGUI_SuppressFacesDlg::ClickOnOk() { - this->ClickOnApply() ; - accept(); - - return ; + this->ClickOnApply(); + this->ClickOnCancel(); + return; } @@ -261,47 +135,41 @@ void RepairGUI_SuppressFacesDlg::ClickOnOk() //================================================================================= void RepairGUI_SuppressFacesDlg::ClickOnApply() { - bool testResult = false ; - switch(myConstructorId) - { - case 0 : - { - if( myOkShape && myOkSelectSubMode ) { - testResult = myRepairGUI->OnSuppressFaces( myShape, myShapeIOR, myLocalContextId, myUseLocalContext ) ; - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset arguments to allow a new selection */ - this->ResetStateOfDialog() ; - break ; - } - } + QAD_Application::getDesktop()->putInfo(tr("")); + bool testResult = false; + + if(myOkShape && myOkSelectSubMode) + testResult = myRepairGUI->OnSuppressFaces(myShape, myShapeIOR, myLocalContextId, myUseLocalContext); + + if(!testResult) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + else + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + + /* Reset arguments to allow a new selection */ + this->ResetStateOfDialog(); return ; } - //================================================================================= -// function : ClickOnClose() +// function : ClickOnCancel() // purpose : //================================================================================= -void RepairGUI_SuppressFacesDlg::ClickOnClose() +void RepairGUI_SuppressFacesDlg::ClickOnCancel() { - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - - if(myUseLocalContext) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true) ; + myDisplayGUI->OnDisplayAll(true); } - reject() ; - return ; + GEOMBase_Skeleton::ClickOnCancel(); + return; } @@ -312,59 +180,57 @@ void RepairGUI_SuppressFacesDlg::ClickOnClose() //================================================================================= void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() { - - /* Reset argument and local context when selection as changed */ - this->ResetStateOfDialog() ; - + myEditCurrentArgument->setText(""); + this->ResetStateOfDialog(); QString aString = ""; /* name of selection */ - - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) - return ; + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + myOkShape = false; + return; + } /* nbSel == 1 */ - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) - return ; + TopoDS_Shape S; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; - if( !IO->hasEntry() ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ; - return ; + if(!IO->hasEntry()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return; } - + /* Test the exact type of topology to suppress faces into */ - if ( !S.IsNull() && ( S.ShapeType() == TopAbs_SOLID || S.ShapeType() == TopAbs_SHELL || S.ShapeType() == TopAbs_COMPOUND ) ) { - - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); + if(!S.IsNull() && (S.ShapeType() == TopAbs_SOLID || S.ShapeType() == TopAbs_SHELL || S.ShapeType() == TopAbs_COMPOUND)) { + if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { + Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IO); myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ - LineEditC1A1->setText(aString) ; - myShape = S ; - myOkShape = true ; + myEditCurrentArgument->setText(aString); + myShape = S; + myOkShape = true; return; } - if ( IO->hasEntry() ) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() ); + if(IO->hasEntry()) { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if ( !obj->_is_nil() ) { - if (obj->FindAttribute(anAttr, "AttributeIOR")) { + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - LineEditC1A1->setText(aString) ; + myOkShape = true; + myShape = S; + myEditCurrentArgument->setText(aString); return; } } } } - return ; + return; } @@ -375,19 +241,14 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() void RepairGUI_SuppressFacesDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - SelectionIntoArgument() ; - } - break; - } - } - return ; + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + this->SelectionIntoArgument(); + + return; } @@ -397,7 +258,14 @@ void RepairGUI_SuppressFacesDlg::SetEditCurrentArgument() //================================================================================= void RepairGUI_SuppressFacesDlg::LineEditReturnPressed() { - return ; + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; } @@ -407,20 +275,11 @@ void RepairGUI_SuppressFacesDlg::LineEditReturnPressed() //================================================================================= void RepairGUI_SuppressFacesDlg::DeactivateActiveDialog() { - if ( GroupConstructors->isEnabled() ) { - - this->ResetStateOfDialog() ; - - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true) ; + if(GroupConstructors->isEnabled()) { + this->ResetStateOfDialog(); + GEOMBase_Skeleton::DeactivateActiveDialog(); } - return ; + return; } @@ -430,14 +289,9 @@ void RepairGUI_SuppressFacesDlg::DeactivateActiveDialog() //================================================================================= void RepairGUI_SuppressFacesDlg::ActivateThisDialog() { - /* Emit a signal to deactivate other active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - return ; + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; } @@ -447,10 +301,10 @@ void RepairGUI_SuppressFacesDlg::ActivateThisDialog() //================================================================================= void RepairGUI_SuppressFacesDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } @@ -458,11 +312,11 @@ void RepairGUI_SuppressFacesDlg::enterEvent(QEvent* e) // function : closeEvent() // purpose : //================================================================================= -void RepairGUI_SuppressFacesDlg::closeEvent( QCloseEvent* e ) +void RepairGUI_SuppressFacesDlg::closeEvent(QCloseEvent* e) { /* same than click on cancel button */ - this->ClickOnClose() ; - return ; + this->ClickOnCancel(); + return; } @@ -472,34 +326,37 @@ void RepairGUI_SuppressFacesDlg::closeEvent( QCloseEvent* e ) //================================================================================= void RepairGUI_SuppressFacesDlg::ActivateUserSelection() { - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - if( !this->myOkShape ) { - this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ; - return ; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + if(!myOkShape) { + this->ResetStateOfDialog(); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")); + return; } - this->myOkSelectSubMode = CheckBox1->isChecked() ; + myOkSelectSubMode = GroupPoints->CheckButton1->isChecked(); - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true) ; + myDisplayGUI->OnDisplayAll(true); } - if( myOkShape && myOkSelectSubMode ) { + if(myOkShape && myOkSelectSubMode) { /* local context is defined into the method : 4 = FACES sub selection */ DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->PrepareSubShapeSelection( int(TopAbs_FACE), this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")) ; + myDisplayGUI->PrepareSubShapeSelection(int(TopAbs_FACE), myLocalContextId); + myUseLocalContext = true; + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")); } - } else { - CheckBox1->setChecked( false ); - } - - return ; + } + else + GroupPoints->CheckButton1->setChecked(false); + return; } @@ -510,19 +367,23 @@ void RepairGUI_SuppressFacesDlg::ActivateUserSelection() //================================================================================= void RepairGUI_SuppressFacesDlg::ResetStateOfDialog() { - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; + myOkShape = false ; + myEditCurrentArgument->setText(""); /* Select sub shapes mode not checked */ - this->myOkSelectSubMode = false ; - this->CheckBox1->setChecked( FALSE ); + myOkSelectSubMode = false; + GroupPoints->CheckButton1->setChecked(FALSE); /* Close its local contact if opened */ - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true) ; + myDisplayGUI->OnDisplayAll(true); } - return ; + return; } diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.h b/src/RepairGUI/RepairGUI_SuppressFacesDlg.h index e200493c9..4c92a694c 100644 --- a/src/RepairGUI/RepairGUI_SuppressFacesDlg.h +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.h @@ -29,102 +29,56 @@ #ifndef DIALOGBOX_SUPPRESSFACES_H #define DIALOGBOX_SUPPRESSFACES_H -#include "RepairGUI.h" - -#include -#include - -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel1Check_QTD.h" +#include "RepairGUI.h" //================================================================================= // class : RepairGUI_SuppressFacesDlg // purpose : //================================================================================= -class RepairGUI_SuppressFacesDlg : public QDialog +class RepairGUI_SuppressFacesDlg : public GEOMBase_Skeleton { Q_OBJECT public: - RepairGUI_SuppressFacesDlg( QWidget* parent = 0, - const char* name = 0, - RepairGUI* theRepairGUI = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); + RepairGUI_SuppressFacesDlg(QWidget* parent = 0, const char* name = 0, RepairGUI* theRepairGUI = 0, SALOME_Selection* Sel = 0, Handle(AIS_InteractiveContext) ic = 0, bool modal = FALSE, WFlags fl = 0); ~RepairGUI_SuppressFacesDlg(); private : - RepairGUI* myRepairGUI; - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void ResetStateOfDialog() ; - - /* Interactive and local context management see also : bool myUseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ + void Init(Handle(AIS_InteractiveContext) ic); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GEOMBase* myGeomBase ; /* Current GeomGUI object */ - GEOMContext* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ + void ResetStateOfDialog(); - TopoDS_Shape myShape ; - char* myShapeIOR ; - bool myOkShape ; + RepairGUI* myRepairGUI; - bool myOkSelectSubMode ; /* true = sub mode selection activated */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonApply; - QPushButton* buttonClose; + /* Interactive and local context management see also : bool myUseLocalContext() */ + Handle(AIS_InteractiveContext) myIC; /* Interactive context */ + Standard_Integer myLocalContextId; /* identify a local context used by this method */ + bool myUseLocalContext; /* true when this method as opened a local context */ - QCheckBox* CheckBox1; + TopoDS_Shape myShape; + char* myShapeIOR; + bool myOkShape; + bool myOkSelectSubMode; /* true = sub mode selection activated */ -private slots: + DlgRef_1Sel1Check_QTD* GroupPoints; - void ConstructorsClicked(int constructorId); +private slots: void ClickOnOk(); - void ClickOnApply() ; - void ClickOnClose(); - - void LineEditReturnPressed() ; - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ActivateUserSelection() ; + void ClickOnApply(); + void ClickOnCancel(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ActivateUserSelection(); -protected: - QGridLayout* RepairGUI_SuppressFacesDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QHBoxLayout* Layout2; - QGridLayout* GroupButtonsLayout; }; #endif // DIALOGBOX_SUPPRESSFACES_H diff --git a/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx b/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx index de49f47a7..f19590be2 100644 --- a/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx +++ b/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx @@ -401,7 +401,7 @@ void RepairGUI_SuppressHoleDlg::ClickOnOk() //================================================================================= void RepairGUI_SuppressHoleDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; + QAD_Application::getDesktop()->putInfo( tr("") ) ; bool testResult = false ; if( !myOkShape ) @@ -424,7 +424,7 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply() myDisplayGUI->OnDisplayAll(true) ;/* Display all objects so that next method using ic can memorize them */ if( !aTest || myListOfIdWire->length() != 1 ) { CheckBox2->setChecked(FALSE) ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; + QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; } else { myListOfIdEndFace->length(0) ; /* no end face */ @@ -442,7 +442,7 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply() myDisplayGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ if( !aTest || myListOfIdEndFace->length() != 1 ) { CheckBox3->setChecked(FALSE) ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; + QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; } else { QApplication::setOverrideCursor( Qt::waitCursor ); @@ -466,7 +466,7 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply() if( !aTest || myListOfIdWire->length() < 1 ) { CheckBoxC2_1->setChecked(FALSE) ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; + QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; } else { QApplication::setOverrideCursor( Qt::waitCursor ); @@ -480,9 +480,9 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply() if( !testResult ) - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; + QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; else - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_DONE") ) ; + QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_DONE") ) ; /* Reset arguments to allow a new selection */ this->ResetStateOfDialog() ; @@ -498,11 +498,11 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply() void RepairGUI_SuppressHoleDlg::ClickOnClose() { disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; + //myGeomGUI->ResetState() ; - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); + if ( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); // myIC = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); if(myUseLocalContext) { myIC->CloseLocalContext(myLocalContextId) ; this->myUseLocalContext = false ; @@ -560,7 +560,7 @@ void RepairGUI_SuppressHoleDlg::SelectionIntoArgument() } if ( IO->hasEntry() ) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() ); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeIOR_var anIOR; @@ -656,7 +656,7 @@ void RepairGUI_SuppressHoleDlg::DeactivateActiveDialog() GroupC2->setEnabled(false) ; GroupButtons->setEnabled(false) ; - myGeomGUI->ResetState() ; + //myGeomGUI->ResetState() ; myGeomGUI->SetActiveDialogBox(0) ; DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; @@ -719,13 +719,13 @@ void RepairGUI_SuppressHoleDlg::ActivateUserFaceSelection() { if( !this->myOkShape ) { this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_MAIN_OBJECT") ) ; + QAD_Application::getDesktop()->putInfo( tr("GEOM_MAIN_OBJECT") ) ; return ; } /* Test the viewer type VTK */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; + if ( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { + QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; this->ResetStateOfDialog() ; return; } @@ -736,7 +736,7 @@ void RepairGUI_SuppressHoleDlg::ActivateUserFaceSelection() DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->PrepareSubShapeSelection( int(TopAbs_FACE), this->myLocalContextId ) ; myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE") ) ; + QAD_Application::getDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE") ) ; } else { this->ResetPartial() ; @@ -756,13 +756,13 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWireSelection() if( !this->myOkShape ) { this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_MAIN_OBJECT") ) ; + QAD_Application::getDesktop()->putInfo(tr("GEOM_MAIN_OBJECT") ) ; return ; } /* Test the type of viewer VTK */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; + if ( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; this->ResetStateOfDialog() ; return; } @@ -777,7 +777,7 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWireSelection() if( !aTest || myListOfIdFace->length() != 1 ) { CheckBox1->setChecked(FALSE) ; myOkSelectFace = false ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; + QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; } else { myOkSelectFace = true ; @@ -797,7 +797,7 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWireSelection() DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->PrepareSubShapeSelectionArgumentShape( this->myFace, int(TopAbs_WIRE), this->myLocalContextId ) ; myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTWIRE") ) ; + QAD_Application::getDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTWIRE") ) ; } else { this->ResetPartial() ; @@ -818,13 +818,13 @@ void RepairGUI_SuppressHoleDlg::ActivateUserEndFaceSelection() if( !this->myOkShape ) { this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_MAIN_OBJECT") ) ; + QAD_Application::getDesktop()->putInfo(tr("GEOM_MAIN_OBJECT") ) ; return ; } /* Test the type of viewer VTK */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; + if ( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; this->ResetStateOfDialog() ; return; } @@ -840,7 +840,7 @@ void RepairGUI_SuppressHoleDlg::ActivateUserEndFaceSelection() if( !aTest || myListOfIdWire->length() != 1 ) { CheckBox2->setChecked(FALSE) ; CheckBox3->setChecked(FALSE) ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; + QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; return ; } } @@ -855,7 +855,7 @@ void RepairGUI_SuppressHoleDlg::ActivateUserEndFaceSelection() DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->PrepareSubShapeSelectionArgumentShape( this->myShape, int(TopAbs_FACE), this->myLocalContextId ) ; myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE_END") ) ; + QAD_Application::getDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE_END") ) ; } else { this->ResetPartial() ; @@ -877,13 +877,13 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWiresOnFaceShellSelection() if( !this->myOkShape ) { this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_MAIN_OBJECT") ) ; + QAD_Application::getDesktop()->putInfo(tr("GEOM_MAIN_OBJECT") ) ; return ; } /* Test the type of viewer VTK */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; + if ( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; this->ResetStateOfDialog() ; return; } @@ -893,7 +893,7 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWiresOnFaceShellSelection() DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->PrepareSubShapeSelectionArgumentShape( this->myShape, int(TopAbs_WIRE), this->myLocalContextId ) ; myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE") ) ; + QAD_Application::getDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE") ) ; } else { this->ResetPartial() ; @@ -966,9 +966,9 @@ void RepairGUI_SuppressHoleDlg::ResetPartial() myListOfIdEndFace->length(0) ; /* Close its local contact if opened */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); + if ( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); // myIC = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); if( this->myUseLocalContext ) { myIC->CloseLocalContext(this->myLocalContextId) ; this->myUseLocalContext = false ; @@ -989,10 +989,10 @@ void RepairGUI_SuppressHoleDlg::ResetPartial() bool RepairGUI_SuppressHoleDlg::GetIndexSubShapeSelected(const TopoDS_Shape& ShapeTopo, const int SubShapeType, GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID, Standard_Integer& aLocalContextId, bool& myUseLocalContext) { //* Test the type of viewer */ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); ic->InitSelected(); diff --git a/src/TransformationGUI/Makefile.in b/src/TransformationGUI/Makefile.in index 6901aa85a..bf544b577 100644 --- a/src/TransformationGUI/Makefile.in +++ b/src/TransformationGUI/Makefile.in @@ -57,21 +57,15 @@ LIB_MOC = \ TransformationGUI_MirrorDlg.h \ TransformationGUI_ScaleDlg.h -LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ - SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ +LIB_CLIENT_IDL = LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lGEOMFiltersSelection -lGEOMBase @CONCLUDE@ diff --git a/src/TransformationGUI/TransformationGUI.cxx b/src/TransformationGUI/TransformationGUI.cxx index 4efdc5ea2..54ea7d019 100644 --- a/src/TransformationGUI/TransformationGUI.cxx +++ b/src/TransformationGUI/TransformationGUI.cxx @@ -68,7 +68,7 @@ bool TransformationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { TransformationGUI* myTransformationGUI = new TransformationGUI(); myTransformationGUI->myGeomGUI->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(myTransformationGUI->myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); switch (theCommandID) { @@ -121,12 +121,12 @@ void TransformationGUI::MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, gp try { GEOM::GEOM_Shape_var result = myGeom->MakeTranslation(Shape, V.X(), V.Y(), V.Z()); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } result->NameType(Shape->NameType()); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -147,12 +147,12 @@ void TransformationGUI::MakeRotationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const dir.X(), dir.Y(), dir.Z()); GEOM::GEOM_Shape_var result = myGeom->MakeRotation(Shape, axis, angle); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return ; } result->NameType(Shape->NameType()); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -170,12 +170,12 @@ void TransformationGUI::MakeMirrorAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM:: try { GEOM::GEOM_Shape_var result = myGeom->MakeMirrorByPlane(Shape1, Shape2); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); return; } result->NameType(Shape1->NameType()); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -196,9 +196,9 @@ void TransformationGUI::MakeScaleAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp GEOM::GEOM_Shape_var result = myGeom->MakeScaleTransform(Shape, P, factor); result->NameType(Shape->NameType()); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); else - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -220,12 +220,12 @@ void TransformationGUI::MakeMultiTranslation1DAndDisplay(GEOM::GEOM_Shape_ptr Sh GEOM::GEOM_Shape_var result = myGeom->MakeMultiTranslation1D(Shape, dstruct, Step, NbTimes); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } result->NameType(tr("GEOM_COMPOUND")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -251,12 +251,12 @@ void TransformationGUI::MakeMultiTranslation2DAndDisplay(GEOM::GEOM_Shape_ptr Sh GEOM::GEOM_Shape_var result = myGeom->MakeMultiTranslation2D(Shape, dstruct1, Step1, NbTimes1, dstruct2, Step2, NbTimes2); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } result->NameType(tr("GEOM_COMPOUND")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -279,12 +279,12 @@ void TransformationGUI::MakeMultiRotation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape GEOM::GEOM_Shape_var result = myGeom->MakeMultiRotation1D(Shape, dstruct, pstruct, NbTimes); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } result->NameType(tr("GEOM_COMPOUND")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -309,12 +309,12 @@ void TransformationGUI::MakeMultiRotation2DAndDisplay(GEOM::GEOM_Shape_ptr Shape GEOM::GEOM_Shape_var result = myGeom->MakeMultiRotation2D(Shape, dstruct, pstruct, Ang, NbTimes1, Step, NbTimes2); if(result->_is_nil()) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); return; } result->NameType(tr("GEOM_COMPOUND")); if(myGeomBase->Display(result)) - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); diff --git a/src/TransformationGUI/TransformationGUI.h b/src/TransformationGUI/TransformationGUI.h index efe1aba83..f8451c60e 100644 --- a/src/TransformationGUI/TransformationGUI.h +++ b/src/TransformationGUI/TransformationGUI.h @@ -30,6 +30,7 @@ #define TRANSFORMATIONGUI_H #include "GEOMBase.h" +#include //================================================================================= // class : TransformationGUI diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx index e6aacd1d9..6a968659c 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -131,7 +131,7 @@ void TransformationGUI_MirrorDlg::ClickOnOk() //================================================================================= void TransformationGUI_MirrorDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index 3e3ff8686..c347d7256 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -29,8 +29,7 @@ using namespace std; #include "TransformationGUI_MultiRotationDlg.h" -#include "QAD_Config.h" - +#include #include #include #include @@ -41,6 +40,7 @@ using namespace std; #include #include #include +#include "QAD_Config.h" //================================================================================= // class : TransformationGUI_MultiRotationDlg() @@ -258,7 +258,7 @@ void TransformationGUI_MultiRotationDlg::ClickOnOk() //================================================================================= void TransformationGUI_MultiRotationDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index c8b68bdfc..5e89231e2 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -29,8 +29,7 @@ using namespace std; #include "TransformationGUI_MultiTranslationDlg.h" -#include "QAD_Config.h" - +#include #include #include #include @@ -38,6 +37,7 @@ using namespace std; #include #include #include +#include "QAD_Config.h" //================================================================================= // class : TransformationGUI_MultiTranslationDlg() @@ -269,7 +269,7 @@ void TransformationGUI_MultiTranslationDlg::ClickOnOk() //================================================================================= void TransformationGUI_MultiTranslationDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index c021fcbfe..4c410e4c4 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -29,6 +29,7 @@ using namespace std; #include "TransformationGUI_RotationDlg.h" +#include #include #include @@ -141,7 +142,7 @@ void TransformationGUI_RotationDlg::ClickOnOk() //================================================================================= void TransformationGUI_RotationDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index 64e1227a3..6f408cff1 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -140,7 +140,7 @@ void TransformationGUI_ScaleDlg::ClickOnOk() //================================================================================= void TransformationGUI_ScaleDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index 857f54db4..46778b0c7 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -148,7 +148,7 @@ void TransformationGUI_TranslationDlg::ClickOnOk() //================================================================================= void TransformationGUI_TranslationDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo(tr("")); + QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; myGeomBase->EraseSimulationShape(); -- 2.39.2