From: dcq Date: Tue, 28 Oct 2003 18:21:06 +0000 (+0000) Subject: DCQ : New Architecture... X-Git-Tag: DCQ_03_12_03~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9e7c6a0dff1e71f4887fac142c892d1e048039f1;p=modules%2Fgeom.git DCQ : New Architecture... --- diff --git a/src/BasicGUI/BasicGUI.cxx b/src/BasicGUI/BasicGUI.cxx index f69336d67..21f117bb7 100644 --- a/src/BasicGUI/BasicGUI.cxx +++ b/src/BasicGUI/BasicGUI.cxx @@ -36,6 +36,8 @@ using namespace std; #include #include +#include +#include #include "BasicGUI_PointDlg.h" // Method POINT #include "BasicGUI_LineDlg.h" // Method LINE @@ -166,10 +168,10 @@ bool BasicGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame if(ic->MoreSelected()) thePoint = BRep_Tool::Pnt(TopoDS::Vertex(ic->SelectedShape())); else - thePoint = myBasicGUI->myGeomBase->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView()); + thePoint = myBasicGUI->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView()); } else - thePoint = myBasicGUI->myGeomBase->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView()); + thePoint = myBasicGUI->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView()); if(DialogPt != 0) DialogPt->PointIntoCoordinates(thePoint, true); /* display point */ @@ -180,6 +182,33 @@ bool BasicGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame } +//======================================================================= +// function : ConvertClickToPoint() +// purpose : Returns the point clicked in 3D view +//======================================================================= +gp_Pnt BasicGUI::ConvertClickToPoint(Standard_Real x, Standard_Real y, Handle(V3d_View) aView) +{ + V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt; + aView->Eye(XEye, YEye, ZEye); + + aView->At(XAt, YAt, ZAt); + gp_Pnt EyePoint(XEye, YEye, ZEye); + gp_Pnt AtPoint(XAt, YAt, ZAt); + + gp_Vec EyeVector(EyePoint, AtPoint); + gp_Dir EyeDir(EyeVector); + + gp_Pln PlaneOfTheView = gp_Pln(AtPoint,EyeDir); + Standard_Real X, Y, Z; + aView->Convert(x, y, X, Y, Z); + gp_Pnt ConvertedPoint(X, Y, Z); + + gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project(PlaneOfTheView, ConvertedPoint); + gp_Pnt ResultPoint = ElSLib::Value(ConvertedPointOnPlane.X(), ConvertedPointOnPlane.Y(), PlaneOfTheView); + return ResultPoint; +} + + //======================================================================= // function : MakePointAndDisplay // purpose : diff --git a/src/BasicGUI/BasicGUI.h b/src/BasicGUI/BasicGUI.h index 809eda533..ef5d957f1 100644 --- a/src/BasicGUI/BasicGUI.h +++ b/src/BasicGUI/BasicGUI.h @@ -30,6 +30,7 @@ #define BASICGUI_H #include "GEOMBase.h" +#include //================================================================================= // class : BasicGUI @@ -46,6 +47,8 @@ public : static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); static bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); + gp_Pnt ConvertClickToPoint(Standard_Real x, Standard_Real y, Handle(V3d_View) aView); + void MakePointAndDisplay(const double x, const double y, const double z); void MakeLineAndDisplay(const gp_Pnt InitPoint, const gp_Pnt LastPoint); void MakeCircleAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Radius); diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index 2b00b7960..4304ca724 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -252,6 +252,7 @@ void BasicGUI_ArcDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myVertexFilter); if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index 9dd783546..e9044dacb 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -251,6 +251,9 @@ void BasicGUI_CircleDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + mySelection->AddFilter(myVertexFilter); if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index 7cd186d4f..f62e96fa7 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -258,6 +258,9 @@ void BasicGUI_EllipseDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + mySelection->AddFilter(myVertexFilter); if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx index d421f7cb2..52573dda3 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.cxx +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -238,6 +238,7 @@ void BasicGUI_LineDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myVertexFilter); if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index 65f6fc8e7..c90a6279e 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -131,19 +131,20 @@ void BasicGUI_PlaneDlg::Init() this->myTrimSize = 2000.0; /* min, max, step and decimals for spin boxes */ - GroupPointDirection->SpinBox_DX->RangeStepAndValidator(+0.001, 10000000.0, step, 5); + GroupPointDirection->SpinBox_DX->RangeStepAndValidator(0.001, 10000000.0, step, 3); GroupPointDirection->SpinBox_DX->SetValue(myTrimSize); - GroupPointPlusCoordinates->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); - GroupPointPlusCoordinates->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); - GroupPointPlusCoordinates->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); - GroupPointPlusCoordinates->SpinBox_DX->SetValue(1.0); - GroupPointPlusCoordinates->SpinBox_DY->SetValue(1.0); + double SpecificStep = 1; + GroupPointPlusCoordinates->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, SpecificStep, 3); + GroupPointPlusCoordinates->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, SpecificStep, 3); + GroupPointPlusCoordinates->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, SpecificStep, 3); + GroupPointPlusCoordinates->SpinBox_DX->SetValue(0.0); + GroupPointPlusCoordinates->SpinBox_DY->SetValue(0.0); GroupPointPlusCoordinates->SpinBox_DZ->SetValue(1.0); - GroupPointPlusCoordinates->SpinBox_S->RangeStepAndValidator(+0.001, 10000000.0, step, 5); + GroupPointPlusCoordinates->SpinBox_S->RangeStepAndValidator(0.001, 10000000.0, step, 3); GroupPointPlusCoordinates->SpinBox_S->SetValue(myTrimSize) ; - GroupFace->SpinBox_DX->RangeStepAndValidator(+0.001, 10000000.0, step, 5); + GroupFace->SpinBox_DX->RangeStepAndValidator(0.001, 10000000.0, step, 3); GroupFace->SpinBox_DX->SetValue(myTrimSize); /* signals and slots connections */ @@ -226,8 +227,8 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId) myEditCurrentArgument = GroupPointPlusCoordinates->LineEdit1; GroupPointPlusCoordinates->LineEdit1->setText(tr("")); - GroupPointPlusCoordinates->SpinBox_DX->SetValue(1.0); - GroupPointPlusCoordinates->SpinBox_DY->SetValue(1.0); + GroupPointPlusCoordinates->SpinBox_DX->SetValue(0.0); + GroupPointPlusCoordinates->SpinBox_DY->SetValue(0.0); GroupPointPlusCoordinates->SpinBox_DZ->SetValue(1.0); myOkCoordinates = true; @@ -419,7 +420,7 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument() QPushButton* send = (QPushButton*)sender(); mySelection->ClearFilters(); - switch (myConstructorId) + switch(myConstructorId) { case 0: { @@ -493,6 +494,30 @@ void BasicGUI_PlaneDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + switch(myConstructorId) + { + case 0: + { + GroupPointDirection->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPointDirection->LineEdit1; + mySelection->AddFilter(myVertexFilter); + break; + } + case 1: + { + GroupPointPlusCoordinates->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPointPlusCoordinates->LineEdit1; + mySelection->AddFilter(myVertexFilter); + break; + } + case 2: + { + GroupFace->LineEdit1->setFocus(); + myEditCurrentArgument = GroupFace->LineEdit1; + mySelection->AddFilter(myFaceFilter); + break; + } + } if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index f2e5f9a57..10d0bd6f1 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -29,6 +29,9 @@ using namespace std; #include "BasicGUI_PointDlg.h" +#include "QAD_RightFrame.h" +#include "OCCViewer_Viewer3d.h" + #include #include #include @@ -46,8 +49,8 @@ using namespace std; BasicGUI_PointDlg::BasicGUI_PointDlg(QWidget* parent, const char* name, BasicGUI* theBasicGUI, SALOME_Selection* Sel, const 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_POINT_EDGE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_POINT"))); + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_POINT"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_POINT_EDGE"))); QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_POINT_TITLE")); @@ -58,17 +61,17 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(QWidget* parent, const char* name, BasicGUI RadioButton2->setPixmap(image1); RadioButton3->close(TRUE); - GroupPoints = new DlgRef_1Sel1Spin(this, "GroupPoints"); - GroupPoints->GroupBox1->setTitle(tr("GEOM_PARAM_POINT")); - GroupPoints->TextLabel1->setText(tr("GEOM_EDGE")); - GroupPoints->TextLabel2->setText(tr("GEOM_PARAMETER")); - GroupPoints->PushButton1->setPixmap(image2); + GroupPoints = new DlgRef_3Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_COORDINATES")); + GroupPoints->TextLabel1->setText(tr("GEOM_X")); + GroupPoints->TextLabel2->setText(tr("GEOM_Y")); + GroupPoints->TextLabel3->setText(tr("GEOM_Z")); - GroupDimensions = new DlgRef_3Spin(this, "GroupDimensions"); - GroupDimensions->GroupBox1->setTitle(tr("GEOM_COORDINATES")); - GroupDimensions->TextLabel1->setText(tr("GEOM_X")); - GroupDimensions->TextLabel2->setText(tr("GEOM_Y")); - GroupDimensions->TextLabel3->setText(tr("GEOM_Z")); + GroupDimensions = new DlgRef_1Sel1Spin(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_PARAM_POINT")); + GroupDimensions->TextLabel1->setText(tr("GEOM_EDGE")); + GroupDimensions->TextLabel2->setText(tr("GEOM_PARAMETER")); + GroupDimensions->PushButton1->setPixmap(image2); Layout1->addWidget(GroupPoints, 1, 0); Layout1->addWidget(GroupDimensions, 1, 0); @@ -98,7 +101,7 @@ void BasicGUI_PointDlg::Init(const Handle(AIS_InteractiveContext)& ic) { /* init variables */ myConstructorId = 0; - myEditCurrentArgument = GroupPoints->LineEdit1; + myEditCurrentArgument = GroupDimensions->LineEdit1; myIC = ic; myParameter = 0.50; @@ -109,7 +112,6 @@ void BasicGUI_PointDlg::Init(const Handle(AIS_InteractiveContext)& ic) /* Vertices Filter for all arguments */ myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom); - mySelection->AddFilter(myEdgeFilter); /* Get setting of step value from file configuration */ QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); @@ -117,25 +119,25 @@ void BasicGUI_PointDlg::Init(const Handle(AIS_InteractiveContext)& ic) /* min, max, step and decimals for spin boxes */ double specificStep = 0.1; - GroupPoints->SpinBox_DX->RangeStepAndValidator(-999999.99999, 999999.99999, specificStep, 5); - GroupDimensions->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); - GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); - GroupDimensions->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); - GroupPoints->SpinBox_DX->SetValue(myParameter); - GroupDimensions->SpinBox_DX->SetValue(0.0); - GroupDimensions->SpinBox_DY->SetValue(0.0); - GroupDimensions->SpinBox_DZ->SetValue(0.0); - - if (myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + GroupDimensions->SpinBox_DX->RangeStepAndValidator(-999999.99999, 999999.99999, specificStep, 5); + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupPoints->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupPoints->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DX->SetValue(myParameter); + GroupPoints->SpinBox_DX->SetValue(0.0); + GroupPoints->SpinBox_DY->SetValue(0.0); + GroupPoints->SpinBox_DZ->SetValue(0.0); + + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { myLocalContextId = myIC->OpenLocalContext(); myGeomBase->SetDisplayedObjectList(); /* sub shapes selection */ myLocalContextMode = TopAbs_VERTEX; myIC->ActivateStandardMode(myLocalContextMode); myUseLocalContext = true; - } else { + } + else myUseLocalContext = false; - } TopoDS_Shape S; bool displayPoint = true; @@ -144,24 +146,29 @@ void BasicGUI_PointDlg::Init(const Handle(AIS_InteractiveContext)& ic) if(myGeomBase->VertexToPoint(S, myPoint)) displayPoint = false; } + this->PointIntoCoordinates(myPoint, displayPoint); /* 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())); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); - connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double))); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -190,41 +197,41 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) { case 0: { - if (myUseLocalContext == true && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - myIC->CloseLocalContext(myLocalContextId); - myUseLocalContext = false; + if(myUseLocalContext == false && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + myLocalContextId = myIC->OpenLocalContext(); + myGeomBase->SetDisplayedObjectList(); + /* sub shapes selection */ + myLocalContextMode = TopAbs_VERTEX; + myIC->ActivateStandardMode(myLocalContextMode); + myUseLocalContext = true; } GroupDimensions->hide(); resize(0, 0); GroupPoints->show(); - myEditCurrentArgument = GroupPoints->LineEdit1; - GroupPoints->LineEdit1->setText(""); - myOkEdge = false; - - /* filter for next selections */ - mySelection->AddFilter(myEdgeFilter); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + /* Display point simulation */ + PointIntoCoordinates(myPoint, true); break; } case 1: { - if(myUseLocalContext == false && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - myLocalContextId = myIC->OpenLocalContext(); - myGeomBase->SetDisplayedObjectList(); - /* sub shapes selection */ - myLocalContextMode = TopAbs_VERTEX; - myIC->ActivateStandardMode(myLocalContextMode); - myUseLocalContext = true; + if(myUseLocalContext == true && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; } GroupPoints->hide(); resize(0, 0); GroupDimensions->show(); - /* Display point simulation */ - PointIntoCoordinates(myPoint, true); + myEditCurrentArgument = GroupDimensions->LineEdit1; + GroupDimensions->LineEdit1->setText(""); + myOkEdge = false; + + /* filter for next selections */ + mySelection->AddFilter(myEdgeFilter); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } } @@ -239,7 +246,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) void BasicGUI_PointDlg::ClickOnOk() { this->ClickOnApply(); - ClickOnCancel(); + this->ClickOnCancel(); return; } @@ -257,7 +264,7 @@ void BasicGUI_PointDlg::ClickOnApply() mySimulationTopoDs.Nullify(); /* Close local context */ - if (myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { myIC->CloseLocalContext(myLocalContextId); myUseLocalContext = false; } @@ -265,19 +272,11 @@ void BasicGUI_PointDlg::ClickOnApply() switch(myConstructorId) { case 0 : - { - if(myOkEdge == true) { - /* this constructor method has no idl interface : we use same than constructor 0 */ - myBasicGUI->MakePointAndDisplay(myPoint.X(), myPoint.Y(), myPoint.Z()); - } - break; - } - case 1 : { /* Recup args and call method */ - double x = GroupDimensions->SpinBox_DX->GetValue(); - double y = GroupDimensions->SpinBox_DY->GetValue(); - double z = GroupDimensions->SpinBox_DZ->GetValue(); + double x = GroupPoints->SpinBox_DX->GetValue(); + double y = GroupPoints->SpinBox_DY->GetValue(); + 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) { @@ -291,7 +290,35 @@ void BasicGUI_PointDlg::ClickOnApply() } break; } + case 1 : + { + if(myOkEdge == true) { + /* this constructor method has no idl interface : we use same than constructor 0 */ + myBasicGUI->MakePointAndDisplay(myPoint.X(), myPoint.Y(), myPoint.Z()); + } + break; + } + } + return; +} + + +//======================================================================= +// function : ClickOnCancel() +// purpose : +//======================================================================= +void BasicGUI_PointDlg::ClickOnCancel() +{ + if(myConstructorId == 0 && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + if(myIC->HasOpenedContext()) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; } + } + + GEOMBase_Skeleton::ClickOnCancel(); return; } @@ -321,7 +348,7 @@ void BasicGUI_PointDlg::SelectionIntoArgument() if(S.ShapeType() == TopAbs_EDGE) { if(CalculateVertexOnCurve(TopoDS::Edge(S), myParameter, mySimulationTopoDs)) { if(myGeomBase->VertexToPoint(mySimulationTopoDs, myPoint)) { - GroupPoints->LineEdit1->setText(aString); + GroupDimensions->LineEdit1->setText(aString); myOkEdge = true; myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } @@ -338,8 +365,8 @@ void BasicGUI_PointDlg::SelectionIntoArgument() void BasicGUI_PointDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == GroupPoints->LineEdit1) - myEditCurrentArgument = GroupPoints->LineEdit1; + if(send == GroupDimensions->LineEdit1) + myEditCurrentArgument = GroupDimensions->LineEdit1; else return; @@ -356,9 +383,9 @@ void BasicGUI_PointDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == GroupPoints->PushButton1) { - GroupPoints->LineEdit1->setFocus(); - myEditCurrentArgument = GroupPoints->LineEdit1; + if(send == GroupDimensions->PushButton1) { + GroupDimensions->LineEdit1->setFocus(); + myEditCurrentArgument = GroupDimensions->LineEdit1; mySelection->AddFilter(myEdgeFilter); this->SelectionIntoArgument(); } @@ -379,6 +406,17 @@ void BasicGUI_PointDlg::enterEvent(QEvent* e) } +//======================================================================= +// function : closeEvent() +// purpose : +//======================================================================= +void BasicGUI_PointDlg::closeEvent(QCloseEvent* e) +{ + /* same than click on cancel button */ + this->ClickOnCancel(); +} + + //================================================================================= // function : ActivateThisDialog() // purpose : @@ -388,17 +426,20 @@ 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(); -// myIC = v3d->getAISContext(); -// myLocalContextId = myIC->OpenLocalContext(); -// myGeomBase->SetDisplayedObjectList(); -// /* sub shapes selection */ -// myLocalContextMode = TopAbs_VERTEX ; -// myIC->ActivateStandardMode(myLocalContextMode); -// myUseLocalContext = true ; -// } + myGeomGUI->SetState(POINT_METHOD); + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + myLocalContextId = myIC->OpenLocalContext(); + myGeomBase->SetDisplayedObjectList(); + /* sub shapes selection */ + myLocalContextMode = TopAbs_VERTEX; + myIC->ActivateStandardMode(myLocalContextMode); + myUseLocalContext = true; + } + + if(myConstructorId == 1) + mySelection->AddFilter(myEdgeFilter); if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); @@ -406,6 +447,21 @@ void BasicGUI_PointDlg::ActivateThisDialog( ) } +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void BasicGUI_PointDlg::DeactivateActiveDialog() +{ + if(myConstructorId == 0 && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } + GEOMBase_Skeleton::DeactivateActiveDialog(); + return; +} + + //================================================================================= // function : ValueChangedInSpinBox() // purpose : @@ -415,19 +471,19 @@ void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue) DlgRef_SpinBox* send = (DlgRef_SpinBox*)sender(); double vx, vy, vz; - if(send == GroupDimensions->SpinBox_DX) { + if(send == GroupPoints->SpinBox_DX) { vx = newValue; - vy = GroupDimensions->SpinBox_DY->GetValue(); - vz = GroupDimensions->SpinBox_DZ->GetValue(); - } else if(send == GroupDimensions->SpinBox_DY) { - vx = GroupDimensions->SpinBox_DX->GetValue(); + vy = GroupPoints->SpinBox_DY->GetValue(); + vz = GroupPoints->SpinBox_DZ->GetValue(); + } else if(send == GroupPoints->SpinBox_DY) { + vx = GroupPoints->SpinBox_DX->GetValue(); vy = newValue; - vz = GroupDimensions->SpinBox_DZ->GetValue(); - } else if(send == GroupDimensions->SpinBox_DZ) { - vx = GroupDimensions->SpinBox_DX->GetValue(); - vy = GroupDimensions->SpinBox_DY->GetValue(); + vz = GroupPoints->SpinBox_DZ->GetValue(); + } else if(send == GroupPoints->SpinBox_DZ) { + vx = GroupPoints->SpinBox_DX->GetValue(); + vy = GroupPoints->SpinBox_DY->GetValue(); vz = newValue; - } else if(send == GroupPoints->SpinBox_DX) { + } else if(send == GroupDimensions->SpinBox_DX) { myParameter = newValue; } else return; @@ -436,14 +492,14 @@ void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue) { case 0: // default constructor { - this->SelectionIntoArgument(); + myPoint.SetCoord(vx, vy, vz); + mySimulationTopoDs = BRepBuilderAPI_MakeVertex (myPoint).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); break; } case 1: { - myPoint.SetCoord(vx, vy, vz); - mySimulationTopoDs = BRepBuilderAPI_MakeVertex (myPoint).Shape(); - myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + this->SelectionIntoArgument(); break; } } @@ -490,10 +546,10 @@ bool BasicGUI_PointDlg::CalculateVertexOnCurve(const TopoDS_Edge& anEdge, const //======================================================================= void BasicGUI_PointDlg::PointIntoCoordinates(gp_Pnt P, bool displayPoint) { - GroupDimensions->SpinBox_DX->SetValue(P.X()); - GroupDimensions->SpinBox_DY->SetValue(P.Y()); - GroupDimensions->SpinBox_DZ->SetValue(P.Z()); - this->myPoint.SetCoord(P.X(), P.Y(), P.Z()); + GroupPoints->SpinBox_DX->SetValue(P.X()); + GroupPoints->SpinBox_DY->SetValue(P.Y()); + GroupPoints->SpinBox_DZ->SetValue(P.Z()); + myPoint.SetCoord(P.X(), P.Y(), P.Z()); if(displayPoint) { mySimulationTopoDs = BRepBuilderAPI_MakeVertex(P).Shape(); myGeomBase->DisplaySimulationShape(mySimulationTopoDs); diff --git a/src/BasicGUI/BasicGUI_PointDlg.h b/src/BasicGUI/BasicGUI_PointDlg.h index 904787d04..2ee583633 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.h +++ b/src/BasicGUI/BasicGUI_PointDlg.h @@ -54,6 +54,7 @@ public: private : void Init(const Handle(AIS_InteractiveContext)& ic); void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); BasicGUI* myBasicGUI; @@ -71,13 +72,15 @@ private : TopAbs_ShapeEnum myLocalContextMode; /* identify a selection mode into local context */ bool myUseLocalContext; /* true when method as opened a local context */ - DlgRef_1Sel1Spin* GroupPoints; - DlgRef_3Spin* GroupDimensions; + DlgRef_1Sel1Spin* GroupDimensions; + DlgRef_3Spin* GroupPoints; private slots: void ClickOnOk(); + void ClickOnCancel(); void ClickOnApply(); void ActivateThisDialog(); + void DeactivateActiveDialog(); void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index 4868df461..c5d97be42 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -363,6 +363,8 @@ void BasicGUI_VectorDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(myConstructorId == 0) + mySelection->AddFilter(myVertexFilter); if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; @@ -386,25 +388,18 @@ void BasicGUI_VectorDlg::enterEvent(QEvent* e) // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void BasicGUI_VectorDlg::ValueChangedInSpinBox( double newValue ) +void BasicGUI_VectorDlg::ValueChangedInSpinBox(double newValue) { myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); QObject* send = (QObject*)sender(); - if(send == GroupDimensions->SpinBox_DX ) { + if(send == GroupDimensions->SpinBox_DX) myDx = newValue; - myDy = GroupDimensions->SpinBox_DY->GetValue(); - myDz = GroupDimensions->SpinBox_DZ->GetValue(); - } else if (send == GroupDimensions->SpinBox_DY) { - myDx = GroupDimensions->SpinBox_DX->GetValue(); + else if (send == GroupDimensions->SpinBox_DY) myDy = newValue; - myDz = GroupDimensions->SpinBox_DZ->GetValue(); - } else if (send == GroupDimensions->SpinBox_DZ) { - myDx = GroupDimensions->SpinBox_DX->GetValue(); - myDy = GroupDimensions->SpinBox_DY->GetValue(); + else if (send == GroupDimensions->SpinBox_DZ) myDz = newValue; - } myPoint1.SetCoord(0.0, 0.0, 0.0); myPoint2.SetCoord(myDx, myDy, myDz); @@ -452,11 +447,10 @@ void BasicGUI_VectorDlg::ReverseVector(int state) mySimulationTopoDs.Nullify(); myDx = -myDx; - myDy = -myDy; - myDz = -myDz; - GroupDimensions->SpinBox_DX->SetValue(myDx); + myDy = -myDy; GroupDimensions->SpinBox_DY->SetValue(myDy); + myDz = -myDz; GroupDimensions->SpinBox_DZ->SetValue(myDz); myPoint1.SetCoord(0.0, 0.0, 0.0); diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx index 4006b7644..d2d5e5978 100644 --- a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx @@ -199,6 +199,7 @@ void BasicGUI_WorkingPlaneDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myFaceFilter); return; } diff --git a/src/BuildGUI/BuildGUI.cxx b/src/BuildGUI/BuildGUI.cxx index c464f8176..085b80773 100644 --- a/src/BuildGUI/BuildGUI.cxx +++ b/src/BuildGUI/BuildGUI.cxx @@ -277,6 +277,38 @@ void BuildGUI::MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) } + + +//===================================================================================== +// function : SObjectExist() +// purpose : +//===================================================================================== +bool BuildGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR) +{ + SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(theFatherObject); + SALOMEDS::SObject_var RefSO; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + for(; it->More();it->Next()) { + SALOMEDS::SObject_var SO= it->Value(); + if(SO->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + if(strcmp( anIOR->Value(), IOR ) == 0) + return true; + } + if(SO->ReferencedObject(RefSO)) { + if(RefSO->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + if(strcmp(anIOR->Value(), IOR) == 0) + return true; + } + } + } + return false; +} + + //===================================================================================== // function : OnSubShapeGetAll() // purpose : Explode a shape in all sub shapes with a SubShapeType @@ -405,7 +437,7 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape } else { allreadyexist = true; - if(!myGeomBase->SObjectExist(theObj, aResult->Name())) { + if(!this->SObjectExist(theObj, aResult->Name())) { SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); aStudyBuilder->Addreference(newObj1, SO); IO->setEntry(SO->GetID()); @@ -462,7 +494,7 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape } else { allreadyexist = true; - if(!myGeomBase->SObjectExist(theObj, aResult->Name())) { + if(!this->SObjectExist(theObj, aResult->Name())) { SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); aStudyBuilder->Addreference(newObj1, SO); IO->setEntry(SO->GetID()); @@ -655,7 +687,7 @@ bool BuildGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* } else { allreadyexist = true; - if(!myGeomBase->SObjectExist(theObj, aResult->Name())) { + if(!this->SObjectExist(theObj, aResult->Name())) { SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); aStudyBuilder->Addreference(newObj1, SO); diff --git a/src/BuildGUI/BuildGUI.h b/src/BuildGUI/BuildGUI.h index 180677fdb..198f1fa78 100644 --- a/src/BuildGUI/BuildGUI.h +++ b/src/BuildGUI/BuildGUI.h @@ -53,6 +53,7 @@ public : void MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); /* Methods for sub shapes explode */ + bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR); bool OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType); bool OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext); diff --git a/src/BuildGUI/BuildGUI_EdgeDlg.cxx b/src/BuildGUI/BuildGUI_EdgeDlg.cxx index bd264e279..c75c1dd44 100644 --- a/src/BuildGUI/BuildGUI_EdgeDlg.cxx +++ b/src/BuildGUI/BuildGUI_EdgeDlg.cxx @@ -237,6 +237,7 @@ void BuildGUI_EdgeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myVertexFilter); if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/BuildGUI/BuildGUI_FaceDlg.cxx b/src/BuildGUI/BuildGUI_FaceDlg.cxx index 3f61a996e..d08b1b254 100644 --- a/src/BuildGUI/BuildGUI_FaceDlg.cxx +++ b/src/BuildGUI/BuildGUI_FaceDlg.cxx @@ -201,6 +201,7 @@ void BuildGUI_FaceDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myWireFilter); return; } diff --git a/src/BuildGUI/BuildGUI_ShellDlg.cxx b/src/BuildGUI/BuildGUI_ShellDlg.cxx index e03d8e561..45608b3a3 100644 --- a/src/BuildGUI/BuildGUI_ShellDlg.cxx +++ b/src/BuildGUI/BuildGUI_ShellDlg.cxx @@ -165,13 +165,10 @@ void BuildGUI_ShellDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); mySelection->ClearFilters() ; - - if(send == GroupShell->PushButton1) { - GroupShell->LineEdit1->setFocus(); - myEditCurrentArgument = GroupShell->LineEdit1; - mySelection->AddFilter(myFaceFilter); - } - SelectionIntoArgument(); + GroupShell->LineEdit1->setFocus(); + myEditCurrentArgument = GroupShell->LineEdit1; + mySelection->AddFilter(myFaceFilter); + this->SelectionIntoArgument(); return; } @@ -184,6 +181,7 @@ void BuildGUI_ShellDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myFaceFilter); return; } diff --git a/src/BuildGUI/BuildGUI_SolidDlg.cxx b/src/BuildGUI/BuildGUI_SolidDlg.cxx index aa3f2b70b..710b95161 100644 --- a/src/BuildGUI/BuildGUI_SolidDlg.cxx +++ b/src/BuildGUI/BuildGUI_SolidDlg.cxx @@ -164,15 +164,11 @@ void BuildGUI_SolidDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); mySelection->ClearFilters() ; - - if(send == GroupSolid->PushButton1) { - GroupSolid->LineEdit1->setFocus(); - myEditCurrentArgument = GroupSolid->LineEdit1; - mySelection->AddFilter(myShellFilter); - } + GroupSolid->LineEdit1->setFocus(); + myEditCurrentArgument = GroupSolid->LineEdit1; + mySelection->AddFilter(myShellFilter); SelectionIntoArgument(); - - return ; + return; } @@ -184,7 +180,8 @@ void BuildGUI_SolidDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - return ; + mySelection->AddFilter(myShellFilter); + return; } diff --git a/src/BuildGUI/BuildGUI_SubShapeDlg.cxx b/src/BuildGUI/BuildGUI_SubShapeDlg.cxx index 0c16ece3c..b54a5e7d4 100644 --- a/src/BuildGUI/BuildGUI_SubShapeDlg.cxx +++ b/src/BuildGUI/BuildGUI_SubShapeDlg.cxx @@ -61,7 +61,7 @@ BuildGUI_SubShapeDlg::BuildGUI_SubShapeDlg(QWidget* parent, const char* name, Bu GroupPoints = new DlgRef_1Sel1Check1List_QTD(this, "GroupPoints"); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); - //GroupPoints->ComboBox1->setText(tr("GEOM_SUBSHAPE_TYPE")); + GroupPoints->TextLabel2->setText(tr("GEOM_SUBSHAPE_TYPE")); GroupPoints->CheckButton1->setText(tr("GEOM_SUBSHAPE_SELECT")); GroupPoints->PushButton1->setPixmap(image1); @@ -112,7 +112,14 @@ void BuildGUI_SubShapeDlg::Init(Handle(AIS_InteractiveContext) ic) myShapeType = GroupPoints->ComboBox1->currentItem(); myOkSelectSubMode = GroupPoints->CheckButton1->isChecked(); + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC) + GroupPoints->CheckButton1->setEnabled(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())); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -204,13 +211,12 @@ void BuildGUI_SubShapeDlg::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); } + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); } GEOMBase_Skeleton::ClickOnCancel(); return; @@ -361,10 +367,8 @@ void BuildGUI_SubShapeDlg::LineEditReturnPressed() void BuildGUI_SubShapeDlg::DeactivateActiveDialog() { if(GroupConstructors->isEnabled()) { - GEOMBase_Skeleton::DeactivateActiveDialog(); this->ResetStateOfDialog(); - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true); + GEOMBase_Skeleton::DeactivateActiveDialog(); } return; } @@ -378,6 +382,10 @@ void BuildGUI_SubShapeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + GroupPoints->CheckButton1->setEnabled(true); + else + GroupPoints->CheckButton1->setEnabled(false); return; } @@ -447,13 +455,12 @@ void BuildGUI_SubShapeDlg::ResetStateOfDialog() 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); } + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); } return; } @@ -492,9 +499,9 @@ void BuildGUI_SubShapeDlg::AllOrNotAll() if(myUseLocalContext) { myIC->CloseLocalContext(myLocalContextId); myUseLocalContext = false; - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true); } + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); } else { myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER")); @@ -534,9 +541,9 @@ void BuildGUI_SubShapeDlg::ComboTextChanged() if(myUseLocalContext) { myIC->CloseLocalContext(myLocalContextId); myUseLocalContext = false; - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true); } + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); } return; } diff --git a/src/BuildGUI/BuildGUI_SubShapeDlg.h b/src/BuildGUI/BuildGUI_SubShapeDlg.h index 656ed6f5c..e6295ced5 100644 --- a/src/BuildGUI/BuildGUI_SubShapeDlg.h +++ b/src/BuildGUI/BuildGUI_SubShapeDlg.h @@ -81,8 +81,8 @@ private slots: void LineEditReturnPressed(); void SelectionIntoArgument(); void SetEditCurrentArgument(); - void AllOrNotAll() ; - void ComboTextChanged() ; + void AllOrNotAll(); + void ComboTextChanged(); }; diff --git a/src/DlgRef/DlgRef_1Sel1Check1List_QTD.cxx b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.cxx index 655c9ac5f..b629360ef 100644 --- a/src/DlgRef/DlgRef_1Sel1Check1List_QTD.cxx +++ b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.cxx @@ -1,7 +1,7 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'DlgRef_1Sel1Check1List_QTD.ui' ** -** Created: jeu oct 16 10:43:10 2003 +** Created: lun oct 27 16:18:55 2003 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! @@ -41,12 +41,25 @@ DlgRef_1Sel1Check1List_QTD::DlgRef_1Sel1Check1List_QTD( QWidget* parent, const GroupBox1Layout->setAlignment( Qt::AlignTop ); Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + QSpacerItem* spacer = new QSpacerItem( 0, 166, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" ); CheckButton1->setText( trUtf8( "" ) ); Layout1->addMultiCellWidget( CheckButton1, 2, 2, 0, 2 ); + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addMultiCellWidget( TextLabel2, 1, 1, 0, 1 ); + + ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" ); + ComboBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( ComboBox1, 1, 2 ); + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); Layout1->addWidget( LineEdit1, 0, 2 ); @@ -63,13 +76,6 @@ DlgRef_1Sel1Check1List_QTD::DlgRef_1Sel1Check1List_QTD( QWidget* parent, const Layout1->addWidget( PushButton1, 0, 1 ); - ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" ); - ComboBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox1->sizePolicy().hasHeightForWidth() ) ); - - Layout1->addWidget( ComboBox1, 1, 2 ); - QSpacerItem* spacer = new QSpacerItem( 0, 60, QSizePolicy::Minimum, QSizePolicy::Expanding ); - Layout1->addItem( spacer, 3, 2 ); - GroupBox1Layout->addLayout( Layout1, 0, 0 ); DlgRef_1Sel1Check1List_QTDLayout->addWidget( GroupBox1, 0, 0 ); diff --git a/src/DlgRef/DlgRef_1Sel1Check1List_QTD.h b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.h index a6b61ae81..d1b8893b3 100644 --- a/src/DlgRef/DlgRef_1Sel1Check1List_QTD.h +++ b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.h @@ -1,7 +1,7 @@ /**************************************************************************** ** Form interface generated from reading ui file 'DlgRef_1Sel1Check1List_QTD.ui' ** -** Created: jeu oct 16 10:43:10 2003 +** Created: lun oct 27 16:18:55 2003 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! @@ -31,10 +31,11 @@ public: QGroupBox* GroupBox1; QRadioButton* CheckButton1; + QLabel* TextLabel2; + QComboBox* ComboBox1; QLineEdit* LineEdit1; QLabel* TextLabel1; QPushButton* PushButton1; - QComboBox* ComboBox1; protected: diff --git a/src/DlgRef/DlgRef_1Sel3Spin.cxx b/src/DlgRef/DlgRef_1Sel3Spin.cxx index d5170c7da..8cf310421 100644 --- a/src/DlgRef/DlgRef_1Sel3Spin.cxx +++ b/src/DlgRef/DlgRef_1Sel3Spin.cxx @@ -47,10 +47,10 @@ DlgRef_1Sel3Spin::DlgRef_1Sel3Spin(QWidget* parent, const char* name, WFlags fl Layout2->addWidget(SpinBox_DX, 0, 1); SpinBox_DY = new DlgRef_SpinBox( GroupBox1, "SpinBox_DY"); - Layout2->addWidget(SpinBox_DY, 0, 3); + Layout2->addWidget(SpinBox_DY, 1, 1); SpinBox_DZ = new DlgRef_SpinBox( GroupBox1, "SpinBox_DZ"); - Layout2->addWidget(SpinBox_DZ, 0, 5); + Layout2->addWidget(SpinBox_DZ, 2, 1); } diff --git a/src/DlgRef/DlgRef_1Sel3Spin_QTD.cxx b/src/DlgRef/DlgRef_1Sel3Spin_QTD.cxx index 3dc087045..a4c3cb2d8 100644 --- a/src/DlgRef/DlgRef_1Sel3Spin_QTD.cxx +++ b/src/DlgRef/DlgRef_1Sel3Spin_QTD.cxx @@ -1,7 +1,7 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'DlgRef_1Sel3Spin_QTD.ui' ** -** Created: mer oct 1 16:53:03 2003 +** Created: ven oct 24 15:55:11 2003 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! @@ -27,7 +27,7 @@ DlgRef_1Sel3Spin_QTD::DlgRef_1Sel3Spin_QTD( QWidget* parent, const char* name, { if ( !name ) setName( "DlgRef_1Sel3Spin_QTD" ); - resize( 232, 87 ); + resize( 129, 143 ); setCaption( trUtf8( "DlgRef_1Sel3Spin_QTD" ) ); DlgRef_1Sel3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel3Spin_QTDLayout"); @@ -41,58 +41,58 @@ DlgRef_1Sel3Spin_QTD::DlgRef_1Sel3Spin_QTD( QWidget* parent, const char* name, Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); - 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, 207, QSizePolicy::Minimum, QSizePolicy::Expanding ); - Layout1->addItem( spacer, 2, 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 ); + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); Layout1->addWidget( LineEdit1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 150, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); - TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); - TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); - TextLabel4->setText( trUtf8( "TL4" ) ); - - Layout2->addWidget( TextLabel4, 0, 5 ); - - TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); - TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); - TextLabel2->setText( trUtf8( "TL2" ) ); + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); - Layout2->addWidget( TextLabel2, 0, 1 ); + Layout2->addWidget( SpinBox2, 1, 1 ); TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); TextLabel3->setText( trUtf8( "TL3" ) ); - Layout2->addWidget( TextLabel3, 0, 3 ); + Layout2->addWidget( TextLabel3, 1, 0 ); SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); - Layout2->addWidget( SpinBox3, 0, 6 ); + Layout2->addWidget( SpinBox3, 2, 1 ); SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); - Layout2->addWidget( SpinBox1, 0, 2 ); + Layout2->addWidget( SpinBox1, 0, 1 ); - SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); - SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 2, 0 ); + + 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( SpinBox2, 0, 4 ); + Layout2->addWidget( TextLabel2, 0, 0 ); Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); diff --git a/src/DlgRef/DlgRef_1Sel3Spin_QTD.h b/src/DlgRef/DlgRef_1Sel3Spin_QTD.h index 90275651f..681d72f62 100644 --- a/src/DlgRef/DlgRef_1Sel3Spin_QTD.h +++ b/src/DlgRef/DlgRef_1Sel3Spin_QTD.h @@ -1,7 +1,7 @@ /**************************************************************************** ** Form interface generated from reading ui file 'DlgRef_1Sel3Spin_QTD.ui' ** -** Created: mer oct 1 16:53:02 2003 +** Created: ven oct 24 15:55:10 2003 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! @@ -29,15 +29,15 @@ public: ~DlgRef_1Sel3Spin_QTD(); QGroupBox* GroupBox1; - QPushButton* PushButton1; QLabel* TextLabel1; + QPushButton* PushButton1; QLineEdit* LineEdit1; - QLabel* TextLabel4; - QLabel* TextLabel2; + QSpinBox* SpinBox2; QLabel* TextLabel3; QSpinBox* SpinBox3; QSpinBox* SpinBox1; - QSpinBox* SpinBox2; + QLabel* TextLabel4; + QLabel* TextLabel2; protected: diff --git a/src/DlgRef/DlgRef_2Sel2Spin1Check.cxx b/src/DlgRef/DlgRef_2Sel2Spin1Check.cxx new file mode 100644 index 000000000..e996c3cfa --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin1Check.cxx @@ -0,0 +1,57 @@ +// 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_2Sel1Spin1Check.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_2Sel2Spin1Check.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel1Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_2Sel2Spin1Check::DlgRef_2Sel2Spin1Check(QWidget* parent, const char* name, WFlags fl) + :DlgRef_2Sel2Spin1Check_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout2->addWidget(SpinBox_DX, 0, 1); + Layout2->addWidget(SpinBox_DY, 1, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel2Spin1Check::~DlgRef_2Sel2Spin1Check() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_2Sel2Spin1Check.h b/src/DlgRef/DlgRef_2Sel2Spin1Check.h new file mode 100644 index 000000000..b5bdba917 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin1Check.h @@ -0,0 +1,48 @@ +// 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_2Sel1Spin1Check.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_2SEL2SPIN1CHECK_H +#define DLGREF_2SEL2SPIN1CHECK_H + +#include "DlgRef_2Sel2Spin1Check_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_2Sel2Spin1Check : public DlgRef_2Sel2Spin1Check_QTD +{ + Q_OBJECT + +public: + DlgRef_2Sel2Spin1Check(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_2Sel2Spin1Check(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + +}; + +#endif // DLGREF_2SEL2SPIN1CHECK_H diff --git a/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.cxx b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.cxx new file mode 100644 index 000000000..22d8dc808 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.cxx @@ -0,0 +1,122 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel2Spin1Check_QTD.ui' +** +** Created: ven oct 24 09:53:25 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel2Spin1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel2Spin1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel2Spin1Check_QTD::DlgRef_2Sel2Spin1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel2Spin1Check_QTD" ); + resize( 129, 164 ); + setCaption( trUtf8( "DlgRef_2Sel2Spin1Check_QTD" ) ); + DlgRef_2Sel2Spin1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel2Spin1Check_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"); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 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 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 0, 0 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 1, 0 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 1, 1 ); + + Layout1->addMultiCellLayout( Layout2, 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 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 275, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 4, 2 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton1, 3, 3, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel2Spin1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel2Spin1Check_QTD::~DlgRef_2Sel2Spin1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.h b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.h new file mode 100644 index 000000000..624e360ed --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin1Check_QTD.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel2Spin1Check_QTD.ui' +** +** Created: ven oct 24 09:53:25 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL2SPIN1CHECK_QTD_H +#define DLGREF_2SEL2SPIN1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QSpinBox; + +class DlgRef_2Sel2Spin1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel2Spin1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel2Spin1Check_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel2; + QPushButton* PushButton1; + QSpinBox* SpinBox1; + QLabel* TextLabel3; + QLabel* TextLabel4; + QSpinBox* SpinBox2; + QLabel* TextLabel1; + QPushButton* PushButton2; + QLineEdit* LineEdit2; + QRadioButton* CheckButton1; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* DlgRef_2Sel2Spin1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_2SEL2SPIN1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_2Sel4Spin1Check.cxx b/src/DlgRef/DlgRef_2Sel4Spin1Check.cxx new file mode 100644 index 000000000..d10c1e50d --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel4Spin1Check.cxx @@ -0,0 +1,63 @@ +// 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_2Sel4Spin1Check.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_2Sel4Spin1Check.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel1Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_2Sel4Spin1Check::DlgRef_2Sel4Spin1Check(QWidget* parent, const char* name, WFlags fl) + :DlgRef_2Sel4Spin1Check_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox3->close(TRUE); + SpinBox4->close(TRUE); + SpinBox_DX1 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX1"); + SpinBox_DY1 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY1"); + SpinBox_DX2 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX2"); + SpinBox_DY2 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY2"); + Layout2->addWidget(SpinBox_DX1, 0, 1); + Layout2->addWidget(SpinBox_DY1, 1, 1); + Layout3->addWidget(SpinBox_DX2, 0, 1); + Layout3->addWidget(SpinBox_DY2, 1, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel4Spin1Check::~DlgRef_2Sel4Spin1Check() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_2Sel4Spin1Check.h b/src/DlgRef/DlgRef_2Sel4Spin1Check.h new file mode 100644 index 000000000..573097cc6 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel4Spin1Check.h @@ -0,0 +1,50 @@ +// 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_2Sel4Spin1Check.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_2SEL4SPIN1CHECK_H +#define DLGREF_2SEL4SPIN1CHECK_H + +#include "DlgRef_2Sel4Spin1Check_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_2Sel4Spin1Check : public DlgRef_2Sel4Spin1Check_QTD +{ + Q_OBJECT + +public: + DlgRef_2Sel4Spin1Check(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_2Sel4Spin1Check(); + + DlgRef_SpinBox* SpinBox_DX1; + DlgRef_SpinBox* SpinBox_DY1; + DlgRef_SpinBox* SpinBox_DX2; + DlgRef_SpinBox* SpinBox_DY2; + +}; + +#endif // DLGREF_2SEL4SPIN1CHECK_H diff --git a/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.cxx b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.cxx new file mode 100644 index 000000000..508e7c648 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.cxx @@ -0,0 +1,148 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel4Spin1Check_QTD.ui' +** +** Created: lun oct 27 11:40:44 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel4Spin1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel4Spin1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel4Spin1Check_QTD::DlgRef_2Sel4Spin1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel4Spin1Check_QTD" ); + resize( 129, 222 ); + setCaption( trUtf8( "DlgRef_2Sel4Spin1Check_QTD" ) ); + DlgRef_2Sel4Spin1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel4Spin1Check_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"); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + 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"); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 1, 1 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 1, 0 ); + + Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + SpinBox4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox4->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox4, 1, 1 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout3->addWidget( TextLabel5, 0, 0 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox3, 0, 1 ); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setText( trUtf8( "TL6" ) ); + + Layout3->addWidget( TextLabel6, 1, 0 ); + + Layout1->addMultiCellLayout( Layout3, 4, 4, 0, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + 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 ); + + CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton1, 3, 3, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 177, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 5, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel4Spin1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel4Spin1Check_QTD::~DlgRef_2Sel4Spin1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.h b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.h new file mode 100644 index 000000000..afde716e6 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel4Spin1Check_QTD.ui' +** +** Created: lun oct 27 11:40:44 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL4SPIN1CHECK_QTD_H +#define DLGREF_2SEL4SPIN1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QSpinBox; + +class DlgRef_2Sel4Spin1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel4Spin1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel4Spin1Check_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit2; + QPushButton* PushButton1; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QSpinBox* SpinBox2; + QLabel* TextLabel4; + QSpinBox* SpinBox4; + QLabel* TextLabel5; + QSpinBox* SpinBox3; + QLabel* TextLabel6; + QPushButton* PushButton2; + QLabel* TextLabel1; + QRadioButton* CheckButton1; + QLineEdit* LineEdit1; + QLabel* TextLabel2; + + +protected: + QGridLayout* DlgRef_2Sel4Spin1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; + QGridLayout* Layout3; +}; + +#endif // DLGREF_2SEL4SPIN1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_3Sel4Spin2Check.cxx b/src/DlgRef/DlgRef_3Sel4Spin2Check.cxx new file mode 100644 index 000000000..7c343f705 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel4Spin2Check.cxx @@ -0,0 +1,63 @@ +// 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_3Sel4Spin2Check.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_3Sel4Spin2Check.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel1Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_3Sel4Spin2Check::DlgRef_3Sel4Spin2Check(QWidget* parent, const char* name, WFlags fl) + :DlgRef_3Sel4Spin2Check_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox3->close(TRUE); + SpinBox4->close(TRUE); + SpinBox_DX1 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX1"); + SpinBox_DY1 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY1"); + SpinBox_DX2 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX2"); + SpinBox_DY2 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY2"); + Layout2->addWidget(SpinBox_DX1, 0, 1); + Layout2->addWidget(SpinBox_DY1, 1, 1); + Layout3->addWidget(SpinBox_DX2, 0, 1); + Layout3->addWidget(SpinBox_DY2, 1, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Sel4Spin2Check::~DlgRef_3Sel4Spin2Check() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_3Sel4Spin2Check.h b/src/DlgRef/DlgRef_3Sel4Spin2Check.h new file mode 100644 index 000000000..d74915a19 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel4Spin2Check.h @@ -0,0 +1,50 @@ +// 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_3Sel4Spin2Check.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_3SEL4SPIN2CHECK_H +#define DLGREF_3SEL4SPIN2CHECK_H + +#include "DlgRef_3Sel4Spin2Check_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_3Sel4Spin2Check : public DlgRef_3Sel4Spin2Check_QTD +{ + Q_OBJECT + +public: + DlgRef_3Sel4Spin2Check(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_3Sel4Spin2Check(); + + DlgRef_SpinBox* SpinBox_DX1; + DlgRef_SpinBox* SpinBox_DY1; + DlgRef_SpinBox* SpinBox_DX2; + DlgRef_SpinBox* SpinBox_DY2; + +}; + +#endif // DLGREF_3SEL4SPIN2CHECK_H diff --git a/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.cxx b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.cxx new file mode 100644 index 000000000..55bee78b8 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.cxx @@ -0,0 +1,169 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_3Sel4Spin2Check_QTD.ui' +** +** Created: ven oct 24 09:53:25 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_3Sel4Spin2Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_3Sel4Spin2Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_3Sel4Spin2Check_QTD::DlgRef_3Sel4Spin2Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_3Sel4Spin2Check_QTD" ); + resize( 129, 271 ); + setCaption( trUtf8( "DlgRef_3Sel4Spin2Check_QTD" ) ); + DlgRef_3Sel4Spin2Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_3Sel4Spin2Check_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"); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + 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 ); + + PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + PushButton3->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton3, 2, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 155, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 7, 2 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout2->addWidget( TextLabel5, 1, 0 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 0, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 1, 1 ); + + Layout1->addMultiCellLayout( Layout2, 3, 3, 0, 2 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + Layout1->addWidget( LineEdit3, 2, 2 ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + SpinBox4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox4->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox4, 1, 1 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox3, 0, 1 ); + + TextLabel7 = new QLabel( GroupBox1, "TextLabel7" ); + TextLabel7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel7->sizePolicy().hasHeightForWidth() ) ); + TextLabel7->setText( trUtf8( "TL7" ) ); + + Layout3->addWidget( TextLabel7, 1, 0 ); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setText( trUtf8( "TL6" ) ); + + Layout3->addWidget( TextLabel6, 0, 0 ); + + Layout1->addMultiCellLayout( Layout3, 5, 5, 0, 2 ); + + CheckButton2 = new QRadioButton( GroupBox1, "CheckButton2" ); + CheckButton2->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton2, 6, 6, 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 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton1, 4, 4, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_3Sel4Spin2Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Sel4Spin2Check_QTD::~DlgRef_3Sel4Spin2Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.h b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.h new file mode 100644 index 000000000..fb053ced4 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel4Spin2Check_QTD.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_3Sel4Spin2Check_QTD.ui' +** +** Created: ven oct 24 09:53:25 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_3SEL4SPIN2CHECK_QTD_H +#define DLGREF_3SEL4SPIN2CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QSpinBox; + +class DlgRef_3Sel4Spin2Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_3Sel4Spin2Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Sel4Spin2Check_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel2; + QLineEdit* LineEdit1; + QPushButton* PushButton1; + QPushButton* PushButton3; + QLabel* TextLabel5; + QLabel* TextLabel4; + QSpinBox* SpinBox1; + QSpinBox* SpinBox2; + QLabel* TextLabel3; + QLineEdit* LineEdit3; + QSpinBox* SpinBox4; + QSpinBox* SpinBox3; + QLabel* TextLabel7; + QLabel* TextLabel6; + QRadioButton* CheckButton2; + QLabel* TextLabel1; + QLineEdit* LineEdit2; + QPushButton* PushButton2; + QRadioButton* CheckButton1; + + +protected: + QGridLayout* DlgRef_3Sel4Spin2Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; + QGridLayout* Layout3; +}; + +#endif // DLGREF_3SEL4SPIN2CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_4Sel1List_QTD.cxx b/src/DlgRef/DlgRef_4Sel1List_QTD.cxx new file mode 100644 index 000000000..62582e40b --- /dev/null +++ b/src/DlgRef/DlgRef_4Sel1List_QTD.cxx @@ -0,0 +1,133 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_4Sel1List_QTD.ui' +** +** Created: lun oct 27 17:21:04 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_4Sel1List_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_4Sel1List_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_4Sel1List_QTD::DlgRef_4Sel1List_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_4Sel1List_QTD" ); + resize( 129, 175 ); + setCaption( trUtf8( "DlgRef_4Sel1List_QTD" ) ); + DlgRef_4Sel1List_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_4Sel1List_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"); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + PushButton4 = new QPushButton( GroupBox1, "PushButton4" ); + PushButton4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton4->sizePolicy().hasHeightForWidth() ) ); + PushButton4->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton4, 4, 1 ); + + 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 ); + + LineEdit4 = new QLineEdit( GroupBox1, "LineEdit4" ); + + Layout1->addWidget( LineEdit4, 4, 2 ); + + PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + PushButton3->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton3, 3, 1 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + 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 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout1->addWidget( TextLabel4, 3, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 80, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 5, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout1->addWidget( TextLabel5, 4, 0 ); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + Layout1->addWidget( LineEdit3, 3, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" ); + ComboBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( ComboBox1, 2, 2 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_4Sel1List_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_4Sel1List_QTD::~DlgRef_4Sel1List_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_4Sel1List_QTD.h b/src/DlgRef/DlgRef_4Sel1List_QTD.h new file mode 100644 index 000000000..f09d2729d --- /dev/null +++ b/src/DlgRef/DlgRef_4Sel1List_QTD.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_4Sel1List_QTD.ui' +** +** Created: lun oct 27 17:21:03 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_4SEL1LIST_QTD_H +#define DLGREF_4SEL1LIST_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QComboBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class DlgRef_4Sel1List_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_4Sel1List_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_4Sel1List_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit2; + QPushButton* PushButton4; + QPushButton* PushButton1; + QLineEdit* LineEdit4; + QPushButton* PushButton3; + QPushButton* PushButton2; + QLabel* TextLabel1; + QLabel* TextLabel4; + QLineEdit* LineEdit1; + QLabel* TextLabel5; + QLineEdit* LineEdit3; + QLabel* TextLabel2; + QComboBox* ComboBox1; + QLabel* TextLabel3; + + +protected: + QGridLayout* DlgRef_4Sel1List_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_4SEL1LIST_QTD_H diff --git a/src/DlgRef/Makefile.in b/src/DlgRef/Makefile.in index 25b5f6a41..d8f32ca58 100644 --- a/src/DlgRef/Makefile.in +++ b/src/DlgRef/Makefile.in @@ -52,6 +52,10 @@ LIB_SRC = DlgRef_Skeleton_QTD.cxx \ DlgRef_2Sel2Spin_QTD.cxx \ DlgRef_2Sel3Spin_QTD.cxx \ DlgRef_2Sel1Spin1Check_QTD.cxx \ + DlgRef_2Sel2Spin1Check_QTD.cxx \ + DlgRef_2Sel4Spin1Check_QTD.cxx \ + DlgRef_3Sel4Spin2Check_QTD.cxx \ + DlgRef_4Sel1List_QTD.cxx \ DlgRef_1Spin_QTD.cxx \ DlgRef_2Spin_QTD.cxx \ DlgRef_3Spin_QTD.cxx \ @@ -66,6 +70,9 @@ LIB_SRC = DlgRef_Skeleton_QTD.cxx \ DlgRef_2Sel2Spin.cxx \ DlgRef_2Sel3Spin.cxx \ DlgRef_2Sel1Spin1Check.cxx \ + DlgRef_2Sel2Spin1Check.cxx \ + DlgRef_2Sel4Spin1Check.cxx \ + DlgRef_3Sel4Spin2Check.cxx \ DlgRef_1Spin.cxx \ DlgRef_2Spin.cxx \ DlgRef_3Spin.cxx \ @@ -87,6 +94,10 @@ LIB_MOC = \ DlgRef_2Sel2Spin_QTD.h \ DlgRef_2Sel3Spin_QTD.h \ DlgRef_2Sel1Spin1Check_QTD.h \ + DlgRef_2Sel2Spin1Check_QTD.h \ + DlgRef_2Sel4Spin1Check_QTD.h \ + DlgRef_3Sel4Spin2Check_QTD.h \ + DlgRef_4Sel1List_QTD.h \ DlgRef_1Spin_QTD.h \ DlgRef_2Spin_QTD.h \ DlgRef_3Spin_QTD.h \ @@ -101,6 +112,9 @@ LIB_MOC = \ DlgRef_2Sel2Spin.h \ DlgRef_2Sel3Spin.h \ DlgRef_2Sel1Spin1Check.h \ + DlgRef_2Sel2Spin1Check.h \ + DlgRef_2Sel4Spin1Check.h \ + DlgRef_3Sel4Spin2Check.h \ DlgRef_1Spin.h \ DlgRef_2Spin.h \ DlgRef_3Spin.h \ diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel1Check1List_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel1Check1List_QTD.ui index 2c4c5d469..677fe88ff 100644 --- a/src/DlgRef/UIFiles/DlgRef_1Sel1Check1List_QTD.ui +++ b/src/DlgRef/UIFiles/DlgRef_1Sel1Check1List_QTD.ui @@ -56,6 +56,23 @@ 6 + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 166 + + + CheckButton1 @@ -64,14 +81,9 @@ - + - LineEdit1 - - - - - TextLabel1 + TextLabel2 @@ -82,55 +94,59 @@ - TL1 + TL2 - + - PushButton1 + ComboBox1 - 0 + 7 0 0 0 - - + + + + LineEdit1 - + - ComboBox1 + TextLabel1 - 7 + 0 0 0 0 + + TL1 + - + - Spacer5 - - - Vertical + PushButton1 - - Expanding + + + 0 + 0 + 0 + 0 + - - - 0 - 60 - + + - + diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel3Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel3Spin_QTD.ui index 262deb7a5..de8d35e33 100644 --- a/src/DlgRef/UIFiles/DlgRef_1Sel3Spin_QTD.ui +++ b/src/DlgRef/UIFiles/DlgRef_1Sel3Spin_QTD.ui @@ -8,8 +8,8 @@ 0 0 - 232 - 87 + 129 + 143 @@ -56,6 +56,22 @@ 6 + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + PushButton1 @@ -72,6 +88,11 @@ + + + LineEdit1 + + Spacer6 @@ -85,31 +106,10 @@ 0 - 207 + 150 - - - TextLabel1 - - - - 0 - 0 - 0 - 0 - - - - TL1 - - - - - LineEdit1 - - Layout2 @@ -124,25 +124,22 @@ 6 - + - TextLabel4 + SpinBox2 - 0 + 7 0 0 0 - - TL4 - - + - TextLabel2 + TextLabel3 @@ -153,28 +150,25 @@ - TL2 + TL3 - + - TextLabel3 + SpinBox3 - 0 + 7 0 0 0 - - TL3 - - + - SpinBox3 + SpinBox1 @@ -185,31 +179,37 @@ - + - SpinBox1 + TextLabel4 - 7 + 0 0 0 0 + + TL4 + - + - SpinBox2 + TextLabel2 - 7 + 0 0 0 0 + + TL2 + diff --git a/src/DlgRef/UIFiles/DlgRef_2Sel2Spin1Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_2Sel2Spin1Check_QTD.ui new file mode 100644 index 000000000..e5c699abb --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_2Sel2Spin1Check_QTD.ui @@ -0,0 +1,239 @@ + +DlgRef_2Sel2Spin1Check_QTD + + + DlgRef_2Sel2Spin1Check_QTD + + + + 0 + 0 + 129 + 164 + + + + DlgRef_2Sel2Spin1Check_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 275 + + + + + + LineEdit2 + + + + + CheckButton1 + + + + + + + + LineEdit1 + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_2Sel4Spin1Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_2Sel4Spin1Check_QTD.ui new file mode 100644 index 000000000..85da96fca --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_2Sel4Spin1Check_QTD.ui @@ -0,0 +1,313 @@ + +DlgRef_2Sel4Spin1Check_QTD + + + DlgRef_2Sel4Spin1Check_QTD + + + + 0 + 0 + 129 + 222 + + + + DlgRef_2Sel4Spin1Check_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + LineEdit2 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox4 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel5 + + + + 0 + 0 + 0 + 0 + + + + TL5 + + + + + SpinBox3 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel6 + + + + 0 + 0 + 0 + 0 + + + + TL6 + + + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + CheckButton1 + + + + + + + + LineEdit1 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 177 + + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_3Sel4Spin2Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_3Sel4Spin2Check_QTD.ui new file mode 100644 index 000000000..93e8f84d8 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_3Sel4Spin2Check_QTD.ui @@ -0,0 +1,358 @@ + +DlgRef_3Sel4Spin2Check_QTD + + + DlgRef_3Sel4Spin2Check_QTD + + + + 0 + 0 + 129 + 271 + + + + DlgRef_3Sel4Spin2Check_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + LineEdit1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + PushButton3 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 155 + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel5 + + + + 0 + 0 + 0 + 0 + + + + TL5 + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + LineEdit3 + + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox4 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox3 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel7 + + + + 0 + 0 + 0 + 0 + + + + TL7 + + + + + TextLabel6 + + + + 0 + 0 + 0 + 0 + + + + TL6 + + + + + + + CheckButton2 + + + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + LineEdit2 + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + CheckButton1 + + + + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_4Sel1List_QTD.ui b/src/DlgRef/UIFiles/DlgRef_4Sel1List_QTD.ui new file mode 100644 index 000000000..831768d79 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_4Sel1List_QTD.ui @@ -0,0 +1,260 @@ + +DlgRef_4Sel1List_QTD + + + DlgRef_4Sel1List_QTD + + + + 0 + 0 + 129 + 175 + + + + DlgRef_4Sel1List_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + LineEdit2 + + + + + PushButton4 + + + + 0 + 0 + 0 + 0 + + + + + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit4 + + + + + PushButton3 + + + + 0 + 0 + 0 + 0 + + + + + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 80 + + + + + + LineEdit1 + + + + + TextLabel5 + + + + 0 + 0 + 0 + 0 + + + + TL5 + + + + + LineEdit3 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + ComboBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/ui_to_cxx b/src/DlgRef/UIFiles/ui_to_cxx index 899243964..be4eb4389 100755 --- a/src/DlgRef/UIFiles/ui_to_cxx +++ b/src/DlgRef/UIFiles/ui_to_cxx @@ -6,12 +6,6 @@ #uic -o DlgRef_1Sel_QTD.h DlgRef_1Sel_QTD.ui #uic -o DlgRef_1Sel_QTD.cxx -impl DlgRef_1Sel_QTD.h DlgRef_1Sel_QTD.ui -#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_1Sel1Check1List_QTD.h DlgRef_1Sel1Check1List_QTD.ui -uic -o DlgRef_1Sel1Check1List_QTD.cxx -impl DlgRef_1Sel1Check1List_QTD.h DlgRef_1Sel1Check1List_QTD.ui - #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 @@ -27,6 +21,15 @@ uic -o DlgRef_1Sel1Check1List_QTD.cxx -impl DlgRef_1Sel1Check1List_QTD.h DlgRef_ #uic -o DlgRef_1Sel5Spin_QTD.h DlgRef_1Sel5Spin_QTD.ui #uic -o DlgRef_1Sel5Spin_QTD.cxx -impl DlgRef_1Sel5Spin_QTD.h DlgRef_1Sel5Spin_QTD.ui +#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_1Sel1Check1List_QTD.h DlgRef_1Sel1Check1List_QTD.ui +#uic -o DlgRef_1Sel1Check1List_QTD.cxx -impl DlgRef_1Sel1Check1List_QTD.h DlgRef_1Sel1Check1List_QTD.ui + +#uic -o DlgRef_2Sel_QTD.h DlgRef_2Sel_QTD.ui +#uic -o DlgRef_2Sel_QTD.cxx -impl DlgRef_2Sel_QTD.h DlgRef_2Sel_QTD.ui + #uic -o DlgRef_2Sel1Spin_QTD.h DlgRef_2Sel1Spin_QTD.ui #uic -o DlgRef_2Sel1Spin_QTD.cxx -impl DlgRef_2Sel1Spin_QTD.h DlgRef_2Sel1Spin_QTD.ui @@ -36,15 +39,24 @@ uic -o DlgRef_1Sel1Check1List_QTD.cxx -impl DlgRef_1Sel1Check1List_QTD.h DlgRef_ #uic -o DlgRef_2Sel2Spin_QTD.h DlgRef_2Sel2Spin_QTD.ui #uic -o DlgRef_2Sel2Spin_QTD.cxx -impl DlgRef_2Sel2Spin_QTD.h DlgRef_2Sel2Spin_QTD.ui +#uic -o DlgRef_2Sel2Spin1Check_QTD.h DlgRef_2Sel2Spin1Check_QTD.ui +#uic -o DlgRef_2Sel2Spin1Check_QTD.cxx -impl DlgRef_2Sel2Spin1Check_QTD.h DlgRef_2Sel2Spin1Check_QTD.ui + #uic -o DlgRef_2Sel3Spin_QTD.h DlgRef_2Sel3Spin_QTD.ui #uic -o DlgRef_2Sel3Spin_QTD.cxx -impl DlgRef_2Sel3Spin_QTD.h DlgRef_2Sel3Spin_QTD.ui -#uic -o DlgRef_2Sel_QTD.h DlgRef_2Sel_QTD.ui -#uic -o DlgRef_2Sel_QTD.cxx -impl DlgRef_2Sel_QTD.h DlgRef_2Sel_QTD.ui +#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_3Sel_QTD.h DlgRef_3Sel_QTD.ui #uic -o DlgRef_3Sel_QTD.cxx -impl DlgRef_3Sel_QTD.h DlgRef_3Sel_QTD.ui +#uic -o DlgRef_3Sel4Spin2Check_QTD.h DlgRef_3Sel4Spin2Check_QTD.ui +#uic -o DlgRef_3Sel4Spin2Check_QTD.cxx -impl DlgRef_3Sel4Spin2Check_QTD.h DlgRef_3Sel4Spin2Check_QTD.ui + #uic -o DlgRef_1Spin_QTD.h DlgRef_1Spin_QTD.ui #uic -o DlgRef_1Spin_QTD.cxx -impl DlgRef_1Spin_QTD.h DlgRef_1Spin_QTD.ui diff --git a/src/GEOM/GEOM_Gen_i.cc b/src/GEOM/GEOM_Gen_i.cc index e048497fe..7ae1df24b 100644 --- a/src/GEOM/GEOM_Gen_i.cc +++ b/src/GEOM/GEOM_Gen_i.cc @@ -3612,6 +3612,94 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFace( GEOM::GEOM_Shape_ptr wire, } +//================================================================================= +// function : MakeShell() +// purpose : Make a compound from a list containing one or more shapes +//================================================================================= +GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeShell( const GEOM::GEOM_Gen::ListOfIOR& ListShapes ) + throw (SALOME::SALOME_Exception) +{ + GEOM::GEOM_Shape_var result ; + BRepTools_Quilt Glue; + TopoDS_Shape C; + + for ( unsigned int i = 0; i < ListShapes.length(); i++) { + GEOM::GEOM_Shape_var aShape = GetIORFromString( ListShapes[i] ); + TopoDS_Shape Shape = GetTopoShape(aShape) ; + if( Shape.IsNull() ) { + THROW_SALOME_CORBA_EXCEPTION("Shell aborted : null shape during operation", SALOME::BAD_PARAM); + } + Glue.Add(Shape) ; + } + + TopExp_Explorer exp(Glue.Shells(), TopAbs_SHELL); + Standard_Integer ish = 0; + for (; exp.More(); exp.Next()) { + C = exp.Current(); + ish++; + } + + if (ish != 1) + C = Glue.Shells(); + + if ( C.IsNull() ) { + THROW_SALOME_CORBA_EXCEPTION("Null result : Shell operation aborted", SALOME::BAD_PARAM); + } + else { + result = CreateObject(C) ; + InsertInLabelMoreArguments(C, result, ListShapes, myCurrentOCAFDoc) ; + } + return result; +} + + +//================================================================================= +// function : MakeSolid() +// purpose : Make a compound from a list containing one or more shapes +//================================================================================= +GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSolid( const GEOM::GEOM_Gen::ListOfIOR& ListShapes ) + throw (SALOME::SALOME_Exception) +{ + GEOM::GEOM_Shape_var result ; + Standard_Integer ish = 0; + TopoDS_Compound Res; + TopoDS_Solid Sol; + BRep_Builder B; + TopoDS_Shape Shape; + + B.MakeCompound(Res); + + for ( unsigned int i = 0; i < ListShapes.length(); i++) { + GEOM::GEOM_Shape_var aShape = GetIORFromString( ListShapes[i] ); + TopoDS_Shape Sh = GetTopoShape(aShape) ; + if( Sh.IsNull() ) { + THROW_SALOME_CORBA_EXCEPTION("Solid aborted : null shape during operation", SALOME::BAD_PARAM); + } + B.MakeSolid(Sol); + B.Add(Sol,Sh); + BRepClass3d_SolidClassifier SC(Sol); + SC.PerformInfinitePoint(Precision::Confusion()); + if (SC.State() == TopAbs_IN) { + B.MakeSolid(Sol); + B.Add(Sol,Sh.Reversed()); + } + B.Add(Res,Sol); + ish++; + } + if (ish == 1) { Shape = Sol;} + else { Shape = Res;} + + if ( Shape.IsNull() ) { + THROW_SALOME_CORBA_EXCEPTION("Null result : Solid operation aborted", SALOME::BAD_PARAM); + } + else { + result = CreateObject(Shape) ; + InsertInLabelMoreArguments(Shape, result, ListShapes, myCurrentOCAFDoc) ; + } + return result; +} + + //================================================================================ // function : MakeLine // purpose : Make a Line topology diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index b74adb230..38735d1d2 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -63,8 +63,6 @@ using namespace std; #include #include -#include -#include // // QT Includes #include @@ -93,312 +91,404 @@ GEOMBase::~GEOMBase() //===================================================================================== -// function : GetIndex() -// purpose : Get the index of a sub shape in a main shape : index start at 1 +// function : Display() +// purpose : Displays a CORBA shape //===================================================================================== -int GEOMBase::GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int /*ShapeType*/) -{ - if(shape.IsNull() || subshape.IsNull()) - return -1; - - int index = 1; - if(subshape.ShapeType() == TopAbs_COMPOUND) { - TopoDS_Iterator it; - TopTools_ListOfShape CL; - CL.Append(shape); - TopTools_ListIteratorOfListOfShape itC; - for(itC.Initialize(CL); itC.More(); itC.Next()) { - for(it.Initialize(itC.Value()); it.More(); it.Next()) { - if(it.Value().ShapeType() == TopAbs_COMPOUND) { - if(it.Value().IsSame(subshape)) - return index; - else - index++; - CL.Append(it.Value()); - } - } - } +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()); + Sel->ClearIObjects(); + + if(aShape->_is_nil()) { + QAD_MessageBox::warn1 (QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_PRP_ABORT"), tr("GEOM_BUT_OK")); + return false; } - else { - TopExp_Explorer Exp(shape, subshape.ShapeType()); - TopTools_MapOfShape M; - while(Exp.More()) { - if(M.Add(Exp.Current())) { - if(Exp.Current().IsSame(subshape)) - return index; - index++; - } - Exp.Next(); - } - } - return -1; -} + + TopoDS_Shape shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + if(shape.IsNull()) + return false; + SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributePixMap_var aPixmap; -//================================================================================= -// function : VertexToPoint() -// purpose : If S can be converted in a gp_Pnt returns true and the result is P -//================================================================================= -bool GEOMBase::VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P) -{ - if(S.IsNull() || S.ShapeType() != TopAbs_VERTEX) - return false; - P = BRep_Tool::Pnt(TopoDS::Vertex(S)); - return true; -} + SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM"); + int aLocked = false; + if(father->_is_nil()) { + QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + op->start(); + aLocked = aStudy->GetProperties()->IsLocked(); + if(aLocked) + aStudy->GetProperties()->SetLocked(false); + father = aStudyBuilder->NewComponent("GEOM"); + anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(QAD_Application::getDesktop()->getComponentUserName("GEOM")); + anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap("ICON_OBJBROWSER_Geometry"); + myGeomGUI->GetActiveStudy()->updateObjBrowser(); + if(aLocked) + aStudy->GetProperties()->SetLocked(true); + op->finish(); + } + aStudyBuilder->DefineComponentInstance(father, myGeom); + father->ComponentIOR(myGeomGUI->GetFatherior()); -//================================================================================= -// function : GetBipointDxDyDz() -// purpose : -//================================================================================= -void GEOMBase::GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz) -{ - dx = P2.X() - P1.X(); - dy = P2.Y() - P1.Y(); - dz = P2.Z() - P1.Z(); - return; -} + TCollection_AsciiString nameG(""); + Standard_CString Type; + if(TCollection_AsciiString(name).IsEqual(Standard_CString(""))) { + if(TCollection_AsciiString(aShape->NameType()).IsEqual(Standard_CString(""))) { + Standard_CString type; + GetShapeTypeString(shape,type); + aShape->NameType(type); + nameG += TCollection_AsciiString(type) + TCollection_AsciiString("_") + TCollection_AsciiString(myGeomGUI->GetNbGeom()++) + TCollection_AsciiString("\0"); + } + else + nameG += TCollection_AsciiString(aShape->NameType()) + TCollection_AsciiString("_") + TCollection_AsciiString(myGeomGUI->GetNbGeom()++) + TCollection_AsciiString("\0"); + } + else + nameG = TCollection_AsciiString(name); + + // VTK + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + int themode = myRenderInter->GetDisplayMode(); + vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(shape, 0, themode, Standard_True); + theActors->InitTraversal(); + vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); -//================================================================================= -// function : LinearEdgeExtremities() -// purpose : If S can be converted in a linear edge and if initial an final points -// : distance is sufficient, returns true else returns false. -// : Resulting points are respectively P1 and P2 -//================================================================================= -bool GEOMBase::LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2) -{ - if(S.IsNull() || S.ShapeType() != TopAbs_EDGE) - return false; - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - if(curv.GetType() != GeomAbs_Line) - return false; + IO = new GEOM_InteractiveObject(aShape->Name(), myGeomGUI->GetFatherior(), "GEOM"); + while(!(anActor==NULL)) { + GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); + GActor->setIO(IO); + GActor->setName(nameG.ToCString()); + + theRenderer->AddActor(GActor); + anActor = (vtkActor*)theActors->GetNextActor(); + } + } + // OCC + else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->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()); + IO = new GEOM_InteractiveObject(aShape->Name(), myGeomGUI->GetFatherior(), "GEOM"); + theResult->setIO(IO); + theResult->setName(nameG.ToCString()); + + /* Precaution : close any local context to permit the display */ + if(ic->HasOpenedContext()) + ic->CloseAllContexts(); - curv.D0(curv.FirstParameter(), P1); - curv.D0(curv.LastParameter(), P2); + ic->Display(theResult); + } - if(P1.Distance(P2) <= Precision::Confusion()) - return false; + Sel->AddIObject(IO, false); + myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Repaint(); + if(myGeomGUI->GetSettings_AddInStudy()) + AddInStudy(false, IO); return true; } -//======================================================================= -// function : GetTopoFromSelection() -// purpose : Define tds from a single selection and retuen true -//======================================================================= -bool GEOMBase::GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds) +//===================================================================================== +// function : AddInStudy() +// purpose : anIOShape or a selected shape +//===================================================================================== +bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject)& anIO) { - if(Sel->IObjectCount() != 1) - return false; - - Handle(SALOME_InteractiveObject) IO = Sel->firstIObject(); - /* case SObject */ - if(IO->hasEntry()) { - SALOMEDS::Study_var aStudy = myGeomGUI->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")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - tds = this->GetShapeFromIOR(anIOR->Value()); - if(tds.IsNull()) - return false; - else - return true; - } - } + SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); + if (!(!myGeomGUI->GetSettings_AddInStudy() || selection)) { + Sel->ClearIObjects(); } - if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { - Standard_CString ior = ""; - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IO); - ior = GIObject->getIOR(); - tds = this->GetShapeFromIOR(ior); - if(tds.IsNull()) - return false; - else - return true; + SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributePixMap_var aPixmap; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributeSelectable_var aSelAttr; + + SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM"); + int aLocked = false; + if(father->_is_nil()) { + QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + op->start(); + aLocked = aStudy->GetProperties()->IsLocked(); + if(aLocked) + aStudy->GetProperties()->SetLocked(false); + father = aStudyBuilder->NewComponent("GEOM"); + anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue( QAD_Application::getDesktop()->getComponentUserName("GEOM")); + anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap("ICON_OBJBROWSER_Geometry"); + if (aLocked) + aStudy->GetProperties()->SetLocked(true); + op->finish(); } + + aStudyBuilder->DefineComponentInstance(father, myGeom); + father->ComponentIOR(myGeomGUI->GetFatherior()); - return false; -} + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + + Handle(GEOM_AISShape) GAISShape; + GEOM_Actor* GActor; + Handle(GEOM_InteractiveObject) GIO; + bool found = false; + // VTK + if (myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + vtkRenderer *Renderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); -//======================================================================= -// function : GetNameOfSelectedIObjects() -// purpose : Define the name geom++ or other name of mono or multi sel. -//======================================================================= -int GEOMBase::GetNameOfSelectedIObjects(SALOME_Selection* Sel, QString& aName) -{ - int nbSel = Sel->IObjectCount(); - if(nbSel == 1) { - Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); - aName = IObject->getName(); - } - else { - aName = tr("%1_objects").arg(nbSel); + 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(SALOME_InteractiveObject) IO = anActor->getIO(); + if(IO->IsKind(STANDARD_TYPE(GEOM_InteractiveObject))) { + GIO = Handle(GEOM_InteractiveObject)::DownCast(IO); + if(anIO->isSame(GIO)) { + found = true; + GActor = anActor; + break; + } + } + } + } + ac = theActors->GetNextActor(); + } + + if(!found) + return false; } - return nbSel; -} - - -//======================================================================= -// function : ConvertIOinGEOMAISShape() -// purpose : -//======================================================================= -Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult, bool onlyInActiveView) -{ - Handle(GEOM_AISShape) res; - 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()); - if(GIO->isSame(IO)) { - if(onlyInActiveView) { - if(sf == myGeomGUI->GetActiveStudy()->getActiveStudyFrame()) { - testResult = true; - return aSh; - } - } - else { - testResult = true; - return aSh; - } + // OCC + else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + AIS_ListOfInteractive List; + ic->DisplayedObjects(List); + 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(SALOME_InteractiveObject) IO = aSh->getIO(); + if ( IO->IsKind(STANDARD_TYPE(GEOM_InteractiveObject))) { + GIO = Handle(GEOM_InteractiveObject)::DownCast(IO); + if(anIO->isSame(GIO)) { + found = true; + GAISShape = aSh; + break; } } } - ite.Next(); - } + } + ite.Next(); } + + if(!found) + return false; } - testResult = false; - return res; -} + if(!myGeomGUI->GetSettings_AddInStudy() || selection) { + QString Name = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), anIO->getName()); + if(!Name.isEmpty()) { + // VTK + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) + GActor->setName(strdup(Name.latin1())); + // OCC + else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + GAISShape->setName(strdup(Name.latin1())); + } + else + return false; + } -//======================================================================= -// function : ConvertIORinGEOMAISShape() -// purpose : -//======================================================================= -Handle(GEOM_AISShape) GEOMBase::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(); + // open transaction + QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + op->start(); - AIS_ListOfInteractive List; - ic->DisplayedObjects(List); - AIS_ListOfInteractive List1; - ic->ObjectsInCollector(List1); - List.Append(List1); + SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(father); - 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(); - } - } + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(GIO->getIOR()); + + /* For the shape inserted into the study we set its field 'studyshapeid' */ + /* so the shape will contain its corresponding entry in the study Ocaf doc. */ + aShape->StudyShapeId(newObj->GetID()); + + GIO->setEntry(newObj->GetID()); + + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(aShape->Name()); + + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + if(aShape->ShapeType() == GEOM::COMPOUND) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); + else if(aShape->ShapeType() == GEOM::COMPSOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); + else if(aShape->ShapeType() == GEOM::SOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); + else if(aShape->ShapeType() == GEOM::SHELL) + aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); + else if(aShape->ShapeType() == GEOM::FACE) + aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); + else if(aShape->ShapeType() == GEOM::WIRE) + aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); + else if(aShape->ShapeType() == GEOM::EDGE) + aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); + else if(aShape->ShapeType() == GEOM::VERTEX) + aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); + + // VTK + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + GActor->setIO(GIO); + aName->SetValue(GActor->getName()); + } + // OCC + else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + GAISShape->setIO(GIO); + aName->SetValue(GAISShape->getName()); } - return resultShape; -} + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1,newObj); -//======================================================================= -// function : ConvertIORinGEOMActor() -// purpose : -//======================================================================= -GEOM_Actor* GEOMBase::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(); + GEOM::GEOM_Gen::ListOfIOR_var listIOR = new GEOM::GEOM_Gen::ListOfIOR; + listIOR = myGeom->GetReferencedObjects(aShape); + + if(listIOR->length()>0) { + SALOMEDS::SObject_var Arguments = aStudyBuilder->NewObject(newObj); + anAttr = aStudyBuilder->FindOrCreateAttribute(Arguments, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(tr("GEOM_ARGUMENTS")); + anAttr = aStudyBuilder->FindOrCreateAttribute(Arguments, "AttributeSelectable"); + aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); + aSelAttr->SetSelectable(false); + + bool ObjectReferenced = false; + for (unsigned int ind = 0; ind < listIOR->length();ind++) { + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(listIOR[ind]); + + if(!theObj->_is_nil()) { + SALOMEDS::SObject_var RefObject = aStudyBuilder->NewObject(Arguments); + aStudyBuilder->Addreference(RefObject, theObj); + ObjectReferenced = true; } } + + if(!ObjectReferenced) + aStudyBuilder->RemoveObject(Arguments); } - testResult = false; - return GEOM_Actor::New(); + op->finish(); + + if(!myGeomGUI->GetSettings_AddInStudy() || selection) + myGeomGUI->GetActiveStudy()->updateObjBrowser(); + else { + myGeomGUI->GetActiveStudy()->updateObjBrowser(false); + Sel->AddIObject(GIO); + } + return true; } -//======================================================================= -// function : ConvertIOinGEOMShape() -// purpose : -//======================================================================= -GEOM::GEOM_Shape_ptr GEOMBase::ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) +//===================================================================================== +// function : GetShapeFromIOR() +// purpose : exist also as static method ! +//===================================================================================== +TopoDS_Shape GEOMBase::GetShapeFromIOR(QString IOR) { - GEOM::GEOM_Shape_ptr aShape; - testResult = false; + TopoDS_Shape result; + if(IOR.stripWhiteSpace().isEmpty()) + return result; + ORB_INIT &init = *SINGLETON_::Instance(); + CORBA::ORB_var& _orb = init.orb() ; + CORBA::Object_var obj = _orb->string_to_object((char*)(IOR.latin1())); + if(CORBA::is_nil(obj)) + return result; + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(IOR); + if(!aShape->_is_nil()) + result = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + return result; +} + + +//===================================================================================== +// function : GetIndex() +// purpose : Get the index of a sub shape in a main shape : index start at 1 +//===================================================================================== +int GEOMBase::GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int /*ShapeType*/) +{ + if(shape.IsNull() || subshape.IsNull()) + return -1; + + int index = 1; + if(subshape.ShapeType() == TopAbs_COMPOUND) { + TopoDS_Iterator it; + TopTools_ListOfShape CL; + CL.Append(shape); + TopTools_ListIteratorOfListOfShape itC; + for(itC.Initialize(CL); itC.More(); itC.Next()) { + for(it.Initialize(itC.Value()); it.More(); it.Next()) { + if(it.Value().ShapeType() == TopAbs_COMPOUND) { + if(it.Value().IsSame(subshape)) + return index; + else + index++; + CL.Append(it.Value()); + } + } + } + } + else { + TopExp_Explorer Exp(shape, subshape.ShapeType()); + TopTools_MapOfShape M; + while(Exp.More()) { + if(M.Add(Exp.Current())) { + if(Exp.Current().IsSame(subshape)) + return index; + index++; + } + Exp.Next(); + } + } + return -1; +} + +//======================================================================= +// function : GetTopoFromSelection() +// purpose : Define tds from a single selection and retuen true +//======================================================================= +bool GEOMBase::GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds) +{ + if(Sel->IObjectCount() != 1) + return false; + + Handle(SALOME_InteractiveObject) IO = Sel->firstIObject(); /* case SObject */ if(IO->hasEntry()) { SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); @@ -408,61 +498,45 @@ GEOM::GEOM_Shape_ptr GEOMBase::ConvertIOinGEOMShape(const Handle(SALOME_Interact if(!obj->_is_nil()) { if(obj->FindAttribute(anAttr, "AttributeIOR")) { anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - aShape = myGeom->GetIORFromString(anIOR->Value()); - testResult = true; - return aShape; + tds = this->GetShapeFromIOR(anIOR->Value()); + if(tds.IsNull()) + return false; + else + return true; } } } - /* case Graphical Object */ + if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { + Standard_CString ior = ""; Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IO); - Standard_CString ior = GIObject->getIOR(); - testResult = true; - aShape = myGeom->GetIORFromString(ior); - return aShape; - } - return aShape; + ior = GIObject->getIOR(); + tds = this->GetShapeFromIOR(ior); + if(tds.IsNull()) + return false; + else + return true; + } + + return false; } //======================================================================= -// function : ConvertListOfIOInListOfIOR() -// purpose : +// function : GetNameOfSelectedIObjects() +// purpose : Define the name geom++ or other name of mono or multi sel. //======================================================================= -void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM_Gen::ListOfIOR& listIOR) +int GEOMBase::GetNameOfSelectedIObjects(SALOME_Selection* Sel, QString& aName) { - int nbSel = aList.Extent(); - listIOR.length(nbSel); - int j=0; - SALOME_ListIteratorOfListIO It(aList); - 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::SObject_var obj = aStudy->FindObjectID(IObject->getEntry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if(!obj->_is_nil() && obj->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - ORB_INIT &init = *SINGLETON_::Instance(); - CORBA::ORB_var& _orb = init.orb(); - CORBA::String_var theValue = anIOR->Value(); - CORBA::Object_var theObj = _orb->string_to_object(theValue); - if(theObj->_is_a("IDL:GEOM/GEOM_Shape:1.0")) { - listIOR[j] = strdup(theValue); - j++; - } - } - } - else if(IObject->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IObject); - Standard_CString ior = GIObject->getIOR(); - listIOR[j] = strdup(ior); - j++; - } + int nbSel = Sel->IObjectCount(); + if(nbSel == 1) { + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + aName = IObject->getName(); + } + else { + aName = tr("%1_objects").arg(nbSel); } - listIOR.length(j); + return nbSel; } @@ -561,614 +635,304 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& case TopAbs_SHAPE: { aTypeString = strdup(tr("GEOM_SHAPE")); - return true; - } - } - return false; -} - - -//================================================================================= -// function : CreateArrowForLinearEdge() -// purpose : Create a cone topology to be used to display an arrow in the middle -// : of an edge showing its orientation. (For simulation and Viewer OCC only) -//================================================================================= -bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone) -{ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC || tds.ShapeType() != TopAbs_EDGE) - return false; - - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort(); - Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)vp)->getView(); - Standard_Real Width, Height; - view3d->Size(Width, Height); - const Standard_Real aHeight = (Width + Height) / 50.0; - - try { - Standard_Real first, last; - Handle(Geom_Curve) curv = BRep_Tool::Curve(TopoDS::Edge(tds), first, last); - if(!curv->IsCN(1)) - return false; - - const Standard_Real param = (first+last) / 2.0; - gp_Pnt middleParamPoint; - gp_Vec V1; - curv->D1( param, middleParamPoint, V1); - if(V1.Magnitude() < Precision::Confusion()) - return false; - - /* Topology orientation not geom orientation */ - if(tds.Orientation() == TopAbs_REVERSED) - V1 *= -1.0; - - gp_Ax2 anAxis( middleParamPoint, gp_Dir(V1)); - const Standard_Real radius1 = aHeight / 5.0; - if(radius1 > 10.0 * Precision::Confusion() && aHeight > 10.0 * Precision::Confusion()) { - ArrowCone = BRepPrimAPI_MakeCone( anAxis, radius1, 0.0, aHeight ).Shape(); - return true; - } - } - catch(Standard_Failure) { - // OCC failures are hard to catch in GUI. - // This because of the position for #include that is very critic to find - // in SALOME environment : compilation error ! - } - return false; -} - - -//======================================================================= -// function : SelectionByNameInDialogs() -// purpose : Called when user has entered a name of object in a LineEdit. -// : The selection is changed. Dialog box will receive the -// : corresponding signal to manage this event. -//======================================================================= -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::ListOfSObject_var listSO = new SALOMEDS::Study::ListOfSObject; - listSO = ST->FindObjectByName(objectUserName, "GEOM"); - - if(listSO->length() < 1) { - const QString caption = tr("GEOM_WRN_WARNING"); - const QString text = tr("GEOM_NAME_INCORRECT"); - const QString button0 = tr("GEOM_BUT_OK"); - QMessageBox::warning(aWidget, caption, text, button0); - return false; - } - /* More than one object with same name */ - if(listSO->length() > 1) { - const QString caption = tr("GEOM_WRN_WARNING"); - const QString text = tr("GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE"); - const QString button0 = tr("GEOM_BUT_OK") ; - QMessageBox::warning(aWidget, caption, text, button0) ; - return false; - } - - SALOMEDS::SObject_var theObj = listSO[0]; - /* Create a SALOME_InteractiveObject with a SALOME::SObject */ - Standard_CString anEntry = theObj->GetID(); - Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(anEntry, "GEOM", strdup(objectUserName)); - - /* Add as a selected object */ - /* Clear any previous selection : */ - /* Warning the LineEdit is purged because of signal currentSelectionChanged ! */ - Sel->ClearIObjects(); - Sel->AddIObject(SI); - return true; -} - - -//===================================================================================== -// function : GetIndexSubShapeSelected() -// purpose : Define a ListOfID of sub shapes selected in ShapeTopo with SubShapeType -// : Method used by Dialogs -//===================================================================================== -bool GEOMBase::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) - return false; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - ic->InitSelected(); - int nbSelected = ic->NbSelected(); - ListOfID.length(nbSelected); - - //***************** DEFINE INDEX OF EACH SELECTION *********************// - int i = 0; - ic->InitSelected(); /* to restart */ - while(ic->MoreSelected()) { - /* Find index of sub shape into main shape */ - TopExp_Explorer Exp (ShapeTopo, TopAbs_ShapeEnum(SubShapeType)); - int index = 1; - bool found = false; - while( Exp.More()) { - if((Exp.Current()).IsSame(ic->SelectedShape())) { - found = true; - break; - } - index++; - Exp.Next(); - } - if(!found) { - /* Manage local context from DialogBox */ - ic->CloseLocalContext(aLocalContextId); - myUseLocalContext = false; - return false; - } - ListOfID[i] = index; - i++; - ic->NextSelected(); - } - //***************** END *********************// - - /* Manage local context from DialogBox */ - ic->CloseLocalContext(aLocalContextId); - myUseLocalContext = false; - - return true; -} - - -//======================================================================= -// function : DefineDlgPosition() -// purpose : Define x and y the default position for a dialog box -//======================================================================= -bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y) -{ - /* Here the position is on the bottom right corner - 10 */ - QAD_Desktop* PP = QAD_Application::getDesktop(); - x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10); - y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10); - return true; -} - - -//======================================================================= -// function : ConvertClickToPoint() -// purpose : Returns the point clicked in 3D view -//======================================================================= -gp_Pnt GEOMBase::ConvertClickToPoint(Standard_Real x, Standard_Real y, Handle(V3d_View) aView) -{ - V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt; - aView->Eye(XEye, YEye, ZEye); - - aView->At(XAt, YAt, ZAt); - gp_Pnt EyePoint(XEye, YEye, ZEye); - gp_Pnt AtPoint(XAt, YAt, ZAt); - - gp_Vec EyeVector(EyePoint, AtPoint); - gp_Dir EyeDir(EyeVector); - - gp_Pln PlaneOfTheView = gp_Pln(AtPoint,EyeDir); - Standard_Real X, Y, Z; - aView->Convert(x, y, X, Y, Z); - gp_Pnt ConvertedPoint(X, Y, Z); - - gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project(PlaneOfTheView, ConvertedPoint); - gp_Pnt ResultPoint = ElSLib::Value(ConvertedPointOnPlane.X(), ConvertedPointOnPlane.Y(), PlaneOfTheView); - return ResultPoint; -} - - -//================================================================================ -// function : SetDisplayedObjectList() -// purpose : -//================================================================================ -void GEOMBase::SetDisplayedObjectList() -{ - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) - return; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myGeomGUI->GetListDisplayedObject().Clear(); - - Handle (AIS_InteractiveContext) aContext = v3d->getAISContext(); - aContext->DisplayedObjects(myGeomGUI->GetListDisplayedObject()); -} - - -//===================================================================================== -// function : DisplaySimulationShape() -// purpose : Displays 'this->mySimulationShape' a pure graphical shape from a TopoDS_Shape -//===================================================================================== -void GEOMBase::DisplaySimulationShape(const TopoDS_Shape& S) -{ - if(S.IsNull()) - return; - - //NRI DEBUG : 14/02/2002 - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) - return; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - - try { - /* erase any previous */ - ic->Erase(myGeomGUI->GetSimulationShape(), Standard_True, Standard_False); - ic->ClearPrs(myGeomGUI->GetSimulationShape()); - myGeomGUI->GetSimulationShape() = new AIS_Shape(TopoDS_Shape()); - myGeomGUI->GetSimulationShape()->Set(S); - myGeomGUI->GetSimulationShape()->SetColor(Quantity_NOC_VIOLET); - ic->Deactivate(myGeomGUI->GetSimulationShape()); - ic->Display(myGeomGUI->GetSimulationShape(), Standard_False); - ic->UpdateCurrentViewer(); - } - catch(Standard_Failure) { - MESSAGE("Exception catched in GEOMBase::DisplaySimulationShape "); - } - myGeomGUI->GetSimulationShape()->UnsetColor(); - return; -} - - -//================================================================================== -// function : EraseSimulationShape() -// purpose : Clears the display of 'mySimulationShape' a pure graphical shape -//================================================================================== -void GEOMBase::EraseSimulationShape() -{ - int count = myGeomGUI->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(); - Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - ic->Erase(myGeomGUI->GetSimulationShape(), Standard_True, Standard_False); - ic->ClearPrs(myGeomGUI->GetSimulationShape()); - ic->UpdateCurrentViewer(); - } - } -} - - -//===================================================================================== -// function : Display() -// purpose : Displays a CORBA shape -//===================================================================================== -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()); - Sel->ClearIObjects(); - - if(aShape->_is_nil()) { - QAD_MessageBox::warn1 (QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_PRP_ABORT"), tr("GEOM_BUT_OK")); - return false; - } - - TopoDS_Shape shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); - if(shape.IsNull()) - return false; - - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributePixMap_var aPixmap; - - SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM"); - int aLocked = false; - if(father->_is_nil()) { - QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); - op->start(); - aLocked = aStudy->GetProperties()->IsLocked(); - if(aLocked) - aStudy->GetProperties()->SetLocked(false); - father = aStudyBuilder->NewComponent("GEOM"); - anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(QAD_Application::getDesktop()->getComponentUserName("GEOM")); - anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - aPixmap->SetPixMap("ICON_OBJBROWSER_Geometry"); - myGeomGUI->GetActiveStudy()->updateObjBrowser(); - if(aLocked) - aStudy->GetProperties()->SetLocked(true); - op->finish(); - } - - aStudyBuilder->DefineComponentInstance(father, myGeom); - father->ComponentIOR(myGeomGUI->GetFatherior()); - - TCollection_AsciiString nameG(""); - Standard_CString Type; - if(TCollection_AsciiString(name).IsEqual(Standard_CString(""))) { - if(TCollection_AsciiString(aShape->NameType()).IsEqual(Standard_CString(""))) { - Standard_CString type; - GetShapeTypeString(shape,type); - aShape->NameType(type); - nameG += TCollection_AsciiString(type) + TCollection_AsciiString("_") + TCollection_AsciiString(myGeomGUI->GetNbGeom()++) + TCollection_AsciiString("\0"); - } - else - nameG += TCollection_AsciiString(aShape->NameType()) + TCollection_AsciiString("_") + TCollection_AsciiString(myGeomGUI->GetNbGeom()++) + TCollection_AsciiString("\0"); - } - else - nameG = TCollection_AsciiString(name); - - // VTK - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); - int themode = myRenderInter->GetDisplayMode(); - - vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(shape, 0, themode, Standard_True); - theActors->InitTraversal(); - vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); - - IO = new GEOM_InteractiveObject(aShape->Name(), myGeomGUI->GetFatherior(), "GEOM"); - while(!(anActor==NULL)) { - GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); - GActor->setIO(IO); - GActor->setName(nameG.ToCString()); - - theRenderer->AddActor(GActor); - anActor = (vtkActor*)theActors->GetNextActor(); - } - } - // OCC - else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->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()); - IO = new GEOM_InteractiveObject(aShape->Name(), myGeomGUI->GetFatherior(), "GEOM"); - theResult->setIO(IO); - theResult->setName(nameG.ToCString()); - - /* Precaution : close any local context to permit the display */ - if(ic->HasOpenedContext()) - ic->CloseAllContexts(); - - ic->Display(theResult); - } - - Sel->AddIObject(IO, false); - myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Repaint(); - if(myGeomGUI->GetSettings_AddInStudy()) - AddInStudy(false, IO); - - return true; + return true; + } + } + return false; } -//===================================================================================== -// function : AddInStudy() -// purpose : anIOShape or a selected shape -//===================================================================================== -bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject)& anIO) +//======================================================================= +// function : ConvertIOinGEOMAISShape() +// purpose : +//======================================================================= +Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult, bool onlyInActiveView) { - SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); - if (!(!myGeomGUI->GetSettings_AddInStudy() || selection)) { - Sel->ClearIObjects(); - } + Handle(GEOM_AISShape) res; + 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(); - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributePixMap_var aPixmap; - SALOMEDS::AttributeIOR_var anIOR; - SALOMEDS::AttributeSelectable_var aSelAttr; - - SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM"); - int aLocked = false; - if(father->_is_nil()) { - QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); - op->start(); - aLocked = aStudy->GetProperties()->IsLocked(); - if(aLocked) - aStudy->GetProperties()->SetLocked(false); - father = aStudyBuilder->NewComponent("GEOM"); - anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue( QAD_Application::getDesktop()->getComponentUserName("GEOM")); - anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - aPixmap->SetPixMap("ICON_OBJBROWSER_Geometry"); - if (aLocked) - aStudy->GetProperties()->SetLocked(true); - op->finish(); + 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()); + if(GIO->isSame(IO)) { + if(onlyInActiveView) { + if(sf == myGeomGUI->GetActiveStudy()->getActiveStudyFrame()) { + testResult = true; + return aSh; + } + } + else { + testResult = true; + return aSh; + } + } + } + } + ite.Next(); + } + } } + testResult = false; + return res; +} - aStudyBuilder->DefineComponentInstance(father, myGeom); - father->ComponentIOR(myGeomGUI->GetFatherior()); - - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); - - Handle(GEOM_AISShape) GAISShape; - GEOM_Actor* GActor; - Handle(GEOM_InteractiveObject) GIO; - bool found = false; - // VTK - if (myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - vtkRenderer *Renderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); +//======================================================================= +// function : ConvertIOinGEOMShape() +// purpose : +//======================================================================= +GEOM::GEOM_Shape_ptr GEOMBase::ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) +{ + GEOM::GEOM_Shape_ptr aShape; + testResult = false; - 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(SALOME_InteractiveObject) IO = anActor->getIO(); - if(IO->IsKind(STANDARD_TYPE(GEOM_InteractiveObject))) { - GIO = Handle(GEOM_InteractiveObject)::DownCast(IO); - if(anIO->isSame(GIO)) { - found = true; - GActor = anActor; - break; - } - } - } + /* case SObject */ + if(IO->hasEntry()) { + SALOMEDS::Study_var aStudy = myGeomGUI->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")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + aShape = myGeom->GetIORFromString(anIOR->Value()); + testResult = true; + return aShape; } - ac = theActors->GetNextActor(); } - - if(!found) - return false; } - // OCC - else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - AIS_ListOfInteractive List; - ic->DisplayedObjects(List); - 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(SALOME_InteractiveObject) IO = aSh->getIO(); - if ( IO->IsKind(STANDARD_TYPE(GEOM_InteractiveObject))) { - GIO = Handle(GEOM_InteractiveObject)::DownCast(IO); - if(anIO->isSame(GIO)) { - found = true; - GAISShape = aSh; - break; - } - } + /* case Graphical Object */ + if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { + Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IO); + Standard_CString ior = GIObject->getIOR(); + testResult = true; + aShape = myGeom->GetIORFromString(ior); + return aShape; + } + return aShape; +} + + +//======================================================================= +// function : ConvertListOfIOInListOfIOR() +// purpose : +//======================================================================= +void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM_Gen::ListOfIOR& listIOR) +{ + int nbSel = aList.Extent(); + listIOR.length(nbSel); + int j=0; + SALOME_ListIteratorOfListIO It(aList); + 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::SObject_var obj = aStudy->FindObjectID(IObject->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil() && obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + ORB_INIT &init = *SINGLETON_::Instance(); + CORBA::ORB_var& _orb = init.orb(); + CORBA::String_var theValue = anIOR->Value(); + CORBA::Object_var theObj = _orb->string_to_object(theValue); + if(theObj->_is_a("IDL:GEOM/GEOM_Shape:1.0")) { + listIOR[j] = strdup(theValue); + j++; } } - ite.Next(); + } + else if(IObject->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { + Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IObject); + Standard_CString ior = GIObject->getIOR(); + listIOR[j] = strdup(ior); + j++; } - - if(!found) - return false; } + listIOR.length(j); +} - if(!myGeomGUI->GetSettings_AddInStudy() || selection) { - QString Name = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), anIO->getName()); - if(!Name.isEmpty()) { - // VTK - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) - GActor->setName(strdup(Name.latin1())); - // OCC - else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) - GAISShape->setName(strdup(Name.latin1())); - } - else - return false; - } - // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); - op->start(); +//================================================================================ +// function : SetDisplayedObjectList() +// purpose : +//================================================================================ +void GEOMBase::SetDisplayedObjectList() +{ + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return; - SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(father); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myGeomGUI->GetListDisplayedObject().Clear(); - GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(GIO->getIOR()); + Handle (AIS_InteractiveContext) aContext = v3d->getAISContext(); + aContext->DisplayedObjects(myGeomGUI->GetListDisplayedObject()); +} - /* For the shape inserted into the study we set its field 'studyshapeid' */ - /* so the shape will contain its corresponding entry in the study Ocaf doc. */ - aShape->StudyShapeId(newObj->GetID()); - GIO->setEntry(newObj->GetID()); +//===================================================================================== +// function : DisplaySimulationShape() +// purpose : Displays 'this->mySimulationShape' a pure graphical shape from a TopoDS_Shape +//===================================================================================== +void GEOMBase::DisplaySimulationShape(const TopoDS_Shape& S) +{ + if(S.IsNull()) + return; + + //NRI DEBUG : 14/02/2002 + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->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->UpdateCurrentViewer(); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in GEOMBase::DisplaySimulationShape "); + } + myGeomGUI->mySimulationShape->UnsetColor(); + return; +} + - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(aShape->Name()); +//================================================================================== +// function : EraseSimulationShape() +// purpose : Clears the display of 'mySimulationShape' a pure graphical shape +//================================================================================== +void GEOMBase::EraseSimulationShape() +{ + int count = myGeomGUI->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(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + ic->Erase(myGeomGUI->mySimulationShape, Standard_True, Standard_False); + ic->ClearPrs(myGeomGUI->mySimulationShape); + ic->UpdateCurrentViewer(); + } + } +} - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - if(aShape->ShapeType() == GEOM::COMPOUND) - aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); - else if(aShape->ShapeType() == GEOM::COMPSOLID) - aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); - else if(aShape->ShapeType() == GEOM::SOLID) - aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); - else if(aShape->ShapeType() == GEOM::SHELL) - aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); - else if(aShape->ShapeType() == GEOM::FACE) - aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); - else if(aShape->ShapeType() == GEOM::WIRE) - aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); - else if(aShape->ShapeType() == GEOM::EDGE) - aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); - else if(aShape->ShapeType() == GEOM::VERTEX) - aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); +//================================================================================= +// function : CreateArrowForLinearEdge() +// purpose : Create a cone topology to be used to display an arrow in the middle +// : of an edge showing its orientation. (For simulation and Viewer OCC only) +//================================================================================= +bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone) +{ + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC || tds.ShapeType() != TopAbs_EDGE) + return false; + + OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort(); + Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)vp)->getView(); + Standard_Real Width, Height; + view3d->Size(Width, Height); + const Standard_Real aHeight = (Width + Height) / 50.0; + + try { + Standard_Real first, last; + Handle(Geom_Curve) curv = BRep_Tool::Curve(TopoDS::Edge(tds), first, last); + if(!curv->IsCN(1)) + return false; - // VTK - if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - GActor->setIO(GIO); - aName->SetValue(GActor->getName()); + const Standard_Real param = (first+last) / 2.0; + gp_Pnt middleParamPoint; + gp_Vec V1; + curv->D1( param, middleParamPoint, V1); + if(V1.Magnitude() < Precision::Confusion()) + return false; + + /* Topology orientation not geom orientation */ + if(tds.Orientation() == TopAbs_REVERSED) + V1 *= -1.0; + + gp_Ax2 anAxis( middleParamPoint, gp_Dir(V1)); + const Standard_Real radius1 = aHeight / 5.0; + if(radius1 > 10.0 * Precision::Confusion() && aHeight > 10.0 * Precision::Confusion()) { + ArrowCone = BRepPrimAPI_MakeCone( anAxis, radius1, 0.0, aHeight ).Shape(); + return true; + } } - // OCC - else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - GAISShape->setIO(GIO); - aName->SetValue(GAISShape->getName()); + catch(Standard_Failure) { + // OCC failures are hard to catch in GUI. + // This because of the position for #include that is very critic to find + // in SALOME environment : compilation error ! } + return false; +} - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1,newObj); - GEOM::GEOM_Gen::ListOfIOR_var listIOR = new GEOM::GEOM_Gen::ListOfIOR; - listIOR = myGeom->GetReferencedObjects(aShape); +//================================================================================= +// function : VertexToPoint() +// purpose : If S can be converted in a gp_Pnt returns true and the result is P +//================================================================================= +bool GEOMBase::VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P) +{ + if(S.IsNull() || S.ShapeType() != TopAbs_VERTEX) + return false; + P = BRep_Tool::Pnt(TopoDS::Vertex(S)); + return true; +} - if(listIOR->length()>0) { - SALOMEDS::SObject_var Arguments = aStudyBuilder->NewObject(newObj); - anAttr = aStudyBuilder->FindOrCreateAttribute(Arguments, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(tr("GEOM_ARGUMENTS")); - anAttr = aStudyBuilder->FindOrCreateAttribute(Arguments, "AttributeSelectable"); - aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); - aSelAttr->SetSelectable(false); - bool ObjectReferenced = false; - for (unsigned int ind = 0; ind < listIOR->length();ind++) { - SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(listIOR[ind]); +//================================================================================= +// function : GetBipointDxDyDz() +// purpose : +//================================================================================= +void GEOMBase::GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz) +{ + dx = P2.X() - P1.X(); + dy = P2.Y() - P1.Y(); + dz = P2.Z() - P1.Z(); + return; +} - if(!theObj->_is_nil()) { - SALOMEDS::SObject_var RefObject = aStudyBuilder->NewObject(Arguments); - aStudyBuilder->Addreference(RefObject, theObj); - ObjectReferenced = true; - } - } - if(!ObjectReferenced) - aStudyBuilder->RemoveObject(Arguments); - } - op->finish(); +//================================================================================= +// function : LinearEdgeExtremities() +// purpose : If S can be converted in a linear edge and if initial an final points +// : distance is sufficient, returns true else returns false. +// : Resulting points are respectively P1 and P2 +//================================================================================= +bool GEOMBase::LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2) +{ + if(S.IsNull() || S.ShapeType() != TopAbs_EDGE) + return false; + BRepAdaptor_Curve curv(TopoDS::Edge(S)); + if(curv.GetType() != GeomAbs_Line) + return false; - if(!myGeomGUI->GetSettings_AddInStudy() || selection) - myGeomGUI->GetActiveStudy()->updateObjBrowser(); - else { - myGeomGUI->GetActiveStudy()->updateObjBrowser(false); - Sel->AddIObject(GIO); - } - return true; -} + curv.D0(curv.FirstParameter(), P1); + curv.D0(curv.LastParameter(), P2); + if(P1.Distance(P2) <= Precision::Confusion()) + return false; -//===================================================================================== -// function : GetShapeFromIOR() -// purpose : exist also as static method ! -//===================================================================================== -TopoDS_Shape GEOMBase::GetShapeFromIOR(QString IOR) -{ - TopoDS_Shape result; - if(IOR.stripWhiteSpace().isEmpty()) - return result; - ORB_INIT &init = *SINGLETON_::Instance(); - CORBA::ORB_var& _orb = init.orb() ; - CORBA::Object_var obj = _orb->string_to_object((char*)(IOR.latin1())); - if(CORBA::is_nil(obj)) - return result; - GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(IOR); - if(!aShape->_is_nil()) - result = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); - return result; + return true; } @@ -1199,31 +963,58 @@ double GEOMBase::Parameter(Standard_Boolean& res, const char* aValue1, const cha } -//===================================================================================== -// function : SObjectExist() -// purpose : -//===================================================================================== -bool GEOMBase::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR) +//======================================================================= +// function : SelectionByNameInDialogs() +// purpose : Called when user has entered a name of object in a LineEdit. +// : The selection is changed. Dialog box will receive the +// : corresponding signal to manage this event. +//======================================================================= +bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectUserName, SALOME_Selection* Sel) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); - SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(theFatherObject); - SALOMEDS::SObject_var RefSO; - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - for(; it->More();it->Next()) { - SALOMEDS::SObject_var SO= it->Value(); - if(SO->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - if(strcmp( anIOR->Value(), IOR ) == 0) - return true; - } - if(SO->ReferencedObject(RefSO)) { - if(RefSO->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - if(strcmp(anIOR->Value(), IOR) == 0) - return true; - } - } + /* Find SObject with name in component GEOM */ + SALOMEDS::Study_var ST = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study::ListOfSObject_var listSO = new SALOMEDS::Study::ListOfSObject; + listSO = ST->FindObjectByName(objectUserName, "GEOM"); + + if(listSO->length() < 1) { + const QString caption = tr("GEOM_WRN_WARNING"); + const QString text = tr("GEOM_NAME_INCORRECT"); + const QString button0 = tr("GEOM_BUT_OK"); + QMessageBox::warning(aWidget, caption, text, button0); + return false; } - return false; + /* More than one object with same name */ + if(listSO->length() > 1) { + const QString caption = tr("GEOM_WRN_WARNING"); + const QString text = tr("GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE"); + const QString button0 = tr("GEOM_BUT_OK") ; + QMessageBox::warning(aWidget, caption, text, button0) ; + return false; + } + + SALOMEDS::SObject_var theObj = listSO[0]; + /* Create a SALOME_InteractiveObject with a SALOME::SObject */ + Standard_CString anEntry = theObj->GetID(); + Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(anEntry, "GEOM", strdup(objectUserName)); + + /* Add as a selected object */ + /* Clear any previous selection : */ + /* Warning the LineEdit is purged because of signal currentSelectionChanged ! */ + Sel->ClearIObjects(); + Sel->AddIObject(SI); + return true; +} + + +//======================================================================= +// function : DefineDlgPosition() +// purpose : Define x and y the default position for a dialog box +//======================================================================= +bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y) +{ + /* Here the position is on the bottom right corner - 10 */ + QAD_Desktop* PP = QAD_Application::getDesktop(); + x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10); + y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10); + return true; } diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h index fcffa1c20..70040df31 100644 --- a/src/GEOMBase/GEOMBase.h +++ b/src/GEOMBase/GEOMBase.h @@ -30,9 +30,7 @@ #define GEOMBASE_H #include "GEOMContext.h" - #include "SALOME_Selection.h" -#include //================================================================================= // class : GEOMBase @@ -46,57 +44,49 @@ public : GEOMBase(); ~GEOMBase(); + bool Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name = ""); bool AddInStudy(bool selection = false, const Handle(SALOME_InteractiveObject)& anIO = 0); - bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P); - bool LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2); - gp_Pnt ConvertClickToPoint(Standard_Real x, Standard_Real y, Handle(V3d_View) aView); - void GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz); - /* User dialog 1 parameter returned */ - double Parameter(Standard_Boolean& res, - const char* aValue1 = 0, const char* aTitle1 = 0, - const char* aTitle = 0, const double bottom = -1E6, - const double top = +1E6, const int decimals = 6); - - bool DefineDlgPosition(QWidget* aDlg, int& x, int& y); - bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR); - /* Selection and objects management */ + int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType); TopoDS_Shape GetShapeFromIOR(QString IOR); bool GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds); int GetNameOfSelectedIObjects(SALOME_Selection* Sel, QString& aName); bool GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& aTypeString); + /* Convertions */ GEOM::GEOM_Shape_ptr ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult); Handle(GEOM_AISShape) ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult, bool onlyInActiveView = false); - 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); void ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM_Gen::ListOfIOR& listIOR); - /* Method used by dialog boxes called when used has entered a name of object in a LineEdit */ - bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, SALOME_Selection *Sel); + /* Geometry */ + bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P); - int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType); - /* Define a list of indices of sub shapes selected in a local context */ - bool GetIndexSubShapeSelected(const TopoDS_Shape& ShapeTopo, const int SubShapeType, - GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID, - Standard_Integer& aLocalContextId, bool& myUseLocalContext); + /* Used just by Plane and Prism */ + bool LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2); + void GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz); + + /* User dialog 1 parameter returned */ + double Parameter(Standard_Boolean& res, + const char* aValue1 = 0, const char* aTitle1 = 0, + const char* aTitle = 0, const double bottom = -1E6, + const double top = +1E6, const int decimals = 6); void SetDisplayedObjectList(); - bool Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name = ""); /* Simulation management */ bool CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone); void DisplaySimulationShape(const TopoDS_Shape& S); void EraseSimulationShape(); + /* Method used by dialog boxes called when used has entered a name of object in a LineEdit */ + bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, SALOME_Selection *Sel); + bool DefineDlgPosition(QWidget* aDlg, int& x, int& y); + GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx index 42eda4f6f..c4b3297b9 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.cxx +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -77,8 +77,6 @@ void GEOMBase_Skeleton::Init(SALOME_Selection* Sel) myGeomBase = new GEOMBase(); myGeomGUI = GEOMContext::GetGeomGUI(); myGeomGUI->SetActiveDialogBox((QDialog*)this); -// Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); -// myGeom = GEOM::GEOM_Gen::_narrow(comp); myGeom = myGeomGUI->myComponentGeom; /* signals and slots connections */ @@ -88,7 +86,7 @@ void GEOMBase_Skeleton::Init(SALOME_Selection* Sel) /* Move widget on the botton right corner of main widget */ // int x, y; -// myGeomGUI->DefineDlgPosition( this, x, y ); +// myGeomBase->DefineDlgPosition( this, x, y ); /* displays Dialog */ RadioButton1->setChecked(TRUE); @@ -142,6 +140,7 @@ void GEOMBase_Skeleton::DeactivateActiveDialog() { this->setEnabled(false); mySelection->ClearFilters(); + myGeomGUI->ResetState(); disconnect(mySelection, 0, this, 0); myGeomBase->EraseSimulationShape(); myGeomGUI->SetActiveDialogBox(0); diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 4b116987e..1f3f61d4f 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -451,8 +451,6 @@ bool GeometryGUI::SetSettings(QAD_Desktop* parent) return true; } - SALOME_Selection* Sel = SALOME_Selection::Selection(GeomGUI->GetActiveStudy()->getSelection()); - theObject = ""; //================================================================================= // function : DefinePopup() @@ -495,18 +493,6 @@ void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString return; } - if((theParent.compare("Viewer")==0)) { - if(GeomGUI->GetState() == CURRENT_SKETCH) - theContext = "Sketch"; - else { - if(Sel->IObjectCount() > 0) - theContext = ""; - else - theContext = "NothingSelected"; - } - } - else - theContext = ""; //================================================================================= // function : CustomPopup() diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index 23e811f16..cc9e680e8 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -502,6 +502,101 @@ 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 : @@ -546,13 +641,13 @@ void GEOMToolsGUI::OnEditDelete() if ( sf->getTypeView() == VIEW_OCC ) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); - Handle(GEOM_AISShape) Result = myGeomBase->ConvertIORinGEOMAISShape( anIOR->Value(), found ); + Handle(GEOM_AISShape) Result = this->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 = myGeomBase->ConvertIORinGEOMActor( anIOR->Value(), found ); + GEOM_Actor* ac = this->ConvertIORinGEOMActor( anIOR->Value(), found ); if ( found ) { //Renderer->RemoveActor(ac); if ( ac->hasIO() ) diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h index 54c3ef764..55093970f 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI.h @@ -45,6 +45,12 @@ 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(); diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx index 788106f0e..c6b5c8b59 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -100,16 +100,14 @@ void GenerationGUI_FillingDlg::Init() myCompoundFilter = new GEOM_ShapeTypeFilter(TopAbs_COMPOUND, myGeom); mySelection->AddFilter(myCompoundFilter); - /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - step = St.toInt(); - + double SpecificStep1 = 1; + double SpecificStep2 = 0.00001; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_1->RangeStepAndValidator(0.001, 999.999, step, 3); - GroupPoints->SpinBox_2->RangeStepAndValidator(0.00001, 10000.0, 3, 10); - GroupPoints->SpinBox_3->RangeStepAndValidator(0.001, 999.999, step, 3); - GroupPoints->SpinBox_4->RangeStepAndValidator(0.001, 999.999, step, 3); - GroupPoints->SpinBox_5->RangeStepAndValidator(0.00001, 10000.0, 3, 10); + GroupPoints->SpinBox_1->RangeStepAndValidator(1.0, 999.999, SpecificStep1, 3); + GroupPoints->SpinBox_2->RangeStepAndValidator(0.00001, 10000.0, SpecificStep2, 5); + GroupPoints->SpinBox_3->RangeStepAndValidator(1.0, 999.999, SpecificStep1, 3); + GroupPoints->SpinBox_4->RangeStepAndValidator(1.0, 999.999, SpecificStep1, 3); + GroupPoints->SpinBox_5->RangeStepAndValidator(0.00001, 10000.0, SpecificStep2, 5); GroupPoints->SpinBox_1->SetValue(myMinDeg); GroupPoints->SpinBox_2->SetValue(myTol2D); @@ -246,6 +244,7 @@ void GenerationGUI_FillingDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myCompoundFilter); return; } diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.h b/src/GenerationGUI/GenerationGUI_FillingDlg.h index e10c2d6fa..d74f51fde 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.h +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.h @@ -54,7 +54,6 @@ private: GenerationGUI* myGenerationGUI; - int step; Handle(GEOM_ShapeTypeFilter) myCompoundFilter; /* Filter selection */ GEOM::GEOM_Shape_var myGeomShape; /* is mySectionShape */ diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index 599410905..9a2ade98c 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -100,7 +100,7 @@ void GenerationGUI_PipeDlg::Init() connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* displays Dialog */ GroupPoints->show(); @@ -168,21 +168,27 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; - if(myEditCurrentArgument == GroupPoints->LineEdit1 && S.ShapeType() != TopAbs_COMPSOLID && S.ShapeType() != TopAbs_COMPOUND && S.ShapeType() != TopAbs_SOLID && S.ShapeType() != TopAbs_SHAPE) { - myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); - if(!testResult) - return; - myEditCurrentArgument->setText(aString); - myOkShape1 = true; - myShape1 = S; + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myOkShape1 = false; + if(S.ShapeType() != TopAbs_COMPSOLID && S.ShapeType() != TopAbs_COMPOUND && S.ShapeType() != TopAbs_SOLID && S.ShapeType() != TopAbs_SHAPE) { + myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myEditCurrentArgument->setText(aString); + myOkShape1 = true; + myShape1 = S; + } } - else if(myEditCurrentArgument == GroupPoints->LineEdit2 && S.ShapeType() != TopAbs_COMPSOLID && S.ShapeType() != TopAbs_COMPOUND && S.ShapeType() != TopAbs_SOLID && S.ShapeType() != TopAbs_SHAPE) { - myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); - if(!testResult) - return; - myEditCurrentArgument->setText(aString); - myOkShape2 = true; - myShape2 = S; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + myOkShape2 = false; + if(S.ShapeType() != TopAbs_COMPSOLID && S.ShapeType() != TopAbs_COMPOUND && S.ShapeType() != TopAbs_SOLID && S.ShapeType() != TopAbs_SHAPE && S.ShapeType() != TopAbs_VERTEX) { + myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myEditCurrentArgument->setText(aString); + myOkShape2 = true; + myShape2 = S; + } } if(myOkShape1 && myOkShape2) diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index 041a6ebb5..f2804f4b9 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -288,6 +288,8 @@ void GenerationGUI_PrismDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index 66bec8ee4..0ac989d50 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -96,12 +96,9 @@ void GenerationGUI_RevolDlg::Init() myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom); - /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - step = St.toDouble(); - + double SpecificStep = 5; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, SpecificStep, 3); GroupPoints->SpinBox_DX->SetValue(myAngle); /* signals and slots connections */ @@ -115,7 +112,9 @@ void GenerationGUI_RevolDlg::Init() connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + + connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseAngle(int))); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; @@ -260,6 +259,8 @@ void GenerationGUI_RevolDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.h b/src/GenerationGUI/GenerationGUI_RevolDlg.h index 1344b6595..eddc3c30f 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.h +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.h @@ -56,7 +56,6 @@ private : GenerationGUI* myGenerationGUI; - double step; Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */ TopoDS_Shape myBase; diff --git a/src/MeasureGUI/Makefile.in b/src/MeasureGUI/Makefile.in index 48ccd7da4..5e672e22e 100644 --- a/src/MeasureGUI/Makefile.in +++ b/src/MeasureGUI/Makefile.in @@ -41,6 +41,13 @@ EXPORT_HEADERS= LIB = libMeasureGUI.la LIB_SRC = MeasureGUI.cxx \ + MeasureGUI_Skeleton_QTD.cxx \ + MeasureGUI_1Sel3LineEdit_QTD.cxx \ + MeasureGUI_1Sel6LineEdit_QTD.cxx \ + MeasureGUI_1Sel12LineEdit_QTD.cxx \ + MeasureGUI_1Sel1TextView_QTD.cxx \ + MeasureGUI_2Sel1LineEdit_QTD.cxx \ + MeasureGUI_Skeleton.cxx \ MeasureGUI_PropertiesDlg.cxx \ MeasureGUI_CenterMassDlg.cxx \ MeasureGUI_InertiaDlg.cxx \ @@ -48,10 +55,17 @@ LIB_SRC = MeasureGUI.cxx \ MeasureGUI_DistanceDlg.cxx \ MeasureGUI_MaxToleranceDlg.cxx \ MeasureGUI_WhatisDlg.cxx \ - MeasureGUI_CheckShape.cxx + MeasureGUI_CheckShapeDlg.cxx LIB_MOC = \ MeasureGUI.h \ + MeasureGUI_Skeleton_QTD.h \ + MeasureGUI_1Sel3LineEdit_QTD.h \ + MeasureGUI_1Sel6LineEdit_QTD.h \ + MeasureGUI_1Sel12LineEdit_QTD.h \ + MeasureGUI_1Sel1TextView_QTD.h \ + MeasureGUI_2Sel1LineEdit_QTD.h \ + MeasureGUI_Skeleton.h \ MeasureGUI_PropertiesDlg.h \ MeasureGUI_CenterMassDlg.h \ MeasureGUI_InertiaDlg.h \ @@ -59,7 +73,7 @@ LIB_MOC = \ MeasureGUI_DistanceDlg.h \ MeasureGUI_MaxToleranceDlg.h \ MeasureGUI_WhatisDlg.h \ - MeasureGUI_CheckShape.h + MeasureGUI_CheckShapeDlg.h LIB_CLIENT_IDL = SALOME_Exception.idl \ GEOM_Gen.idl \ @@ -76,6 +90,6 @@ LIB_SERVER_IDL = 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 += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@ diff --git a/src/MeasureGUI/MeasureGUI.cxx b/src/MeasureGUI/MeasureGUI.cxx index 835d609cc..65f60b161 100644 --- a/src/MeasureGUI/MeasureGUI.cxx +++ b/src/MeasureGUI/MeasureGUI.cxx @@ -38,7 +38,7 @@ using namespace std; #include "MeasureGUI_DistanceDlg.h" // Method DISTANCE #include "MeasureGUI_MaxToleranceDlg.h" // Method MAXTOLERANCE #include "MeasureGUI_WhatisDlg.h" // Method WHATIS -#include "MeasureGUI_CheckShape.h" // Method CHECKSHAPE +#include "MeasureGUI_CheckShapeDlg.h" // Method CHECKSHAPE //======================================================================= // function : MeasureGUI() @@ -111,7 +111,7 @@ bool MeasureGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } case 707: // CHECKSHAPE { - MeasureGUI_CheckShape *aDlg = new MeasureGUI_CheckShape(parent, "", Sel); + MeasureGUI_CheckShapeDlg *aDlg = new MeasureGUI_CheckShapeDlg(parent, "", Sel); break; } default: diff --git a/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.cxx b/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.cxx new file mode 100644 index 000000000..a83fbe4a5 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.cxx @@ -0,0 +1,150 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'MeasureGUI_1Sel12LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "MeasureGUI_1Sel12LineEdit_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a MeasureGUI_1Sel12LineEdit_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +MeasureGUI_1Sel12LineEdit_QTD::MeasureGUI_1Sel12LineEdit_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "MeasureGUI_1Sel12LineEdit_QTD" ); + resize( 131, 171 ); + setCaption( trUtf8( "MeasureGUI_1Sel12LineEdit_QTD" ) ); + MeasureGUI_1Sel12LineEdit_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "MeasureGUI_1Sel12LineEdit_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + 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"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + LineEdit12 = new QLineEdit( GroupBox1, "LineEdit12" ); + + Layout2->addWidget( LineEdit12, 0, 2 ); + + LineEdit11 = new QLineEdit( GroupBox1, "LineEdit11" ); + + Layout2->addWidget( LineEdit11, 0, 1 ); + + LineEdit42 = new QLineEdit( GroupBox1, "LineEdit42" ); + + Layout2->addWidget( LineEdit42, 3, 2 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout2->addWidget( TextLabel5, 3, 0 ); + + LineEdit31 = new QLineEdit( GroupBox1, "LineEdit31" ); + + Layout2->addWidget( LineEdit31, 2, 1 ); + + LineEdit41 = new QLineEdit( GroupBox1, "LineEdit41" ); + + Layout2->addWidget( LineEdit41, 3, 1 ); + + LineEdit23 = new QLineEdit( GroupBox1, "LineEdit23" ); + + Layout2->addWidget( LineEdit23, 1, 3 ); + + LineEdit33 = new QLineEdit( GroupBox1, "LineEdit33" ); + + Layout2->addWidget( LineEdit33, 2, 3 ); + + LineEdit43 = new QLineEdit( GroupBox1, "LineEdit43" ); + + Layout2->addWidget( LineEdit43, 3, 3 ); + + LineEdit22 = new QLineEdit( GroupBox1, "LineEdit22" ); + + Layout2->addWidget( LineEdit22, 1, 2 ); + + 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 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 2, 0 ); + + LineEdit13 = new QLineEdit( GroupBox1, "LineEdit13" ); + + Layout2->addWidget( LineEdit13, 0, 3 ); + + LineEdit32 = new QLineEdit( GroupBox1, "LineEdit32" ); + + Layout2->addWidget( LineEdit32, 2, 2 ); + + LineEdit21 = new QLineEdit( GroupBox1, "LineEdit21" ); + + Layout2->addWidget( LineEdit21, 1, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 1, 0 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); + + 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 ); + + 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 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + MeasureGUI_1Sel12LineEdit_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +MeasureGUI_1Sel12LineEdit_QTD::~MeasureGUI_1Sel12LineEdit_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.h b/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.h new file mode 100644 index 000000000..6d63c89e9 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel12LineEdit_QTD.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'MeasureGUI_1Sel12LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef MEASUREGUI_1SEL12LINEEDIT_QTD_H +#define MEASUREGUI_1SEL12LINEEDIT_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class MeasureGUI_1Sel12LineEdit_QTD : public QWidget +{ + Q_OBJECT + +public: + MeasureGUI_1Sel12LineEdit_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~MeasureGUI_1Sel12LineEdit_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit12; + QLineEdit* LineEdit11; + QLineEdit* LineEdit42; + QLabel* TextLabel5; + QLineEdit* LineEdit31; + QLineEdit* LineEdit41; + QLineEdit* LineEdit23; + QLineEdit* LineEdit33; + QLineEdit* LineEdit43; + QLineEdit* LineEdit22; + QLabel* TextLabel2; + QLabel* TextLabel4; + QLineEdit* LineEdit13; + QLineEdit* LineEdit32; + QLineEdit* LineEdit21; + QLabel* TextLabel3; + QLineEdit* LineEdit1; + QPushButton* PushButton1; + QLabel* TextLabel1; + + +protected: + QGridLayout* MeasureGUI_1Sel12LineEdit_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // MEASUREGUI_1SEL12LINEEDIT_QTD_H diff --git a/src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.cxx b/src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.cxx new file mode 100644 index 000000000..c5c2263da --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.cxx @@ -0,0 +1,77 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'MeasureGUI_1Sel1TextView_QTD.ui' +** +** Created: mar oct 28 14:01:15 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "MeasureGUI_1Sel1TextView_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a MeasureGUI_1Sel1TextView_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +MeasureGUI_1Sel1TextView_QTD::MeasureGUI_1Sel1TextView_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "MeasureGUI_1Sel1TextView_QTD" ); + resize( 130, 160 ); + setCaption( trUtf8( "MeasureGUI_1Sel1TextView_QTD" ) ); + MeasureGUI_1Sel1TextView_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "MeasureGUI_1Sel1TextView_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + 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"); + + 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 ); + + TextEdit1 = new QTextEdit( GroupBox1, "TextEdit1" ); + + Layout1->addMultiCellWidget( TextEdit1, 1, 1, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + 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 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + MeasureGUI_1Sel1TextView_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +MeasureGUI_1Sel1TextView_QTD::~MeasureGUI_1Sel1TextView_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.h b/src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.h new file mode 100644 index 000000000..baa5b7872 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel1TextView_QTD.h @@ -0,0 +1,44 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'MeasureGUI_1Sel1TextView_QTD.ui' +** +** Created: mar oct 28 14:01:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef MEASUREGUI_1SEL1TEXTVIEW_QTD_H +#define MEASUREGUI_1SEL1TEXTVIEW_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QTextEdit; + +class MeasureGUI_1Sel1TextView_QTD : public QWidget +{ + Q_OBJECT + +public: + MeasureGUI_1Sel1TextView_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~MeasureGUI_1Sel1TextView_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QTextEdit* TextEdit1; + QLineEdit* LineEdit1; + QPushButton* PushButton1; + + +protected: + QGridLayout* MeasureGUI_1Sel1TextView_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // MEASUREGUI_1SEL1TEXTVIEW_QTD_H diff --git a/src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.cxx b/src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.cxx new file mode 100644 index 000000000..af0be4fe4 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.cxx @@ -0,0 +1,104 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'MeasureGUI_1Sel3LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:13 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "MeasureGUI_1Sel3LineEdit_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a MeasureGUI_1Sel3LineEdit_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +MeasureGUI_1Sel3LineEdit_QTD::MeasureGUI_1Sel3LineEdit_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "MeasureGUI_1Sel3LineEdit_QTD" ); + resize( 129, 141 ); + setCaption( trUtf8( "MeasureGUI_1Sel3LineEdit_QTD" ) ); + MeasureGUI_1Sel3LineEdit_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "MeasureGUI_1Sel3LineEdit_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + 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 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout2->addWidget( TextLabel1, 0, 0 ); + + LineEdit4 = new QLineEdit( GroupBox1, "LineEdit4" ); + + Layout2->addMultiCellWidget( LineEdit4, 3, 3, 1, 2 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 2, 0 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout2->addMultiCellWidget( LineEdit2, 1, 1, 1, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 80, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout2->addItem( spacer, 4, 2 ); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + Layout2->addMultiCellWidget( LineEdit3, 2, 2, 1, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout2->addWidget( LineEdit1, 0, 2 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 3, 0 ); + + 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, 1, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout2->addWidget( PushButton1, 0, 1 ); + + GroupBox1Layout->addLayout( Layout2, 0, 0 ); + + MeasureGUI_1Sel3LineEdit_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +MeasureGUI_1Sel3LineEdit_QTD::~MeasureGUI_1Sel3LineEdit_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.h b/src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.h new file mode 100644 index 000000000..1312639c7 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel3LineEdit_QTD.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'MeasureGUI_1Sel3LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:13 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef MEASUREGUI_1SEL3LINEEDIT_QTD_H +#define MEASUREGUI_1SEL3LINEEDIT_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class MeasureGUI_1Sel3LineEdit_QTD : public QWidget +{ + Q_OBJECT + +public: + MeasureGUI_1Sel3LineEdit_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~MeasureGUI_1Sel3LineEdit_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QLineEdit* LineEdit4; + QLabel* TextLabel3; + QLineEdit* LineEdit2; + QLineEdit* LineEdit3; + QLineEdit* LineEdit1; + QLabel* TextLabel4; + QLabel* TextLabel2; + QPushButton* PushButton1; + + +protected: + QGridLayout* MeasureGUI_1Sel3LineEdit_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout2; +}; + +#endif // MEASUREGUI_1SEL3LINEEDIT_QTD_H diff --git a/src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.cxx b/src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.cxx new file mode 100644 index 000000000..9883295a2 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.cxx @@ -0,0 +1,132 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'MeasureGUI_1Sel6LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "MeasureGUI_1Sel6LineEdit_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a MeasureGUI_1Sel6LineEdit_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +MeasureGUI_1Sel6LineEdit_QTD::MeasureGUI_1Sel6LineEdit_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "MeasureGUI_1Sel6LineEdit_QTD" ); + resize( 129, 163 ); + setCaption( trUtf8( "MeasureGUI_1Sel6LineEdit_QTD" ) ); + MeasureGUI_1Sel6LineEdit_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "MeasureGUI_1Sel6LineEdit_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + 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, 50, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 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 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + LineEdit22 = new QLineEdit( GroupBox1, "LineEdit22" ); + + Layout2->addWidget( LineEdit22, 2, 2 ); + + LineEdit32 = new QLineEdit( GroupBox1, "LineEdit32" ); + + Layout2->addWidget( LineEdit32, 3, 2 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel4, 1, 0 ); + + LineEdit31 = new QLineEdit( GroupBox1, "LineEdit31" ); + + Layout2->addWidget( LineEdit31, 3, 1 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + Layout2->addWidget( TextLabel5, 2, 0 ); + + LineEdit11 = new QLineEdit( GroupBox1, "LineEdit11" ); + + Layout2->addWidget( LineEdit11, 1, 1 ); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setText( trUtf8( "TL6" ) ); + + Layout2->addWidget( TextLabel6, 3, 0 ); + + LineEdit12 = new QLineEdit( GroupBox1, "LineEdit12" ); + + Layout2->addWidget( LineEdit12, 1, 2 ); + + 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, 1 ); + + LineEdit21 = new QLineEdit( GroupBox1, "LineEdit21" ); + + Layout2->addWidget( LineEdit21, 2, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout2->addWidget( TextLabel3, 0, 2 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + + 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 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + MeasureGUI_1Sel6LineEdit_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +MeasureGUI_1Sel6LineEdit_QTD::~MeasureGUI_1Sel6LineEdit_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.h b/src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.h new file mode 100644 index 000000000..cc8157a84 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_1Sel6LineEdit_QTD.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'MeasureGUI_1Sel6LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:13 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef MEASUREGUI_1SEL6LINEEDIT_QTD_H +#define MEASUREGUI_1SEL6LINEEDIT_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class MeasureGUI_1Sel6LineEdit_QTD : public QWidget +{ + Q_OBJECT + +public: + MeasureGUI_1Sel6LineEdit_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~MeasureGUI_1Sel6LineEdit_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QLineEdit* LineEdit22; + QLineEdit* LineEdit32; + QLabel* TextLabel4; + QLineEdit* LineEdit31; + QLabel* TextLabel5; + QLineEdit* LineEdit11; + QLabel* TextLabel6; + QLineEdit* LineEdit12; + QLabel* TextLabel2; + QLineEdit* LineEdit21; + QLabel* TextLabel3; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* MeasureGUI_1Sel6LineEdit_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // MEASUREGUI_1SEL6LINEEDIT_QTD_H diff --git a/src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.cxx b/src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.cxx new file mode 100644 index 000000000..0efb7a261 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.cxx @@ -0,0 +1,100 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'MeasureGUI_2Sel1LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "MeasureGUI_2Sel1LineEdit_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a MeasureGUI_2Sel1LineEdit_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +MeasureGUI_2Sel1LineEdit_QTD::MeasureGUI_2Sel1LineEdit_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "MeasureGUI_2Sel1LineEdit_QTD" ); + resize( 129, 115 ); + setCaption( trUtf8( "MeasureGUI_2Sel1LineEdit_QTD" ) ); + MeasureGUI_2Sel1LineEdit_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "MeasureGUI_2Sel1LineEdit_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + 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, 60, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + Layout1->addMultiCellWidget( LineEdit3, 2, 2, 1, 2 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + 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 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton2, 1, 1 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + MeasureGUI_2Sel1LineEdit_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +MeasureGUI_2Sel1LineEdit_QTD::~MeasureGUI_2Sel1LineEdit_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.h b/src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.h new file mode 100644 index 000000000..192f6ef33 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_2Sel1LineEdit_QTD.h @@ -0,0 +1,47 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'MeasureGUI_2Sel1LineEdit_QTD.ui' +** +** Created: mar oct 28 16:11:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef MEASUREGUI_2SEL1LINEEDIT_QTD_H +#define MEASUREGUI_2SEL1LINEEDIT_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class MeasureGUI_2Sel1LineEdit_QTD : public QWidget +{ + Q_OBJECT + +public: + MeasureGUI_2Sel1LineEdit_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~MeasureGUI_2Sel1LineEdit_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel3; + QLineEdit* LineEdit3; + QLineEdit* LineEdit2; + QLabel* TextLabel2; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + QPushButton* PushButton2; + + +protected: + QGridLayout* MeasureGUI_2Sel1LineEdit_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // MEASUREGUI_2SEL1LINEEDIT_QTD_H diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx index 90daf1cf3..21cb8420f 100644 --- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx @@ -32,19 +32,6 @@ using namespace std; #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - //================================================================================= // class : MeasureGUI_BndBoxDlg() // purpose : Constructs a MeasureGUI_BndBoxDlg which is a child of 'parent', with the @@ -52,173 +39,39 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :MeasureGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BOUNDING_BOX"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "MeasureGUI_BndBoxDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_BNDBOX_TITLE" ) ); - setSizeGripEnabled( TRUE ); - MeasureGUI_BndBoxDlgLayout = new QGridLayout( this ); - MeasureGUI_BndBoxDlgLayout->setSpacing( 6 ); - MeasureGUI_BndBoxDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_BNDBOX" ) ); - 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)3, (QSizePolicy::SizeType)0, - Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 60, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - MeasureGUI_BndBoxDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_BNDBOX_OBJDIM" ) ); - GroupConstructor1->setColumnLayout(0, Qt::Vertical ); - GroupConstructor1->layout()->setSpacing( 0 ); - GroupConstructor1->layout()->setMargin( 0 ); - GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() ); - GroupConstructor1Layout->setAlignment( Qt::AlignTop ); - GroupConstructor1Layout->setSpacing( 6 ); - GroupConstructor1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupConstructor1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); -// GroupConstructor1Layout->addWidget( LineEditC1A1, 0, 2 ); - SelectButtonC1A1 = new QPushButton( GroupConstructor1, "SelectButtonC1A1" ); - SelectButtonC1A1->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); -// GroupConstructor1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - - TextLabelC1A1 = new QLabel( GroupConstructor1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); -// GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - QHBoxLayout* bl = new QHBoxLayout; - bl->setMargin(0); bl->setSpacing(6); - bl->addWidget(TextLabelC1A1); bl->addWidget(SelectButtonC1A1); bl->addWidget(LineEditC1A1); - GroupConstructor1Layout->addMultiCellLayout(bl, 0, 0, 0, 2); - - TextLabel_Min = new QLabel( GroupConstructor1, "TextLabel_Min" ); - TextLabel_Min->setText( tr( "GEOM_MIN" ) ); - TextLabel_Min->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Min->setFrameShape( QLabel::NoFrame ); - TextLabel_Min->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Min, 1, 1 ); - - TextLabel_Max = new QLabel( GroupConstructor1, "TextLabel_Max" ); - TextLabel_Max->setText( tr( "GEOM_MAX" ) ); - TextLabel_Max->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Max->setFrameShape( QLabel::NoFrame ); - TextLabel_Max->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Max, 1, 2 ); - - TextLabel_X = new QLabel( GroupConstructor1, "TextLabel_X" ); - TextLabel_X->setText( tr( "GEOM_X" ) ); - TextLabel_X->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_X->setFrameShape( QLabel::NoFrame ); - TextLabel_X->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_X, 2, 0 ); - LineEdit_MinX = new QLineEdit( GroupConstructor1, "LineEdit_MinX" ); - LineEdit_MinX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MinX->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MinX->setEnabled( FALSE ); - LineEdit_MinX->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MinX, 2, 1 ); - LineEdit_MaxX = new QLineEdit( GroupConstructor1, "LineEdit_MaxX" ); - LineEdit_MaxX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MaxX->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MaxX->setEnabled( FALSE ); - LineEdit_MaxX->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MaxX, 2, 2 ); - - TextLabel_Y = new QLabel( GroupConstructor1, "TextLabel_Y" ); - TextLabel_Y->setText( tr( "GEOM_Y" ) ); - TextLabel_Y->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Y->setFrameShape( QLabel::NoFrame ); - TextLabel_Y->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Y, 3, 0 ); - LineEdit_MinY = new QLineEdit( GroupConstructor1, "LineEdit_MinY" ); - LineEdit_MinY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MinY->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MinY->setEnabled( FALSE ); - LineEdit_MinY->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MinY, 3, 1 ); - LineEdit_MaxY = new QLineEdit( GroupConstructor1, "LineEdit_MaxY" ); - LineEdit_MaxY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MaxY->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MaxY->setEnabled( FALSE ); - LineEdit_MaxY->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MaxY, 3, 2 ); - - TextLabel_Z = new QLabel( GroupConstructor1, "TextLabel_Z" ); - TextLabel_Z->setText( tr( "GEOM_Z" ) ); - TextLabel_Z->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Z->setFrameShape( QLabel::NoFrame ); - TextLabel_Z->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Z, 4, 0 ); - LineEdit_MinZ = new QLineEdit( GroupConstructor1, "LineEdit_MinZ" ); - LineEdit_MinZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MinZ->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MinZ->setEnabled( FALSE ); - LineEdit_MinZ->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MinZ, 4, 1 ); - LineEdit_MaxZ = new QLineEdit( GroupConstructor1, "LineEdit_MaxZ" ); - LineEdit_MaxZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MaxZ->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MaxZ->setEnabled( FALSE ); - LineEdit_MaxZ->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MaxZ, 4, 2 ); - - MeasureGUI_BndBoxDlgLayout->addWidget( GroupConstructor1, 1, 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, 1 ); - - QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_8, 0, 0 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - - MeasureGUI_BndBoxDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BOUNDING_BOX"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_BNDBOX_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_BNDBOX")); + RadioButton1->setPixmap(image0); + + GroupC1 = new MeasureGUI_1Sel6LineEdit_QTD(this, "GroupC1"); + GroupC1->GroupBox1->setTitle(tr("GEOM_BNDBOX_OBJDIM")); + GroupC1->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupC1->TextLabel2->setText(tr("GEOM_MIN")); + GroupC1->TextLabel3->setText(tr("GEOM_MAX")); + GroupC1->TextLabel4->setText(tr("GEOM_X")); + GroupC1->TextLabel5->setText(tr("GEOM_Y")); + GroupC1->TextLabel6->setText(tr("GEOM_Z")); + GroupC1->LineEdit11->setReadOnly(TRUE); + GroupC1->LineEdit12->setReadOnly(TRUE); + GroupC1->LineEdit21->setReadOnly(TRUE); + GroupC1->LineEdit22->setReadOnly(TRUE); + GroupC1->LineEdit31->setReadOnly(TRUE); + GroupC1->LineEdit32->setReadOnly(TRUE); + GroupC1->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupC1, 1, 0); + /***************************************************************/ + + /* Initialisation */ + Init(); } @@ -228,7 +81,7 @@ MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg( QWidget* parent, const char* name, S //================================================================================= MeasureGUI_BndBoxDlg::~MeasureGUI_BndBoxDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, Qt does it all for us } @@ -236,67 +89,22 @@ MeasureGUI_BndBoxDlg::~MeasureGUI_BndBoxDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_BndBoxDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_BndBoxDlg::Init() { - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomBase = new GEOMBase() ; - myGeomGUI = GEOMContext::GetGeomGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - mySimulationTopoDs.Nullify() ; - - /* 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 ; -} + /* init variables */ + myEditCurrentArgument = GroupC1->LineEdit1; + /* signals and slots connections */ + connect(GroupC1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupC1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void MeasureGUI_BndBoxDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + /* displays Dialog */ + GroupC1->show(); + this->show(); -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void MeasureGUI_BndBoxDlg::ClickOnCancel() -{ - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; + return; } @@ -306,36 +114,31 @@ void MeasureGUI_BndBoxDlg::ClickOnCancel() //================================================================================= void MeasureGUI_BndBoxDlg::SelectionIntoArgument() { - LineEdit_MinX->setText("") ; - LineEdit_MinY->setText("") ; - LineEdit_MinZ->setText("") ; - LineEdit_MaxX->setText("") ; - LineEdit_MaxY->setText("") ; - LineEdit_MaxZ->setText("") ; - myEditCurrentArgument->setText("") ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; + + GroupC1->LineEdit11->setText(""); + GroupC1->LineEdit12->setText(""); + GroupC1->LineEdit21->setText(""); + GroupC1->LineEdit22->setText(""); + GroupC1->LineEdit31->setText(""); + GroupC1->LineEdit32->setText(""); + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) + return; + + /* nbSel == 1 */ TopoDS_Shape S; - if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() ) { - myEditCurrentArgument->setText( "" ); - return ; - } - - LineEditC1A1->setText(aString) ; - this->CalculateAndDisplayBndBox(S) ; + if(!myGeomBase->GetTopoFromSelection(mySelection, S) || S.IsNull()) + return; - return ; + GroupC1->LineEdit1->setText(aString); + + this->CalculateAndDisplayBndBox(S); + return; } @@ -346,21 +149,15 @@ void MeasureGUI_BndBoxDlg::SelectionIntoArgument() void MeasureGUI_BndBoxDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + + this->SelectionIntoArgument(); + return; +} //================================================================================= @@ -369,38 +166,14 @@ void MeasureGUI_BndBoxDlg::SetEditCurrentArgument() //================================================================================= void MeasureGUI_BndBoxDlg::LineEditReturnPressed() { - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; 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 ) ; - } - - return ; -} + return; - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void MeasureGUI_BndBoxDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; + MeasureGUI_Skeleton::LineEditReturnPressed(); + return; } @@ -410,13 +183,11 @@ void MeasureGUI_BndBoxDlg::DeactivateActiveDialog() //================================================================================= void MeasureGUI_BndBoxDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupConstructor1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; + MeasureGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; } @@ -426,22 +197,10 @@ void MeasureGUI_BndBoxDlg::ActivateThisDialog() //================================================================================= void MeasureGUI_BndBoxDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void MeasureGUI_BndBoxDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } @@ -451,33 +210,34 @@ void MeasureGUI_BndBoxDlg::closeEvent( QCloseEvent* e ) //================================================================================= void MeasureGUI_BndBoxDlg::CalculateAndDisplayBndBox(const TopoDS_Shape& S) { - LineEdit_MinX->setText("") ; - LineEdit_MinY->setText("") ; - LineEdit_MinZ->setText("") ; - LineEdit_MaxX->setText("") ; - LineEdit_MaxY->setText("") ; - LineEdit_MaxZ->setText("") ; - if( S.IsNull() ) - return ; - - Standard_Real axmin,aymin,azmin,axmax,aymax,azmax; + GroupC1->LineEdit11->setText(""); + GroupC1->LineEdit12->setText(""); + GroupC1->LineEdit21->setText(""); + GroupC1->LineEdit22->setText(""); + GroupC1->LineEdit31->setText(""); + GroupC1->LineEdit32->setText(""); + + if(S.IsNull()) + return; + + Standard_Real axmin, aymin, azmin, axmax, aymax, azmax; Bnd_Box B; + try { BRepBndLib::Add(S,B); - B.Get(axmin,aymin,azmin,axmax,aymax,azmax); - LineEdit_MinX->setText( tr("%1").arg( axmin, 12, 'f', 6 ) ) ; - LineEdit_MinY->setText( tr("%1").arg( aymin, 12, 'f', 6 ) ) ; - LineEdit_MinZ->setText( tr("%1").arg( azmin, 12, 'f', 6 ) ) ; - LineEdit_MaxX->setText( tr("%1").arg( axmax, 12, 'f', 6 ) ) ; - LineEdit_MaxY->setText( tr("%1").arg( aymax, 12, 'f', 6 ) ) ; - LineEdit_MaxZ->setText( tr("%1").arg( azmax, 12, 'f', 6 ) ) ; + 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->LineEdit32->setText(tr("%1").arg(azmax, 12, 'f', 6)); - mySimulationTopoDs = BRepPrimAPI_MakeBox( gp_Pnt(axmin,aymin,azmin), - gp_Pnt(axmax,aymax,azmax) ).Shape(); - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; + mySimulationTopoDs = BRepPrimAPI_MakeBox(gp_Pnt(axmin, aymin, azmin), gp_Pnt(axmax, aymax, azmax)).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } catch(Standard_Failure) { - MESSAGE("Catch intercepted in CalculateAndDisplayBndBox()" << endl ) ; + MESSAGE("Catch intercepted in CalculateAndDisplayBndBox()"); } - return ; + return; } diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.h b/src/MeasureGUI/MeasureGUI_BndBoxDlg.h index fa65c5b9d..ee17c7008 100644 --- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.h +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.h @@ -29,90 +29,36 @@ #ifndef DIALOGBOX_BNDBOX_H #define DIALOGBOX_BNDBOX_H -#include "MeasureGUI.h" - -#include -#include +#include "MeasureGUI_Skeleton.h" +#include "MeasureGUI_1Sel6LineEdit_QTD.h" -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; +#include "MeasureGUI.h" //================================================================================= // class : DialogBox_PROPERTIES // purpose : //================================================================================= -class MeasureGUI_BndBoxDlg : public QDialog +class MeasureGUI_BndBoxDlg : public MeasureGUI_Skeleton { Q_OBJECT public: - MeasureGUI_BndBoxDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + MeasureGUI_BndBoxDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~MeasureGUI_BndBoxDlg(); private: + void Init(); + void enterEvent(QEvent* e); + void CalculateAndDisplayBndBox(const TopoDS_Shape& S); - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void CalculateAndDisplayBndBox(const TopoDS_Shape& S) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMContext* myGeomGUI ; /* Current GeomGUI object */ - GEOMBase* myGeomBase ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - - QLabel* TextLabel_Min; - QLabel* TextLabel_Max; - - QLabel* TextLabel_X; - QLabel* TextLabel_Y; - QLabel* TextLabel_Z; - - QLineEdit* LineEdit_MinX; - QLineEdit* LineEdit_MinY; - QLineEdit* LineEdit_MinZ; - - QLineEdit* LineEdit_MaxX; - QLineEdit* LineEdit_MaxY; - QLineEdit* LineEdit_MaxZ; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; + MeasureGUI_1Sel6LineEdit_QTD* GroupC1; private slots: + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* MeasureGUI_BndBoxDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; }; #endif // DIALOGBOX_BNDBOX_H diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx index 2cf97db3f..4630e6a1e 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx @@ -30,20 +30,9 @@ using namespace std; #include "MeasureGUI_CenterMassDlg.h" #include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include //================================================================================= // class : MeasureGUI_CenterMassDlg() @@ -52,148 +41,37 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_CenterMassDlg::MeasureGUI_CenterMassDlg( QWidget* parent, const char* name, MeasureGUI* theMeasureGUI, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +MeasureGUI_CenterMassDlg::MeasureGUI_CenterMassDlg(QWidget* parent, const char* name, MeasureGUI* theMeasureGUI, 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_CENTERMASS"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "MeasureGUI_CenterMassDlg" ); - resize( 398, 219 ); - setCaption( tr( "GEOM_CMASS_TITLE" ) ); - setSizeGripEnabled( TRUE ); - MeasureGUI_CenterMassDlgLayout = new QGridLayout( this ); - MeasureGUI_CenterMassDlgLayout->setSpacing( 6 ); - MeasureGUI_CenterMassDlgLayout->setMargin( 11 ); - - /***************************************************************/ - 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 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - MeasureGUI_CenterMassDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_CMASS" ) ); - 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_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 1 ); - MeasureGUI_CenterMassDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_OBJECT_RESULT" ) ); - 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 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEdit_X = new QLineEdit( GroupC1, "LineEdit_X" ); - LineEdit_X->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_X->sizePolicy().hasHeightForWidth() ) ); - LineEdit_X->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_X->setEnabled( FALSE ); - LineEdit_X->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_X, 1, 2 ); - TextLabel_Z = new QLabel( GroupC1, "TextLabel_Z" ); - TextLabel_Z->setText( tr( "GEOM_Z" ) ); - TextLabel_Z->setMinimumSize( QSize( 15, 0 ) ); - TextLabel_Z->setFrameShape( QLabel::NoFrame ); - TextLabel_Z->setFrameShadow( QLabel::Plain ); - TextLabel_Z->setMaximumSize( QSize( 15, 32767 ) ); - GroupC1Layout->addWidget( TextLabel_Z, 1, 5 ); - LineEdit_Z = new QLineEdit( GroupC1, "LineEdit_Z" ); - LineEdit_Z->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Z->sizePolicy().hasHeightForWidth() ) ); - LineEdit_Z->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_Z->setEnabled( FALSE ); - LineEdit_Z->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_Z, 1, 6 ); - 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 ); - LineEdit_Y = new QLineEdit( GroupC1, "LineEdit_Y" ); - LineEdit_Y->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Y->sizePolicy().hasHeightForWidth() ) ); - LineEdit_Y->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_Y->setEnabled( FALSE ); - LineEdit_Y->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_Y, 1, 4 ); - TextLabel_Y = new QLabel( GroupC1, "TextLabel_Y" ); - TextLabel_Y->setText( tr( "GEOM_Y" ) ); - TextLabel_Y->setMinimumSize( QSize( 15, 0 ) ); - TextLabel_Y->setFrameShape( QLabel::NoFrame ); - TextLabel_Y->setFrameShadow( QLabel::Plain ); - TextLabel_Y->setMaximumSize( QSize( 15, 32767 ) ); - GroupC1Layout->addWidget( TextLabel_Y, 1, 3 ); - TextLabel_X = new QLabel( GroupC1, "TextLabel_X" ); - TextLabel_X->setText( tr( "GEOM_X" ) ); - TextLabel_X->setMinimumSize( QSize( 15, 0 ) ); - TextLabel_X->setFrameShape( QLabel::NoFrame ); - TextLabel_X->setFrameShadow( QLabel::Plain ); - TextLabel_X->setMaximumSize( QSize( 15, 32767 ) ); - GroupC1Layout->addWidget( TextLabel_X, 1, 1 ); - TextLabel_Center = new QLabel( GroupC1, "TextLabel_Center" ); - TextLabel_Center->setText( tr( "GEOM_CENTER" ) ); - TextLabel_Center->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Center->setFrameShape( QLabel::NoFrame ); - TextLabel_Center->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabel_Center, 1, 0 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setMinimumSize( QSize( 260, 0 ) ); - GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 6 ); - MeasureGUI_CenterMassDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - myMeasureGUI = theMeasureGUI; - Init(Sel) ; /* Initialisations */ - + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CENTERMASS"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_CMASS_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_CMASS")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupC1 = new MeasureGUI_1Sel3LineEdit_QTD(this, "GroupC1"); + GroupC1->GroupBox1->setTitle(tr("GEOM_CENTER")); + GroupC1->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupC1->TextLabel2->setText(tr("GEOM_X")); + GroupC1->TextLabel3->setText(tr("GEOM_Y")); + GroupC1->TextLabel4->setText(tr("GEOM_Z")); + GroupC1->LineEdit2->setReadOnly(TRUE); + GroupC1->LineEdit3->setReadOnly(TRUE); + GroupC1->LineEdit4->setReadOnly(TRUE); + GroupC1->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupC1, 1, 0); + /***************************************************************/ + + /* Initialisation */ + myMeasureGUI = theMeasureGUI; + Init(); } @@ -203,162 +81,102 @@ MeasureGUI_CenterMassDlg::MeasureGUI_CenterMassDlg( QWidget* parent, const char* //================================================================================= MeasureGUI_CenterMassDlg::~MeasureGUI_CenterMassDlg() { - // 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 MeasureGUI_CenterMassDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_CenterMassDlg::Init() { - LineEdit_X->setMaxLength( 9 ); - LineEdit_Y->setMaxLength( 9 ); - LineEdit_Z->setMaxLength( 9 ); - QDoubleValidator *Va = new QDoubleValidator( -999999, +999999, 3, LineEdit_X ) ; - QDoubleValidator *Vb = new QDoubleValidator( -999999, +999999, 3, LineEdit_Y ) ; - QDoubleValidator *Vc = new QDoubleValidator( -999999, +999999, 3, LineEdit_Z ) ; - LineEdit_X->setValidator( Va ) ; - LineEdit_Y->setValidator( Vb ) ; - LineEdit_Z->setValidator( Vc ) ; - - myConstructorId = 0 ; - - LineEdit_X->setText("") ; - LineEdit_Y->setText("") ; - LineEdit_Z->setText("") ; - - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomBase = new GEOMBase() ; - myGeomGUI = GEOMContext::GetGeomGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - mySimulationTopoDs.Nullify() ; - myShape.Nullify() ; - myOkCenterMass = false ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* 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( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* 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 ; -} + /* init variables */ + myEditCurrentArgument = GroupC1->LineEdit1; + myOkCenterMass = false; -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void MeasureGUI_CenterMassDlg::ConstructorsClicked(int constructorId) -{ - return ; -} + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupC1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupC1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void MeasureGUI_CenterMassDlg::ClickOnCancel() -{ - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; + /* displays Dialog */ + GroupC1->show(); + this->show(); + + return; } + //================================================================================= // function : ClickOnOk() // purpose : //================================================================================= void MeasureGUI_CenterMassDlg::ClickOnOk() { - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; + this->ClickOnApply(); + ClickOnCancel(); + return; } + //================================================================================= // function : ClickOnApply() // purpose : //================================================================================= void MeasureGUI_CenterMassDlg::ClickOnApply() { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - if( myOkCenterMass) { - myMeasureGUI->MakeCDGAndDisplay( myGeomShape ) ; - } - return ; + myGeomGUI->GetDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkCenterMass) + myMeasureGUI->MakeCDGAndDisplay(myGeomShape); + return; } - - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection as changed or other case //================================================================================= void MeasureGUI_CenterMassDlg::SelectionIntoArgument() { - myGeomBase->EraseSimulationShape() ; - myEditCurrentArgument->setText("") ; - myOkCenterMass = false ; - Standard_Boolean testResult ; + myGeomBase->EraseSimulationShape(); + myEditCurrentArgument->setText(""); + QString aString = ""; - LineEdit_X->setText("") ; - LineEdit_Y->setText("") ; - LineEdit_Z->setText("") ; + myOkCenterMass = false; + GroupC1->LineEdit2->setText(""); + GroupC1->LineEdit3->setText(""); + GroupC1->LineEdit4->setText(""); - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) + return; /* nbSel == 1 */ - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomBase->GetTopoFromSelection(mySelection, this->myShape) ) - return ; - - myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - if( this->CalculateAndDisplayCenterMass() ) { - myOkCenterMass = true ; - } + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, this->myShape)) + return; - return ; + Standard_Boolean testResult; + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + + myEditCurrentArgument->setText(aString); + + if(this->CalculateAndDisplayCenterMass()) + myOkCenterMass = true; + return; } @@ -369,21 +187,15 @@ void MeasureGUI_CenterMassDlg::SelectionIntoArgument() void MeasureGUI_CenterMassDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + + this->SelectionIntoArgument(); + return; +} //================================================================================= @@ -392,38 +204,14 @@ void MeasureGUI_CenterMassDlg::SetEditCurrentArgument() //================================================================================= void MeasureGUI_CenterMassDlg::LineEditReturnPressed() { - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; 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 ) ; - } - return ; -} + return; - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void MeasureGUI_CenterMassDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - myGeomBase->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; + GEOMBase_Skeleton::LineEditReturnPressed(); + return; } @@ -433,15 +221,11 @@ void MeasureGUI_CenterMassDlg::DeactivateActiveDialog() //================================================================================= void MeasureGUI_CenterMassDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->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())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; } @@ -451,22 +235,10 @@ void MeasureGUI_CenterMassDlg::ActivateThisDialog() //================================================================================= void MeasureGUI_CenterMassDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void MeasureGUI_CenterMassDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } @@ -476,52 +248,50 @@ void MeasureGUI_CenterMassDlg::closeEvent( QCloseEvent* e ) //================================================================================= bool MeasureGUI_CenterMassDlg::CalculateAndDisplayCenterMass() { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); try { - QString resString; GProp_GProps System; - if ( this->myShape.ShapeType() == TopAbs_VERTEX) { - myGeomBase->VertexToPoint( this->myShape, this->myCenterMass ); - } - else if ( this->myShape.ShapeType() == TopAbs_EDGE || this->myShape.ShapeType() == TopAbs_WIRE ) { - BRepGProp::LinearProperties(this->myShape, System); - this->myCenterMass = System.CentreOfMass() ; + if(myShape.ShapeType() == TopAbs_VERTEX) + myGeomBase->VertexToPoint(myShape, myCenterMass); + else if(myShape.ShapeType() == TopAbs_EDGE || myShape.ShapeType() == TopAbs_WIRE) { + BRepGProp::LinearProperties(myShape, System); + myCenterMass = System.CentreOfMass(); } - else if ( this->myShape.ShapeType() == TopAbs_FACE || this->myShape.ShapeType() == TopAbs_SHELL ) { - BRepGProp::SurfaceProperties(this->myShape, System); - this->myCenterMass = System.CentreOfMass() ; + else if(myShape.ShapeType() == TopAbs_FACE || myShape.ShapeType() == TopAbs_SHELL) { + BRepGProp::SurfaceProperties(myShape, System); + myCenterMass = System.CentreOfMass(); } else { - BRepGProp::VolumeProperties(this->myShape, System); - this->myCenterMass = System.CentreOfMass() ; + BRepGProp::VolumeProperties(myShape, System); + myCenterMass = System.CentreOfMass(); } - BRepBuilderAPI_MakeVertex V(this->myCenterMass) ; - mySimulationTopoDs = V.Shape() ; + BRepBuilderAPI_MakeVertex V(myCenterMass); + mySimulationTopoDs = V.Shape(); - resString = tr("%1").arg( myCenterMass.X(), 12, 'f', 6 ) ; - LineEdit_X->setText(resString) ; + resString = tr("%1").arg(myCenterMass.X(), 12, 'f', 6); + GroupC1->LineEdit2->setText(resString); - resString = tr("%1").arg( myCenterMass.Y(), 12, 'f', 6 ) ; - LineEdit_Y->setText(resString) ; + resString = tr("%1").arg(myCenterMass.Y(), 12, 'f', 6); + GroupC1->LineEdit3->setText(resString); - resString = tr("%1").arg( myCenterMass.Z(), 12, 'f', 6 ) ; - LineEdit_Z->setText(resString) ; + resString = tr("%1").arg(myCenterMass.Z(), 12, 'f', 6); + GroupC1->LineEdit4->setText(resString); - if( !mySimulationTopoDs.IsNull() ) { - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; - return true ; + if(!mySimulationTopoDs.IsNull()) { + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return true; } } catch(Standard_Failure) { - MESSAGE("Catch intercepted in CalculateAndDisplayCenterMass()" << endl ) ; + MESSAGE("Catch intercepted in CalculateAndDisplayCenterMass()"); } - return false ; + return false; } diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.h b/src/MeasureGUI/MeasureGUI_CenterMassDlg.h index 4eac188a0..8447c372b 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.h +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.h @@ -28,93 +28,45 @@ #ifndef DIALOGBOX_CMASS_H #define DIALOGBOX_CMASS_H -#include "MeasureGUI.h" - -#include -#include -#include +#include "GEOMBase_Skeleton.h" +#include "MeasureGUI_1Sel3LineEdit_QTD.h" -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; +#include "MeasureGUI.h" //================================================================================= // class : MeasureGUI_CenterMassDlg // purpose : //================================================================================= -class MeasureGUI_CenterMassDlg : public QDialog +class MeasureGUI_CenterMassDlg : public GEOMBase_Skeleton { Q_OBJECT public: - MeasureGUI_CenterMassDlg( QWidget* parent = 0, const char* name = 0, MeasureGUI* theMeasureGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + MeasureGUI_CenterMassDlg(QWidget* parent = 0, const char* name = 0, MeasureGUI* theMeasureGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~MeasureGUI_CenterMassDlg(); private: - MeasureGUI* myMeasureGUI; - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - bool CalculateAndDisplayCenterMass() ; + void Init(); + void enterEvent(QEvent* e); + bool CalculateAndDisplayCenterMass(); - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMBase* myGeomBase ; /* Current GeomGUI object */ - GEOMContext* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ + MeasureGUI* myMeasureGUI; - GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */ - TopoDS_Shape myShape ; /* Shape argument */ - gp_Pnt myCenterMass ; - bool myOkCenterMass ; /* true after center of mass simulation calculation */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + GEOM::GEOM_Shape_var myGeomShape; /* is myBase */ + TopoDS_Shape myShape; /* Shape argument */ + gp_Pnt myCenterMass; + bool myOkCenterMass; /* true after center of mass simulation calculation */ - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEdit_X; - QLabel* TextLabel_Z; - QLineEdit* LineEdit_Z; - QLabel* TextLabelC1A1; - QLineEdit* LineEdit_Y; - QLabel* TextLabel_Y; - QLabel* TextLabel_X; - QLabel* TextLabel_Center; - QLineEdit* LineEditC1A1; + MeasureGUI_1Sel3LineEdit_QTD* GroupC1; private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void ClickOnOk() ; + void ClickOnOk(); void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); -protected: - QGridLayout* MeasureGUI_CenterMassDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; }; #endif // DIALOGBOX_CMASS_H diff --git a/src/MeasureGUI/MeasureGUI_CheckShape.cxx b/src/MeasureGUI/MeasureGUI_CheckShape.cxx deleted file mode 100644 index 586f58d1c..000000000 --- a/src/MeasureGUI/MeasureGUI_CheckShape.cxx +++ /dev/null @@ -1,398 +0,0 @@ -// 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 : MeasureGUI_CheckShape.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "MeasureGUI_CheckShape.h" - -// Open Cascade Include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : MeasureGUI_CheckShape() -// purpose : Constructs a MeasureGUI_CheckShape which is a child of 'parent', with the -// name 'name' and widget flags set to 'f'. -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -//================================================================================= -MeasureGUI_CheckShape::MeasureGUI_CheckShape( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CHECKSHAPE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "DialogBox_CHECKSHAPE" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_CHECK_TITLE" ) ); - setSizeGripEnabled( TRUE ); - MeasureGUI_CheckShapeLayout = new QGridLayout( this ); - MeasureGUI_CheckShapeLayout->setSpacing( 6 ); - MeasureGUI_CheckShapeLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_CHECK_SHAPE" ) ); - 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)3, (QSizePolicy::SizeType)0, - Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 60, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - MeasureGUI_CheckShapeLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_CHECK_INFOS") ); - GroupConstructor1->setColumnLayout(0, Qt::Vertical ); - GroupConstructor1->layout()->setSpacing( 0 ); - GroupConstructor1->layout()->setMargin( 0 ); - GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() ); - GroupConstructor1Layout->setAlignment( Qt::AlignTop ); - GroupConstructor1Layout->setSpacing( 6 ); - GroupConstructor1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupConstructor1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupConstructor1Layout->addWidget( LineEditC1A1, 0, 2 ); - SelectButtonC1A1 = new QPushButton( GroupConstructor1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupConstructor1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupConstructor1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - Text = new QTextView(GroupConstructor1); - Text->setTextFormat( Qt::PlainText ); - GroupConstructor1Layout->addMultiCellWidget( Text, 1, 1, 0, 2 ); - - MeasureGUI_CheckShapeLayout->addWidget( GroupConstructor1, 1, 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, 1 ); - // buttonApply = new QPushButton( GroupButtons, "buttonApply" ); -// buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); -// buttonApply->setAutoDefault( TRUE ); -// GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_8, 0, 0 ); - 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 ); - MeasureGUI_CheckShapeLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~MeasureGUI_CheckShape() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -MeasureGUI_CheckShape::~MeasureGUI_CheckShape() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void MeasureGUI_CheckShape::Init( SALOME_Selection* Sel ) -{ - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomBase = new GEOMBase() ; - myGeomGUI = GEOMContext::GetGeomGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - SelectedName = ""; - - /* 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 ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void MeasureGUI_CheckShape::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void MeasureGUI_CheckShape::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void MeasureGUI_CheckShape::SelectionIntoArgument() -{ - Text->setText("") ; - myEditCurrentArgument->setText("") ; - - SelectedName = ""; /* future the name of selection */ - - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, SelectedName) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() ) { - myEditCurrentArgument->setText( "" ); - return ; - } - - LineEditC1A1->setText(SelectedName) ; - this->Check(S) ; - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void MeasureGUI_CheckShape::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void MeasureGUI_CheckShape::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 ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void MeasureGUI_CheckShape::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void MeasureGUI_CheckShape::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupConstructor1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void MeasureGUI_CheckShape::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void MeasureGUI_CheckShape::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : Check() -// purpose : -//================================================================================= -void MeasureGUI_CheckShape::Check(const TopoDS_Shape S) -{ - - if( S.IsNull() ) - return ; - - try { - BRepCheck_Analyzer ana(S,false); - if (ana.IsValid()) - Text->setText( "This Shape seems to be valid." ); - else - Text->setText( "This Shape is not valid." ); - } - catch(Standard_Failure) { - MESSAGE("Catch intercepted in Check()" << endl ) ; - } - return ; -} diff --git a/src/MeasureGUI/MeasureGUI_CheckShape.h b/src/MeasureGUI/MeasureGUI_CheckShape.h deleted file mode 100644 index 2bde05a3c..000000000 --- a/src/MeasureGUI/MeasureGUI_CheckShape.h +++ /dev/null @@ -1,107 +0,0 @@ -// 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 : MeasureGUI_CheckShape.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_CHECKSHAPE_H -#define DIALOGBOX_CHECKSHAPE_H - -#include "MeasureGUI.h" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QTextView; - -//================================================================================= -// class : MeasureGUI_CheckShape -// purpose : -//================================================================================= -class MeasureGUI_CheckShape : public QDialog -{ - Q_OBJECT - -public: - MeasureGUI_CheckShape( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~MeasureGUI_CheckShape(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void Check(const TopoDS_Shape S) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMBase* myGeomBase ; /* Current GeomGUI object */ - GEOMContext* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - - QTextView* Text; - QString SelectedName; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* MeasureGUI_CheckShapeLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_CHECKSHAPE_H diff --git a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx new file mode 100644 index 000000000..fb89b1f5f --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx @@ -0,0 +1,209 @@ +// 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 : MeasureGUI_CheckShapeDlg.cxx +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +using namespace std; +#include "MeasureGUI_CheckShapeDlg.h" + +#include + +//================================================================================= +// class : MeasureGUI_CheckShapeDlg() +// purpose : Constructs a MeasureGUI_CheckShapeDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +MeasureGUI_CheckShapeDlg::MeasureGUI_CheckShapeDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :MeasureGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CHECKSHAPE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_CHECK_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_CHECK_SHAPE")); + RadioButton1->setPixmap(image0); + + GroupC1 = new MeasureGUI_1Sel1TextView_QTD(this, "GroupC1"); + GroupC1->GroupBox1->setTitle(tr("GEOM_CHECK_INFOS")); + GroupC1->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupC1->TextEdit1->setReadOnly(TRUE); + GroupC1->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupC1, 1, 0); + /***************************************************************/ + + /* Initialisation */ + Init(); +} + + +//================================================================================= +// function : ~MeasureGUI_CheckShapeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +MeasureGUI_CheckShapeDlg::~MeasureGUI_CheckShapeDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void MeasureGUI_CheckShapeDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupC1->LineEdit1; + + /* signals and slots connections */ + connect(GroupC1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupC1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupC1->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void MeasureGUI_CheckShapeDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + SelectedName = ""; /* future the name of selection */ + GroupC1->TextEdit1->setText(""); + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, SelectedName); + if(nbSel != 1) + return; + + /* nbSel == 1 */ + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(S.IsNull()) + return; + + myEditCurrentArgument->setText(SelectedName); + this->Check(S); + + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void MeasureGUI_CheckShapeDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void MeasureGUI_CheckShapeDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; + else + return; + + MeasureGUI_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void MeasureGUI_CheckShapeDlg::ActivateThisDialog() +{ + MeasureGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void MeasureGUI_CheckShapeDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : Check() +// purpose : +//================================================================================= +void MeasureGUI_CheckShapeDlg::Check(const TopoDS_Shape S) +{ + if(S.IsNull()) + return; + + try { + BRepCheck_Analyzer ana(S,false); + if(ana.IsValid()) + GroupC1->TextEdit1->setText("This Shape seems to be valid."); + else + GroupC1->TextEdit1->setText("This Shape is not valid."); + } + catch(Standard_Failure) { + MESSAGE("Catch intercepted in Check()"); + } + return; +} diff --git a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.h b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.h new file mode 100644 index 000000000..1c80efd27 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.h @@ -0,0 +1,65 @@ +// 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 : MeasureGUI_CheckShapeDlg.h +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_CHECKSHAPEDLG_H +#define DIALOGBOX_CHECKSHAPEDLG_H + +#include "MeasureGUI_Skeleton.h" +#include "MeasureGUI_1Sel1TextView_QTD.h" + +#include "MeasureGUI.h" + +//================================================================================= +// class : MeasureGUI_CheckShapeDlg +// purpose : +//================================================================================= +class MeasureGUI_CheckShapeDlg : public MeasureGUI_Skeleton +{ + Q_OBJECT + +public: + MeasureGUI_CheckShapeDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~MeasureGUI_CheckShapeDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + void Check(const TopoDS_Shape S); + + QString SelectedName; + MeasureGUI_1Sel1TextView_QTD* GroupC1; + +private slots: + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_CHECKSHAPEDLG_H diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index 4c2857f3f..d70b816fe 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -30,32 +30,15 @@ using namespace std; #include "MeasureGUI_DistanceDlg.h" #include "QAD_RightFrame.h" - #include "OCCViewer_Viewer3d.h" -#include "OCCViewer_ViewFrame.h" -// Open CASCADE Includes +#include +#include #include #include #include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - +#include +#include //================================================================================= // class : MeasureGUI_DistanceDlg() @@ -64,123 +47,32 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :MeasureGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MINDIST"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "MeasureGUI_DistanceDlg" ); - resize( 322, 220 ); - setCaption( tr( "GEOM_MINDIST_TITLE" ) ); - setSizeGripEnabled( TRUE ); - - MeasureGUI_DistanceDlgLayout = new QGridLayout( this ); - MeasureGUI_DistanceDlgLayout->setSpacing( 6 ); - MeasureGUI_DistanceDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_DISTANCE" ) ); - 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 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - MeasureGUI_DistanceDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_MINDIST_OBJ" ) ); - GroupConstructor1->setColumnLayout(0, Qt::Vertical ); - GroupConstructor1->layout()->setSpacing( 0 ); - GroupConstructor1->layout()->setMargin( 0 ); - GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() ); - GroupConstructor1Layout->setAlignment( Qt::AlignTop ); - GroupConstructor1Layout->setSpacing( 6 ); - GroupConstructor1Layout->setMargin( 11 ); - LineEditC1A2Shape = new QLineEdit( GroupConstructor1, "LineEditC1A2Shape" ); - LineEditC1A2Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Shape->sizePolicy().hasHeightForWidth() ) ); - GroupConstructor1Layout->addWidget( LineEditC1A2Shape, 1, 2 ); - LineEditC1A1Shape = new QLineEdit( GroupConstructor1, "LineEditC1A1Shape" ); - LineEditC1A1Shape->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Shape->sizePolicy().hasHeightForWidth() ) ); - GroupConstructor1Layout->addWidget( LineEditC1A1Shape, 0, 2 ); - SelectButtonC1A1Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A1Shape" ); - SelectButtonC1A1Shape->setText( tr( "" ) ); - SelectButtonC1A1Shape->setPixmap( image1 ); - GroupConstructor1Layout->addWidget( SelectButtonC1A1Shape, 0, 1 ); - SelectButtonC1A2Shape = new QPushButton( GroupConstructor1, "SelectButtonC1A2Shape" ); - SelectButtonC1A2Shape->setText( tr( "" ) ); - SelectButtonC1A2Shape->setPixmap( image1 ); - GroupConstructor1Layout->addWidget( SelectButtonC1A2Shape, 1, 1 ); - TextLabelC1A2Shape = new QLabel( GroupConstructor1, "TextLabelC1A2Shape" ); - TextLabelC1A2Shape->setText( tr( "GEOM_OBJECT_I" ).arg("2") ); - TextLabelC1A2Shape->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2Shape->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2Shape->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelC1A2Shape, 1, 0 ); - TextLabelC1A1Shape = new QLabel( GroupConstructor1, "TextLabelC1A1Shape" ); - TextLabelC1A1Shape->setText( tr( "GEOM_OBJECT_I" ).arg("1") ); - TextLabelC1A1Shape->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1Shape->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1Shape->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelC1A1Shape, 0, 0 ); - MeasureGUI_DistanceDlgLayout->addWidget( GroupConstructor1, 1, 0 ); - - TextLabel_Length = new QLabel( GroupConstructor1, "TextLabel_Length" ); - TextLabel_Length->setText( tr( "GEOM_LENGTH" ) ); - TextLabel_Length->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Length->setFrameShape( QLabel::NoFrame ); - TextLabel_Length->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Length, 2, 0 ); - LineEdit_Length = new QLineEdit( GroupConstructor1, "LineEdit_Length" ); - LineEdit_Length->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Length->sizePolicy().hasHeightForWidth() ) ); - // LineEdit_Length->setEnabled( FALSE ); - LineEdit_Length->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_Length, 2, 2 ); - - /***************************************************************/ - 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 ); - MeasureGUI_DistanceDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisation */ - Init( Sel ) ; + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_MINDIST"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_MINDIST_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_DISTANCE")); + RadioButton1->setPixmap(image0); + + GroupC1 = new MeasureGUI_2Sel1LineEdit_QTD(this, "GroupC1"); + GroupC1->GroupBox1->setTitle(tr("GEOM_MINDIST_OBJ")); + GroupC1->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1")); + GroupC1->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2")); + GroupC1->TextLabel3->setText(tr("GEOM_LENGTH")); + GroupC1->LineEdit3->setReadOnly(TRUE); + GroupC1->PushButton1->setPixmap(image1); + GroupC1->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupC1, 1, 0); + /***************************************************************/ + + /* Initialisation */ + Init(); } @@ -191,125 +83,38 @@ MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg( QWidget* parent, const char* nam MeasureGUI_DistanceDlg::~MeasureGUI_DistanceDlg() { /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; } - //================================================================================= // function : Init() // purpose : //================================================================================= -void MeasureGUI_DistanceDlg::Init( SALOME_Selection* Sel ) -{ - mySelection = Sel ; - myShape1.Nullify() ; - myShape2.Nullify() ; - myConstructorId = 0 ; - - myGeomGUI = GEOMContext::GetGeomGUI() ; - myGeomBase = new GEOMBase() ; - - GroupConstructor1->show(); - myConstructorId = 0 ; - myEditCurrentArgument = LineEditC1A1Shape ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - // TODO previous selection into argument ? - - /* 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( SelectButtonC1A1Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC1A2Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* 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 ; -} +void MeasureGUI_DistanceDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupC1->LineEdit1; + myOkShape1 = myOkShape2 = false; + /* signals and slots connections */ + connect(buttonClose, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void MeasureGUI_DistanceDlg::ConstructorsClicked(int constructorId) -{ - EraseDistance(); - myGeomBase->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupConstructor1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1Shape ; - LineEditC1A2Shape->setText(tr("")) ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - break; - } - } - return ; -} + connect(GroupC1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupC1->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void MeasureGUI_DistanceDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; + connect(GroupC1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupC1->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - return ; -} + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void MeasureGUI_DistanceDlg::ClickOnApply() -{ - EraseDistance() ; - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - this->MakeDistanceSimulationAndDisplay(myShape1 ,myShape2) ; - } - break ; - } - } + /* displays Dialog */ + GroupC1->show(); + this->show(); - // accept(); - return ; + return; } @@ -319,74 +124,63 @@ void MeasureGUI_DistanceDlg::ClickOnApply() //================================================================================= void MeasureGUI_DistanceDlg::ClickOnCancel() { - EraseDistance() ; - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; + this->EraseDistance(); + MeasureGUI_Skeleton::ClickOnCancel(); + return; } - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection has changed //================================================================================= void MeasureGUI_DistanceDlg::SelectionIntoArgument() { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - LineEdit_Length->setText("") ; - myEditCurrentArgument->setText("") ; /* by default */ - QString aString = ""; /* the name of selection */ - - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myOkShape1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myOkShape2 = false ; - } - break ; - } - } - return ; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + this->EraseDistance(); + myEditCurrentArgument->setText(""); + QString aString = ""; + + GroupC1->LineEdit3->setText(""); + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupC1->LineEdit1) + myOkShape1 = false; + else if(myEditCurrentArgument == GroupC1->LineEdit2) + myOkShape2 = false; + return; } - /* nbSel == 1 */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; + /* nbSel == 1 */ + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape1 = S ; - LineEditC1A1Shape->setText(aString) ; - myOkShape1 = true ; + if(myEditCurrentArgument == GroupC1->LineEdit1) { + myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape1 = S; + myEditCurrentArgument->setText(aString); + myOkShape1 = true; } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape2 = S ; - LineEditC1A2Shape->setText(aString) ; - myOkShape2 = true ; + else if(myEditCurrentArgument == GroupC1->LineEdit2) { + myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape2 = S; + myEditCurrentArgument->setText(aString); + myOkShape2 = true; } - return ; + if(myOkShape1 && myOkShape2) + this->MakeDistanceSimulationAndDisplay(myShape1 ,myShape2); + return; } @@ -398,25 +192,18 @@ void MeasureGUI_DistanceDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if( send == SelectButtonC1A1Shape ) { - LineEditC1A1Shape->setFocus() ; - myEditCurrentArgument = LineEditC1A1Shape ; - } - else if(send == SelectButtonC1A2Shape) { - LineEditC1A2Shape->setFocus() ; - myEditCurrentArgument = LineEditC1A2Shape; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + else if(send == GroupC1->PushButton2) { + GroupC1->LineEdit2->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit2; + } + this->SelectionIntoArgument(); + return; +} //================================================================================= @@ -425,52 +212,30 @@ void MeasureGUI_DistanceDlg::SetEditCurrentArgument() //================================================================================= void MeasureGUI_DistanceDlg::LineEditReturnPressed() { - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Shape ) - myEditCurrentArgument = LineEditC1A1Shape ; - else if ( send == LineEditC1A2Shape ) - myEditCurrentArgument = LineEditC1A2Shape ; + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; + else if(send == GroupC1->LineEdit2) + myEditCurrentArgument = GroupC1->LineEdit2; 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 ) ; - } - return ; -} - + return; - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void MeasureGUI_DistanceDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - } - return ; + MeasureGUI_Skeleton::LineEditReturnPressed(); + return; } - //================================================================================= -// function : closeEvent() +// function : ActivateThisDialog() // purpose : //================================================================================= -void MeasureGUI_DistanceDlg::closeEvent( QCloseEvent* e ) +void MeasureGUI_DistanceDlg::ActivateThisDialog() { - this->ClickOnCancel() ; /* same than click on cancel button */ + MeasureGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; } @@ -478,63 +243,60 @@ void MeasureGUI_DistanceDlg::closeEvent( QCloseEvent* e ) // function : enterEvent() // purpose : when mouse enter onto the QWidget //================================================================================= -void MeasureGUI_DistanceDlg::enterEvent( QEvent * ) +void MeasureGUI_DistanceDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } - //================================================================================= -// function : ActivateThisDialog() +// function : closeEvent() // purpose : //================================================================================= -void MeasureGUI_DistanceDlg::ActivateThisDialog() +void MeasureGUI_DistanceDlg::closeEvent(QCloseEvent* e) { - /* Emit a signal to deactivate any active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupConstructor1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - if( !mySimulationTopoDs.IsNull() ) - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; + /* same than click on cancel button */ + this->ClickOnCancel(); + return; } - //================================================================================= // function : MakeDistanceSimulationAndDisplay() // purpose : //================================================================================= void MeasureGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape& S1, const TopoDS_Shape& S2) { - LineEdit_Length->setText("") ; - EraseDistance() ; - myGeomBase->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + GroupC1->LineEdit3->setText(""); - BRepExtrema_DistShapeShape dst( S1, S2 ); - if (dst.IsDone()) { - int i; - for (i=1; i<= dst.NbSolution(); i++) { - gp_Pnt P1,P2; - P1 = (dst.PointOnShape1(i)); - P2 = (dst.PointOnShape2(i)); - - Standard_Real Dist = P1.Distance(P2); - if (Dist<=1.e-9) { + BRepExtrema_DistShapeShape dst(S1, S2); + + try { + if(dst.IsDone()) { + gp_Pnt P1, P2; + Standard_Real Dist = 1.e9; + for(int i = 1; i <= dst.NbSolution(); i++) { + P1 = (dst.PointOnShape1(i)); + P2 = (dst.PointOnShape2(i)); + + Standard_Real MinDist = P1.Distance(P2); + if(Dist > MinDist) + Dist = MinDist; + } + + if(Dist <= 1.e-9) { BRepBuilderAPI_MakeVertex MakeVertex(P1); - mySimulationTopoDs = MakeVertex.Vertex(); - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; + mySimulationTopoDs = MakeVertex.Vertex(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); - LineEdit_Length->setText("0.0") ; - } else { + GroupC1->LineEdit3->setText("0.0"); + } + else { BRepBuilderAPI_MakeEdge MakeEdge(P1, P2); mySimulationTopoDs = MakeEdge.Edge(); @@ -542,23 +304,39 @@ void MeasureGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(P2); QString S; - S.sprintf("%.1f",Dist); - Handle(AIS_LengthDimension) Distance = new AIS_LengthDimension (V1,V2, new Geom_Plane (0.,0.,1.,0.), - Dist, TCollection_ExtendedString(strdup(S))); - - LineEdit_Length->setText(S) ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - return ; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - ic->Display( Distance ); - ic->UpdateCurrentViewer(); + S.sprintf("%.1f", Dist); + + gp_Pnt P3; + P3.SetX((P1.X() + P2.X()) / 2); + P3.SetY((P1.Y() + P2.Y()) / 2); + P3.SetZ(((P1.Z() + P2.Z()) / 2) + 100); + gp_Vec va(P3, P1); + gp_Vec vb(P3, P2); + if(va.IsParallel(vb, Precision::Angular())) { + P3.SetY(((P1.Y() + P2.Y()) / 2) + 100); + P3.SetZ(((P1.Z() + P2.Z()) / 2)); + } + gce_MakePln gce_MP(P1, P2, P3); + gp_Pln gp_P = gce_MP.Value(); + Handle(Geom_Plane) P = new Geom_Plane(gp_P); + + Handle(AIS_LengthDimension) Distance = new AIS_LengthDimension(V1, V2, P, Dist, TCollection_ExtendedString(strdup(S))); + + GroupC1->LineEdit3->setText(S); + + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + ic->Display(Distance); + ic->UpdateCurrentViewer(); + } } } - } else - myGeomGUI->GetDesktop()->putInfo( tr( "GEOM_PRP_MIN_DIST" ) ); + } + catch(Standard_Failure) { + MESSAGE("Catch intercepted in MakeDistanceSimulationAndDisplay()"); + } + return; } @@ -569,18 +347,20 @@ void MeasureGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape void MeasureGUI_DistanceDlg::EraseDistance() { int count = myGeomGUI->GetActiveStudy()->getStudyFramesCount(); - for ( int i = 0; i < count; i++ ) + 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(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); AIS_ListOfInteractive L; - ic->DisplayedObjects(AIS_KOI_Relation,-1,L); + ic->DisplayedObjects(AIS_KOI_Relation, -1, L); AIS_ListIteratorOfListOfInteractive ite(L); while (ite.More()) { - ic->Remove( ite.Value() ); + ic->Remove(ite.Value()); ic->UpdateCurrentViewer(); ite.Next(); } } + } + return; } diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.h b/src/MeasureGUI/MeasureGUI_DistanceDlg.h index 70c4bd878..50718dd40 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.h +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.h @@ -29,96 +29,46 @@ #ifndef DIALOGBOX_DISTANCE_H #define DIALOGBOX_DISTANCE_H -#include "MeasureGUI.h" - -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; +#include "MeasureGUI_Skeleton.h" +#include "MeasureGUI_2Sel1LineEdit_QTD.h" +#include "MeasureGUI.h" //================================================================================= // class : MeasureGUI_DistanceDlg // purpose : //================================================================================= -class MeasureGUI_DistanceDlg : public QDialog +class MeasureGUI_DistanceDlg : public MeasureGUI_Skeleton { Q_OBJECT public: - MeasureGUI_DistanceDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + MeasureGUI_DistanceDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~MeasureGUI_DistanceDlg(); private: + void Init(); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); + void MakeDistanceSimulationAndDisplay(const TopoDS_Shape& S1, const TopoDS_Shape& S2); + void EraseDistance(); - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void MakeDistanceSimulationAndDisplay( const TopoDS_Shape& S1, const TopoDS_Shape& S2 ) ; - void EraseDistance() ; + TopoDS_Shape myShape1; + TopoDS_Shape myShape2; + GEOM::GEOM_Shape_var myGeomShape1; + GEOM::GEOM_Shape_var myGeomShape2; + bool myOkShape1; + bool myOkShape2; /* to check when arguments are defined */ - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMContext* myGeomGUI ; /* Current GeomGUI object */ - GEOMBase* myGeomBase ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape myShape1 ; - TopoDS_Shape myShape2 ; - GEOM::GEOM_Shape_var myGeomShape1 ; - GEOM::GEOM_Shape_var myGeomShape2 ; - bool myOkShape1 ; - bool myOkShape2 ; /* to check when arguments are defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1Shape; - QLineEdit* LineEditC1A2Shape; - QPushButton* SelectButtonC1A1Shape; - QPushButton* SelectButtonC1A2Shape; - QLabel* TextLabelC1A2Shape; - QLabel* TextLabelC1A1Shape; - - QLabel* TextLabel_Length; - QLineEdit* LineEdit_Length; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; + MeasureGUI_2Sel1LineEdit_QTD* GroupC1; private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); -protected: - QGridLayout* MeasureGUI_DistanceDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructor1Layout; }; #endif // DIALOGBOX_DISTANCE_H diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx index c6d629d9e..e8c796ad8 100644 --- a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx @@ -28,18 +28,9 @@ using namespace std; #include "MeasureGUI_InertiaDlg.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include //================================================================================= // class : MeasureGUI_InertiaDlg() @@ -48,200 +39,44 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_InertiaDlg::MeasureGUI_InertiaDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +MeasureGUI_InertiaDlg::MeasureGUI_InertiaDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :MeasureGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_INERTIA"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_INERTIA"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); - if ( !name ) - setName( "MeasureGUI_InertiaDlg" ); - resize( 356, 303 ); - setCaption( tr( "GEOM_INERTIA_TITLE" ) ); - setSizeGripEnabled( TRUE ); - MeasureGUI_InertiaDlgLayout = new QGridLayout( this ); - MeasureGUI_InertiaDlgLayout->setSpacing( 6 ); - MeasureGUI_InertiaDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_INERTIA_CONSTR" ) ); - 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 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - MeasureGUI_InertiaDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_OBJECT_RESULT" ) ); - 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 ); - 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 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A1->setMinimumSize( QSize( 220, 0 ) ); - GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 4 ); - TextLabel_Matrix = new QLabel( GroupC1, "TextLabel_Matrix" ); - TextLabel_Matrix->setText( tr( "GEOM_MATRIX" ) ); - TextLabel_Matrix->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Matrix->setFrameShape( QLabel::NoFrame ); - TextLabel_Matrix->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabel_Matrix, 1, 0 ); - TextLabelMatrix_11 = new QLabel( GroupC1, "TextLabelMatrix_11" ); - TextLabelMatrix_11->setText( tr( "GEOM_INERTIA_I" ).arg("1") ); - TextLabelMatrix_11->setMinimumSize( QSize( 0, 0 ) ); - TextLabelMatrix_11->setFrameShape( QLabel::NoFrame ); - TextLabelMatrix_11->setFrameShadow( QLabel::Plain ); - TextLabelMatrix_11->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - GroupC1Layout->addWidget( TextLabelMatrix_11, 1, 1 ); - TextLabelMatrix_21 = new QLabel( GroupC1, "TextLabelMatrix_21" ); - TextLabelMatrix_21->setText( tr( "GEOM_INERTIA_I" ).arg("2") ); - TextLabelMatrix_21->setMinimumSize( QSize( 0, 0 ) ); - TextLabelMatrix_21->setFrameShape( QLabel::NoFrame ); - TextLabelMatrix_21->setFrameShadow( QLabel::Plain ); - TextLabelMatrix_21->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - GroupC1Layout->addWidget( TextLabelMatrix_21, 2, 1 ); - TextLabelMatrix_31 = new QLabel( GroupC1, "TextLabelMatrix_31" ); - TextLabelMatrix_31->setText( tr( "GEOM_INERTIA_I" ).arg("3") ); - TextLabelMatrix_31->setMinimumSize( QSize( 0, 0 ) ); - TextLabelMatrix_31->setFrameShape( QLabel::NoFrame ); - TextLabelMatrix_31->setFrameShadow( QLabel::Plain ); - TextLabelMatrix_31->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - GroupC1Layout->addWidget( TextLabelMatrix_31, 3, 1 ); - LineEdit_L1C1 = new QLineEdit( GroupC1, "LineEdit_L1C1" ); - LineEdit_L1C1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L1C1->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L1C1->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L1C1->setEnabled( FALSE ); - LineEdit_L1C1->setReadOnly( TRUE ); - LineEdit_L1C1->setText( tr( "" ) ); - GroupC1Layout->addWidget( LineEdit_L1C1, 1, 2 ); - LineEdit_L1C2 = new QLineEdit( GroupC1, "LineEdit_L1C2" ); - LineEdit_L1C2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L1C2->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L1C2->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L1C2->setEnabled( FALSE ); - LineEdit_L1C2->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L1C2, 1, 3 ); - LineEdit_L1C3 = new QLineEdit( GroupC1, "LineEdit_L1C3" ); - LineEdit_L1C3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L1C3->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L1C3->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L1C3->setEnabled( FALSE ); - LineEdit_L1C3->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L1C3, 1, 4 ); - LineEdit_L2C1 = new QLineEdit( GroupC1, "LineEdit_L2C1" ); - LineEdit_L2C1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L2C1->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L2C1->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L2C1->setEnabled( FALSE ); - LineEdit_L2C1->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L2C1, 2, 2 ); - LineEdit_L2C2 = new QLineEdit( GroupC1, "LineEdit_L2C2" ); - LineEdit_L2C2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L2C2->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L2C2->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L2C2->setEnabled( FALSE ); - LineEdit_L2C2->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L2C2, 2, 3 ); - LineEdit_L2C3 = new QLineEdit( GroupC1, "LineEdit_L2C3" ); - LineEdit_L2C3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L2C3->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L2C3->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L2C3->setEnabled( FALSE ); - LineEdit_L2C3->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L2C3, 2, 4 ); - LineEdit_L3C1 = new QLineEdit( GroupC1, "LineEdit_L3C1" ); - LineEdit_L3C1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L3C1->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L3C1->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L3C1->setEnabled( FALSE ); - LineEdit_L3C1->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L3C1, 3, 2 ); - LineEdit_L3C2 = new QLineEdit( GroupC1, "LineEdit_L3C2" ); - LineEdit_L3C2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L3C2->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L3C2->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L3C2->setEnabled( FALSE ); - LineEdit_L3C2->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L3C2, 3, 3 ); - LineEdit_L3C3 = new QLineEdit( GroupC1, "LineEdit_L3C3" ); - LineEdit_L3C3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_L3C3->sizePolicy().hasHeightForWidth() ) ); - LineEdit_L3C3->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_L3C3->setEnabled( FALSE ); - LineEdit_L3C3->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_L3C3, 3, 4 ); - LineEdit_IX = new QLineEdit( GroupC1, "LineEdit_IX" ); - LineEdit_IX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_IX->sizePolicy().hasHeightForWidth() ) ); - LineEdit_IX->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_IX->setEnabled( FALSE ); - LineEdit_IX->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_IX, 4, 2 ); - LineEdit_IY = new QLineEdit( GroupC1, "LineEdit_IY" ); - LineEdit_IY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_IY->sizePolicy().hasHeightForWidth() ) ); - LineEdit_IY->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_IY->setEnabled( FALSE ); - LineEdit_IY->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_IY, 4, 3 ); - LineEdit_IZ = new QLineEdit( GroupC1, "LineEdit_IZ" ); - LineEdit_IZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_IZ->sizePolicy().hasHeightForWidth() ) ); - LineEdit_IZ->setMinimumSize( QSize( 70, 0 ) ); - //LineEdit_IZ->setEnabled( FALSE ); - LineEdit_IZ->setReadOnly( TRUE ); - GroupC1Layout->addWidget( LineEdit_IZ, 4, 4 ); - TextLabel_IXIYIZ = new QLabel( GroupC1, "TextLabel_IXIYIZ" ); - TextLabel_IXIYIZ->setText( tr( "GEOM_INERTIA_IXYZ" ) ); - TextLabel_IXIYIZ->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_IXIYIZ->setFrameShape( QLabel::NoFrame ); - TextLabel_IXIYIZ->setFrameShadow( QLabel::Plain ); - TextLabel_IXIYIZ->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); - GroupC1Layout->addMultiCellWidget( TextLabel_IXIYIZ, 4, 4, 0, 1 ); - MeasureGUI_InertiaDlgLayout->addWidget( GroupC1, 1, 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, 1 ); - - QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_8, 0, 0 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - - MeasureGUI_InertiaDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ + setCaption(tr("GEOM_INERTIA_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_INERTIA_CONSTR")); + RadioButton1->setPixmap(image0); + + GroupC1 = new MeasureGUI_1Sel12LineEdit_QTD(this, "GroupC1"); + GroupC1->GroupBox1->setTitle(tr("GEOM_MATRIX")); + GroupC1->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupC1->TextLabel2->setText(tr("GEOM_INERTIA_I").arg("1")); + GroupC1->TextLabel3->setText(tr("GEOM_INERTIA_I").arg("2")); + GroupC1->TextLabel4->setText(tr("GEOM_INERTIA_I").arg("3")); + GroupC1->TextLabel5->setText(tr("GEOM_INERTIA_IXYZ")); + GroupC1->LineEdit11->setReadOnly(TRUE); + GroupC1->LineEdit12->setReadOnly(TRUE); + GroupC1->LineEdit13->setReadOnly(TRUE); + GroupC1->LineEdit21->setReadOnly(TRUE); + GroupC1->LineEdit22->setReadOnly(TRUE); + GroupC1->LineEdit23->setReadOnly(TRUE); + GroupC1->LineEdit31->setReadOnly(TRUE); + GroupC1->LineEdit32->setReadOnly(TRUE); + GroupC1->LineEdit33->setReadOnly(TRUE); + GroupC1->LineEdit41->setReadOnly(TRUE); + GroupC1->LineEdit42->setReadOnly(TRUE); + GroupC1->LineEdit43->setReadOnly(TRUE); + GroupC1->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupC1, 1, 0); + /***************************************************************/ + + /* Initialisation */ + Init(); } @@ -251,7 +86,7 @@ MeasureGUI_InertiaDlg::MeasureGUI_InertiaDlg( QWidget* parent, const char* name, //================================================================================= MeasureGUI_InertiaDlg::~MeasureGUI_InertiaDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, Qt does it all for us } @@ -259,80 +94,22 @@ MeasureGUI_InertiaDlg::~MeasureGUI_InertiaDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_InertiaDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_InertiaDlg::Init() { + /* init variables */ + myEditCurrentArgument = GroupC1->LineEdit1; - LineEdit_L1C1->setMaxLength( 10 ); - LineEdit_L1C2->setMaxLength( 10 ); - LineEdit_L1C3->setMaxLength( 10 ); - LineEdit_L2C1->setMaxLength( 10 ); - LineEdit_L2C2->setMaxLength( 10 ); - LineEdit_L2C3->setMaxLength( 10 ); - LineEdit_L3C1->setMaxLength( 10 ); - LineEdit_L3C2->setMaxLength( 10 ); - LineEdit_L3C3->setMaxLength( 10 ); - - LineEdit_IX->setMaxLength( 10 ); - LineEdit_IY->setMaxLength( 10 ); - LineEdit_IZ->setMaxLength( 10 ); - - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomBase = new GEOMBase() ; - myGeomGUI = GEOMContext::GetGeomGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), this, SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - - /* 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 ; -} - + /* signals and slots connections */ + connect(GroupC1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupC1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void MeasureGUI_InertiaDlg::ConstructorsClicked(int constructorId) -{ - return ; -} + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + /* displays Dialog */ + GroupC1->show(); + this->show(); - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void MeasureGUI_InertiaDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; + return; } @@ -342,36 +119,35 @@ void MeasureGUI_InertiaDlg::ClickOnCancel() //================================================================================= void MeasureGUI_InertiaDlg::SelectionIntoArgument() { - LineEdit_L1C1->setText("") ; - LineEdit_L1C2->setText("") ; - LineEdit_L1C3->setText("") ; - LineEdit_L2C1->setText("") ; - LineEdit_L2C2->setText("") ; - LineEdit_L2C3->setText("") ; - LineEdit_L3C1->setText("") ; - LineEdit_L3C2->setText("") ; - LineEdit_L3C3->setText("") ; - - LineEdit_IX->setText("") ; - LineEdit_IY->setText("") ; - LineEdit_IZ->setText("") ; - - myEditCurrentArgument->setText("") ; - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ + myEditCurrentArgument->setText(""); + QString aString = ""; + + GroupC1->LineEdit11->setText(""); + GroupC1->LineEdit12->setText(""); + GroupC1->LineEdit13->setText(""); + GroupC1->LineEdit21->setText(""); + GroupC1->LineEdit22->setText(""); + GroupC1->LineEdit23->setText(""); + GroupC1->LineEdit31->setText(""); + GroupC1->LineEdit32->setText(""); + GroupC1->LineEdit33->setText(""); + GroupC1->LineEdit41->setText(""); + GroupC1->LineEdit42->setText(""); + GroupC1->LineEdit43->setText(""); + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) + return; + + /* nbSel == 1 */ TopoDS_Shape S; - if( !myGeomBase->GetTopoFromSelection(mySelection, S) || S.IsNull() ) - return ; - - LineEditC1A1->setText(aString) ; - this->CalculateAndDisplayInertia(S) ; - return ; + if(!myGeomBase->GetTopoFromSelection(mySelection, S) || S.IsNull()) + return; + + GroupC1->LineEdit1->setText(aString); + + this->CalculateAndDisplayInertia(S); + return; } @@ -382,21 +158,15 @@ void MeasureGUI_InertiaDlg::SelectionIntoArgument() void MeasureGUI_InertiaDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + + this->SelectionIntoArgument(); + return; +} //================================================================================= @@ -405,38 +175,14 @@ void MeasureGUI_InertiaDlg::SetEditCurrentArgument() //================================================================================= void MeasureGUI_InertiaDlg::LineEditReturnPressed() { - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; 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 ) ; - } - return ; - return ; -} + return; - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void MeasureGUI_InertiaDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; + MeasureGUI_Skeleton::LineEditReturnPressed(); + return; } @@ -446,13 +192,9 @@ void MeasureGUI_InertiaDlg::DeactivateActiveDialog() //================================================================================= void MeasureGUI_InertiaDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; + MeasureGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; } @@ -462,22 +204,10 @@ void MeasureGUI_InertiaDlg::ActivateThisDialog() //================================================================================= void MeasureGUI_InertiaDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void MeasureGUI_InertiaDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } @@ -487,38 +217,32 @@ void MeasureGUI_InertiaDlg::closeEvent( QCloseEvent* e ) //================================================================================= void MeasureGUI_InertiaDlg::CalculateAndDisplayInertia(const TopoDS_Shape& S) { - LineEdit_L1C1->setText("") ; - LineEdit_L1C2->setText("") ; - LineEdit_L1C3->setText("") ; - LineEdit_L2C1->setText("") ; - LineEdit_L2C2->setText("") ; - LineEdit_L2C3->setText("") ; - LineEdit_L3C1->setText("") ; - LineEdit_L3C2->setText("") ; - LineEdit_L3C3->setText("") ; - - LineEdit_IX->setText("") ; - LineEdit_IY->setText("") ; - LineEdit_IZ->setText("") ; - - - if( S.IsNull() ) - return ; + GroupC1->LineEdit11->setText(""); + GroupC1->LineEdit12->setText(""); + GroupC1->LineEdit13->setText(""); + GroupC1->LineEdit21->setText(""); + GroupC1->LineEdit22->setText(""); + GroupC1->LineEdit23->setText(""); + GroupC1->LineEdit31->setText(""); + GroupC1->LineEdit32->setText(""); + GroupC1->LineEdit33->setText(""); + GroupC1->LineEdit41->setText(""); + GroupC1->LineEdit42->setText(""); + GroupC1->LineEdit43->setText(""); + + if(S.IsNull()) + return; + + QString resString; + GProp_GProps System; try { - - QString resString; - GProp_GProps System; - - if ( S.ShapeType() == TopAbs_VERTEX || S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE ) { + if(S.ShapeType() == TopAbs_VERTEX || S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) BRepGProp::LinearProperties(S, System); - } - else if ( S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL ) { + else if(S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) BRepGProp::SurfaceProperties(S, System); - } - else { + else BRepGProp::VolumeProperties(S, System); - } gp_Mat I = System.MatrixOfInertia() ; GProp_PrincipalProps Pr = System.PrincipalProperties(); @@ -526,40 +250,37 @@ void MeasureGUI_InertiaDlg::CalculateAndDisplayInertia(const TopoDS_Shape& S) Pr.Moments(Ix,Iy,Iz); /* matrix 3x3 */ - resString = tr("%1").arg( I(1,1), 12, 'f', 6 ) ; - LineEdit_L1C1->setText(resString) ; - resString = tr("%1").arg( I(1,2), 12, 'f', 6 ) ; - LineEdit_L1C2->setText(resString) ; - resString = tr("%1").arg( I(1,3), 12, 'f', 6 ) ; - LineEdit_L1C3->setText(resString) ; - - resString = tr("%1").arg( I(2,1), 12, 'f', 6 ) ; - LineEdit_L2C1->setText(resString) ; - resString = tr("%1").arg( I(2,2), 12, 'f', 6 ) ; - LineEdit_L2C2->setText(resString) ; - resString = tr("%1").arg( I(2,3), 12, 'f', 6 ) ; - LineEdit_L2C3->setText(resString) ; - - resString = tr("%1").arg( I(3,1), 12, 'f', 6 ) ; - LineEdit_L3C1->setText(resString) ; - resString = tr("%1").arg( I(3,2), 12, 'f', 6 ) ; - LineEdit_L3C2->setText(resString) ; - resString = tr("%1").arg( I(3,3), 12, 'f', 6 ) ; - LineEdit_L3C3->setText(resString) ; + resString = tr("%1").arg(I(1,1), 12, 'f', 6); + GroupC1->LineEdit11->setText(resString); + resString = tr("%1").arg(I(1,2), 12, 'f', 6); + GroupC1->LineEdit12->setText(resString); + resString = tr("%1").arg(I(1,3), 12, 'f', 6); + GroupC1->LineEdit13->setText(resString); + + resString = tr("%1").arg(I(2,1), 12, 'f', 6); + GroupC1->LineEdit21->setText(resString); + resString = tr("%1").arg(I(2,2), 12, 'f', 6); + GroupC1->LineEdit22->setText(resString); + resString = tr("%1").arg(I(2,3), 12, 'f', 6); + GroupC1->LineEdit23->setText(resString); + + resString = tr("%1").arg(I(3,1), 12, 'f', 6); + GroupC1->LineEdit31->setText(resString); + resString = tr("%1").arg(I(3,2), 12, 'f', 6); + GroupC1->LineEdit32->setText(resString); + resString = tr("%1").arg(I(3,3), 12, 'f', 6); + GroupC1->LineEdit33->setText(resString); /* moments */ - resString = tr("%1").arg( Ix, 12, 'f', 6 ) ; - LineEdit_IX->setText(resString) ; - resString = tr("%1").arg( Ix, 12, 'f', 6 ) ; - LineEdit_IY->setText(resString) ; - resString = tr("%1").arg( Iz, 12, 'f', 6 ) ; - LineEdit_IZ->setText(resString) ; - + resString = tr("%1").arg(Ix, 12, 'f', 6); + GroupC1->LineEdit41->setText(resString); + resString = tr("%1").arg(Ix, 12, 'f', 6); + GroupC1->LineEdit42->setText(resString); + resString = tr("%1").arg(Iz, 12, 'f', 6); + GroupC1->LineEdit43->setText(resString); } catch(Standard_Failure) { - MESSAGE("Catch intercepted in CalculateAndDisplayInertia()" << endl ) ; + MESSAGE("Catch intercepted in CalculateAndDisplayInertia()"); } - return ; + return; } - - diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.h b/src/MeasureGUI/MeasureGUI_InertiaDlg.h index 5980f9926..4e6bc2f02 100644 --- a/src/MeasureGUI/MeasureGUI_InertiaDlg.h +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.h @@ -29,95 +29,36 @@ #ifndef DIALOGBOX_INERTIA_H #define DIALOGBOX_INERTIA_H -#include "MeasureGUI.h" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; +#include "MeasureGUI_Skeleton.h" +#include "MeasureGUI_1Sel12LineEdit_QTD.h" +#include "MeasureGUI.h" //================================================================================= // class : MeasureGUI_InertiaDlg // purpose : //================================================================================= -class MeasureGUI_InertiaDlg : public QDialog +class MeasureGUI_InertiaDlg : public MeasureGUI_Skeleton { Q_OBJECT public: - MeasureGUI_InertiaDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + MeasureGUI_InertiaDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~MeasureGUI_InertiaDlg(); - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void CalculateAndDisplayInertia(const TopoDS_Shape& S) ; +private: + void Init(); + void enterEvent(QEvent* e); + void CalculateAndDisplayInertia(const TopoDS_Shape& S); - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMBase* myGeomBase ; /* Current GeomGUI object */ - GEOMContext* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QLabel* TextLabel_Matrix; - QLabel* TextLabelMatrix_11; - QLabel* TextLabelMatrix_21; - QLabel* TextLabelMatrix_31; - QLineEdit* LineEdit_L1C1; - QLineEdit* LineEdit_L1C2; - QLineEdit* LineEdit_L1C3; - QLineEdit* LineEdit_L2C1; - QLineEdit* LineEdit_L2C2; - QLineEdit* LineEdit_L2C3; - QLineEdit* LineEdit_L3C1; - QLineEdit* LineEdit_L3C2; - QLineEdit* LineEdit_L3C3; - QLineEdit* LineEdit_IX; - QLineEdit* LineEdit_IY; - QLineEdit* LineEdit_IZ; - QLabel* TextLabel_IXIYIZ; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; + MeasureGUI_1Sel12LineEdit_QTD* GroupC1; private slots: + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* MeasureGUI_InertiaDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupButtonsLayout; }; #endif // DIALOGBOX_INERTIA_H diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx index d1053be6a..8bc1252b3 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx @@ -29,26 +29,9 @@ using namespace std; #include "MeasureGUI_MaxToleranceDlg.h" -// Open CASCADE Includes #include #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - //================================================================================= // class : MeasureGUI_MaxToleranceDlg() // purpose : Constructs a MeasureGUI_MaxToleranceDlg which is a child of 'parent', with the @@ -56,179 +39,39 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_MaxToleranceDlg::MeasureGUI_MaxToleranceDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +MeasureGUI_MaxToleranceDlg::MeasureGUI_MaxToleranceDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :MeasureGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_TOLERANCE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "MeasureGUI_MaxToleranceDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_TOLERANCE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - MeasureGUI_MaxToleranceDlgLayout = new QGridLayout( this ); - MeasureGUI_MaxToleranceDlgLayout->setSpacing( 6 ); - MeasureGUI_MaxToleranceDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_TOLERANCE" ) ); - 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)3, (QSizePolicy::SizeType)0, - Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 60, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - MeasureGUI_MaxToleranceDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_TOLERANCE_CONSTR" ) ); - GroupConstructor1->setColumnLayout(0, Qt::Vertical ); - GroupConstructor1->layout()->setSpacing( 0 ); - GroupConstructor1->layout()->setMargin( 0 ); - GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() ); - GroupConstructor1Layout->setAlignment( Qt::AlignTop ); - GroupConstructor1Layout->setSpacing( 6 ); - GroupConstructor1Layout->setMargin( 11 ); - - LineEditC1A1 = new QLineEdit( GroupConstructor1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); -// GroupConstructor1Layout->addWidget( LineEditC1A1, 0, 2 ); - SelectButtonC1A1 = new QPushButton( GroupConstructor1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); -// GroupConstructor1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupConstructor1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); -// GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - QHBoxLayout* bl = new QHBoxLayout; - bl->setMargin(0); bl->setSpacing(6); - bl->addWidget(TextLabelC1A1); bl->addWidget(SelectButtonC1A1); bl->addWidget(LineEditC1A1); - GroupConstructor1Layout->addMultiCellLayout(bl, 0, 0, 0, 2); - - TextLabel_Min = new QLabel( GroupConstructor1, "TextLabel_Min" ); - TextLabel_Min->setText( tr( "GEOM_MIN" ) ); - TextLabel_Min->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Min->setFrameShape( QLabel::NoFrame ); - TextLabel_Min->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Min, 1, 1 ); - - TextLabel_Max = new QLabel( GroupConstructor1, "TextLabel_Max" ); - TextLabel_Max->setText( tr( "GEOM_MAX" ) ); - TextLabel_Max->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Max->setFrameShape( QLabel::NoFrame ); - TextLabel_Max->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Max, 1, 2 ); - - TextLabel_Face = new QLabel( GroupConstructor1, "TextLabel_Face" ); - TextLabel_Face->setText( tr( "GEOM_TOLERANCE_FACE" ) ); - TextLabel_Face->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Face->setFrameShape( QLabel::NoFrame ); - TextLabel_Face->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Face, 2, 0 ); - LineEdit_MinFace = new QLineEdit( GroupConstructor1, "LineEdit_MinFace" ); - LineEdit_MinFace->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MinFace->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MinFace->setEnabled( FALSE ); - LineEdit_MinFace->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MinFace, 2, 1 ); - LineEdit_MaxFace = new QLineEdit( GroupConstructor1, "LineEdit_MaxFace" ); - LineEdit_MaxFace->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MaxFace->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MaxFace->setEnabled( FALSE ); - LineEdit_MaxFace->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MaxFace, 2, 2 ); - - TextLabel_Edge = new QLabel( GroupConstructor1, "TextLabel_Edge" ); - TextLabel_Edge->setText( tr( "GEOM_TOLERANCE_EDGE" ) ); - TextLabel_Edge->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Edge->setFrameShape( QLabel::NoFrame ); - TextLabel_Edge->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Edge, 3, 0 ); - LineEdit_MinEdge = new QLineEdit( GroupConstructor1, "LineEdit_MinEdge" ); - LineEdit_MinEdge->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MinEdge->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MinEdge->setEnabled( FALSE ); - LineEdit_MinEdge->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MinEdge, 3, 1 ); - LineEdit_MaxEdge = new QLineEdit( GroupConstructor1, "LineEdit_MaxEdge" ); - LineEdit_MaxEdge->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MaxEdge->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MaxEdge->setEnabled( FALSE ); - LineEdit_MaxEdge->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MaxEdge, 3, 2 ); - - TextLabel_Vertex = new QLabel( GroupConstructor1, "TextLabel_Vertex" ); - TextLabel_Vertex->setText( tr( "GEOM_TOLERANCE_VERTEX" ) ); - TextLabel_Vertex->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Vertex->setFrameShape( QLabel::NoFrame ); - TextLabel_Vertex->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Vertex, 4, 0 ); - LineEdit_MinVertex = new QLineEdit( GroupConstructor1, "LineEdit_MinVertex" ); - LineEdit_MinVertex->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MinVertex->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MinVertex->setEnabled( FALSE ); - LineEdit_MinVertex->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MinVertex, 4, 1 ); - LineEdit_MaxVertex = new QLineEdit( GroupConstructor1, "LineEdit_MaxVertex" ); - LineEdit_MaxVertex->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, - LineEdit_MaxVertex->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_MaxVertex->setEnabled( FALSE ); - LineEdit_MaxVertex->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_MaxVertex, 4, 2 ); - - MeasureGUI_MaxToleranceDlgLayout->addWidget( GroupConstructor1, 1, 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, 1 ); - // buttonApply = new QPushButton( GroupButtons, "buttonApply" ); -// buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); -// buttonApply->setAutoDefault( TRUE ); -// GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_8, 0, 0 ); - 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 ); - MeasureGUI_MaxToleranceDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_TOLERANCE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_TOLERANCE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_TOLERANCE")); + RadioButton1->setPixmap(image0); + + GroupC1 = new MeasureGUI_1Sel6LineEdit_QTD(this, "GroupC1"); + GroupC1->GroupBox1->setTitle(tr("GEOM_TOLERANCE_CONSTR")); + GroupC1->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupC1->TextLabel2->setText(tr("GEOM_MIN")); + GroupC1->TextLabel3->setText(tr("GEOM_MAX")); + GroupC1->TextLabel4->setText(tr("GEOM_TOLERANCE_FACE")); + GroupC1->TextLabel5->setText(tr("GEOM_TOLERANCE_EDGE")); + GroupC1->TextLabel6->setText(tr("GEOM_TOLERANCE_VERTEX")); + GroupC1->LineEdit11->setReadOnly(TRUE); + GroupC1->LineEdit12->setReadOnly(TRUE); + GroupC1->LineEdit21->setReadOnly(TRUE); + GroupC1->LineEdit22->setReadOnly(TRUE); + GroupC1->LineEdit31->setReadOnly(TRUE); + GroupC1->LineEdit32->setReadOnly(TRUE); + GroupC1->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupC1, 1, 0); + /***************************************************************/ + + /* Initialisation */ + Init(); } @@ -238,7 +81,7 @@ MeasureGUI_MaxToleranceDlg::MeasureGUI_MaxToleranceDlg( QWidget* parent, const c //================================================================================= MeasureGUI_MaxToleranceDlg::~MeasureGUI_MaxToleranceDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, Qt does it all for us } @@ -246,64 +89,22 @@ MeasureGUI_MaxToleranceDlg::~MeasureGUI_MaxToleranceDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_MaxToleranceDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_MaxToleranceDlg::Init() { - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GEOMContext::GetGeomGUI() ; - myGeomBase = new GEOMBase() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* 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 ; -} + /* init variables */ + myEditCurrentArgument = GroupC1->LineEdit1; + /* signals and slots connections */ + connect(GroupC1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupC1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void MeasureGUI_MaxToleranceDlg::ConstructorsClicked(int constructorId) -{ - return ; -} + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + /* displays Dialog */ + GroupC1->show(); + this->show(); - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void MeasureGUI_MaxToleranceDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; + return; } @@ -313,35 +114,32 @@ void MeasureGUI_MaxToleranceDlg::ClickOnCancel() //================================================================================= void MeasureGUI_MaxToleranceDlg::SelectionIntoArgument() { - LineEdit_MinFace->setText("") ; - LineEdit_MinEdge->setText("") ; - LineEdit_MinVertex->setText("") ; - LineEdit_MaxFace->setText("") ; - LineEdit_MaxEdge->setText("") ; - LineEdit_MaxVertex->setText("") ; - myEditCurrentArgument->setText("") ; - - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } + myEditCurrentArgument->setText(""); + QString aString = ""; + + GroupC1->LineEdit11->setText(""); + GroupC1->LineEdit12->setText(""); + GroupC1->LineEdit21->setText(""); + GroupC1->LineEdit22->setText(""); + GroupC1->LineEdit31->setText(""); + GroupC1->LineEdit32->setText(""); - /* nbSel == 1 */ + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) + return; + + /* nbSel == 1 */ TopoDS_Shape S; - if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() ) { - myEditCurrentArgument->setText( "" ); - return ; - } - - LineEditC1A1->setText(aString) ; - this->CalculateMaxTolerance(S) ; + if(!myGeomBase->GetTopoFromSelection(mySelection, S) || S.IsNull()) + return; + + if(S.IsNull()) + return; + + GroupC1->LineEdit1->setText(aString); - return ; + this->CalculateMaxTolerance(S); + return; } @@ -352,21 +150,15 @@ void MeasureGUI_MaxToleranceDlg::SelectionIntoArgument() void MeasureGUI_MaxToleranceDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + + this->SelectionIntoArgument(); + return; +} //================================================================================= @@ -375,38 +167,14 @@ void MeasureGUI_MaxToleranceDlg::SetEditCurrentArgument() //================================================================================= void MeasureGUI_MaxToleranceDlg::LineEditReturnPressed() { - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; 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 ) ; - } - return ; -} - + return; - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void MeasureGUI_MaxToleranceDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; + MeasureGUI_Skeleton::LineEditReturnPressed(); + return; } @@ -416,13 +184,9 @@ void MeasureGUI_MaxToleranceDlg::DeactivateActiveDialog() //================================================================================= void MeasureGUI_MaxToleranceDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupConstructor1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; + MeasureGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; } @@ -432,22 +196,10 @@ void MeasureGUI_MaxToleranceDlg::ActivateThisDialog() //================================================================================= void MeasureGUI_MaxToleranceDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void MeasureGUI_MaxToleranceDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } @@ -457,87 +209,73 @@ void MeasureGUI_MaxToleranceDlg::closeEvent( QCloseEvent* e ) //================================================================================= void MeasureGUI_MaxToleranceDlg::CalculateMaxTolerance(const TopoDS_Shape& S) { - LineEdit_MinFace->setText("") ; - LineEdit_MinEdge->setText("") ; - LineEdit_MinVertex->setText("") ; - LineEdit_MaxFace->setText("") ; - LineEdit_MaxEdge->setText("") ; - LineEdit_MaxVertex->setText("") ; - if( S.IsNull() ) - return ; - - Standard_Real T,TMF,TME,TMV,TmF,TmE,TmV; - Standard_Integer nbF,nbE,nbV; - TMF=TME=TMV=-RealLast(); - TmF=TmE=TmV=RealLast(); - nbF=nbE=nbV=0; - - bool m_isFace = false; - bool m_isEdge = false; - bool m_isVertex = false; - try - { - for( TopExp_Explorer ExF(S,TopAbs_FACE); ExF.More(); ExF.Next() ) - { - m_isFace = true; - TopoDS_Face Face=TopoDS::Face(ExF.Current()); - T=BRep_Tool::Tolerance(Face); - if(T>TMF) TMF=T; - if(TTME) TME=T; - if(TTMV) TMV=T; - if(TsetText( tr("%1").arg( TmF, 5, 'e', 8 ) ) ; - LineEdit_MaxFace->setText( tr("%1").arg( TMF, 5, 'e', 8 ) ) ; - } - else - { - LineEdit_MinFace->setText( "" ) ; - LineEdit_MaxFace->setText( "" ) ; - } - if (m_isEdge) - { - LineEdit_MinEdge->setText( tr("%1").arg( TmE, 5, 'e', 8 ) ) ; - LineEdit_MaxEdge->setText( tr("%1").arg( TME, 5, 'e', 8 ) ) ; - } - else - { - LineEdit_MinEdge->setText( "" ) ; - LineEdit_MaxEdge->setText( "" ) ; - } - if (m_isVertex) - { - LineEdit_MinVertex->setText( tr("%1").arg( TmV, 5, 'e', 8 ) ) ; - LineEdit_MaxVertex->setText( tr("%1").arg( TMV, 5, 'e', 8 ) ) ; - } - else - { - LineEdit_MinVertex->setText( "" ) ; - LineEdit_MaxVertex->setText( "" ) ; + GroupC1->LineEdit11->setText(""); + GroupC1->LineEdit12->setText(""); + GroupC1->LineEdit21->setText(""); + GroupC1->LineEdit22->setText(""); + GroupC1->LineEdit31->setText(""); + GroupC1->LineEdit32->setText(""); + + if(S.IsNull()) + return; + + Standard_Real T, TMF, TME, TMV, TmF, TmE, TmV; + Standard_Integer nbF, nbE, nbV; + bool m_isFace, m_isEdge, m_isVertex; + + TMF = TME = TMV = -RealLast(); + TmF = TmE = TmV = RealLast(); + nbF = nbE = nbV = 0; + m_isFace = m_isEdge = m_isVertex = false; + + try { + for(TopExp_Explorer ExF(S,TopAbs_FACE); ExF.More(); ExF.Next()) { + m_isFace = true; + TopoDS_Face Face=TopoDS::Face(ExF.Current()); + T=BRep_Tool::Tolerance(Face); + if(T>TMF) + TMF=T; + if(TTME) + TME=T; + if(TTMV) + TMV=T; + if(TLineEdit11->setText(tr("%1").arg(TmF, 5, 'e', 8)); + GroupC1->LineEdit12->setText(tr("%1").arg(TMF, 5, 'e', 8)); + } + if(m_isEdge) { + GroupC1->LineEdit21->setText(tr("%1").arg(TmE, 5, 'e', 8)); + GroupC1->LineEdit22->setText(tr("%1").arg(TME, 5, 'e', 8)); } + if(m_isVertex) { + GroupC1->LineEdit31->setText(tr("%1").arg(TmV, 5, 'e', 8)); + GroupC1->LineEdit32->setText(tr("%1").arg(TMV, 5, 'e', 8)); + } } catch(Standard_Failure) { - MESSAGE("Catch intercepted in CalculateMaxTolerance()" << endl ) ; + MESSAGE("Catch intercepted in CalculateMaxTolerance()"); } - return ; + return; } diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h index d2fcfa2e0..5513582b7 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h @@ -29,90 +29,36 @@ #ifndef DIALOGBOX_MAXTOLERANCE_H #define DIALOGBOX_MAXTOLERANCE_H -#include "MeasureGUI.h" - -#include -#include +#include "MeasureGUI_Skeleton.h" +#include "MeasureGUI_1Sel6LineEdit_QTD.h" -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; +#include "MeasureGUI.h" //================================================================================= // class : DialogBox_PROPERTIES // purpose : //================================================================================= -class MeasureGUI_MaxToleranceDlg : public QDialog +class MeasureGUI_MaxToleranceDlg : public MeasureGUI_Skeleton { Q_OBJECT public: - MeasureGUI_MaxToleranceDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + MeasureGUI_MaxToleranceDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~MeasureGUI_MaxToleranceDlg(); private: + void Init(); + void enterEvent(QEvent* e); + void CalculateMaxTolerance(const TopoDS_Shape& S); - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void CalculateMaxTolerance(const TopoDS_Shape& S) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMContext* myGeomGUI ; /* Current GeomGUI object */ - GEOMBase* myGeomBase ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - - QLabel* TextLabel_Min; - QLabel* TextLabel_Max; - - QLabel* TextLabel_Face; - QLabel* TextLabel_Edge; - QLabel* TextLabel_Vertex; - - QLineEdit* LineEdit_MinFace; - QLineEdit* LineEdit_MinEdge; - QLineEdit* LineEdit_MinVertex; - - QLineEdit* LineEdit_MaxFace; - QLineEdit* LineEdit_MaxEdge; - QLineEdit* LineEdit_MaxVertex; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; + MeasureGUI_1Sel6LineEdit_QTD* GroupC1; private slots: + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* MeasureGUI_MaxToleranceDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; }; #endif // DIALOGBOX_MAXTOLERANCE_H diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx index 81cd61ca0..934551b84 100644 --- a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx @@ -29,21 +29,10 @@ using namespace std; #include "MeasureGUI_PropertiesDlg.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include - +#include +#include +#include //================================================================================= // class : MeasureGUI_PropertiesDlg() @@ -52,126 +41,34 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_PropertiesDlg::MeasureGUI_PropertiesDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +MeasureGUI_PropertiesDlg::MeasureGUI_PropertiesDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :MeasureGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BASICPROPERTIES"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "MeasureGUI_PropertiesDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_PROPERTIES_TITLE" ) ); - setSizeGripEnabled( TRUE ); - MeasureGUI_PropertiesDlgLayout = new QGridLayout( this ); - MeasureGUI_PropertiesDlgLayout->setSpacing( 6 ); - MeasureGUI_PropertiesDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_PROPERTIES" ) ); - 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)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 60, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - MeasureGUI_PropertiesDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_PROPERTIES_CONSTR" ) ); - GroupConstructor1->setColumnLayout(0, Qt::Vertical ); - GroupConstructor1->layout()->setSpacing( 0 ); - GroupConstructor1->layout()->setMargin( 0 ); - GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() ); - GroupConstructor1Layout->setAlignment( Qt::AlignTop ); - GroupConstructor1Layout->setSpacing( 6 ); - GroupConstructor1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupConstructor1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupConstructor1Layout->addWidget( LineEditC1A1, 0, 2 ); - SelectButtonC1A1 = new QPushButton( GroupConstructor1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupConstructor1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupConstructor1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabel_Length = new QLabel( GroupConstructor1, "TextLabel_Length" ); - TextLabel_Length->setText( tr( "GEOM_LENGTH" ) ); - TextLabel_Length->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Length->setFrameShape( QLabel::NoFrame ); - TextLabel_Length->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Length, 1, 0 ); - LineEdit_Length = new QLineEdit( GroupConstructor1, "LineEdit_Length" ); - LineEdit_Length->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Length->sizePolicy().hasHeightForWidth() ) ); - // LineEdit_Length->setEnabled( FALSE ); - LineEdit_Length->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_Length, 1, 2 ); - LineEdit_Surface = new QLineEdit( GroupConstructor1, "LineEdit_Surface" ); - LineEdit_Surface->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Surface->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_Surface->setEnabled( FALSE ); - LineEdit_Surface->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_Surface, 2, 2 ); - TextLabel_Surface = new QLabel( GroupConstructor1, "TextLabel_Surface" ); - TextLabel_Surface->setText( tr( "GEOM_PROPERTIES_SURFACE" ) ); - TextLabel_Surface->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Surface->setFrameShape( QLabel::NoFrame ); - TextLabel_Surface->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Surface, 2, 0 ); - TextLabel_Volume = new QLabel( GroupConstructor1, "TextLabel_Volume" ); - TextLabel_Volume->setText( tr( "GEOM_PROPERTIES_VOLUME" ) ); - TextLabel_Volume->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Volume->setFrameShape( QLabel::NoFrame ); - TextLabel_Volume->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabel_Volume, 3, 0 ); - LineEdit_Volume = new QLineEdit( GroupConstructor1, "LineEdit_Volume" ); - LineEdit_Volume->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEdit_Volume->sizePolicy().hasHeightForWidth() ) ); - //LineEdit_Volume->setEnabled( FALSE ); - LineEdit_Volume->setReadOnly( TRUE ); - GroupConstructor1Layout->addWidget( LineEdit_Volume, 3, 2 ); - MeasureGUI_PropertiesDlgLayout->addWidget( GroupConstructor1, 1, 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, 1 ); - - QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_8, 0, 0 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - - MeasureGUI_PropertiesDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BASICPROPERTIES"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_PROPERTIES_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_PROPERTIES")); + RadioButton1->setPixmap(image0); + + GroupC1 = new MeasureGUI_1Sel3LineEdit_QTD(this, "GroupC1"); + GroupC1->GroupBox1->setTitle(tr("GEOM_PROPERTIES_CONSTR")); + GroupC1->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupC1->TextLabel2->setText(tr("GEOM_LENGTH")); + GroupC1->TextLabel3->setText(tr("GEOM_PROPERTIES_SURFACE")); + GroupC1->TextLabel4->setText(tr("GEOM_PROPERTIES_VOLUME")); + GroupC1->LineEdit2->setReadOnly(TRUE); + GroupC1->LineEdit3->setReadOnly(TRUE); + GroupC1->LineEdit4->setReadOnly(TRUE); + GroupC1->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupC1, 1, 0); + /***************************************************************/ + + /* Initialisation */ + Init(); } @@ -181,7 +78,7 @@ MeasureGUI_PropertiesDlg::MeasureGUI_PropertiesDlg( QWidget* parent, const char* //================================================================================= MeasureGUI_PropertiesDlg::~MeasureGUI_PropertiesDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, Qt does it all for us } @@ -189,65 +86,22 @@ MeasureGUI_PropertiesDlg::~MeasureGUI_PropertiesDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_PropertiesDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_PropertiesDlg::Init() { - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomBase = new GEOMBase() ; - myGeomGUI = GEOMContext::GetGeomGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* 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 ; -} + /* init variables */ + myEditCurrentArgument = GroupC1->LineEdit1; + /* signals and slots connections */ + connect(GroupC1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupC1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void MeasureGUI_PropertiesDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + /* displays Dialog */ + GroupC1->show(); + this->show(); -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void MeasureGUI_PropertiesDlg::ClickOnCancel() -{ - myGeomBase->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomBase->EraseSimulationShape() ; - myGeomGUI->ResetState() ; - reject() ; - return ; + return; } @@ -257,40 +111,36 @@ void MeasureGUI_PropertiesDlg::ClickOnCancel() //================================================================================= void MeasureGUI_PropertiesDlg::SelectionIntoArgument() { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - LineEdit_Length->setText("") ; - LineEdit_Surface->setText("") ; - LineEdit_Volume->setText("") ; - myEditCurrentArgument->setText("") ; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; - QString aString = ""; /* future the name of selection */ + GroupC1->LineEdit2->setText(""); + GroupC1->LineEdit3->setText(""); + GroupC1->LineEdit4->setText(""); - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) + return; - /* nbSel == 1 */ + /* nbSel == 1 */ TopoDS_Shape S; - if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) - return ; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + - if( S.IsNull() || S.ShapeType() == TopAbs_VERTEX ) { - myEditCurrentArgument->setText( "" ); - return ; - } + if(S.IsNull() || S.ShapeType() == TopAbs_VERTEX) + return; - LineEditC1A1->setText(aString) ; + GroupC1->LineEdit1->setText(aString); /* Try to display of a cone simulation shape to show direction of a linear edge only in OCC viewer */ - if( myGeomBase->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) { - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; - } - this->CalculateAndDisplayProperties(S) ; - - return ; + if(myGeomBase->CreateArrowForLinearEdge(S, mySimulationTopoDs)) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + + this->CalculateAndDisplayProperties(S); + return; } @@ -301,21 +151,15 @@ void MeasureGUI_PropertiesDlg::SelectionIntoArgument() void MeasureGUI_PropertiesDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + + this->SelectionIntoArgument(); + return; +} //================================================================================= @@ -323,39 +167,15 @@ void MeasureGUI_PropertiesDlg::SetEditCurrentArgument() // purpose : //================================================================================= void MeasureGUI_PropertiesDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; 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 ) ; - } - return ; -} - + return; -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void MeasureGUI_PropertiesDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - myGeomBase->EraseSimulationShape() ; - GroupButtons->setEnabled(false) ; - } - return ; + MeasureGUI_Skeleton::LineEditReturnPressed(); + return; } @@ -365,17 +185,11 @@ void MeasureGUI_PropertiesDlg::DeactivateActiveDialog() //================================================================================= void MeasureGUI_PropertiesDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupConstructor1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - if( !mySimulationTopoDs.IsNull() ) - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; + MeasureGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; } @@ -385,22 +199,10 @@ void MeasureGUI_PropertiesDlg::ActivateThisDialog() //================================================================================= void MeasureGUI_PropertiesDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void MeasureGUI_PropertiesDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } @@ -410,54 +212,47 @@ void MeasureGUI_PropertiesDlg::closeEvent( QCloseEvent* e ) //================================================================================= void MeasureGUI_PropertiesDlg::CalculateAndDisplayProperties(const TopoDS_Shape& S) { - LineEdit_Length->setText("") ; - LineEdit_Surface->setText("") ; - LineEdit_Volume->setText("") ; - if( S.IsNull() ) - return ; + GroupC1->LineEdit2->setText(""); + GroupC1->LineEdit3->setText(""); + GroupC1->LineEdit4->setText(""); + + if(S.IsNull()) + return; Standard_Real result; - GProp_GProps LProps; - GProp_GProps SProps; + GProp_GProps LProps, SProps; QString resString; - try - { - BRepGProp::LinearProperties(S,LProps); - result = LProps.Mass(); - if (!IsEqual( result, 0.0)) - { - resString = tr("%1").arg( result, 12, 'f', 6 ) ; - LineEdit_Length->setText(resString) ; - } - - BRepGProp::SurfaceProperties(S, SProps); - result = SProps.Mass(); - if (!IsEqual( result, 0.0)) - { - resString = tr("%1").arg( result, 12, 'f', 6 ) ; - LineEdit_Surface->setText(resString) ; - } + try { + BRepGProp::LinearProperties(S,LProps); + result = LProps.Mass(); + if(!IsEqual(result, 0.0)) { + resString = tr("%1").arg(result, 12, 'f', 6); + GroupC1->LineEdit2->setText(resString); + } + + BRepGProp::SurfaceProperties(S, SProps); + result = SProps.Mass(); + if(!IsEqual(result, 0.0)) { + resString = tr("%1").arg(result, 12, 'f', 6); + GroupC1->LineEdit3->setText(resString); + } - result = 0.0; - if (S.ShapeType() < TopAbs_SHELL) - { - for( TopExp_Explorer Exp(S,TopAbs_SOLID); Exp.More(); Exp.Next() ) - { - GProp_GProps VProps; - BRepGProp::VolumeProperties(Exp.Current(), VProps); - result += VProps.Mass(); - } - } - if (!IsEqual( result, 0.0 )) - { - resString = tr("%1").arg( result, 12, 'f', 6 ) ; - LineEdit_Volume->setText(resString) ; - } + result = 0.0; + if(S.ShapeType() < TopAbs_SHELL) { + for(TopExp_Explorer Exp(S,TopAbs_SOLID); Exp.More(); Exp.Next()) { + GProp_GProps VProps; + BRepGProp::VolumeProperties(Exp.Current(), VProps); + result += VProps.Mass(); + } } - catch(Standard_Failure) - { - MESSAGE("Catch intercepted in CalculateAndDisplayProperties()" << endl ) ; + if (!IsEqual(result, 0.0)) { + resString = tr("%1").arg(result, 12, 'f', 6); + GroupC1->LineEdit4->setText(resString); } - return ; + } + catch(Standard_Failure) { + MESSAGE("Catch intercepted in CalculateAndDisplayProperties()"); + } + return; } diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.h b/src/MeasureGUI/MeasureGUI_PropertiesDlg.h index 1259983b1..d2402393d 100644 --- a/src/MeasureGUI/MeasureGUI_PropertiesDlg.h +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.h @@ -28,89 +28,36 @@ #ifndef DIALOGBOX_PROPERTIES_H #define DIALOGBOX_PROPERTIES_H -#include "MeasureGUI.h" - -#include -#include -#include - -#include -#include +#include "MeasureGUI_Skeleton.h" +#include "MeasureGUI_1Sel3LineEdit_QTD.h" -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class MeasureGUI; +#include "MeasureGUI.h" //================================================================================= // class : MeasureGUI_PropertiesDlg // purpose : //================================================================================= -class MeasureGUI_PropertiesDlg : public QDialog +class MeasureGUI_PropertiesDlg : public MeasureGUI_Skeleton { Q_OBJECT public: - MeasureGUI_PropertiesDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + MeasureGUI_PropertiesDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~MeasureGUI_PropertiesDlg(); private: + void Init(); + void enterEvent(QEvent* e); + void CalculateAndDisplayProperties(const TopoDS_Shape& S); - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void CalculateAndDisplayProperties(const TopoDS_Shape& S) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMContext* myGeomGUI ; /* Current GeomGUI object */ - GEOMBase* myGeomBase ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - - QLabel* TextLabel_Length; - QLabel* TextLabel_Surface; - QLabel* TextLabel_Volume; - - QLineEdit* LineEdit_Length; - QLineEdit* LineEdit_Surface; - QLineEdit* LineEdit_Volume; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; + MeasureGUI_1Sel3LineEdit_QTD* GroupC1; private slots: + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* MeasureGUI_PropertiesDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; }; #endif // DIALOGBOX_PROPERTIES_H diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.cxx b/src/MeasureGUI/MeasureGUI_Skeleton.cxx new file mode 100644 index 000000000..c07c26097 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_Skeleton.cxx @@ -0,0 +1,169 @@ +// 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 : MeasureGUI_Skeleton.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "MeasureGUI_Skeleton.h" + +//================================================================================= +// class : MeasureGUI_Skeleton() +// purpose : Constructs a MeasureGUI_Skeleton which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +MeasureGUI_Skeleton::MeasureGUI_Skeleton(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :MeasureGUI_Skeleton_QTD(parent, name, modal, fl) +{ + if (!name) + setName("MeasureGUI_Skeleton"); + + buttonClose->setText(tr("GEOM_BUT_CLOSE")); + + GroupMedium->close(TRUE); + resize(350, 0); + + Init(Sel); +} + + +//================================================================================= +// function : ~MeasureGUI_Skeleton() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +MeasureGUI_Skeleton::~MeasureGUI_Skeleton() +{ + // no need to delete child widgets, Qt does it all for us + this->destroy(TRUE, TRUE); +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::Init(SALOME_Selection* Sel) +{ + /* init variables */ + mySelection = Sel; + mySimulationTopoDs.Nullify(); + + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeomGUI->SetActiveDialogBox((QDialog*)this); + myGeom = myGeomGUI->myComponentGeom; + + /* signals and slots connections */ + connect(buttonClose, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + 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 ); + + /* displays Dialog */ + RadioButton1->setChecked(TRUE); + + return; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::ClickOnCancel() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + disconnect(mySelection, 0, this, 0); + myGeomGUI->ResetState(); + reject(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::LineEditReturnPressed() +{ + /* 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); + + return; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::DeactivateActiveDialog() +{ + this->setEnabled(false); + myGeomGUI->ResetState(); + disconnect(mySelection, 0, this, 0); + myGeomBase->EraseSimulationShape(); + myGeomGUI->SetActiveDialogBox(0); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + myGeomGUI->EmitSignalDeactivateDialog(); + this->setEnabled(true); + myGeomGUI->SetActiveDialogBox((QDialog*)this); + return; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::closeEvent(QCloseEvent* e) +{ + /* same than click on cancel button */ + this->ClickOnCancel(); + return; +} diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.h b/src/MeasureGUI/MeasureGUI_Skeleton.h new file mode 100644 index 000000000..015951864 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_Skeleton.h @@ -0,0 +1,72 @@ +// 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 : MeasureGUI_Skeleton.h +// Author : Damine COQUERET +// Module : GEOM +// $Header: + +#ifndef MEASUREGUI_SKELETON_H +#define MEASUREGUI_SKELETON_H + +#include "MeasureGUI_Skeleton_QTD.h" + +#include "GEOMBase.h" + +#include +#include +#include +#include +#include +#include + +class MeasureGUI_Skeleton : public MeasureGUI_Skeleton_QTD +{ + Q_OBJECT + +public: + MeasureGUI_Skeleton(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~MeasureGUI_Skeleton(); + +private : + void Init(SALOME_Selection* Sel); + +protected: + void closeEvent(QCloseEvent* e); + + TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + SALOME_Selection* mySelection; /* User shape selection */ + GEOM::GEOM_Gen_var myGeom; /* Current GeomI object */ + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; /* Current GeomGUI object */ + +protected slots: + void ClickOnCancel(); + void LineEditReturnPressed(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + +}; + +#endif // MEASUREGUI_SKELETON_H diff --git a/src/MeasureGUI/MeasureGUI_Skeleton_QTD.cxx b/src/MeasureGUI/MeasureGUI_Skeleton_QTD.cxx new file mode 100644 index 000000000..5022ad561 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_Skeleton_QTD.cxx @@ -0,0 +1,99 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'MeasureGUI_Skeleton_QTD.ui' +** +** Created: lun oct 27 11:23:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "MeasureGUI_Skeleton_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a MeasureGUI_Skeleton_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +MeasureGUI_Skeleton_QTD::MeasureGUI_Skeleton_QTD( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "MeasureGUI_Skeleton_QTD" ); + resize( 228, 266 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "MeasureGUI_Skeleton_QTD" ) ); + setSizeGripEnabled( TRUE ); + MeasureGUI_Skeleton_QTDLayout = new QGridLayout( this, 1, 1, 11, 6, "MeasureGUI_Skeleton_QTDLayout"); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) ); + GroupButtons->setTitle( trUtf8( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 6 ); + GroupButtons->layout()->setMargin( 11 ); + GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + QSpacerItem* spacer = new QSpacerItem( 120, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout3->addItem( spacer, 0, 2 ); + QSpacerItem* spacer_2 = new QSpacerItem( 120, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout3->addItem( spacer_2, 0, 0 ); + + buttonClose = new QPushButton( GroupButtons, "buttonClose" ); + buttonClose->setText( trUtf8( "&Close" ) ); + + Layout3->addWidget( buttonClose, 0, 1 ); + + GroupButtonsLayout->addLayout( Layout3, 0, 0 ); + + Layout1->addWidget( GroupButtons, 2, 0 ); + + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) ); + GroupConstructors->setTitle( trUtf8( "" ) ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 6 ); + GroupConstructors->layout()->setMargin( 11 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + + Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2"); + + RadioButton1 = new QRadioButton( GroupConstructors, "RadioButton1" ); + RadioButton1->setText( trUtf8( "" ) ); + Layout2->addWidget( RadioButton1 ); + + GroupConstructorsLayout->addLayout( Layout2, 0, 0 ); + + Layout1->addWidget( GroupConstructors, 0, 0 ); + + GroupMedium = new QGroupBox( this, "GroupMedium" ); + GroupMedium->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupMedium->sizePolicy().hasHeightForWidth() ) ); + GroupMedium->setTitle( trUtf8( "" ) ); + + Layout1->addWidget( GroupMedium, 1, 0 ); + + MeasureGUI_Skeleton_QTDLayout->addLayout( Layout1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +MeasureGUI_Skeleton_QTD::~MeasureGUI_Skeleton_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/MeasureGUI/MeasureGUI_Skeleton_QTD.h b/src/MeasureGUI/MeasureGUI_Skeleton_QTD.h new file mode 100644 index 000000000..39564b036 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_Skeleton_QTD.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'MeasureGUI_Skeleton_QTD.ui' +** +** Created: lun oct 27 11:23:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef MEASUREGUI_SKELETON_QTD_H +#define MEASUREGUI_SKELETON_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QPushButton; +class QRadioButton; + +class MeasureGUI_Skeleton_QTD : public QDialog +{ + Q_OBJECT + +public: + MeasureGUI_Skeleton_QTD( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~MeasureGUI_Skeleton_QTD(); + + QGroupBox* GroupButtons; + QPushButton* buttonClose; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QGroupBox* GroupMedium; + + +protected: + QGridLayout* MeasureGUI_Skeleton_QTDLayout; + QGridLayout* Layout1; + QGridLayout* GroupButtonsLayout; + QGridLayout* Layout3; + QGridLayout* GroupConstructorsLayout; + QHBoxLayout* Layout2; +}; + +#endif // MEASUREGUI_SKELETON_QTD_H diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx index 29823591a..ebd8e5952 100644 --- a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx @@ -29,30 +29,9 @@ using namespace std; #include "MeasureGUI_WhatisDlg.h" -// Open CASCADE Includes -//#include -#include -#include #include #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - //================================================================================= // class : MeasureGUI_WhatisDlg() // purpose : Constructs a MeasureGUI_WhatisDlg which is a child of 'parent', with the @@ -60,99 +39,29 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -MeasureGUI_WhatisDlg::MeasureGUI_WhatisDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +MeasureGUI_WhatisDlg::MeasureGUI_WhatisDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :MeasureGUI_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_WHATIS"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "MeasureGUI_WhatisDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_WHATIS_TITLE" ) ); - setSizeGripEnabled( TRUE ); - MeasureGUI_WhatisDlgLayout = new QGridLayout( this ); - MeasureGUI_WhatisDlgLayout->setSpacing( 6 ); - MeasureGUI_WhatisDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_WHATIS" ) ); - 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)3, (QSizePolicy::SizeType)0, - Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 60, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - MeasureGUI_WhatisDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_WHATIS_OBJECT" ) ); - GroupConstructor1->setColumnLayout(0, Qt::Vertical ); - GroupConstructor1->layout()->setSpacing( 0 ); - GroupConstructor1->layout()->setMargin( 0 ); - GroupConstructor1Layout = new QGridLayout( GroupConstructor1->layout() ); - GroupConstructor1Layout->setAlignment( Qt::AlignTop ); - GroupConstructor1Layout->setSpacing( 6 ); - GroupConstructor1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupConstructor1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupConstructor1Layout->addWidget( LineEditC1A1, 0, 2 ); - SelectButtonC1A1 = new QPushButton( GroupConstructor1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupConstructor1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupConstructor1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - Text = new QTextView(GroupConstructor1); - Text->setTextFormat( Qt::PlainText ); - GroupConstructor1Layout->addMultiCellWidget( Text, 1, 1, 0, 2 ); - - MeasureGUI_WhatisDlgLayout->addWidget( GroupConstructor1, 1, 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, 1 ); - - QSpacerItem* spacer_8 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_8, 0, 0 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - - MeasureGUI_WhatisDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_WHATIS"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_WHATIS_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_WHATIS")); + RadioButton1->setPixmap(image0); + + GroupC1 = new MeasureGUI_1Sel1TextView_QTD(this, "GroupC1"); + GroupC1->GroupBox1->setTitle(tr("GEOM_WHATIS_OBJECT")); + GroupC1->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupC1->TextEdit1->setReadOnly(TRUE); + GroupC1->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupC1, 1, 0); + /***************************************************************/ + + /* Initialisation */ + Init(); } @@ -162,7 +71,7 @@ MeasureGUI_WhatisDlg::MeasureGUI_WhatisDlg( QWidget* parent, const char* name, S //================================================================================= MeasureGUI_WhatisDlg::~MeasureGUI_WhatisDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, Qt does it all for us } @@ -170,68 +79,22 @@ MeasureGUI_WhatisDlg::~MeasureGUI_WhatisDlg() // function : Init() // purpose : //================================================================================= -void MeasureGUI_WhatisDlg::Init( SALOME_Selection* Sel ) +void MeasureGUI_WhatisDlg::Init() { - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomBase = new GEOMBase() ; - myGeomGUI = GEOMContext::GetGeomGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* signals and slots connections */ - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - SelectedName = ""; - - /* 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 ; -} + /* init variables */ + myEditCurrentArgument = GroupC1->LineEdit1; + /* signals and slots connections */ + connect(GroupC1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupC1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void MeasureGUI_WhatisDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + /* displays Dialog */ + GroupC1->show(); + this->show(); -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void MeasureGUI_WhatisDlg::ClickOnCancel() -{ - myGeomBase->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; + return; } @@ -241,37 +104,33 @@ void MeasureGUI_WhatisDlg::ClickOnCancel() //================================================================================= void MeasureGUI_WhatisDlg::SelectionIntoArgument() { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - Text->setText("") ; - myEditCurrentArgument->setText("") ; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); SelectedName = ""; /* future the name of selection */ + GroupC1->TextEdit1->setText(""); - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, SelectedName) ; - if ( nbSel != 1 ) { - return ; - } + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, SelectedName); + if(nbSel != 1) + return; - /* nbSel == 1 */ + /* nbSel == 1 */ TopoDS_Shape S; - if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() ) { - myEditCurrentArgument->setText( "" ); - return ; - } - + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(S.IsNull()) + return; + /* Try to display of a cone simulation shape to show direction of a linear edge only in OCC viewer */ - if( myGeomBase->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) { - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; - } - LineEditC1A1->setText(SelectedName) ; - this->CalculateWhatis(S) ; + if(myGeomBase->CreateArrowForLinearEdge(S, mySimulationTopoDs)) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); - return ; + GroupC1->LineEdit1->setText(SelectedName); + this->CalculateWhatis(S); + + return; } @@ -282,21 +141,15 @@ void MeasureGUI_WhatisDlg::SelectionIntoArgument() void MeasureGUI_WhatisDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + + this->SelectionIntoArgument(); + return; +} //================================================================================= @@ -305,38 +158,14 @@ void MeasureGUI_WhatisDlg::SetEditCurrentArgument() //================================================================================= void MeasureGUI_WhatisDlg::LineEditReturnPressed() { - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; 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 ) ; - } - return ; -} - + return; -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void MeasureGUI_WhatisDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - myGeomBase->EraseSimulationShape() ; - GroupButtons->setEnabled(false) ; - } - return ; + MeasureGUI_Skeleton::LineEditReturnPressed(); + return; } @@ -346,15 +175,11 @@ void MeasureGUI_WhatisDlg::DeactivateActiveDialog() //================================================================================= void MeasureGUI_WhatisDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupConstructor1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; + MeasureGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; } @@ -364,22 +189,10 @@ void MeasureGUI_WhatisDlg::ActivateThisDialog() //================================================================================= void MeasureGUI_WhatisDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void MeasureGUI_WhatisDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } @@ -389,57 +202,49 @@ void MeasureGUI_WhatisDlg::closeEvent( QCloseEvent* e ) //================================================================================= void MeasureGUI_WhatisDlg::CalculateWhatis(const TopoDS_Shape& S) { - - if( S.IsNull() ) - return ; + if(S.IsNull()) + return; TCollection_AsciiString Astr; - Astr = Astr + " Number of shapes in " + strdup(SelectedName.latin1()) + ": \n"; + Astr = Astr + " Number of shapes in " + strdup(SelectedName.latin1()) + " : \n"; try { - // BRepTools_ShapeSet BS; - // BS.Add(S); - // BS.DumpExtent(Astr); - int iType, nbTypes [TopAbs_SHAPE]; - for (iType = 0; iType < TopAbs_SHAPE; ++iType) - nbTypes[ iType ] = 0; - nbTypes[ S.ShapeType() ]++; + for(iType = 0; iType < TopAbs_SHAPE; ++iType) + nbTypes[iType] = 0; + nbTypes[S.ShapeType()]++; TopTools_MapOfShape aMapOfShape; - aMapOfShape.Add( S ); + aMapOfShape.Add(S); TopTools_ListOfShape aListOfShape; - aListOfShape.Append( S ); + aListOfShape.Append(S); TopTools_ListIteratorOfListOfShape itL(aListOfShape); - for (; itL.More(); itL.Next()) - { + for(; itL.More(); itL.Next()) { TopoDS_Iterator it(itL.Value()); - for (; it.More(); it.Next()) - { + for(; it.More(); it.Next()) { TopoDS_Shape s = it.Value(); - if (aMapOfShape.Add( s )) - { - aListOfShape.Append( s ); - nbTypes[ s.ShapeType() ] ++; + if(aMapOfShape.Add(s)) { + aListOfShape.Append(s); + nbTypes[s.ShapeType()]++; } } } - Astr = Astr + " VERTEX : " + TCollection_AsciiString(nbTypes[ TopAbs_VERTEX ]) + "\n"; - Astr = Astr + " EDGE : " + TCollection_AsciiString(nbTypes[ TopAbs_EDGE ]) + "\n"; - Astr = Astr + " WIRE : " + TCollection_AsciiString(nbTypes[ TopAbs_WIRE ]) + "\n"; - Astr = Astr + " FACE : " + TCollection_AsciiString(nbTypes[ TopAbs_FACE ]) + "\n"; - Astr = Astr + " SHELL : " + TCollection_AsciiString(nbTypes[ TopAbs_SHELL ]) + "\n"; - Astr = Astr + " SOLID : " + TCollection_AsciiString(nbTypes[ TopAbs_SOLID ]) + "\n"; - Astr = Astr + " COMPSOLID : " + TCollection_AsciiString(nbTypes[ TopAbs_COMPSOLID ]) + "\n"; - Astr = Astr + " COMPOUND : " + TCollection_AsciiString(nbTypes[ TopAbs_COMPOUND ]) + "\n"; - Astr = Astr + " SHAPE : " + TCollection_AsciiString(aMapOfShape.Extent()) + "\n"; - - Text->setText( Astr.ToCString() ); + Astr = Astr + " VERTEX : " + TCollection_AsciiString(nbTypes[TopAbs_VERTEX]) + "\n"; + Astr = Astr + " EDGE : " + TCollection_AsciiString(nbTypes[TopAbs_EDGE]) + "\n"; + Astr = Astr + " WIRE : " + TCollection_AsciiString(nbTypes[TopAbs_WIRE]) + "\n"; + Astr = Astr + " FACE : " + TCollection_AsciiString(nbTypes[TopAbs_FACE]) + "\n"; + Astr = Astr + " SHELL : " + TCollection_AsciiString(nbTypes[TopAbs_SHELL]) + "\n"; + Astr = Astr + " SOLID : " + TCollection_AsciiString(nbTypes[TopAbs_SOLID]) + "\n"; + Astr = Astr + " COMPSOLID : " + TCollection_AsciiString(nbTypes[TopAbs_COMPSOLID]) + "\n"; + Astr = Astr + " COMPOUND : " + TCollection_AsciiString(nbTypes[TopAbs_COMPOUND]) + "\n"; + Astr = Astr + " SHAPE : " + TCollection_AsciiString(aMapOfShape.Extent()); + + GroupC1->TextEdit1->setText(Astr.ToCString()); } catch(Standard_Failure) { - MESSAGE("Catch intercepted in CalculateWhatis()" << endl ) ; + MESSAGE("Catch intercepted in CalculateWhatis()"); } - return ; + return; } diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.h b/src/MeasureGUI/MeasureGUI_WhatisDlg.h index f7c981aec..2714f0b26 100644 --- a/src/MeasureGUI/MeasureGUI_WhatisDlg.h +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.h @@ -29,83 +29,37 @@ #ifndef DIALOGBOX_WHATIS_H #define DIALOGBOX_WHATIS_H -#include "MeasureGUI.h" - -#include - -#include -#include +#include "MeasureGUI_Skeleton.h" +#include "MeasureGUI_1Sel1TextView_QTD.h" -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QTextView; -class MeasureGUI; +#include "MeasureGUI.h" //================================================================================= // class : DialogBox_PROPERTIES // purpose : //================================================================================= -class MeasureGUI_WhatisDlg : public QDialog +class MeasureGUI_WhatisDlg : public MeasureGUI_Skeleton { Q_OBJECT public: - MeasureGUI_WhatisDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + MeasureGUI_WhatisDlg(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~MeasureGUI_WhatisDlg(); private: + void Init(); + void enterEvent(QEvent* e); + void CalculateWhatis(const TopoDS_Shape& S); - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void CalculateWhatis(const TopoDS_Shape& S) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMContext* myGeomGUI ; /* Current GeomGUI object */ - GEOMBase* myGeomBase ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - - QTextView* Text; - QString SelectedName; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; + QString SelectedName; + MeasureGUI_1Sel1TextView_QTD* GroupC1; private slots: + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* MeasureGUI_WhatisDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; }; #endif // DIALOGBOX_WHATIS_H diff --git a/src/MeasureGUI/UIFiles/MeasureGUI_1Sel12LineEdit_QTD.ui b/src/MeasureGUI/UIFiles/MeasureGUI_1Sel12LineEdit_QTD.ui new file mode 100644 index 000000000..505b87b68 --- /dev/null +++ b/src/MeasureGUI/UIFiles/MeasureGUI_1Sel12LineEdit_QTD.ui @@ -0,0 +1,268 @@ + +MeasureGUI_1Sel12LineEdit_QTD + + + MeasureGUI_1Sel12LineEdit_QTD + + + + 0 + 0 + 131 + 171 + + + + MeasureGUI_1Sel12LineEdit_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + 7 + 7 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + LineEdit12 + + + + + LineEdit11 + + + + + LineEdit42 + + + + + TextLabel5 + + + + 0 + 0 + 0 + 0 + + + + TL5 + + + + + LineEdit31 + + + + + LineEdit41 + + + + + LineEdit23 + + + + + LineEdit33 + + + + + LineEdit43 + + + + + LineEdit22 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + LineEdit13 + + + + + LineEdit32 + + + + + LineEdit21 + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + + + LineEdit1 + + + + + Spacer8 + + + Vertical + + + Expanding + + + + 0 + 40 + + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + + + + + + diff --git a/src/MeasureGUI/UIFiles/MeasureGUI_1Sel1TextView_QTD.ui b/src/MeasureGUI/UIFiles/MeasureGUI_1Sel1TextView_QTD.ui new file mode 100644 index 000000000..d8e24583e --- /dev/null +++ b/src/MeasureGUI/UIFiles/MeasureGUI_1Sel1TextView_QTD.ui @@ -0,0 +1,116 @@ + +MeasureGUI_1Sel1TextView_QTD + + + MeasureGUI_1Sel1TextView_QTD + + + + 0 + 0 + 130 + 160 + + + + MeasureGUI_1Sel1TextView_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + 7 + 7 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + TextEdit1 + + + + + LineEdit1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + + + + + + diff --git a/src/MeasureGUI/UIFiles/MeasureGUI_1Sel3LineEdit_QTD.ui b/src/MeasureGUI/UIFiles/MeasureGUI_1Sel3LineEdit_QTD.ui new file mode 100644 index 000000000..07db7bfb0 --- /dev/null +++ b/src/MeasureGUI/UIFiles/MeasureGUI_1Sel3LineEdit_QTD.ui @@ -0,0 +1,191 @@ + +MeasureGUI_1Sel3LineEdit_QTD + + + MeasureGUI_1Sel3LineEdit_QTD + + + + 0 + 0 + 129 + 141 + + + + MeasureGUI_1Sel3LineEdit_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + 7 + 7 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + LineEdit4 + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + LineEdit2 + + + + + Spacer8 + + + Vertical + + + Expanding + + + + 0 + 80 + + + + + + LineEdit3 + + + + + LineEdit1 + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + + + + + + diff --git a/src/MeasureGUI/UIFiles/MeasureGUI_1Sel6LineEdit_QTD.ui b/src/MeasureGUI/UIFiles/MeasureGUI_1Sel6LineEdit_QTD.ui new file mode 100644 index 000000000..b439a76de --- /dev/null +++ b/src/MeasureGUI/UIFiles/MeasureGUI_1Sel6LineEdit_QTD.ui @@ -0,0 +1,254 @@ + +MeasureGUI_1Sel6LineEdit_QTD + + + MeasureGUI_1Sel6LineEdit_QTD + + + + 0 + 0 + 129 + 163 + + + + MeasureGUI_1Sel6LineEdit_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + 7 + 7 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Spacer8 + + + Vertical + + + Expanding + + + + 0 + 50 + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + LineEdit22 + + + + + LineEdit32 + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + LineEdit31 + + + + + TextLabel5 + + + + 0 + 0 + 0 + 0 + + + + TL5 + + + + + LineEdit11 + + + + + TextLabel6 + + + + 0 + 0 + 0 + 0 + + + + TL6 + + + + + LineEdit12 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + LineEdit21 + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit1 + + + + + + + + + + diff --git a/src/MeasureGUI/UIFiles/MeasureGUI_2Sel1LineEdit_QTD.ui b/src/MeasureGUI/UIFiles/MeasureGUI_2Sel1LineEdit_QTD.ui new file mode 100644 index 000000000..e68cca900 --- /dev/null +++ b/src/MeasureGUI/UIFiles/MeasureGUI_2Sel1LineEdit_QTD.ui @@ -0,0 +1,186 @@ + +MeasureGUI_2Sel1LineEdit_QTD + + + MeasureGUI_2Sel1LineEdit_QTD + + + + 0 + 0 + 129 + 115 + + + + MeasureGUI_2Sel1LineEdit_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + 7 + 7 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Spacer8 + + + Vertical + + + Expanding + + + + 0 + 60 + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + LineEdit3 + + + + + LineEdit2 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit1 + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + + + + + + diff --git a/src/MeasureGUI/UIFiles/MeasureGUI_Skeleton_QTD.ui b/src/MeasureGUI/UIFiles/MeasureGUI_Skeleton_QTD.ui new file mode 100644 index 000000000..d759fb401 --- /dev/null +++ b/src/MeasureGUI/UIFiles/MeasureGUI_Skeleton_QTD.ui @@ -0,0 +1,210 @@ + +MeasureGUI_Skeleton_QTD + + + MeasureGUI_Skeleton_QTD + + + + 0 + 0 + 228 + 266 + + + + + 5 + 7 + 0 + 0 + + + + MeasureGUI_Skeleton_QTD + + + true + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + GroupButtons + + + + 7 + 0 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 120 + 0 + + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 120 + 0 + + + + + + buttonClose + + + &Close + + + + + + + + + GroupConstructors + + + + 5 + 0 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + RadioButton1 + + + + + + + + + + + + GroupMedium + + + + 7 + 7 + 0 + 0 + + + + + + + + + + + + diff --git a/src/MeasureGUI/UIFiles/ui_to_cxx b/src/MeasureGUI/UIFiles/ui_to_cxx new file mode 100755 index 000000000..a0a350391 --- /dev/null +++ b/src/MeasureGUI/UIFiles/ui_to_cxx @@ -0,0 +1,19 @@ +#!/bin/sh + +#uic -o MeasureGUI_Skeleton_QTD.h MeasureGUI_Skeleton_QTD.ui +#uic -o MeasureGUI_Skeleton_QTD.cxx -impl MeasureGUI_Skeleton_QTD.h MeasureGUI_Skeleton_QTD.ui + +uic -o MeasureGUI_1Sel3LineEdit_QTD.h MeasureGUI_1Sel3LineEdit_QTD.ui +uic -o MeasureGUI_1Sel3LineEdit_QTD.cxx -impl MeasureGUI_1Sel3LineEdit_QTD.h MeasureGUI_1Sel3LineEdit_QTD.ui + +uic -o MeasureGUI_1Sel6LineEdit_QTD.h MeasureGUI_1Sel6LineEdit_QTD.ui +uic -o MeasureGUI_1Sel6LineEdit_QTD.cxx -impl MeasureGUI_1Sel6LineEdit_QTD.h MeasureGUI_1Sel6LineEdit_QTD.ui + +uic -o MeasureGUI_1Sel12LineEdit_QTD.h MeasureGUI_1Sel12LineEdit_QTD.ui +uic -o MeasureGUI_1Sel12LineEdit_QTD.cxx -impl MeasureGUI_1Sel12LineEdit_QTD.h MeasureGUI_1Sel12LineEdit_QTD.ui + +uic -o MeasureGUI_2Sel1LineEdit_QTD.h MeasureGUI_2Sel1LineEdit_QTD.ui +uic -o MeasureGUI_2Sel1LineEdit_QTD.cxx -impl MeasureGUI_2Sel1LineEdit_QTD.h MeasureGUI_2Sel1LineEdit_QTD.ui + +#uic -o MeasureGUI_1Sel1TextView_QTD.h MeasureGUI_1Sel1TextView_QTD.ui +#uic -o MeasureGUI_1Sel1TextView_QTD.cxx -impl MeasureGUI_1Sel1TextView_QTD.h MeasureGUI_1Sel1TextView_QTD.ui diff --git a/src/OperationGUI/OperationGUI.cxx b/src/OperationGUI/OperationGUI.cxx index a8b16ffbc..9e35ea407 100644 --- a/src/OperationGUI/OperationGUI.cxx +++ b/src/OperationGUI/OperationGUI.cxx @@ -53,8 +53,6 @@ OperationGUI::OperationGUI() : { myGeomBase = new GEOMBase(); myGeomGUI = GEOMContext::GetGeomGUI(); -// Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); -// myGeom = GEOM::GEOM_Gen::_narrow(comp); myGeom = myGeomGUI->myComponentGeom; } diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx index f75fd01ec..ffb19bf50 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx @@ -97,10 +97,13 @@ void OperationGUI_ArchimedeDlg::Init() QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); step = St.toDouble(); + + double SpecificStep1 = 0.1; + double SpecificStep2 = 0.01; /* min, max, step and decimals for spin boxes & initial values */ GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); - GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); - GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep1, 3); + GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, 999.999, SpecificStep2, 3); GroupPoints->SpinBox_DX->SetValue(myWeight); GroupPoints->SpinBox_DY->SetValue(myWaterDensity); diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx index 26cb4de39..f5646c54c 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.cxx +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -143,6 +143,10 @@ void OperationGUI_ChamferDlg::Init(Handle (AIS_InteractiveContext) ic) Group3->SpinBox_DY->SetValue(myD2); /* 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())); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); @@ -283,8 +287,6 @@ void OperationGUI_ChamferDlg::ClickOnOk() void OperationGUI_ChamferDlg::ClickOnApply() { myGeomGUI->GetDesktop()->putInfo(tr("")); - if (mySimulationTopoDs.IsNull()) - return; myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); @@ -459,12 +461,10 @@ void OperationGUI_ChamferDlg::SetEditCurrentArgument() //================================================================================= void OperationGUI_ChamferDlg::DeactivateActiveDialog() { - if(GroupConstructors->isEnabled()) { - GEOMBase_Skeleton::DeactivateActiveDialog(); - this->ResetStateOfDialog(); - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true); - } + this->ResetStateOfDialog(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + GEOMBase_Skeleton::DeactivateActiveDialog(); return; } diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx index 0fe04bbc7..40bc2d0d0 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.cxx +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -130,6 +130,10 @@ void OperationGUI_FilletDlg::Init(Handle(AIS_InteractiveContext) ic) Group3->SpinBox_DX->SetValue(myRadius); /* 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())); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); @@ -258,8 +262,6 @@ void OperationGUI_FilletDlg::ClickOnOk() void OperationGUI_FilletDlg::ClickOnApply() { myGeomGUI->GetDesktop()->putInfo(tr("")); - if (mySimulationTopoDs.IsNull()) - return; myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); @@ -432,13 +434,10 @@ void OperationGUI_FilletDlg::SetEditCurrentArgument() //================================================================================= void OperationGUI_FilletDlg::DeactivateActiveDialog() { - if(GroupConstructors->isEnabled()) { - GEOMBase_Skeleton::DeactivateActiveDialog(); this->ResetStateOfDialog(); DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true); - } - return; + GEOMBase_Skeleton::DeactivateActiveDialog(); } diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx index e0370df1e..396b18d81 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.cxx +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -29,18 +29,6 @@ using namespace std; #include "OperationGUI_PartitionDlg.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MIN_EDIT_SIZE 150 - //================================================================================= // class : OperationGUI_PartitionDlg() // purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the @@ -48,158 +36,38 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( QWidget* parent, const char* name, OperationGUI* theOperationGUI, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +OperationGUI_PartitionDlg::OperationGUI_PartitionDlg(QWidget* parent, const char* name, OperationGUI* theOperationGUI, 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_PARTITION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); -// QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "OperationGUI",tr("ICON_DLG_PARTITION_KEEP_FACES"))); - - if ( !name ) - setName( "OperationGUI_PartitionDlg" ); - setCaption( tr( "GEOM_PARTITION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - QGridLayout* OperationGUI_PartitionDlgLayout = new QGridLayout( this ); - OperationGUI_PartitionDlgLayout->setSpacing( 6 ); - OperationGUI_PartitionDlgLayout->setMargin( 11 ); - - /***************************************************************/ - /* Constructor group */ - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_PARTITION" ) ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - QGridLayout* GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - GroupConstructorsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 0 ); - - OperationGUI_PartitionDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - /* Arguments group */ - /***************************************************************/ - /* Shapes and Tools */ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_PARTITION" ) ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setMinimumSize(MIN_EDIT_SIZE, 0); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_TOOL_OBJECT" ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setPixmap( image1 ); - SelectButtonC1A2->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - LineEditC1A2->setMinimumSize(MIN_EDIT_SIZE, 0); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - - /* Limit */ - TextLabelComboBox1 = new QLabel( GroupC1, "TextLabelComboBox1" ); - TextLabelComboBox1->setText( tr( "RECONSTRUCTION_LIMIT") ); - GroupC1Layout->addWidget( TextLabelComboBox1, 2, 0 ); - ComboBox1 = new QComboBox( FALSE, GroupC1, "ComboBox1" ); - ComboBox1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); - ComboBox1->setMinimumSize(MIN_EDIT_SIZE, 0); - GroupC1Layout->addWidget( ComboBox1, 2, 2 ); - - OperationGUI_PartitionDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - /* Result suppresion */ - /***************************************************************/ - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "SUPPRESS_RESULT") ); - GroupC2->setColumnLayout(0, Qt::Vertical ); - GroupC2->layout()->setSpacing( 0 ); - GroupC2->layout()->setMargin( 0 ); - QGridLayout* GroupC2Layout = new QGridLayout( GroupC2->layout() ); - GroupC2Layout->setAlignment( Qt::AlignTop ); - GroupC2Layout->setSpacing( 6 ); - GroupC2Layout->setMargin( 11 ); - - TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" ); - TextLabelC2A1->setText( tr( "SUPPRESS_RESULT_INSIDE") ); - GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 ); - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setPixmap( image1 ); - GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 ); - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - GroupC2Layout->addWidget( LineEditC2A1, 0, 2 ); - - TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" ); - TextLabelC2A2->setText( tr( "SUPPRESS_RESULT_OUTSIDE") ); - GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 ); - SelectButtonC2A2 = new QPushButton( GroupC2, "SelectButtonC2A2" ); - SelectButtonC2A2->setPixmap( image1 ); - GroupC2Layout->addWidget( SelectButtonC2A2, 1, 1 ); - LineEditC2A2 = new QLineEdit( GroupC2, "LineEditC2A2" ); - GroupC2Layout->addWidget( LineEditC2A2, 1, 2 ); - - OperationGUI_PartitionDlgLayout->addWidget( GroupC2, 2, 0 ); - - /***************************************************************/ - /* , , buttons */ - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - QGridLayout* 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 ); - - GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 ); - - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - - OperationGUI_PartitionDlgLayout->addWidget( GroupButtons, 3, 0 ); - - /***************************************************************/ - myOperationGUI = theOperationGUI; - Init(Sel) ; /* Initialisations */ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PARTITION"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_PARTITION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_PARTITION")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_4Sel1List_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_PARTITION")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->TextLabel2->setText(tr("GEOM_TOOL_OBJECT")); + GroupPoints->TextLabel3->setText(tr("GEOM_RECONSTRUCTION_LIMIT")); + GroupPoints->TextLabel4->setText(tr("GEOM_SUPPRESS_RESULT_INSIDE")); + GroupPoints->TextLabel5->setText(tr("GEOM_SUPPRESS_RESULT_OUTSIDE")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + GroupPoints->PushButton3->setPixmap(image1); + GroupPoints->PushButton4->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myOperationGUI = theOperationGUI; + Init(); } @@ -209,190 +77,168 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( QWidget* parent, const cha //================================================================================= OperationGUI_PartitionDlg::~OperationGUI_PartitionDlg() { - // 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 OperationGUI_PartitionDlg::Init( SALOME_Selection* Sel ) +void OperationGUI_PartitionDlg::Init() { - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomBase = new GEOMBase() ; - myGeomGUI = GEOMContext::GetGeomGUI() ; - myOkListShapes = myOkListTools = myOkKeepShape = myOkRemoveShape = false ; + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; + myOkListShapes = myOkListTools = myOkKeepShape = myOkRemoveShape = false; /* type for sub shape selection */ -// ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_SHAPE" ) ); - ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_SOLID" ) ); - ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_SHELL" ) ); - ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_FACE" ) ); - ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_WIRE" ) ); - ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_EDGE" ) ); - ComboBox1->insertItem( tr( "RECONSTRUCTION_LIMIT_VERTEX" ) ); + GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_SOLID")); + GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_SHELL")); + GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_FACE")); + GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_WIRE")); + GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_EDGE")); + GroupPoints->ComboBox1->insertItem(tr("GEOM_RECONSTRUCTION_LIMIT_VERTEX")); /* Current item is 'Shape' */ - ComboBox1->setCurrentItem(0); - myLimit = ComboBox1->currentItem(); - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + GroupPoints->ComboBox1->setCurrentItem(0); + myLimit = GroupPoints->ComboBox1->currentItem(); /* 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( ComboBox1, SIGNAL( activated(int) ), this, SLOT( ComboTextChanged() ) ); - - connect( SelectButtonC1A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC1A2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SelectButtonC2A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - 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 */ - - ComboTextChanged(); - return ; + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit4, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; } + //================================================================================= // function : ClickOnOk() // purpose : //================================================================================= void OperationGUI_PartitionDlg::ClickOnOk() { - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; + this->ClickOnApply(); + ClickOnCancel(); + return; } + //================================================================================= // function : ClickOnApply() // purpose : //================================================================================= void OperationGUI_PartitionDlg::ClickOnApply() { - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - if (myOkListShapes || myOkListTools || myOkKeepShape || myOkRemoveShape) - { - GEOM::shape_type limit; - switch (myLimit) { -// case 0: limit = GEOM::SOLID ; break; - case 0: limit = GEOM::SHAPE ; break; - case 1: limit = GEOM::SHELL ; break; - case 2: limit = GEOM::FACE ; break; - case 3: limit = GEOM::WIRE ; break; - case 4: limit = GEOM::EDGE ; break; - case 5: limit = GEOM::VERTEX; break; - default:limit = GEOM::SHAPE; - } - myOperationGUI->MakePartitionAndDisplay (myListShapes, - myListTools, - myListKeepInside, - myListRemoveInside, - limit); + myGeomGUI->GetDesktop()->putInfo(tr("")); + if(myOkListShapes || myOkListTools || myOkKeepShape || myOkRemoveShape) { + GEOM::shape_type limit; + switch(myLimit) + { + case 0 : + { + limit = GEOM::SHAPE; + break; + } + case 1 : + { + limit = GEOM::SHELL; + break; + } + case 2 : + { + limit = GEOM::FACE; + break; + } + case 3 : + { + limit = GEOM::WIRE; + break; + } + case 4 : + { + limit = GEOM::EDGE; + break; + } + case 5 : + { + limit = GEOM::VERTEX; + break; + } + default : + limit = GEOM::SHAPE; + } + + myOperationGUI->MakePartitionAndDisplay(myListShapes, myListTools, myListKeepInside, myListRemoveInside, limit); } - // accept(); - return ; + return; } -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void OperationGUI_PartitionDlg::ClickOnCancel() -{ - myGeomBase->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : -//================================================================================= -// void OperationGUI_PartitionDlg::ConstructorsClicked(int constructorId) -// { -// } - - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection as changed or other case //================================================================================= void OperationGUI_PartitionDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText("") ; + myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; - - if ( nbSel < 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myOkListShapes = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myOkListTools = false ; - } - else if ( myEditCurrentArgument == LineEditC2A1 ) { - myOkListTools = false ; - } - else if ( myEditCurrentArgument == LineEditC2A2 ) { - myOkListTools = false ; - } - return ; + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel < 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkListShapes = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkListTools = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit3) + myOkKeepShape = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit4) + myOkRemoveShape = false; + return; } - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; - myEditCurrentArgument->setText(aString) ; - myOkListShapes = true ; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes); + myEditCurrentArgument->setText(aString); + myOkListShapes = true; } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListTools) ; - myEditCurrentArgument->setText(aString) ; - myOkListTools = true ; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListTools); + myEditCurrentArgument->setText(aString); + myOkListTools = true; } - else if ( myEditCurrentArgument == LineEditC2A1 ) { - myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListRemoveInside) ; - myEditCurrentArgument->setText(aString) ; - myOkKeepShape = true ; + else if(myEditCurrentArgument == GroupPoints->LineEdit3) { + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListRemoveInside); + myEditCurrentArgument->setText(aString); + myOkKeepShape = true; } - else if ( myEditCurrentArgument == LineEditC2A2 ) { - myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListKeepInside) ; - myEditCurrentArgument->setText(aString) ; - myOkRemoveShape = true ; + else if(myEditCurrentArgument == GroupPoints->LineEdit4) { + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListKeepInside); + myEditCurrentArgument->setText(aString); + myOkRemoveShape = true; } + /* no simulation */ - return ; + return; } @@ -403,72 +249,49 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument() void OperationGUI_PartitionDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - - if (send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1 ; + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2 ; + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; } - else if(send == SelectButtonC2A1) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1 ; + else if(send == GroupPoints->PushButton3) { + GroupPoints->LineEdit3->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit3; } - else if(send == SelectButtonC2A2) { - LineEditC2A2->setFocus() ; - myEditCurrentArgument = LineEditC2A2 ; + else if(send == GroupPoints->PushButton4) { + GroupPoints->LineEdit4->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit4; } - SelectionIntoArgument() ; - - return ; + this->SelectionIntoArgument(); + + return; } + //================================================================================= // function : LineEditReturnPressed() // purpose : //================================================================================= void OperationGUI_PartitionDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - else if ( send == LineEditC2A1 ) - myEditCurrentArgument = LineEditC2A1 ; - else if ( send == LineEditC2A2 ) - myEditCurrentArgument = LineEditC2A2 ; +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else if (send == GroupPoints->LineEdit3) + myEditCurrentArgument = GroupPoints->LineEdit3; + else if (send == GroupPoints->LineEdit4) + myEditCurrentArgument = GroupPoints->LineEdit4; 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 ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= + return; -void OperationGUI_PartitionDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; + GEOMBase_Skeleton::LineEditReturnPressed(); + return; } @@ -478,13 +301,9 @@ void OperationGUI_PartitionDlg::DeactivateActiveDialog() //================================================================================= void OperationGUI_PartitionDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupC2->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - return ; + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; } @@ -494,24 +313,13 @@ void OperationGUI_PartitionDlg::ActivateThisDialog() //================================================================================= void OperationGUI_PartitionDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void OperationGUI_PartitionDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - //======================================================================= //function : ComboTextChanged //purpose : @@ -519,9 +327,14 @@ void OperationGUI_PartitionDlg::closeEvent( QCloseEvent* e ) void OperationGUI_PartitionDlg::ComboTextChanged() { - - myLimit = ComboBox1->currentItem(); - GroupC2->setEnabled( ComboBox1->currentItem() < 3 ); - - return ; + myLimit = GroupPoints->ComboBox1->currentItem(); + + bool IsEnabled = GroupPoints->ComboBox1->currentItem() < 3; + GroupPoints->LineEdit3->setEnabled(IsEnabled); + GroupPoints->LineEdit4->setEnabled(IsEnabled); + GroupPoints->TextLabel4->setEnabled(IsEnabled); + GroupPoints->TextLabel5->setEnabled(IsEnabled); + GroupPoints->PushButton3->setEnabled(IsEnabled); + GroupPoints->PushButton4->setEnabled(IsEnabled); + return; } diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.h b/src/OperationGUI/OperationGUI_PartitionDlg.h index cbef3fa4a..20673e83e 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.h +++ b/src/OperationGUI/OperationGUI_PartitionDlg.h @@ -29,98 +29,51 @@ #ifndef DIALOGBOX_PARTITION_H #define DIALOGBOX_PARTITION_H -#include "OperationGUI.h" - -#include - -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QComboBox; +#include "GEOMBase_Skeleton.h" +#include "DlgRef_4Sel1List_QTD.h" +#include "OperationGUI.h" //================================================================================= // class : OperationGUI_PartitionDlg // purpose : //================================================================================= -class OperationGUI_PartitionDlg : public QDialog +class OperationGUI_PartitionDlg : public GEOMBase_Skeleton { Q_OBJECT public: - OperationGUI_PartitionDlg( QWidget* parent = 0, const char* name = 0, OperationGUI* theOperationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + OperationGUI_PartitionDlg(QWidget* parent = 0, const char* name = 0, OperationGUI* theOperationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~OperationGUI_PartitionDlg(); private: - OperationGUI* myOperationGUI; - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* Mouse enter the QWidget */ - - 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 Init(); + void enterEvent(QEvent* e); - GEOM::GEOM_Gen::ListOfIOR myListShapes ; - GEOM::GEOM_Gen::ListOfIOR myListTools ; - GEOM::GEOM_Gen::ListOfIOR myListRemoveInside ; - GEOM::GEOM_Gen::ListOfIOR myListKeepInside ; - - bool myOkListShapes ; /* to check when argument is defined */ - bool myOkListTools ; /* to check when argument is defined */ - bool myOkKeepShape ; /* to check when argument is defined */ - bool myOkRemoveShape ; /* to check when argument is defined */ - int myLimit; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - /* common buttons */ - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - - /* constructor radiobuttons */ - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; + OperationGUI* myOperationGUI; - /* Arguments group */ - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A2; - QLabel* TextLabelC1A2; - QPushButton* SelectButtonC1A2; + GEOM::GEOM_Gen::ListOfIOR myListShapes; + GEOM::GEOM_Gen::ListOfIOR myListTools; + GEOM::GEOM_Gen::ListOfIOR myListRemoveInside; + GEOM::GEOM_Gen::ListOfIOR myListKeepInside; - /* limit */ - QComboBox* ComboBox1; - QLabel* TextLabelComboBox1; + bool myOkListShapes; /* to check when argument is defined */ + bool myOkListTools; /* to check when argument is defined */ + bool myOkKeepShape; /* to check when argument is defined */ + bool myOkRemoveShape; /* to check when argument is defined */ + int myLimit; - /* Keep Inside and Remove Inside feilds */ - QGroupBox* GroupC2; - QLineEdit* LineEditC2A1; - QLabel* TextLabelC2A1; - QPushButton* SelectButtonC2A1; - QLineEdit* LineEditC2A2; - QLabel* TextLabelC2A2; - QPushButton* SelectButtonC2A2; + DlgRef_4Sel1List_QTD* GroupPoints; private slots: - - //void ConstructorsClicked(int constructorId); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ComboTextChanged() ; + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ComboTextChanged(); + }; #endif // DIALOGBOX_PARTITION_H diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index 8854279be..f7eb0458a 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -159,6 +159,7 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId) myConstructorId = constructorId; mySelection->ClearFilters(); myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); disconnect(mySelection, 0, this, 0); myOkPoint1 = myOkPoint2 = false; @@ -344,6 +345,8 @@ void PrimitiveGUI_BoxDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(myConstructorId == 0) + mySelection->AddFilter(myVertexFilter); if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index a0b35c5de..b7af6b4e3 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -360,6 +360,11 @@ void PrimitiveGUI_ConeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(myConstructorId == 0) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + mySelection->AddFilter(myVertexFilter); + } if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index 9629891e6..4e6b300ed 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -347,6 +347,11 @@ void PrimitiveGUI_CylinderDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(myConstructorId == 0) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + mySelection->AddFilter(myVertexFilter); + } if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx index 185b36598..fcdad43fc 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -96,7 +96,7 @@ void PrimitiveGUI_SphereDlg::Init() myPoint1.SetCoord(0.0, 0.0, 0.0); myRadius = 100.0; - myOkPoint1 = myOkRadius = false; + myOkPoint1 = false; /* Vertices Filter for all arguments */ myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); @@ -148,7 +148,6 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId) myGeomBase->EraseSimulationShape(); disconnect(mySelection, 0, this, 0); myRadius = 100.0; - myOkRadius = true; switch (constructorId) { @@ -212,7 +211,7 @@ void PrimitiveGUI_SphereDlg::ClickOnApply() myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); - if(myOkPoint1 && myOkRadius) + if(myOkPoint1) myPrimitiveGUI->MakeSphereAndDisplay(myPoint1, myRadius); return; } @@ -248,7 +247,7 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument() myOkPoint1 = true; } - if(myOkPoint1 && myOkRadius) { + if(myOkPoint1) { mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } @@ -302,6 +301,8 @@ void PrimitiveGUI_SphereDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(myConstructorId == 0) + mySelection->AddFilter(myVertexFilter); if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; @@ -330,9 +331,8 @@ void PrimitiveGUI_SphereDlg::ValueChangedInSpinBox(double newValue) myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); myRadius = newValue; - myOkRadius = true; - if(myOkPoint1 && myOkRadius) { + if(myOkPoint1) { mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h index 37ca2c969..c09fe193c 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h @@ -62,7 +62,6 @@ private : gp_Pnt myPoint1; /* Points containing the vector */ Standard_Real myRadius; - bool myOkRadius; /* Are true when myPoint is defined */ bool myOkPoint1; DlgRef_1Sel1Spin* GroupPoints; diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index ff6e50e3c..9a5d1bce2 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -338,6 +338,11 @@ void PrimitiveGUI_TorusDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(myConstructorId == 1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + mySelection->AddFilter(myVertexFilter); + } if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx b/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx index 6a98dfcaf..de49f47a7 100644 --- a/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx +++ b/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx @@ -418,7 +418,7 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply() if( !CheckBox3->isChecked() ) { /* Call method to get sub shape selection of GEOM::WIRE */ - bool aTest = myGeomBase->GetIndexSubShapeSelected(myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; + bool aTest = this->GetIndexSubShapeSelected(myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ;/* Display all objects so that next method using ic can memorize them */ @@ -436,7 +436,7 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply() else { /* CheckBox3->isChecked() */ /* Call method to get sub shape selection of END GEOM::FACE */ - bool aTest = myGeomBase->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdEndFace, myLocalContextId, myUseLocalContext) ; + bool aTest = this->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdEndFace, myLocalContextId, myUseLocalContext) ; DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ @@ -459,7 +459,7 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply() if( CheckBoxC2_1->isChecked() ) { /* Call method to get sub shape selection of one or more GEOM::WIRE(s) on a face or a shell */ - bool aTest = myGeomBase->GetIndexSubShapeSelected(myShape, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; + bool aTest = this->GetIndexSubShapeSelected(myShape, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ @@ -770,7 +770,7 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWireSelection() if( CheckBox1->isChecked() ) { /* Get sub shape selection GEOM::FACE : local context is closed */ - bool aTest = myGeomBase->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdFace, myLocalContextId, myUseLocalContext) ; + bool aTest = this->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdFace, myLocalContextId, myUseLocalContext) ; DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ @@ -832,7 +832,7 @@ void RepairGUI_SuppressHoleDlg::ActivateUserEndFaceSelection() if( CheckBox2->isChecked() ) { /* Call method to get sub shape selection for the GEOM::WIRE into myFace : local context is closed */ - bool aTest = myGeomBase->GetIndexSubShapeSelected(this->myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; + bool aTest = this->GetIndexSubShapeSelected(this->myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ @@ -979,3 +979,57 @@ void RepairGUI_SuppressHoleDlg::ResetPartial() return ; } + + +//===================================================================================== +// function : GetIndexSubShapeSelected() +// purpose : Define a ListOfID of sub shapes selected in ShapeTopo with SubShapeType +// : Method used by Dialogs +//===================================================================================== +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) + return false; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + ic->InitSelected(); + int nbSelected = ic->NbSelected(); + ListOfID.length(nbSelected); + + //***************** DEFINE INDEX OF EACH SELECTION *********************// + int i = 0; + ic->InitSelected(); /* to restart */ + while(ic->MoreSelected()) { + /* Find index of sub shape into main shape */ + TopExp_Explorer Exp (ShapeTopo, TopAbs_ShapeEnum(SubShapeType)); + int index = 1; + bool found = false; + while( Exp.More()) { + if((Exp.Current()).IsSame(ic->SelectedShape())) { + found = true; + break; + } + index++; + Exp.Next(); + } + if(!found) { + /* Manage local context from DialogBox */ + ic->CloseLocalContext(aLocalContextId); + myUseLocalContext = false; + return false; + } + ListOfID[i] = index; + i++; + ic->NextSelected(); + } + //***************** END *********************// + + /* Manage local context from DialogBox */ + ic->CloseLocalContext(aLocalContextId); + myUseLocalContext = false; + + return true; +} diff --git a/src/RepairGUI/RepairGUI_SuppressHoleDlg.h b/src/RepairGUI/RepairGUI_SuppressHoleDlg.h index 85738c985..a348369e8 100644 --- a/src/RepairGUI/RepairGUI_SuppressHoleDlg.h +++ b/src/RepairGUI/RepairGUI_SuppressHoleDlg.h @@ -75,6 +75,11 @@ private : void ResetStateOfDialog() ; void ResetPartial() ; + + /* Define a list of indices of sub shapes selected in a local context */ + bool GetIndexSubShapeSelected(const TopoDS_Shape& ShapeTopo, const int SubShapeType, + GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID, + Standard_Integer& aLocalContextId, bool& myUseLocalContext); /* Return the face selected by user from the main shape and index in a ListOfSub */ TopoDS_Shape FaceFromList( const TopoDS_Shape& aShape, diff --git a/src/TransformationGUI/Makefile.in b/src/TransformationGUI/Makefile.in index 41c729512..6901aa85a 100644 --- a/src/TransformationGUI/Makefile.in +++ b/src/TransformationGUI/Makefile.in @@ -41,21 +41,21 @@ EXPORT_HEADERS= LIB = libTransformationGUI.la LIB_SRC = TransformationGUI.cxx \ + TransformationGUI_MultiTranslationDlg.cxx \ + TransformationGUI_MultiRotationDlg.cxx \ TransformationGUI_TranslationDlg.cxx \ TransformationGUI_RotationDlg.cxx \ TransformationGUI_MirrorDlg.cxx \ - TransformationGUI_ScaleDlg.cxx \ - TransformationGUI_MultiTranslationDlg.cxx \ - TransformationGUI_MultiRotationDlg.cxx + TransformationGUI_ScaleDlg.cxx LIB_MOC = \ TransformationGUI.h \ + TransformationGUI_MultiTranslationDlg.h \ + TransformationGUI_MultiRotationDlg.h \ TransformationGUI_TranslationDlg.h \ TransformationGUI_RotationDlg.h \ TransformationGUI_MirrorDlg.h \ - TransformationGUI_ScaleDlg.h \ - TransformationGUI_MultiTranslationDlg.h \ - TransformationGUI_MultiRotationDlg.h + TransformationGUI_ScaleDlg.h LIB_CLIENT_IDL = SALOME_Exception.idl \ GEOM_Gen.idl \ @@ -72,6 +72,6 @@ LIB_SERVER_IDL = 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 += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase -lDisplayGUI -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@ diff --git a/src/TransformationGUI/TransformationGUI.cxx b/src/TransformationGUI/TransformationGUI.cxx index c8e99cc14..4efdc5ea2 100644 --- a/src/TransformationGUI/TransformationGUI.cxx +++ b/src/TransformationGUI/TransformationGUI.cxx @@ -31,12 +31,12 @@ using namespace std; #include "SALOMEGUI_QtCatchCorbaException.hxx" +#include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION +#include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION #include "TransformationGUI_TranslationDlg.h" // Method TRANSLATION #include "TransformationGUI_RotationDlg.h" // Method ROTATION #include "TransformationGUI_MirrorDlg.h" // Method MIRROR #include "TransformationGUI_ScaleDlg.h" // Method SCALE -#include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION -#include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION //======================================================================= // function : TransformationGUI() @@ -47,8 +47,6 @@ TransformationGUI::TransformationGUI() : { myGeomBase = new GEOMBase(); myGeomGUI = GEOMContext::GetGeomGUI(); -// Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); -// myGeom = GEOM::GEOM_Gen::_narrow(comp); myGeom = myGeomGUI->myComponentGeom; } @@ -142,7 +140,7 @@ void TransformationGUI::MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, gp // purpose : //======================================================================================= void TransformationGUI::MakeRotationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc, - const gp_Dir dir, const Standard_Real angle) + const gp_Dir dir, const Standard_Real angle) { try { const GEOM::AxisStruct axis = myGeom->MakeAxisStruct(loc.X(), loc.Y(), loc.Z(), @@ -191,7 +189,7 @@ void TransformationGUI::MakeMirrorAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM:: // purpose : //===================================================================================== void TransformationGUI::MakeScaleAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt centralPoint, - const Standard_Real factor) + const Standard_Real factor) { try { GEOM::PointStruct P = myGeom->MakePointStruct(centralPoint.X(), centralPoint.Y(), centralPoint.Z()); @@ -214,7 +212,7 @@ void TransformationGUI::MakeScaleAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp // purpose : Multi-Translate a shape //================================================================================= void TransformationGUI::MakeMultiTranslation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, - const double Step, const short NbTimes) + const double Step, const short NbTimes) { try { GEOM::PointStruct d = myGeom->MakePointStruct(Dir.X(), Dir.Y(), Dir.Z()); @@ -241,8 +239,8 @@ void TransformationGUI::MakeMultiTranslation1DAndDisplay(GEOM::GEOM_Shape_ptr Sh // purpose : Multi-Translate a shape //================================================================================= void TransformationGUI::MakeMultiTranslation2DAndDisplay(GEOM::GEOM_Shape_ptr Shape, - const gp_Dir Dir1,const double Step1, const short NbTimes1, - const gp_Dir Dir2, const double Step2, const short NbTimes2) + const gp_Dir Dir1,const double Step1, const short NbTimes1, + const gp_Dir Dir2, const double Step2, const short NbTimes2) { try { GEOM::PointStruct d1 = myGeom->MakePointStruct(Dir1.X(), Dir1.Y(), Dir1.Z()); @@ -272,7 +270,7 @@ void TransformationGUI::MakeMultiTranslation2DAndDisplay(GEOM::GEOM_Shape_ptr Sh // purpose : Multi-Rotate a shape //================================================================================= void TransformationGUI::MakeMultiRotation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, - const gp_Pnt Loc, const short NbTimes) + const gp_Pnt Loc, const short NbTimes) { try { GEOM::PointStruct d = myGeom->MakePointStruct(Dir.X(), Dir.Y(), Dir.Z()); @@ -300,7 +298,7 @@ void TransformationGUI::MakeMultiRotation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape // purpose : Multi-Rotate a shape //================================================================================= void TransformationGUI::MakeMultiRotation2DAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, - const gp_Pnt Loc, const double Ang, const short NbTimes1, + const gp_Pnt Loc, const double Ang, const short NbTimes1, const double Step, const short NbTimes2) { try { diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx index 46c0bc7c8..e6aacd1d9 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -257,6 +257,8 @@ void TransformationGUI_MirrorDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index 9b1b32d2f..3e3ff8686 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -29,10 +29,9 @@ using namespace std; #include "TransformationGUI_MultiRotationDlg.h" -#include "DisplayGUI.h" #include "QAD_Config.h" -#include +#include #include #include #include @@ -43,23 +42,6 @@ using namespace std; #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - //================================================================================= // class : TransformationGUI_MultiRotationDlg() // purpose : Constructs a TransformationGUI_MultiRotationDlg which is a child of 'parent', with the @@ -67,249 +49,51 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg( QWidget* parent, const char* name, TransformationGUI* theTransformationGUI, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg(QWidget* parent, const char* name, TransformationGUI* theTransformationGUI, 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_MULTIROTATION_SIMPLE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MULTIROTATION_DOUBLE"))); - - if ( !name ) - setName( "TransformationGUI_MultiTranlationDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_MULTIROTATION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - TransformationGUI_MultiRotationDlgLayout = new QGridLayout( this ); - TransformationGUI_MultiRotationDlgLayout->setSpacing( 6 ); - TransformationGUI_MultiRotationDlgLayout->setMargin( 11 ); - - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_MULTIROTATION" ) ); - 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 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 3 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); - - TransformationGUI_MultiRotationDlgLayout->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 ); - TransformationGUI_MultiRotationDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_MULTIROTATION_SIMPLE" ) ); - 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 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_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" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_NB_TIMES" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A3->setFrameShape( QLabel::NoFrame ); - TextLabelC1A3->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - - /* a QSpinBox */ - SpinBox_C1A3 = new QSpinBox( GroupC1, "SpinBox_C1A3" ) ; - SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - SelectButtonC1A2->setToggleButton( FALSE ); - SelectButtonC1A2->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - - TransformationGUI_MultiRotationDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "GEOM_MULTIROTATION_DOUBLE" ) ); - GroupC2->setMinimumSize( QSize( 0, 0 ) ); - GroupC2->setFrameShape( QGroupBox::Box ); - GroupC2->setFrameShadow( QGroupBox::Sunken ); - GroupC2->setColumnLayout(0, Qt::Vertical ); - GroupC2->layout()->setSpacing( 0 ); - GroupC2->layout()->setMargin( 0 ); - GroupC2Layout = new QGridLayout( GroupC2->layout() ); - GroupC2Layout->setAlignment( Qt::AlignTop ); - GroupC2Layout->setSpacing( 6 ); - GroupC2Layout->setMargin( 11 ); - - TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" ); - TextLabelC2A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A1->setFrameShape( QLabel::NoFrame ); - TextLabelC2A1->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 ); - - TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" ); - TextLabelC2A2->setText( tr( "GEOM_VECTOR" ) ); - TextLabelC2A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A2->setFrameShape( QLabel::NoFrame ); - TextLabelC2A2->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 ); - - TextLabelC2A3 = new QLabel( GroupC2, "TextLabelC2A3" ); - TextLabelC2A3->setText( tr( "GEOM_ANGLE" ) ); - TextLabelC2A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A3->setFrameShape( QLabel::NoFrame ); - TextLabelC2A3->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A3, 2, 0 ); - - TextLabelC2A4 = new QLabel( GroupC2, "TextLabelC2A4" ); - TextLabelC2A4->setText( tr( "GEOM_NB_TIMES" ) ); - TextLabelC2A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A4->setFrameShape( QLabel::NoFrame ); - TextLabelC2A4->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A4, 3, 0 ); - - TextLabelC2A5 = new QLabel( GroupC2, "TextLabelC2A5" ); - TextLabelC2A5->setText( tr( "GEOM_STEP" ) ); - TextLabelC2A5->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A5->setFrameShape( QLabel::NoFrame ); - TextLabelC2A5->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A5, 5, 0 ); - - TextLabelC2A6 = new QLabel( GroupC2, "TextLabelC2A6" ); - TextLabelC2A6->setText( tr( "GEOM_NB_TIMES" ) ); - TextLabelC2A6->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A6->setFrameShape( QLabel::NoFrame ); - TextLabelC2A6->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A6, 6, 0 ); - - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - GroupC2Layout->addWidget( LineEditC2A1, 0, 2 ); - - LineEditC2A2 = new QLineEdit( GroupC2, "LineEditC2A2" ); - GroupC2Layout->addWidget( LineEditC2A2, 1, 2 ); - - /* a TransformationGUI_SpinBox */ - SpinBox_C2A3 = new DlgRef_SpinBox( GroupC2, "GeomSpinBox_C2A3" ) ; - SpinBox_C2A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A3->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A3, 2, 2 ); - /* a QSpinBox */ - SpinBox_C2A4 = new QSpinBox( GroupC2, "SpinBox_C2A4" ) ; - SpinBox_C2A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A4->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A4, 3, 2 ); - - /* a TransformationGUI_SpinBox */ - SpinBox_C2A5 = new DlgRef_SpinBox( GroupC2, "GeomSpinBox_C2A5" ) ; - SpinBox_C2A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A5->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A5, 5, 2 ); - /* a QSpinBox */ - SpinBox_C2A6 = new QSpinBox( GroupC2, "SpinBox_C2A6" ) ; - SpinBox_C2A6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A6->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A6, 6, 2 ); - - CheckBoxReverse = new QCheckBox( GroupC2, "CheckBoxReverse" ); - CheckBoxReverse->setText( tr( "GEOM_REVERSE" ) ); - GroupC2Layout->addWidget( CheckBoxReverse, 4, 0 ); - - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setText( tr( "" ) ); - SelectButtonC2A1->setPixmap( image1 ); - SelectButtonC2A1->setToggleButton( FALSE ); - SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 ); - - SelectButtonC2A2 = new QPushButton( GroupC2, "SelectButtonC2A2" ); - SelectButtonC2A2->setText( tr( "" ) ); - SelectButtonC2A2->setPixmap( image1 ); - SelectButtonC2A2->setToggleButton( FALSE ); - SelectButtonC2A2->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A2, 1, 1 ); - - TransformationGUI_MultiRotationDlgLayout->addWidget( GroupC2, 1, 0 ); - - /***************************************************************/ - myTransformationGUI = theTransformationGUI; - Init(Sel) ; /* Initialisations */ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_MULTIROTATION_SIMPLE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_MULTIROTATION_DOUBLE"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_MULTIROTATION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_MULTIROTATION")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel1Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_SIMPLE")); + GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->TextLabel3->setText(tr("GEOM_NB_TIMES")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + + GroupDimensions = new DlgRef_2Sel4Spin1Check(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_DOUBLE")); + GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupDimensions->TextLabel3->setText(tr("GEOM_ANGLE")); + GroupDimensions->TextLabel4->setText(tr("GEOM_NB_TIMES")); + GroupDimensions->TextLabel5->setText(tr("GEOM_STEP")); + GroupDimensions->TextLabel6->setText(tr("GEOM_NB_TIMES")); + GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE")); + GroupDimensions->PushButton1->setPixmap(image2); + GroupDimensions->PushButton2->setPixmap(image2); + + Layout1->addWidget(GroupPoints, 1, 0); + Layout1->addWidget(GroupDimensions, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myTransformationGUI = theTransformationGUI; + Init(); } + //================================================================================= // function : ~TransformationGUI_MultiRotationDlg() // purpose : Destroys the object and frees any allocated resources @@ -319,122 +103,81 @@ TransformationGUI_MultiRotationDlg::~TransformationGUI_MultiRotationDlg() // no need to delete child widgets, Qt does it all for us } + //================================================================================= // function : Init() // purpose : //================================================================================= -void TransformationGUI_MultiRotationDlg::Init( SALOME_Selection* Sel ) +void TransformationGUI_MultiRotationDlg::Init() { + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupPoints->LineEdit1; - /* Get setting of step value from file configuration */ - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for geom spin boxes */ - SpinBox_C2A3->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* angle : constructor 2 */ - SpinBox_C2A3->SetValue( 45.0 ) ; - SpinBox_C2A5->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* step : constructor 2 */ - SpinBox_C2A5->SetValue( 50.0 ) ; - - /* min, max, step for QT spin boxes */ - SpinBox_C1A3->setMinValue( 2 ); /* myNbTimes : constructor 1 */ - SpinBox_C1A3->setMaxValue( 10000 ); - SpinBox_C1A3->setWrapping( TRUE ); - SpinBox_C1A3->setValue(2) ; - - SpinBox_C2A4->setMinValue( 2 ); /* myNbTimes1 : constructor 2 */ - SpinBox_C2A4->setMaxValue( 10000 ); - SpinBox_C2A4->setWrapping( TRUE ); - SpinBox_C2A4->setValue(2) ; - - SpinBox_C2A6->setMinValue( 2 ); /* myNbTimes2 : constructor 2 */ - SpinBox_C2A6->setMaxValue( 10000 ); - SpinBox_C2A6->setWrapping( TRUE ); - SpinBox_C2A6->setValue(2) ; - - myAng = 45.0 ; - myStep = 50.0 ; + myAng = 45.0; + myStep = 50.0; myNbTimes1 = 2; myNbTimes2 = 2; + myOkBase = myOkDir = false; - GroupC1->show(); - GroupC2->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomBase = new GEOMBase() ; - myGeomGUI = GEOMContext::GetGeomGUI() ; + myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom); - myOkBase = myOkDir = false ; - mySimulationTopoDs.Nullify() ; - myBase.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); - // TODO : set previous selection into argument ? + double SpecificStep1 = 5; + double SpecificStep2 = 1; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(1.0, 999.999, SpecificStep2, 3); + GroupPoints->SpinBox_DX->SetValue(myNbTimes1); - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom ); + GroupDimensions->SpinBox_DX1->RangeStepAndValidator(-999.999, 999.999, SpecificStep1, 3); + GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, 999.999, SpecificStep2, 3); + GroupDimensions->SpinBox_DX2->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, 999.999, SpecificStep2, 3); + GroupDimensions->SpinBox_DX1->SetValue(myAng); + GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); + GroupDimensions->SpinBox_DX2->SetValue(myStep); + GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); /* 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( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - /* TransformationGUI_SpinBox */ - connect( SpinBox_C2A3, SIGNAL ( valueChanged( double) ), this, SLOT( valueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A5, SIGNAL ( valueChanged( double) ), this, SLOT( valueChangedInSpinBox( double) ) ) ; + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); + + connect(GroupDimensions->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseAngle(int))); - /* QSpinBox */ - connect( SpinBox_C1A3, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ; /* Not const ! */ - connect( SpinBox_C2A4, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ; - connect( SpinBox_C2A6, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ; - - connect( CheckBoxReverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle(int) ) ) ; - - 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(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); -//================================================================================= -// function : ReverseAngle() -// purpose : 'state' not used here -//================================================================================= -void TransformationGUI_MultiRotationDlg::ReverseAngle(int state) -{ - myAng = -myAng ; - SpinBox_C2A3->SetValue( myAng ) ; - if( myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; + /* displays Dialog */ + GroupDimensions->hide(); + GroupPoints->show(); + this->show(); + + return; } @@ -444,245 +187,141 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle(int state) //================================================================================= void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) { - myEditCurrentArgument->setText(tr("")) ; - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myAng = 45.0 ; - myStep = 50.0 ; + myConstructorId = constructorId; + mySelection->ClearFilters(); + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + disconnect(mySelection, 0, this, 0); + myAng = 45.0; + myStep = 50.0; myNbTimes1 = 2; myNbTimes2 = 2; - - myOkBase = myOkDir = false ; - myConstructorId = constructorId ; + myOkBase = myOkDir = false; switch (constructorId) { case 0: /* Rotate simple */ { - GroupC1->show(); - GroupC2->hide() ; - myEditCurrentArgument = LineEditC1A1 ; - SpinBox_C1A3->setValue( 2 ) ; - LineEditC1A1->setText(tr("")) ; - LineEditC1A2->setText(tr("")) ; + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(""); + GroupPoints->LineEdit2->setText(""); + + GroupPoints->SpinBox_DX->SetValue(myNbTimes1); + + /* filter for next selection */ + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } - case 1: /* Rotate double */ { - GroupC1->hide(); - GroupC2->show() ; - myEditCurrentArgument = LineEditC2A1 ; - SpinBox_C2A3->SetValue( 45.0 ) ; - SpinBox_C2A4->setValue( 2 ) ; - SpinBox_C2A5->SetValue( 50.0 ) ; - SpinBox_C2A6->setValue( 2 ) ; - LineEditC2A1->setText(tr("")) ; - LineEditC2A2->setText(tr("")) ; - break ; - } - } - return ; -} + GroupPoints->hide(); + resize(0, 0); + GroupDimensions->show(); -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void TransformationGUI_MultiRotationDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; + myEditCurrentArgument = GroupDimensions->LineEdit1; + GroupDimensions->LineEdit1->setText(""); + GroupDimensions->LineEdit2->setText(""); - return ; -} + GroupDimensions->SpinBox_DX1->SetValue(myAng); + GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); + GroupDimensions->SpinBox_DX2->SetValue(myStep); + GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void TransformationGUI_MultiRotationDlg::ClickOnApply() -{ - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkBase && myOkDir) { - myTransformationGUI->MakeMultiRotation1DAndDisplay( myGeomShape, myDir, myLoc, myNbTimes1 ) ; - } - break ; - } - case 1 : - { - if(myOkBase && myOkDir) { - myTransformationGUI->MakeMultiRotation2DAndDisplay( myGeomShape, myDir, myLoc, myAng, myNbTimes1, myStep, myNbTimes2 ) ; - } - break ; - } + /* filter for next selection */ + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } } - return ; + return; } //================================================================================= -// function : ClickOnCancel() +// function : ClickOnOk() // purpose : //================================================================================= -void TransformationGUI_MultiRotationDlg::ClickOnCancel() +void TransformationGUI_MultiRotationDlg::ClickOnOk() { - mySelection->ClearFilters() ; - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; + this->ClickOnApply(); + ClickOnCancel(); + return; } //================================================================================= -// function : LineEditReturnPressed() +// function : ClickOnApply() // purpose : //================================================================================= -void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() +void TransformationGUI_MultiRotationDlg::ClickOnApply() { - QLineEdit* send = (QLineEdit*)sender() ; - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - else if ( send == LineEditC2A1 ) - myEditCurrentArgument = LineEditC2A1; - else if ( send == LineEditC2A2 ) - myEditCurrentArgument = LineEditC2A2 ; - 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 ) ; + myGeomGUI->GetDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myConstructorId == 0) { + if(myOkBase && myOkDir) + myTransformationGUI->MakeMultiRotation1DAndDisplay(myGeomShape, myDir, myLoc, myNbTimes1); } - return ; + else if(myConstructorId == 1) { + if(myOkBase && myOkDir) + myTransformationGUI->MakeMultiRotation2DAndDisplay(myGeomShape, myDir, myLoc, myAng, myNbTimes1, myStep, myNbTimes2); + } + return; } - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection as changed or other case //================================================================================= void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText("") ; - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Name of future selection */ - QString aString = ""; - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; - - TopoDS_Shape S; - Standard_Boolean testResult ; - - switch (myConstructorId) - { - case 0 : - { - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myEditCurrentArgument->setText("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myEditCurrentArgument->setText("") ; - myOkDir = false ; - } - return ; - } - - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - myLoc = curv.Line().Location(); - myEditCurrentArgument->setText(aString) ; - myOkDir = true ; - } - - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC2A1 ) { - myEditCurrentArgument->setText("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC2A2 ) { - myEditCurrentArgument->setText("") ; - myOkDir = false ; - } - return ; - } + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) + myOkBase = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) + myOkDir = false; + return; + } - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC2A1 ) { - myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - else if ( myEditCurrentArgument == LineEditC2A2 ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - myLoc = curv.Line().Location(); - myEditCurrentArgument->setText(aString) ; - myOkDir = true ; - } - - if ( myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } + // nbSel == 1 + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) { + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myEditCurrentArgument->setText(aString); + myBase = S; + myOkBase = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) { + BRepAdaptor_Curve curv(TopoDS::Edge(S)); + myDir = curv.Line().Direction(); + myLoc = curv.Line().Location(); + myEditCurrentArgument->setText(aString); + myOkDir = true; + } - return ; + if(myOkBase && myOkDir) + this->MakeMultiRotationSimulationAndDisplay(); + return; } @@ -693,199 +332,132 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0 : - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->ClearFilters() ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - case 1 : - { - if(send == SelectButtonC2A1) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1; - mySelection->ClearFilters() ; - } - else if(send == SelectButtonC2A2) { - LineEditC2A2->setFocus() ; - myEditCurrentArgument = LineEditC2A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} + mySelection->ClearFilters(); -//================================================================================= -// function : ValueChangedInt() -// purpose : -//================================================================================= -void TransformationGUI_MultiRotationDlg::ValueChangedInt( int newIntValue ) -{ - QSpinBox* send = (QSpinBox*)sender(); - - if( send == SpinBox_C1A3 ) { - myNbTimes1 = newIntValue ; + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + mySelection->AddFilter(myEdgeFilter); } - else if(send == SpinBox_C2A4 ) { - myNbTimes1 = newIntValue ; + else if(send == GroupDimensions->PushButton1) { + GroupDimensions->LineEdit1->setFocus(); + myEditCurrentArgument = GroupDimensions->LineEdit1; } - else if(send == SpinBox_C2A6 ) { - myNbTimes2 = newIntValue ; + else if(send == GroupDimensions->PushButton2) { + GroupDimensions->LineEdit2->setFocus(); + myEditCurrentArgument = GroupDimensions->LineEdit2; + mySelection->AddFilter(myEdgeFilter); } + this->SelectionIntoArgument(); - switch (myConstructorId) - { - case 0 : - { - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - return ; + return; } //================================================================================= -// function : ValueChangedInSpinBox() -// purpose : (specifig for TransformationGUI_SpinBox) +// function : LineEditReturnPressed() +// purpose : //================================================================================= -void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox( double newValue ) -{ - DlgRef_SpinBox* send = (DlgRef_SpinBox*)sender(); - - if( send == SpinBox_C2A3 ) { - myAng = newValue ; - } - else if( send == SpinBox_C2A5 ) { - myStep = newValue ; - } - - switch (myConstructorId) - { - case 0 : - { - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - return ; +void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else if (send == GroupDimensions->LineEdit1) + myEditCurrentArgument = GroupDimensions->LineEdit1; + else if (send == GroupDimensions->LineEdit2) + myEditCurrentArgument = GroupDimensions->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; } //================================================================================= -// function : DeactivateActiveDialog() +// function : ActivateThisDialog() // purpose : //================================================================================= -void TransformationGUI_MultiRotationDlg::DeactivateActiveDialog() +void TransformationGUI_MultiRotationDlg::ActivateThisDialog() { - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomBase->EraseSimulationShape() ; - mySelection->ClearFilters() ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true) ; + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + if(myConstructorId == 0) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + else if(myConstructorId == 1) { + GroupDimensions->LineEdit1->setFocus(); + myEditCurrentArgument = GroupDimensions->LineEdit1; } - return ; + + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; } //================================================================================= -// function : ActivateThisDialog() +// function : enterEvent() // purpose : //================================================================================= -void TransformationGUI_MultiRotationDlg::ActivateThisDialog() +void TransformationGUI_MultiRotationDlg::enterEvent(QEvent* e) { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupC2->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - if( !mySimulationTopoDs.IsNull() ) - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } - //================================================================================= -// function : enterEvent() +// function : ValueChangedInSpinBox() // purpose : //================================================================================= -void TransformationGUI_MultiRotationDlg::enterEvent(QEvent* e) +void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox(double newValue) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + QObject* send = (QObject*)sender(); + + if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1) + myNbTimes1 = newValue; + else if(send == GroupDimensions->SpinBox_DX1) + myAng = newValue; + else if(send == GroupDimensions->SpinBox_DX2) + myStep = newValue; + else if(send == GroupDimensions->SpinBox_DY2) + myNbTimes2 = newValue; + + if(myOkBase && myOkDir) + this->MakeMultiRotationSimulationAndDisplay(); + return; } - //================================================================================= -// function : closeEvent() -// purpose : +// function : ReverseAngle() +// purpose : 'state' not used here //================================================================================= -void TransformationGUI_MultiRotationDlg::closeEvent( QCloseEvent* e ) +void TransformationGUI_MultiRotationDlg::ReverseAngle(int state) { - this->ClickOnCancel() ; /* same than click on cancel button */ - return ; + myAng = -myAng; + if(myConstructorId == 0) + GroupPoints->SpinBox_DX->SetValue(myAng); + else if(myConstructorId == 1) + GroupDimensions->SpinBox_DX1->SetValue(myAng); + + if(myOkBase && myOkDir) + this->MakeMultiRotationSimulationAndDisplay(); + return; } @@ -895,38 +467,34 @@ void TransformationGUI_MultiRotationDlg::closeEvent( QCloseEvent* e ) //================================================================================= void TransformationGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay() { - myGeomBase->EraseSimulationShape() ; - gp_Trsf theTransformation ; - gp_Trsf theTransformation1 ; - gp_Trsf theTransformation2 ; - mySimulationTopoDs.Nullify() ; - - int i ; - int j ; - Standard_Real DX ; - Standard_Real DY ; - Standard_Real DZ ; - GProp_GProps System ; - gp_Pnt myPoint ; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + int i, j; + Standard_Real DX, DY, DZ; + gp_Trsf theTransformation; + gp_Trsf theTransformation1; + gp_Trsf theTransformation2; + gp_Pnt myPoint; + GProp_GProps System; TopoDS_Compound compound; - BRep_Builder B; - B.MakeCompound( compound ); + BRep_Builder B; + B.MakeCompound(compound); - if ( myBase.ShapeType() == TopAbs_VERTEX) { - myGeomBase->VertexToPoint( myBase, myPoint ); - } - else if ( myBase.ShapeType() == TopAbs_EDGE || myBase.ShapeType() == TopAbs_WIRE ) { + if(myBase.ShapeType() == TopAbs_VERTEX) + myGeomBase->VertexToPoint(myBase, myPoint); + else if(myBase.ShapeType() == TopAbs_EDGE || myBase.ShapeType() == TopAbs_WIRE) { BRepGProp::LinearProperties(myBase, System); - myPoint = System.CentreOfMass() ; + myPoint = System.CentreOfMass(); } - else if ( myBase.ShapeType() == TopAbs_FACE || myBase.ShapeType() == TopAbs_SHELL ) { + else if(myBase.ShapeType() == TopAbs_FACE || myBase.ShapeType() == TopAbs_SHELL) { BRepGProp::SurfaceProperties(myBase, System); - myPoint = System.CentreOfMass() ; + myPoint = System.CentreOfMass(); } else { BRepGProp::VolumeProperties(myBase, System); - myPoint = System.CentreOfMass() ; + myPoint = System.CentreOfMass(); } TopoDS_Shape S = BRepBuilderAPI_MakeVertex(myPoint).Shape(); @@ -936,50 +504,51 @@ void TransformationGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay() { case 0 : { - gp_Ax1 AX1( myLoc, myDir ) ; + gp_Ax1 AX1(myLoc, myDir); Standard_Real angle = 360/myNbTimes1; - for ( i = 0; i < myNbTimes1; i++ ) { - theTransformation.SetRotation(AX1, i*angle*PI180) ; - BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False) ; - B.Add( compound, myBRepTransformation.Shape() ); + for(i = 0; i < myNbTimes1; i++) { + theTransformation.SetRotation(AX1, i*angle*PI180); + BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False); + B.Add(compound, myBRepTransformation.Shape()); } mySimulationTopoDs = compound; - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); break; } case 1 : { - gp_Ax1 AX2( myLoc, myDir ) ; + gp_Ax1 AX2(myLoc, myDir); Handle(Geom_Line) Line = new Geom_Line(AX2); - gp_Pnt P2 = GeomAPI_ProjectPointOnCurve( myPoint, Line ) ; - if ( myPoint.IsEqual(P2, Precision::Confusion() ) ) + gp_Pnt P2 = GeomAPI_ProjectPointOnCurve(myPoint, Line); + if(myPoint.IsEqual(P2, Precision::Confusion())) return; - gp_Vec Vec(P2, myPoint) ; + + gp_Vec Vec(P2, myPoint); Vec.Normalize(); - for ( i = 0; i < myNbTimes2; i++ ) { - for ( j = 0; j < myNbTimes1; j++ ) { - DX = i * myStep * Vec.X() ; - DY = i * myStep * Vec.Y() ; - DZ = i * myStep * Vec.Z() ; - myVec.SetCoord( DX, DY, DZ ) ; - - theTransformation1.SetTranslation(myVec) ; - theTransformation2.SetRotation(AX2, j*myAng*PI180) ; - BRepBuilderAPI_Transform myBRepTransformation1(S, theTransformation1, Standard_False) ; - BRepBuilderAPI_Transform myBRepTransformation2(myBRepTransformation1.Shape(), theTransformation2, Standard_False) ; - B.Add( compound, myBRepTransformation2.Shape() ); + for(i = 0; i < myNbTimes2; i++) { + for(j = 0; j < myNbTimes1; j++) { + DX = i * myStep * Vec.X(); + DY = i * myStep * Vec.Y(); + DZ = i * myStep * Vec.Z(); + myVec.SetCoord(DX, DY, DZ); + + theTransformation1.SetTranslation(myVec); + theTransformation2.SetRotation(AX2, j*myAng*PI180); + BRepBuilderAPI_Transform myBRepTransformation1(S, theTransformation1, Standard_False); + BRepBuilderAPI_Transform myBRepTransformation2(myBRepTransformation1.Shape(), theTransformation2, Standard_False); + B.Add(compound, myBRepTransformation2.Shape()); } } - mySimulationTopoDs = compound ; - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; + mySimulationTopoDs = compound; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); break; } } } catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeMultitranslationSimulationAndDisplay" ) ; - return ; + MESSAGE("Exception catched in MakeMultitranslationSimulationAndDisplay"); + return; } - return ; + return; } diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h index 829536660..10a4a401e 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h @@ -29,132 +29,65 @@ #ifndef DIALOGBOX_MULTIROTATION_H #define DIALOGBOX_MULTIROTATION_H -#include "TransformationGUI.h" +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel4Spin1Check.h" +#include "DlgRef_2Sel1Spin.h" -#include "GEOM_EdgeFilter.hxx" -#include "DlgRef_SpinBox.h" +#include "TransformationGUI.h" +#include "GEOM_ShapeTypeFilter.hxx" #include #include -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QSpinBox; -class QRadioButton; - //================================================================================= // class : TransformationGUI_MultiRotationDlg // purpose : //================================================================================= -class TransformationGUI_MultiRotationDlg : public QDialog +class TransformationGUI_MultiRotationDlg : public GEOMBase_Skeleton { Q_OBJECT public: - TransformationGUI_MultiRotationDlg( QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + TransformationGUI_MultiRotationDlg(QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~TransformationGUI_MultiRotationDlg(); private : - TransformationGUI* myTransformationGUI; - 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 */ - TopoDS_Shape myBase ; - GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */ - - gp_Vec myVec ; - int myNbTimes1 ; - int myNbTimes2 ; - Standard_Real myAng ; - Standard_Real myStep ; - gp_Dir myDir ; - gp_Pnt myLoc ; - - bool myOkBase ; - bool myOkDir ; - bool myOkAng ; - - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeMultiRotationSimulationAndDisplay() ; + void Init(); + void enterEvent(QEvent* e); + void MakeMultiRotationSimulationAndDisplay(); - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A1; - QPushButton* SelectButtonC1A2; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QLabel* TextLabelC1A3; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QSpinBox* SpinBox_C1A3; /* int : Nb times */ - - QGroupBox* GroupC2; - QPushButton* SelectButtonC2A1; - QPushButton* SelectButtonC2A2; - QLabel* TextLabelC2A1; - QLabel* TextLabelC2A2; - QLabel* TextLabelC2A3; - QLabel* TextLabelC2A4; - QLabel* TextLabelC2A5; - QLabel* TextLabelC2A6; - - QLineEdit* LineEditC2A1; - QLineEdit* LineEditC2A2; - DlgRef_SpinBox* SpinBox_C2A3 ; /* double : angle */ - QSpinBox* SpinBox_C2A4; /* int : Nb times 1 */ - DlgRef_SpinBox* SpinBox_C2A5 ; /* double : step value */ - QSpinBox* SpinBox_C2A6; /* int : Nb times 2 */ + TransformationGUI* myTransformationGUI; - QCheckBox* CheckBoxReverse; + double step; + int myConstructorId; /* Current constructor id = radio button id */ + Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */ + + TopoDS_Shape myBase; + GEOM::GEOM_Shape_var myGeomShape; /* is myBase */ + gp_Vec myVec; + int myNbTimes1; + int myNbTimes2; + Standard_Real myAng; + Standard_Real myStep; + gp_Dir myDir; + gp_Pnt myLoc; + bool myOkBase; + bool myOkDir; + + DlgRef_2Sel1Spin* GroupPoints; + DlgRef_2Sel4Spin1Check* GroupDimensions; private slots: - - void ConstructorsClicked(int constructorId); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ReverseAngle(int) ; - void ValueChangedInSpinBox( double newValue ) ; /* for TransformationGUI_SpinBox */ - void ValueChangedInt( int newIntValue ) ; /* for QT spin box ! not const ! */ + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ReverseAngle(int state); + void ValueChangedInSpinBox(double newValue); + void ConstructorsClicked(int constructorId); -protected: - QGridLayout* TransformationGUI_MultiRotationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; }; #endif // DIALOGBOX_MULTIROTATION_H diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index 3e53e51bd..c8b68bdfc 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -30,7 +30,6 @@ using namespace std; #include "TransformationGUI_MultiTranslationDlg.h" #include "QAD_Config.h" -#include "DisplayGUI.h" #include #include @@ -40,22 +39,6 @@ using namespace std; #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - //================================================================================= // class : TransformationGUI_MultiTranslationDlg() // purpose : Constructs a TransformationGUI_MultiTranslationDlg which is a child of 'parent', with the @@ -63,441 +46,147 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg( QWidget* parent, const char* name, TransformationGUI* theTransformationGUI, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg(QWidget* parent, const char* name, TransformationGUI* theTransformationGUI, 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_MULTITRANSLATION_SIMPLE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MULTITRANSLATION_DOUBLE"))); - - if ( !name ) - setName( "TransformationGUI_MultiTranlationDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_MULTITRANSLATION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - TransformationGUI_MultiTranslationDlgLayout = new QGridLayout( this ); - TransformationGUI_MultiTranslationDlgLayout->setSpacing( 6 ); - TransformationGUI_MultiTranslationDlgLayout->setMargin( 11 ); - - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_MULTITRANSLATION" ) ); - 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 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 3 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); - - TransformationGUI_MultiTranslationDlgLayout->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 ); - TransformationGUI_MultiTranslationDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_MULTITRANSLATION_SIMPLE" ) ); - 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 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_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_U" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_STEP_U" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A3->setFrameShape( QLabel::NoFrame ); - TextLabelC1A3->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - - TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" ); - TextLabelC1A4->setText( tr( "GEOM_NB_TIMES_U" ) ); - TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A4->setFrameShape( QLabel::NoFrame ); - TextLabelC1A4->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - - /* a TransformationGUI_SpinBox */ - SpinBox_C1A3 = new DlgRef_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ; - SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 ); - /* a QSpinBox */ - SpinBox_C1A4 = new QSpinBox( GroupC1, "SpinBox_C1A4" ) ; - SpinBox_C1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A4->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A4, 3, 2 ); - - CheckBoxReverse0 = new QCheckBox( GroupC1, "CheckBoxReverse0" ); - CheckBoxReverse0->setText( tr( "GEOM_REVERSE_U" ) ); - GroupC1Layout->addWidget( CheckBoxReverse0, 5, 0 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - SelectButtonC1A2->setToggleButton( FALSE ); - SelectButtonC1A2->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - - TransformationGUI_MultiTranslationDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "GEOM_MULTITRANSLATION_DOUBLE" ) ); - GroupC2->setMinimumSize( QSize( 0, 0 ) ); - GroupC2->setFrameShape( QGroupBox::Box ); - GroupC2->setFrameShadow( QGroupBox::Sunken ); - GroupC2->setColumnLayout(0, Qt::Vertical ); - GroupC2->layout()->setSpacing( 0 ); - GroupC2->layout()->setMargin( 0 ); - GroupC2Layout = new QGridLayout( GroupC2->layout() ); - GroupC2Layout->setAlignment( Qt::AlignTop ); - GroupC2Layout->setSpacing( 6 ); - GroupC2Layout->setMargin( 11 ); - - TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" ); - TextLabelC2A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A1->setFrameShape( QLabel::NoFrame ); - TextLabelC2A1->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 ); - - TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" ); - TextLabelC2A2->setText( tr( "GEOM_VECTOR_U" ) ); - TextLabelC2A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A2->setFrameShape( QLabel::NoFrame ); - TextLabelC2A2->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 ); - - TextLabelC2A3 = new QLabel( GroupC2, "TextLabelC2A3" ); - TextLabelC2A3->setText( tr( "GEOM_VECTOR_V" ) ); - TextLabelC2A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A3->setFrameShape( QLabel::NoFrame ); - TextLabelC2A3->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A3, 2, 0 ); - - TextLabelC2A4 = new QLabel( GroupC2, "TextLabelC2A4" ); - TextLabelC2A4->setText( tr( "GEOM_STEP_U" ) ); - TextLabelC2A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A4->setFrameShape( QLabel::NoFrame ); - TextLabelC2A4->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A4, 3, 0 ); - - TextLabelC2A5 = new QLabel( GroupC2, "TextLabelC2A5" ); - TextLabelC2A5->setText( tr( "GEOM_NB_TIMES_U" ) ); - TextLabelC2A5->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A5->setFrameShape( QLabel::NoFrame ); - TextLabelC2A5->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A5, 4, 0 ); - - TextLabelC2A6 = new QLabel( GroupC2, "TextLabelC2A6" ); - TextLabelC2A6->setText( tr( "GEOM_STEP_V" ) ); - TextLabelC2A6->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A6->setFrameShape( QLabel::NoFrame ); - TextLabelC2A6->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A6, 6, 0 ); - - TextLabelC2A7 = new QLabel( GroupC2, "TextLabelC2A7" ); - TextLabelC2A7->setText( tr( "GEOM_NB_TIMES_V" ) ); - TextLabelC2A7->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A7->setFrameShape( QLabel::NoFrame ); - TextLabelC2A7->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A7, 7, 0 ); - - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - GroupC2Layout->addWidget( LineEditC2A1, 0, 2 ); - - LineEditC2A2 = new QLineEdit( GroupC2, "LineEditC2A2" ); - GroupC2Layout->addWidget( LineEditC2A2, 1, 2 ); - - LineEditC2A3 = new QLineEdit( GroupC2, "LineEditC2A3" ); - GroupC2Layout->addWidget( LineEditC2A3, 2, 2 ); - - /* a TransformationGUI_SpinBox */ - SpinBox_C2A4 = new DlgRef_SpinBox( GroupC2, "GeomSpinBox_C2A4" ) ; - SpinBox_C2A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A4->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A4, 3, 2 ); - /* a QSpinBox */ - SpinBox_C2A5 = new QSpinBox( GroupC2, "SpinBox_C2A5" ) ; - SpinBox_C2A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A5->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A5, 4, 2 ); - - /* a TransformationGUI_SpinBox */ - SpinBox_C2A6 = new DlgRef_SpinBox( GroupC2, "GeomSpinBox_C2A6" ) ; - SpinBox_C2A6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A6->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A6, 6, 2 ); - /* a QSpinBox */ - SpinBox_C2A7 = new QSpinBox( GroupC2, "SpinBox_C2A7" ) ; - SpinBox_C2A7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A7->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A7, 7, 2 ); - - - CheckBoxReverse1 = new QCheckBox( GroupC2, "CheckBoxReverse1" ); - CheckBoxReverse1->setText( tr( "GEOM_REVERSE_U" ) ); - GroupC2Layout->addWidget( CheckBoxReverse1, 5, 0 ); - - CheckBoxReverse2 = new QCheckBox( GroupC2, "CheckBoxReverse2" ); - CheckBoxReverse2->setText( tr( "GEOM_REVERSE_V" ) ); - GroupC2Layout->addWidget( CheckBoxReverse2, 8, 0 ); - - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setText( tr( "" ) ); - SelectButtonC2A1->setPixmap( image1 ); - SelectButtonC2A1->setToggleButton( FALSE ); - SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 ); - - SelectButtonC2A2 = new QPushButton( GroupC2, "SelectButtonC2A2" ); - SelectButtonC2A2->setText( tr( "" ) ); - SelectButtonC2A2->setPixmap( image1 ); - SelectButtonC2A2->setToggleButton( FALSE ); - SelectButtonC2A2->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A2, 1, 1 ); - - SelectButtonC2A3 = new QPushButton( GroupC2, "SelectButtonC2A3" ); - SelectButtonC2A3->setText( tr( "" ) ); - SelectButtonC2A3->setPixmap( image1 ); - SelectButtonC2A3->setToggleButton( FALSE ); - SelectButtonC2A3->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A3, 2, 1 ); - - TransformationGUI_MultiTranslationDlgLayout->addWidget( GroupC2, 1, 0 ); - - /***************************************************************/ - - myTransformationGUI = theTransformationGUI; - Init(Sel) ; /* Initialisations */ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MULTITRANSLATION_SIMPLE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MULTITRANSLATION_DOUBLE"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_MULTITRANSLATION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_MULTITRANSLATION")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel2Spin1Check(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_SIMPLE")); + GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR_U")); + GroupPoints->TextLabel3->setText(tr("GEOM_STEP_U")); + GroupPoints->TextLabel4->setText(tr("GEOM_NB_TIMES_U")); + GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE_U")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + + GroupDimensions = new DlgRef_3Sel4Spin2Check(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_DOUBLE")); + GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR_U")); + GroupDimensions->TextLabel3->setText(tr("GEOM_VECTOR_V")); + GroupDimensions->TextLabel4->setText(tr("GEOM_STEP_U")); + GroupDimensions->TextLabel5->setText(tr("GEOM_NB_TIMES_U")); + GroupDimensions->TextLabel6->setText(tr("GEOM_STEP_V")); + GroupDimensions->TextLabel7->setText(tr("GEOM_NB_TIMES_V")); + GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE_U")); + GroupDimensions->CheckButton2->setText(tr("GEOM_REVERSE_V")); + GroupDimensions->PushButton1->setPixmap(image2); + GroupDimensions->PushButton2->setPixmap(image2); + GroupDimensions->PushButton3->setPixmap(image2); + + Layout1->addWidget(GroupPoints, 1, 0); + Layout1->addWidget(GroupDimensions, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myTransformationGUI = theTransformationGUI; + Init(); } + //================================================================================= // function : ~TransformationGUI_MultiTranslationDlg() // purpose : Destroys the object and frees any allocated resources //================================================================================= TransformationGUI_MultiTranslationDlg::~TransformationGUI_MultiTranslationDlg() { - // no need to delete child widgets, Qt does it all for us - this->destroy(TRUE, TRUE) ; + // no need to delete child widgets, Qt does it all for us } + //================================================================================= // function : Init() // purpose : //================================================================================= -void TransformationGUI_MultiTranslationDlg::Init( SALOME_Selection* Sel ) +void TransformationGUI_MultiTranslationDlg::Init() { - + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupPoints->LineEdit1; + + myStep1 = 50.0; + myStep2 = 50.0; + myNbTimes1 = 2; + myNbTimes2 = 2; + myOkBase = myOkDir1 = myOkDir2 = false; + + myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom); + /* Get setting of step value from file configuration */ - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for geom spin boxes */ - SpinBox_C1A3->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* step U : constructor 1 */ - SpinBox_C1A3->SetValue( 50 ) ; - SpinBox_C2A4->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* step U : constructor 2 */ - SpinBox_C2A4->SetValue( 50 ) ; - SpinBox_C2A6->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* step V : constructor 2 */ - SpinBox_C2A6->SetValue( 50 ) ; - - /* min, max, step for QT spin boxes */ - SpinBox_C1A4->setMinValue( 1 ); /* myNbTimes1 : constructor 1 */ - SpinBox_C1A4->setMaxValue( 10000 ); - SpinBox_C1A4->setWrapping( TRUE ); - SpinBox_C1A4->setValue(2) ; - - SpinBox_C2A5->setMinValue( 1 ); /* myNbTimes1 : constructor 2 */ - SpinBox_C2A5->setMaxValue( 10000 ); - SpinBox_C2A5->setWrapping( TRUE ); - SpinBox_C2A5->setValue(2) ; - - SpinBox_C2A7->setMinValue( 1 ); /* myNbTimes2 : constructor 2 */ - SpinBox_C2A7->setMaxValue( 10000 ); - SpinBox_C2A7->setWrapping( TRUE ); - SpinBox_C2A7->setValue(2) ; - - myStep1 = 50.0 ; - myStep2 = 50.0 ; - myNbTimes1 = 2 ; - myNbTimes2 = 2 ; - - GroupC1->show(); - GroupC2->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomBase = new GEOMBase() ; - myGeomGUI = GEOMContext::GetGeomGUI() ; - - myOkBase = myOkDir1 = myOkDir2 = false ; - mySimulationTopoDs.Nullify() ; - myBase.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : set previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom ); + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + double SpecificStep = 1; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupPoints->SpinBox_DY->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3); + GroupPoints->SpinBox_DX->SetValue(myStep1); + GroupPoints->SpinBox_DY->SetValue(myNbTimes1); + + GroupDimensions->SpinBox_DX1->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DY1->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3); + GroupDimensions->SpinBox_DX2->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DY2->RangeStepAndValidator(1.0, 999.999, SpecificStep, 3); + GroupDimensions->SpinBox_DX1->SetValue(myStep1); + GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); + GroupDimensions->SpinBox_DX2->SetValue(myStep2); + GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); /* 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( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A3, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - /* TransformationGUI_SpinBox */ - connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A6, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupDimensions->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupDimensions->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupDimensions->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX1, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY1, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DX2, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY2, SLOT(SetStep(double))); + + connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseAngle1(int))); + connect(GroupDimensions->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseAngle1(int))); + connect(GroupDimensions->CheckButton2, SIGNAL(stateChanged(int)), this, SLOT(ReverseAngle2(int))); - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A3, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - /* QSpinBox */ - connect( SpinBox_C1A4, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ; /* Not const ! */ - connect( SpinBox_C2A5, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ; - connect( SpinBox_C2A7, SIGNAL ( valueChanged(int) ), this, SLOT( ValueChangedInt(int) ) ) ; - - connect( CheckBoxReverse0, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle1(int) ) ) ; - connect( CheckBoxReverse1, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle1(int) ) ) ; - connect( CheckBoxReverse2, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle2(int) ) ) ; - - 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(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); -//================================================================================= -// function : ReverseAngle1() -// purpose : 'state' not used here -//================================================================================= -void TransformationGUI_MultiTranslationDlg::ReverseAngle1(int state) -{ - myStep1 = -myStep1 ; - SpinBox_C1A3->SetValue( myStep1 ) ; - SpinBox_C2A4->SetValue( myStep1 ) ; - if( myOkBase && myOkDir1 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} + /* displays Dialog */ + GroupDimensions->hide(); + GroupPoints->show(); + this->show(); - -//================================================================================= -// function : ReverseAngle2() -// purpose : 'state' not used here -//================================================================================= -void TransformationGUI_MultiTranslationDlg::ReverseAngle2(int state) -{ - myStep2 = -myStep2 ; - SpinBox_C2A6->SetValue( myStep2 ) ; - if( myOkBase && myOkDir1 && myOkDir2 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; + return; } @@ -507,259 +196,178 @@ void TransformationGUI_MultiTranslationDlg::ReverseAngle2(int state) //================================================================================= void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId) { - myEditCurrentArgument->setText(tr("")) ; - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myStep1 = 50.0 ; - myStep2 = 50.0 ; + myConstructorId = constructorId; + mySelection->ClearFilters(); + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + disconnect(mySelection, 0, this, 0); + myStep1 = 50.0; + myStep2 = 50.0; myNbTimes1 = 2; myNbTimes2 = 2; - - myOkBase = myOkDir1 = myOkDir2 = false ; - myConstructorId = constructorId ; + myOkBase = myOkDir1 = myOkDir2 = false; switch (constructorId) { case 0: /* Translate simple */ { - GroupC1->show(); - GroupC2->hide() ; - myEditCurrentArgument = LineEditC1A1 ; - SpinBox_C1A3->SetValue(50) ; - SpinBox_C1A4->setValue(2) ; - LineEditC1A1->setText(tr("")) ; - LineEditC1A2->setText(tr("")) ; + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(""); + GroupPoints->LineEdit2->setText(""); + + GroupPoints->SpinBox_DX->SetValue(myStep1); + GroupPoints->SpinBox_DY->SetValue(myNbTimes1); + + /* filter for next selection */ + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } - case 1: /* Translate double */ { - GroupC1->hide(); - GroupC2->show() ; - myEditCurrentArgument = LineEditC2A1 ; - SpinBox_C2A4->SetValue(50) ; - SpinBox_C2A5->setValue(2) ; - SpinBox_C2A6->SetValue(50) ; - SpinBox_C2A7->setValue(2) ; - LineEditC2A1->setText(tr("")) ; - LineEditC2A2->setText(tr("")) ; - LineEditC2A3->setText(tr("")) ; - break ; + GroupPoints->hide(); + resize(0, 0); + GroupDimensions->show(); + + myEditCurrentArgument = GroupDimensions->LineEdit1; + GroupDimensions->LineEdit1->setText(""); + GroupDimensions->LineEdit2->setText(""); + GroupDimensions->LineEdit3->setText(""); + + GroupDimensions->SpinBox_DX1->SetValue(myStep1); + GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); + GroupDimensions->SpinBox_DX2->SetValue(myStep2); + GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); + + /* filter for next selection */ + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; } - } - - return ; + return; } + //================================================================================= // function : ClickOnOk() // purpose : //================================================================================= void TransformationGUI_MultiTranslationDlg::ClickOnOk() { - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; + this->ClickOnApply(); + ClickOnCancel(); + return; } + //================================================================================= // function : ClickOnApply() // purpose : //================================================================================= void TransformationGUI_MultiTranslationDlg::ClickOnApply() { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkBase && myOkDir1 ) { - myTransformationGUI->MakeMultiTranslation1DAndDisplay( myGeomShape, myDir1, myStep1, myNbTimes1 ) ; - } - break ; - } - case 1 : - { - if(myOkBase && myOkDir1 && myOkDir2 ) { - myTransformationGUI->MakeMultiTranslation2DAndDisplay( myGeomShape, myDir1, myStep1, myNbTimes1, myDir2, myStep2, myNbTimes2 ) ; - } - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void TransformationGUI_MultiTranslationDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender() ; - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - else if ( send == LineEditC2A1 ) - myEditCurrentArgument = LineEditC2A1; - else if ( send == LineEditC2A2 ) - myEditCurrentArgument = LineEditC2A2 ; - else if ( send == LineEditC2A3 ) - myEditCurrentArgument = LineEditC2A3 ; - 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 ) ; + myGeomGUI->GetDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myConstructorId == 0) { + if(myOkBase && myOkDir1) + myTransformationGUI->MakeMultiTranslation1DAndDisplay(myGeomShape, myDir1, myStep1, myNbTimes1); } - return ; + else if(myConstructorId == 1) { + if(myOkBase && myOkDir1 && myOkDir2) + myTransformationGUI->MakeMultiTranslation2DAndDisplay(myGeomShape, myDir1, myStep1, myNbTimes1, myDir2, myStep2, myNbTimes2); + } + return; } - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection as changed or other case //================================================================================= void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText("") ; - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1 || myEditCurrentArgument == GroupDimensions->LineEdit1) + myOkBase = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupDimensions->LineEdit2) + myOkDir1 = false; + else if(myEditCurrentArgument == GroupDimensions->LineEdit3) + myOkDir2 = false; + return; + } - /* Future name of selection */ - QString aString = ""; - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; + // nbSel == 1 + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; - TopoDS_Shape S; - Standard_Boolean testResult ; - - switch (myConstructorId) + switch(myConstructorId) { case 0 : - { - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myEditCurrentArgument->setText("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myEditCurrentArgument->setText("") ; - myOkDir1 = false ; - } - return ; - } - - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - myBase = S ; - myOkBase = true ; + { + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myEditCurrentArgument->setText(aString); + myBase = S; + myOkBase = true; } - else if ( myEditCurrentArgument == LineEditC1A2 ) { + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { BRepAdaptor_Curve curv(TopoDS::Edge(S)); myDir1 = curv.Line().Direction(); - myEditCurrentArgument->setText(aString) ; - myOkDir1 = true ; - } - - if (myOkBase && myOkDir1 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; + myEditCurrentArgument->setText(aString); + myOkDir1 = true; } + + if(myOkBase && myOkDir1) + this->MakeMultiTranslationSimulationAndDisplay(); break; } case 1 : { - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC2A1 ) { - myEditCurrentArgument->setText("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC2A2 ) { - myEditCurrentArgument->setText("") ; - myOkDir1 = false ; - } - else if ( myEditCurrentArgument == LineEditC2A3 ) { - myEditCurrentArgument->setText("") ; - myOkDir2 = false ; - } - return ; - } - - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC2A1 ) { - myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - myBase = S ; - myOkBase = true ; + if(myEditCurrentArgument == GroupDimensions->LineEdit1) { + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myEditCurrentArgument->setText(aString); + myBase = S; + myOkBase = true; } - else if ( myEditCurrentArgument == LineEditC2A2 ) { + else if(myEditCurrentArgument == GroupDimensions->LineEdit2) { BRepAdaptor_Curve curv(TopoDS::Edge(S)); myDir1 = curv.Line().Direction(); - myEditCurrentArgument->setText(aString) ; - myOkDir1 = true ; + myEditCurrentArgument->setText(aString); + myOkDir1 = true; } - else if ( myEditCurrentArgument == LineEditC2A3 ) { + else if(myEditCurrentArgument == GroupDimensions->LineEdit3) { BRepAdaptor_Curve curv(TopoDS::Edge(S)); myDir2 = curv.Line().Direction(); - myEditCurrentArgument->setText(aString) ; - myOkDir2 = true ; + myEditCurrentArgument->setText(aString); + myOkDir2 = true; } - if (myOkBase && myOkDir1 && myOkDir2 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } + if(myOkBase && myOkDir1 && myOkDir2) + this->MakeMultiTranslationSimulationAndDisplay(); break; } } - - return ; + return; } @@ -770,212 +378,172 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0 : - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->ClearFilters() ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - case 1 : - { - if(send == SelectButtonC2A1) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1; - mySelection->ClearFilters() ; - } - else if(send == SelectButtonC2A2) { - LineEditC2A2->setFocus() ; - myEditCurrentArgument = LineEditC2A2; - mySelection->AddFilter(myEdgeFilter) ; - } - else if(send == SelectButtonC2A3) { - LineEditC2A3->setFocus() ; - myEditCurrentArgument = LineEditC2A3; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; + mySelection->ClearFilters(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + mySelection->AddFilter(myEdgeFilter); + } + else if(send == GroupDimensions->PushButton1) { + GroupDimensions->LineEdit1->setFocus(); + myEditCurrentArgument = GroupDimensions->LineEdit1; + } + else if(send == GroupDimensions->PushButton2) { + GroupDimensions->LineEdit2->setFocus(); + myEditCurrentArgument = GroupDimensions->LineEdit2; + mySelection->AddFilter(myEdgeFilter); + } + else if(send == GroupDimensions->PushButton3) { + GroupDimensions->LineEdit3->setFocus(); + myEditCurrentArgument = GroupDimensions->LineEdit3; + mySelection->AddFilter(myEdgeFilter); + } + this->SelectionIntoArgument(); + + return; } //================================================================================= -// function : ValueChangedInt() -// purpose : (General QT SpinBox) +// function : LineEditReturnPressed() +// purpose : //================================================================================= -void TransformationGUI_MultiTranslationDlg::ValueChangedInt( int newIntValue ) +void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() { - QSpinBox* send = (QSpinBox*)sender(); - - /* First constructor */ - if( send == SpinBox_C1A4 ) { - myNbTimes1 = newIntValue ; - } - /* Second constructor */ - else if( send == SpinBox_C2A5 ) { - myNbTimes1 = newIntValue ; - } - else if( send == SpinBox_C2A7 ) { - myNbTimes2 = newIntValue ; - } + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else if (send == GroupDimensions->LineEdit1) + myEditCurrentArgument = GroupDimensions->LineEdit1; + else if (send == GroupDimensions->LineEdit2) + myEditCurrentArgument = GroupDimensions->LineEdit2; + else if (send == GroupDimensions->LineEdit3) + myEditCurrentArgument = GroupDimensions->LineEdit3; + else + return; - switch (myConstructorId) - { - case 0 : - { - if (myOkBase && myOkDir1 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if (myOkBase && myOkDir1 && myOkDir2 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - return ; + GEOMBase_Skeleton::LineEditReturnPressed(); + return; } //================================================================================= -// function : ValueChangedInSpinBox() -// purpose : (specifig for TransformationGUI_SpinBox) +// function : ActivateThisDialog() +// purpose : //================================================================================= -void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox( double newValue ) -{ - DlgRef_SpinBox* send = (DlgRef_SpinBox*)sender(); +void TransformationGUI_MultiTranslationDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - /* First constructor */ - if( send == SpinBox_C1A3 ) { - myStep1 = newValue ; + if(myConstructorId == 0) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; } - /* Second constructor */ - else if( send == SpinBox_C2A4 ) { - myStep1 = newValue ; + else if(myConstructorId == 1) { + GroupDimensions->LineEdit1->setFocus(); + myEditCurrentArgument = GroupDimensions->LineEdit1; } - else if( send == SpinBox_C2A6 ) { - myStep2 = newValue ; - } - - switch (myConstructorId) - { - case 0 : - { - if (myOkBase && myOkDir1 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if (myOkBase && myOkDir1 && myOkDir2 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomBase->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - return ; + + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; } //================================================================================= -// function : DeactivateActiveDialog() +// function : enterEvent() // purpose : //================================================================================= -void TransformationGUI_MultiTranslationDlg::DeactivateActiveDialog() +void TransformationGUI_MultiTranslationDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomBase->EraseSimulationShape() ; - mySelection->ClearFilters() ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true) ; - } - return ; + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } //================================================================================= -// function : ActivateThisDialog() +// function : ValueChangedInSpinBox() // purpose : //================================================================================= -void TransformationGUI_MultiTranslationDlg::ActivateThisDialog() +void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValue) { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupC2->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - if( !mySimulationTopoDs.IsNull() ) - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + QObject* send = (QObject*)sender(); + switch(myConstructorId) + { + case 0 : + { + if(send == GroupPoints->SpinBox_DX) + myStep1 = newValue; + else if(send == GroupPoints->SpinBox_DY) + myNbTimes1 = newValue; + if(myOkBase && myOkDir1) + this->MakeMultiTranslationSimulationAndDisplay(); + break; + } + case 1 : + { + if(send == GroupDimensions->SpinBox_DX1) + myStep1 = newValue; + else if(send == GroupDimensions->SpinBox_DY1) + myNbTimes1 = newValue; + else if(send == GroupDimensions->SpinBox_DX2) + myStep2 = newValue; + else if(send == GroupDimensions->SpinBox_DY2) + myNbTimes2 = newValue; + if(myOkBase && myOkDir1 && myOkDir2) + this->MakeMultiTranslationSimulationAndDisplay(); + break; + } + } + return; +} //================================================================================= -// function : enterEvent() -// purpose : +// function : ReverseAngle1() +// purpose : 'state' not used here //================================================================================= -void TransformationGUI_MultiTranslationDlg::enterEvent(QEvent* e) +void TransformationGUI_MultiTranslationDlg::ReverseAngle1(int state) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; + myStep1 = -myStep1; + if(myConstructorId == 0) { + GroupPoints->SpinBox_DX->SetValue(myStep1); + if(myOkBase && myOkDir1) + this->MakeMultiTranslationSimulationAndDisplay(); + } + else if(myConstructorId == 1) { + GroupDimensions->SpinBox_DX1->SetValue(myStep1); + if(myOkBase && myOkDir1 && myOkDir2) + this->MakeMultiTranslationSimulationAndDisplay(); + } + return; } - //================================================================================= -// function : closeEvent() -// purpose : +// function : ReverseAngle2() +// purpose : 'state' not used here //================================================================================= -void TransformationGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e ) +void TransformationGUI_MultiTranslationDlg::ReverseAngle2(int state) { - this->ClickOnCancel() ; /* same than click on cancel button */ - return ; + myStep2 = -myStep2; + GroupDimensions->SpinBox_DX2->SetValue(myStep2); + if(myOkBase && myOkDir1 && myOkDir2) + MakeMultiTranslationSimulationAndDisplay(); + return; } @@ -985,78 +553,72 @@ void TransformationGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e ) //================================================================================= void TransformationGUI_MultiTranslationDlg::MakeMultiTranslationSimulationAndDisplay() { - myGeomBase->EraseSimulationShape() ; - gp_Trsf theTransformation ; - mySimulationTopoDs.Nullify() ; - - int i ; - int j ; - Standard_Real DX ; - Standard_Real DY ; - Standard_Real DZ ; - GProp_GProps System ; - gp_Pnt myPoint ; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + int i, j; + Standard_Real DX, DY, DZ; + gp_Trsf theTransformation; + GProp_GProps System; TopoDS_Compound compound; - BRep_Builder B; - B.MakeCompound( compound ); - TopoDS_Shape S ; + BRep_Builder B; + B.MakeCompound(compound); try { - BRepGProp::LinearProperties(myBase, System); - myPoint = System.CentreOfMass() ; - S = BRepBuilderAPI_MakeVertex(myPoint).Shape(); + gp_Pnt myPoint = System.CentreOfMass(); + TopoDS_Shape S = BRepBuilderAPI_MakeVertex(myPoint).Shape(); switch (myConstructorId) { case 0 : { - gp_Vec Vec(myDir1) ; + gp_Vec Vec(myDir1); Vec.Normalize(); - for ( i = 0; i < myNbTimes1; i++ ) { - DX = i * myStep1 * Vec.X() ; - DY = i * myStep1 * Vec.Y() ; - DZ = i * myStep1 * Vec.Z() ; - myVec.SetCoord( DX, DY, DZ ) ; + for(i = 0; i < myNbTimes1; i++) { + DX = i * myStep1 * Vec.X(); + DY = i * myStep1 * Vec.Y(); + DZ = i * myStep1 * Vec.Z(); + myVec.SetCoord(DX, DY, DZ); - theTransformation.SetTranslation(myVec) ; - BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False) ; - B.Add( compound, myBRepTransformation.Shape() ); + theTransformation.SetTranslation(myVec); + BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False); + B.Add(compound, myBRepTransformation.Shape()); } mySimulationTopoDs = compound; - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); break; } case 1 : { - gp_Vec Vec1(myDir1) ; + gp_Vec Vec1(myDir1); Vec1.Normalize(); - gp_Vec Vec2(myDir2) ; + gp_Vec Vec2(myDir2); Vec2.Normalize(); - for ( i = 0; i < myNbTimes1; i++ ) { - for ( j = 0; j < myNbTimes2; j++ ) { - DX = i * myStep1 * Vec1.X() + j * myStep2 * Vec2.X() ; - DY = i * myStep1 * Vec1.Y() + j * myStep2 * Vec2.Y() ; - DZ = i * myStep1 * Vec1.Z() + j * myStep2 * Vec2.Z() ; - myVec.SetCoord( DX, DY, DZ ) ; + for(i = 0; i < myNbTimes1; i++) { + for(j = 0; j < myNbTimes2; j++) { + DX = i * myStep1 * Vec1.X() + j * myStep2 * Vec2.X(); + DY = i * myStep1 * Vec1.Y() + j * myStep2 * Vec2.Y(); + DZ = i * myStep1 * Vec1.Z() + j * myStep2 * Vec2.Z(); + myVec.SetCoord(DX, DY, DZ); - theTransformation.SetTranslation(myVec) ; - BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False) ; - B.Add( compound, myBRepTransformation.Shape() ); + theTransformation.SetTranslation(myVec); + BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False); + B.Add(compound, myBRepTransformation.Shape()); } } - mySimulationTopoDs = compound ; - myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; + mySimulationTopoDs = compound; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); break; } } } catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeMultitranslationSimulationAndDisplay" ) ; - return ; + MESSAGE("Exception catched in MakeMultitranslationSimulationAndDisplay"); + return; } - return ; + return; } diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h index acf17c231..26b39d78a 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h @@ -29,141 +29,67 @@ #ifndef DIALOGBOX_MULTITRANSLATION_H #define DIALOGBOX_MULTITRANSLATION_H -#include "TransformationGUI.h" +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel2Spin1Check.h" +#include "DlgRef_3Sel4Spin2Check.h" -#include "GEOM_EdgeFilter.hxx" -#include "DlgRef_SpinBox.h" +#include "TransformationGUI.h" +#include "GEOM_ShapeTypeFilter.hxx" #include #include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QSpinBox; -class QLineEdit; -class QPushButton; -class QSpinBox; -class QRadioButton; - //================================================================================= // class : TransformationGUI_MultiTranslationDlg // purpose : //================================================================================= -class TransformationGUI_MultiTranslationDlg : public QDialog +class TransformationGUI_MultiTranslationDlg : public GEOMBase_Skeleton { Q_OBJECT public: - TransformationGUI_MultiTranslationDlg( QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + TransformationGUI_MultiTranslationDlg(QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~TransformationGUI_MultiTranslationDlg(); private : - TransformationGUI* myTransformationGUI; - 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 */ - TopoDS_Shape myBase ; - GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */ - - gp_Vec myVec ; - int myNbTimes1 ; - int myNbTimes2 ; - Standard_Real myStep1 ; - Standard_Real myStep2 ; - gp_Dir myDir1 ; - gp_Dir myDir2 ; - - bool myOkBase ; - bool myOkDir1 ; - bool myOkDir2 ; - - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeMultiTranslationSimulationAndDisplay() ; + void Init(); + void enterEvent(QEvent* e); + void MakeMultiTranslationSimulationAndDisplay(); - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - - QLabel* TextLabelC1A3; - QLabel* TextLabelC1A4; - DlgRef_SpinBox* SpinBox_C1A3 ; - QSpinBox* SpinBox_C1A4 ; - - QGroupBox* GroupC2; - QPushButton* SelectButtonC2A2; - QLineEdit* LineEditC2A1; - QLineEdit* LineEditC2A2; - QPushButton* SelectButtonC2A1; - QLineEdit* LineEditC2A3; - QPushButton* SelectButtonC2A3; - QLabel* TextLabelC2A1; - QLabel* TextLabelC2A2; - QLabel* TextLabelC2A3; - - QLabel* TextLabelC2A4; - QLabel* TextLabelC2A5; - QLabel* TextLabelC2A6; - QLabel* TextLabelC2A7; - DlgRef_SpinBox* SpinBox_C2A4 ; - QSpinBox* SpinBox_C2A5; - DlgRef_SpinBox* SpinBox_C2A6 ; - QSpinBox* SpinBox_C2A7 ; + TransformationGUI* myTransformationGUI; - QCheckBox* CheckBoxReverse0; - QCheckBox* CheckBoxReverse1; - QCheckBox* CheckBoxReverse2; + double step; + int myConstructorId; /* Current constructor id = radio button id */ + Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */ + + TopoDS_Shape myBase; + GEOM::GEOM_Shape_var myGeomShape; /* is myBase */ + gp_Vec myVec; + int myNbTimes1; + int myNbTimes2; + Standard_Real myStep1; + Standard_Real myStep2; + gp_Dir myDir1; + gp_Dir myDir2; + bool myOkBase; + bool myOkDir1; + bool myOkDir2; + + DlgRef_2Sel2Spin1Check* GroupPoints; + DlgRef_3Sel4Spin2Check* GroupDimensions; private slots: - - void ConstructorsClicked(int constructorId); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void LineEditReturnPressed() ; - void ReverseAngle1(int) ; - void ReverseAngle2(int) ; - void ValueChangedInSpinBox( double newValue ) ; /* for TransformationGUI_SpinBox */ - void ValueChangedInt( int newIntValue ) ; /* for QT spin box ! not const ! */ + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ReverseAngle1(int state); + void ReverseAngle2(int state); + void ValueChangedInSpinBox(double newValue); + void ConstructorsClicked(int constructorId); -protected: - QGridLayout* TransformationGUI_MultiTranslationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; }; #endif // DIALOGBOX_MULTITRANSLATION_H diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index 69a1b60d3..c021fcbfe 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -29,7 +29,6 @@ using namespace std; #include "TransformationGUI_RotationDlg.h" -#include "QAD_Config.h" #include #include @@ -91,17 +90,14 @@ void TransformationGUI_RotationDlg::Init() /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; - myAngle = 45.0; + myAngle = 0.0; myOkBase = myOkAxis = false; myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom); - /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - step = St.toDouble(); - + double SpecificStep = 5; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, SpecificStep, 3); GroupPoints->SpinBox_DX->SetValue(myAngle); /* signals and slots connections */ @@ -257,6 +253,8 @@ void TransformationGUI_RotationDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.h b/src/TransformationGUI/TransformationGUI_RotationDlg.h index c04d84bc6..c0cda42cc 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.h +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.h @@ -56,7 +56,6 @@ private : TransformationGUI* myTransformationGUI; - double step; Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */ TopoDS_Shape myBase; diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index 86b512d78..64e1227a3 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -29,7 +29,6 @@ using namespace std; #include "TransformationGUI_ScaleDlg.h" -#include "QAD_Config.h" #include //================================================================================= @@ -95,12 +94,9 @@ void TransformationGUI_ScaleDlg::Init() myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); - /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - step = St.toDouble(); - + double SpecificStep = 0.5; /* min, max, step and decimals for spin boxes & initial values */ - GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, SpecificStep, 3); GroupPoints->SpinBox_DX->SetValue(myFactor); /* signals and slots connections */ @@ -254,6 +250,8 @@ void TransformationGUI_ScaleDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; if(!mySimulationTopoDs.IsNull()) myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.h b/src/TransformationGUI/TransformationGUI_ScaleDlg.h index 6e6cf8bf2..bb7c59c51 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.h +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.h @@ -55,7 +55,6 @@ private : TransformationGUI* myTransformationGUI; - double step; Handle(GEOM_ShapeTypeFilter) myVertexFilter; gp_Pnt myPoint1; /* Points containing the vector */ diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index ef8015c88..857f54db4 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -89,7 +89,7 @@ void TransformationGUI_TranslationDlg::Init() /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; - myVec.SetCoord(100.0, 100.0, 100.0); + myVec.SetCoord(0.0, 0.0, 0.0); myOkBase = false; /* Get setting of step value from file configuration */ @@ -101,9 +101,9 @@ void TransformationGUI_TranslationDlg::Init() GroupPoints->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); GroupPoints->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); - GroupPoints->SpinBox_DX->SetValue(100.0); - GroupPoints->SpinBox_DY->SetValue(100.0); - GroupPoints->SpinBox_DZ->SetValue(100.0); + GroupPoints->SpinBox_DX->SetValue(0.0); + GroupPoints->SpinBox_DY->SetValue(0.0); + GroupPoints->SpinBox_DZ->SetValue(0.0); /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));