diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index e00ea89cd..12eff04d7 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -229,6 +229,7 @@ module GEOM in double WaterDensity, in double MeshingDeflection) raises (SALOME::SALOME_Exception); + //-----------------------------------------------------------// // Build // //-----------------------------------------------------------// @@ -238,6 +239,8 @@ module GEOM GEOM_Shape MakeCompound (in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ; GEOM_Shape MakeFace (in GEOM_Shape shapeWire, in boolean wantplanarface ) raises (SALOME::SALOME_Exception) ; + GEOM_Shape MakeShell (in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ; + GEOM_Shape MakeSolid (in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ; //-----------------------------------------------------------// diff --git a/resources/GEOM_en.xml b/resources/GEOM_en.xml index c2d623628..1b6fdcc20 100644 --- a/resources/GEOM_en.xml +++ b/resources/GEOM_en.xml @@ -41,28 +41,28 @@ - - - - - - - + + + + + + + - - - + + + - - - - - - + + + + + + - + @@ -70,104 +70,106 @@ - - - + + + - - + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - + + - - + + - - + + - - - + + + + + - - + + - - + + - - - + + + - + - - + + - + + - - - + + - - - + + + @@ -176,12 +178,12 @@ - + - - - - + + + + @@ -192,29 +194,29 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + - - - - + + + + @@ -225,28 +227,28 @@ - - - - + + + + - - + + - + - - - + + + - + @@ -256,17 +258,17 @@ - - + + - - - + + + - + - - + + diff --git a/resources/build_shell.png b/resources/build_shell.png index 993902335..fc13a46f5 100644 Binary files a/resources/build_shell.png and b/resources/build_shell.png differ diff --git a/resources/build_solid.png b/resources/build_solid.png index 45e0efb7f..14b89582d 100644 Binary files a/resources/build_solid.png and b/resources/build_solid.png differ diff --git a/resources/ellipse.png b/resources/ellipse.png index 8cd0e4aed..1d6f199fc 100755 Binary files a/resources/ellipse.png and b/resources/ellipse.png differ diff --git a/resources/ellipsepointvector.png b/resources/ellipsepointvector.png index 8cd0e4aed..1d6f199fc 100755 Binary files a/resources/ellipsepointvector.png and b/resources/ellipsepointvector.png differ diff --git a/resources/supressHolesOnFaceShell.png b/resources/supressHolesOnFaceShell.png index 99eb53ae3..358793969 100755 Binary files a/resources/supressHolesOnFaceShell.png and b/resources/supressHolesOnFaceShell.png differ diff --git a/resources/supresshole.png b/resources/supresshole.png index 87dbdaa9c..071790cf1 100755 Binary files a/resources/supresshole.png and b/resources/supresshole.png differ diff --git a/src/BasicGUI/BasicGUI.cxx b/src/BasicGUI/BasicGUI.cxx new file mode 100644 index 000000000..54e4116cb --- /dev/null +++ b/src/BasicGUI/BasicGUI.cxx @@ -0,0 +1,445 @@ +// 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 : BasicGUI.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "BasicGUI.h" + +#include "QAD_RightFrame.h" +#include "OCCViewer_Viewer3d.h" +#include "OCCViewer_ViewPort3d.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include +#include +#include +#include + +#include "BasicGUI_PointDlg.h" // Method POINT +#include "BasicGUI_LineDlg.h" // Method LINE +#include "BasicGUI_CircleDlg.h" // Method CIRCLE +#include "BasicGUI_EllipseDlg.h" // Method ELLIPSE +#include "BasicGUI_ArcDlg.h" // Method ARC +#include "BasicGUI_VectorDlg.h" // Method VECTOR +#include "BasicGUI_PlaneDlg.h" // Method PLANE +#include "BasicGUI_WorkingPlaneDlg.h" // Method WORKING PLANE + +//======================================================================= +// function : BasicGUI() +// purpose : Constructor +//======================================================================= +BasicGUI::BasicGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; +} + + +//======================================================================= +// function : ~BasicGUI() +// purpose : Destructor +//======================================================================= +BasicGUI::~BasicGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool BasicGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + BasicGUI* myBasicGUI = new BasicGUI(); + myBasicGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + + switch (theCommandID) + { + case 4011: // POINT + { + Handle(AIS_InteractiveContext) ic; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + ic = v3d->getAISContext(); + } + BasicGUI_PointDlg *aDlg = new BasicGUI_PointDlg(parent, "", myBasicGUI, Sel, ic); + break; + } + case 4012: // LINE + { + BasicGUI_LineDlg *aDlg = new BasicGUI_LineDlg(parent, "", myBasicGUI, Sel); + break; + } + case 4013: // CIRCLE + { + BasicGUI_CircleDlg *aDlg = new BasicGUI_CircleDlg(parent, "", myBasicGUI, Sel); + break; + } + case 4014: // ELLIPSE + { + BasicGUI_EllipseDlg *aDlg = new BasicGUI_EllipseDlg(parent, "", myBasicGUI, Sel); + break; + } + case 4015: // ARC + { + BasicGUI_ArcDlg *aDlg = new BasicGUI_ArcDlg(parent, "", myBasicGUI, Sel); + break ; + } + case 4016: // VECTOR + { + BasicGUI_VectorDlg *aDlg = new BasicGUI_VectorDlg(parent, "", myBasicGUI, Sel); + break; + } + case 4017: // PLANE + { + BasicGUI_PlaneDlg *aDlg = new BasicGUI_PlaneDlg(parent, "", myBasicGUI, Sel); + break; + } + case 4018: // WORKING PLANE + { + BasicGUI_WorkingPlaneDlg *aDlg = new BasicGUI_WorkingPlaneDlg(parent, "", myBasicGUI, Sel); + break; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//================================================================================= +// function : 0nMousePress() +// purpose : [static] manage mouse events +//================================================================================= +bool BasicGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) +{ + BasicGUI* myBasicGUI = new BasicGUI(); + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort(); + + /* Get the clicked or selected point */ + gp_Pnt thePoint; + + myBasicGUI->myGeomBase->EraseSimulationShape(); + BasicGUI_PointDlg *DialogPt = (BasicGUI_PointDlg*)(myBasicGUI->myGeomGUI->GetActiveDialogBox()); + + if(DialogPt->UseLocalContext()) { + ic->InitSelected(); + if(pe->state() == Qt::ShiftButton) + v3d->getAISSelector()->shiftSelect(); /* Append selection */ + else + v3d->getAISSelector()->select(); /* New selection */ + + ic->InitSelected(); + if(ic->MoreSelected()) + thePoint = BRep_Tool::Pnt(TopoDS::Vertex(ic->SelectedShape())); + else + thePoint = myBasicGUI->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView()); + } + else + thePoint = myBasicGUI->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView()); + + if(DialogPt != 0) + DialogPt->PointIntoCoordinates(thePoint, true); /* display point */ + else + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + + return false; +} + + +//======================================================================= +// 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 : +//======================================================================= +void BasicGUI::MakePointAndDisplay(const double x, const double y, const double z) +{ + try { + GEOM::GEOM_Shape_var P = myGeom->MakeVertex(x, y, z); + P->NameType(tr("GEOM_VERTEX")); + if (myGeomBase->Display(P)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeLineAndDisplay() +// purpose : Create an infinite oriented line (linear edge in fact) +//===================================================================================== +void BasicGUI::MakeLineAndDisplay(const gp_Pnt InitPoint, const gp_Pnt LastPoint) +{ + gp_Pnt P1, P2; + double dx, dy, dz; + myGeomBase->GetBipointDxDyDz(InitPoint, LastPoint, dx, dy, dz); + Standard_Real length = InitPoint.Distance(LastPoint); + if(length <= Precision::Confusion()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + + Standard_Real coeff = 1E6 / length; + + /* To create a line with length = 1E6 */ + /* Precision::Infinite() is 1E100 in OCC */ + P1.SetX(InitPoint.X() - (coeff * dx)); + P1.SetY(InitPoint.Y() - (coeff * dy)); + P1.SetZ(InitPoint.Z() - (coeff * dz)); + + P2.SetX(LastPoint.X() + (coeff * dx)); + P2.SetY(LastPoint.Y() + (coeff * dy)); + P2.SetZ(LastPoint.Z() + (coeff * dz)); + + try { + GEOM::PointStruct pstruct = myGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z()); + GEOM::PointStruct d = myGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z()); + GEOM::DirStruct dstruct = myGeom->MakeDirection(d); + + GEOM::GEOM_Shape_ptr result = myGeom->MakeLine(pstruct, dstruct); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + result->NameType(tr("GEOM_LINE")); + + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeCircleAndDisplay() +// purpose : +//===================================================================================== +void BasicGUI::MakeCircleAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Radius) +{ + try { + GEOM::PointStruct pstruct = myGeom->MakePointStruct(CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z()); + GEOM::PointStruct d = myGeom->MakePointStruct(dir.X(), dir.Y(), dir.Z()); + GEOM::DirStruct dstruct = myGeom->MakeDirection(d); + + GEOM::GEOM_Shape_var result = myGeom->MakeCircle(pstruct, dstruct, Radius); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + result->NameType(tr("GEOM_CIRCLE")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeEllipseAndDisplay() +// purpose : +//===================================================================================== +void BasicGUI::MakeEllipseAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir, + const Standard_Real Major_Radius, const Standard_Real Minor_Radius) +{ + try { + GEOM::PointStruct pstruct = myGeom->MakePointStruct(CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z()); + GEOM::PointStruct d = myGeom->MakePointStruct(dir.X(), dir.Y(), dir.Z()); + GEOM::DirStruct dstruct = myGeom->MakeDirection(d) ; + + GEOM::GEOM_Shape_var result = myGeom->MakeEllipse(pstruct, dstruct, Major_Radius, Minor_Radius); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + result->NameType(tr("GEOM_ELLIPSE")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//======================================================================================= +// function : MakeArcAndDisplay() +// purpose : Make an arc of circle from InitPoint to CirclePoint and passing on EndPoint +//======================================================================================= +void BasicGUI::MakeArcAndDisplay(gp_Pnt InitPoint, gp_Pnt CirclePoint, gp_Pnt EndPoint) +{ + gp_Vec v1(CirclePoint, InitPoint); + gp_Vec v2(CirclePoint, EndPoint); + if(v1.IsParallel(v2, Precision::Angular())) + return; + + try { + GEOM::PointStruct pI = myGeom->MakePointStruct(InitPoint.X(), InitPoint.Y(), InitPoint.Z()); + GEOM::PointStruct pC = myGeom->MakePointStruct(CirclePoint.X(), CirclePoint.Y(), CirclePoint.Z()); + GEOM::PointStruct pE = myGeom->MakePointStruct(EndPoint.X(), EndPoint.Y(), EndPoint.Z()); + GEOM::GEOM_Shape_var result = myGeom->MakeArc(pI, pC, pE); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + result->NameType(tr("GEOM_ARC")); + if (myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//======================================================================= +// function : MakeVectorAndDisplay() +// purpose : +//======================================================================= +void BasicGUI::MakeVectorAndDisplay(const gp_Pnt P1, const gp_Pnt P2) +{ + try { + GEOM::PointStruct pstruct1 = myGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z()); + GEOM::PointStruct pstruct2 = myGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z()); + GEOM::GEOM_Shape_var Vector = myGeom->MakeVector(pstruct1, pstruct2); + Vector->NameType(tr("GEOM_VECTOR")); + if(myGeomBase->Display(Vector)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//======================================================================= +// function : MakePlaneAndDisplay() +// purpose : Plane point is P1 and dx, dy, dz define a normal vector +//======================================================================= +void BasicGUI::MakePlaneAndDisplay(const gp_Pnt P1, const Standard_Real dx, const Standard_Real dy, + const Standard_Real dz, const Standard_Real TrimSize) +{ + try { + gp_Dir aDirection; + aDirection.SetCoord(dx, dy, dz); + gp_Ax2 Axis(P1, aDirection); + + GEOM::PointStruct pstruct = myGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z()); + GEOM::PointStruct d = myGeom->MakePointStruct(aDirection.X(), aDirection.Y(), aDirection.Z()); + GEOM::DirStruct dstruct = myGeom->MakeDirection(d); + GEOM::GEOM_Shape_ptr plane = myGeom->MakePlane(pstruct, dstruct, TrimSize); + plane->NameType(tr("GEOM_PLANE")); + if(myGeomBase->Display(plane)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//======================================================================= +// function : MakeWorkingPlane() +// purpose : Change the point of view3d +//======================================================================= +void BasicGUI::MakeWorkingPlane(const gp_Pnt P, const gp_Dir D) +{ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER")); + return; + } + + OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort(); + Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)vp)->getView(); + view3d->SetAt(P.X(), P.Y(), P.Z()); + view3d->SetProj(D.X(), D.Y(), D.Z()); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + return; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return BasicGUI::OnGUIEvent(theCommandID, parent);} + + bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) + {return BasicGUI::OnMousePress(pe, parent, studyFrame);} +} diff --git a/src/BasicGUI/BasicGUI.h b/src/BasicGUI/BasicGUI.h new file mode 100644 index 000000000..ef5d957f1 --- /dev/null +++ b/src/BasicGUI/BasicGUI.h @@ -0,0 +1,69 @@ +// 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 : BasicGUI.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef BASICGUI_H +#define BASICGUI_H + +#include "GEOMBase.h" +#include + +//================================================================================= +// class : BasicGUI +// purpose : +//================================================================================= +class BasicGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + BasicGUI(); + ~BasicGUI(); + + 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); + void MakeEllipseAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir, + const Standard_Real Major_Radius, const Standard_Real Minor_Radius); + void MakeArcAndDisplay(gp_Pnt InitPoint, gp_Pnt CirclePoint, gp_Pnt EndPoint); + void MakeVectorAndDisplay(const gp_Pnt P1, const gp_Pnt P2); + void MakePlaneAndDisplay(const gp_Pnt P1, const Standard_Real dx, const Standard_Real dy, + const Standard_Real dz, const Standard_Real TrimSize); + void MakeWorkingPlane(const gp_Pnt P, const gp_Dir D); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx new file mode 100644 index 000000000..33f929e3d --- /dev/null +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -0,0 +1,309 @@ +// 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 : BasicGUI_ArcDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BasicGUI_ArcDlg.h" + +#include +#include +#include +#include + +//================================================================================= +// class : BasicGUI_ArcDlg() +// purpose : Constructs a BasicGUI_ArcDlg 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. +//================================================================================= +BasicGUI_ArcDlg::BasicGUI_ArcDlg(QWidget* parent, const char* name, BasicGUI* theBasicGUI, 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_ARC"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_ARC_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_ARC")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_3Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_POINTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); + GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); + GroupPoints->TextLabel3->setText(tr("GEOM_POINT_I").arg("3")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + GroupPoints->PushButton3->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myBasicGUI = theBasicGUI; + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_ArcDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_ArcDlg::~BasicGUI_ArcDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + myOkPoint1 = myOkPoint2 = myOkPoint3 = false; + + /* Vertices Filter for all arguments */ + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* signals and slots connections */ + 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkPoint1 && myOkPoint2 && myOkPoint3) + myBasicGUI->MakeArcAndDisplay(myPoint1, myPoint2, myPoint3); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_ArcDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel != 1) { + if (myEditCurrentArgument == GroupPoints->LineEdit1) + myOkPoint1 = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkPoint2 = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit3) + myOkPoint3 = false; + return; + } + + // nbSel == 1 + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + myEditCurrentArgument->setText(aString); + myOkPoint1 = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint2)) { + myEditCurrentArgument->setText(aString); + myOkPoint2 = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit3 && myGeomBase->VertexToPoint(S, myPoint3)) { + myEditCurrentArgument->setText(aString); + myOkPoint3 = true; + } + + if(myOkPoint1 && myOkPoint2 && myOkPoint3) + this->MakeArcSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + mySelection->ClearFilters(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + } + else if(send == GroupPoints->PushButton3) { + GroupPoints->LineEdit3->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit3; + } + mySelection->AddFilter(myVertexFilter); + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::LineEditReturnPressed() +{ + 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 + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myVertexFilter); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : MakeArcSimulationAndDisplay() +// purpose : +//================================================================================= +void BasicGUI_ArcDlg::MakeArcSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + if(myPoint2.IsEqual(myPoint1, Precision::Confusion()) || + myPoint2.IsEqual(myPoint3, Precision::Confusion())) { + myEditCurrentArgument->setText(""); + return; + } + + gp_Vec v1(myPoint2, myPoint1); + gp_Vec v2(myPoint2, myPoint3); + if(v1.IsParallel(v2, Precision::Angular())) { + myEditCurrentArgument->setText(""); + return; + } + + GC_MakeArcOfCircle Arc(myPoint1, myPoint2, myPoint3); + if(Arc.IsDone()) { + Handle(Geom_TrimmedCurve) curve = Arc.Value(); + mySimulationTopoDs = BRepBuilderAPI_MakeEdge(curve).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeArcSimulationAndDisplay"); + } + return; +} diff --git a/src/BasicGUI/BasicGUI_ArcDlg.h b/src/BasicGUI/BasicGUI_ArcDlg.h new file mode 100644 index 000000000..408e7077b --- /dev/null +++ b/src/BasicGUI/BasicGUI_ArcDlg.h @@ -0,0 +1,77 @@ +// 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 : BasicGUI_ArcDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_ARC_H +#define DIALOGBOX_ARC_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_3Sel_QTD.h" + +#include "BasicGUI.h" +#include "GEOM_ShapeTypeFilter.hxx" + +//================================================================================= +// class : BasicGUI_ArcDlg +// purpose : +//================================================================================= +class BasicGUI_ArcDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BasicGUI_ArcDlg( QWidget* parent = 0, const char* name = 0, BasicGUI* theBasicGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~BasicGUI_ArcDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakeArcSimulationAndDisplay(); + + BasicGUI* myBasicGUI; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */ + + gp_Pnt myPoint1; + gp_Pnt myPoint2; + gp_Pnt myPoint3; + bool myOkPoint1; + bool myOkPoint2; + bool myOkPoint3; + + DlgRef_3Sel_QTD* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + +}; + +#endif // DIALOGBOX_ARC_H diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx new file mode 100644 index 000000000..b29e778fe --- /dev/null +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -0,0 +1,311 @@ +// 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 : BasicGUI_CircleDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BasicGUI_CircleDlg.h" + +#include +#include +#include +#include +#include "QAD_Config.h" + +//================================================================================= +// class : BasicGUI_CircleDlg() +// purpose : Constructs a BasicGUI_CircleDlg 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. +//================================================================================= +BasicGUI_CircleDlg::BasicGUI_CircleDlg(QWidget* parent, const char* name, BasicGUI* theBasicGUI, 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_CIRCLE_PV"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_CIRCLE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_CIRCLE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel1Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_CENTER_POINT")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myBasicGUI = theBasicGUI; + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_CircleDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_CircleDlg::~BasicGUI_CircleDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myRadius = 100.0; + myOkPoint1 = myOkDir = false; + + myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom); + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupPoints->SpinBox_DX->SetValue(myRadius); + + /* signals and slots connections */ + 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkPoint1 && myOkDir) + myBasicGUI->MakeCircleAndDisplay(myPoint1, myDir, myRadius); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_CircleDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkPoint1 = false; + else if (myEditCurrentArgument == GroupPoints->LineEdit2) + myOkDir = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + /* gp_Pnt : not used */ + if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + GroupPoints->LineEdit1->setText(aString); + myOkPoint1 = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + BRepAdaptor_Curve curv(TopoDS::Edge(S)); + myDir = curv.Line().Direction(); + GroupPoints->LineEdit2->setText(aString); + myOkDir = true; + } + + if(myOkPoint1 && myOkDir) + this->MakeCircleSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + mySelection->ClearFilters(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + mySelection->AddFilter(myVertexFilter); + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + mySelection->AddFilter(myEdgeFilter); + } + this->SelectionIntoArgument(); + + return; +} + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::ValueChangedInSpinBox(double newValue) +{ + myRadius = newValue; + if(myOkPoint1 && myOkDir) + MakeCircleSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : MakeCircleSimulationAndDisplay() +// purpose : +//================================================================================= +void BasicGUI_CircleDlg::MakeCircleSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + gp_Ax2 anAxis(myPoint1, myDir); + gp_Circ circ(anAxis, myRadius); + BRepBuilderAPI_MakeEdge MakeEdge(circ); + mySimulationTopoDs = MakeEdge.Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeCircleSimulationAndDisplay"); + } + return; +} diff --git a/src/BasicGUI/BasicGUI_CircleDlg.h b/src/BasicGUI/BasicGUI_CircleDlg.h new file mode 100644 index 000000000..1ed69fb55 --- /dev/null +++ b/src/BasicGUI/BasicGUI_CircleDlg.h @@ -0,0 +1,82 @@ +// 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 : BasicGUI_CircleDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_CIRCLE_H +#define DIALOGBOX_CIRCLE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel1Spin.h" + +#include "BasicGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" +#include + +//================================================================================= +// class : BasicGUI_CircleDlg +// purpose : +//================================================================================= +class BasicGUI_CircleDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BasicGUI_CircleDlg(QWidget* parent = 0, const char* name = 0, BasicGUI* theBasicGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BasicGUI_CircleDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakeCircleSimulationAndDisplay(); + + BasicGUI* myBasicGUI; + + double step; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; + Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filter selection */ + + gp_Pnt myPoint1; + gp_Dir myDir; + Standard_Real myRadius; + bool myOkPoint1; + bool myOkDir; + + DlgRef_2Sel1Spin* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_CIRCLE_H diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx new file mode 100644 index 000000000..6093d492b --- /dev/null +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -0,0 +1,325 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE +// +// 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 : BasicGUI_EllipseDlg.cxx +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BasicGUI_EllipseDlg.h" + +#include +#include +#include +#include +#include "QAD_Config.h" + +//================================================================================= +// class : BasicGUI_EllipseDlg() +// purpose : Constructs a BasicGUI_EllipseDlg 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. +//================================================================================= +BasicGUI_EllipseDlg::BasicGUI_EllipseDlg(QWidget* parent, const char* name, BasicGUI* theBasicGUI, 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_ELLIPSE_PV"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_ELLIPSE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_ELLIPSE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel2Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_CENTER")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_MINOR")); + GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_MAJOR")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myBasicGUI = theBasicGUI; + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_EllipseDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_EllipseDlg::~BasicGUI_EllipseDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myMajorRadius = 200.0; + myMinorRadius = 100.0; + myOkPoint = myOkDir = false; + + myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom); + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + /* 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_DX->SetValue(myMajorRadius); + GroupPoints->SpinBox_DY->SetValue(myMinorRadius); + + /* signals and slots connections */ + 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, 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(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkPoint && myOkDir) + myBasicGUI->MakeEllipseAndDisplay(myPoint, myDir, myMajorRadius, myMinorRadius); +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_EllipseDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkPoint = false; + else if (myEditCurrentArgument == GroupPoints->LineEdit2) + myOkDir = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + /* gp_Pnt : not used */ + if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint)) { + GroupPoints->LineEdit1->setText(aString); + myOkPoint = true; + } + else if (myEditCurrentArgument == GroupPoints->LineEdit2) { + BRepAdaptor_Curve curv(TopoDS::Edge(S)); + myDir = curv.Line().Direction(); + GroupPoints->LineEdit2->setText(aString); + myOkDir = true; + } + + if(myOkPoint && myOkDir) + this->MakeEllipseSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + mySelection->ClearFilters(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + mySelection->AddFilter(myVertexFilter); + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + mySelection->AddFilter(myEdgeFilter); + } + this->SelectionIntoArgument(); + + return; +} + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::ValueChangedInSpinBox(double newValue) +{ + QObject* send = (QObject*)sender(); + + if(send == GroupPoints->SpinBox_DX ) + myMajorRadius = newValue; + else if(send == GroupPoints->SpinBox_DY) + myMinorRadius = newValue; + + if (myOkPoint && myOkDir) + MakeEllipseSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : MakeEllipseSimulationAndDisplay() +// purpose : +//================================================================================= +void BasicGUI_EllipseDlg::MakeEllipseSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myMajorRadius < myMinorRadius) + return; + + try { + gp_Ax2 anAxis(myPoint, myDir); + gp_Elips ellipse(anAxis, myMajorRadius, myMinorRadius); + BRepBuilderAPI_MakeEdge MakeEdge(ellipse); + mySimulationTopoDs = MakeEdge.Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeEllipseSimulationAndDisplay"); + } + return; +} diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.h b/src/BasicGUI/BasicGUI_EllipseDlg.h new file mode 100644 index 000000000..512b0c322 --- /dev/null +++ b/src/BasicGUI/BasicGUI_EllipseDlg.h @@ -0,0 +1,83 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE +// +// 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 : BasicGUI_EllipseDlg.h +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +#ifndef BASICGUI_ELLIPSE_H +#define BASICGUI_ELLIPSE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel2Spin.h" + +#include "BasicGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" +#include + +//================================================================================= +// class : BasicGUI_EllipseDlg +// purpose : +//================================================================================= +class BasicGUI_EllipseDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BasicGUI_EllipseDlg(QWidget* parent = 0, const char* name = 0, BasicGUI* theBasicGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BasicGUI_EllipseDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakeEllipseSimulationAndDisplay(); + + BasicGUI* myBasicGUI; + + double step; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; + Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filter selection */ + + gp_Pnt myPoint; /* Central point of ellipse */ + bool myOkPoint; /* true when myPoint is defined */ + gp_Dir myDir; /* to set normal axis of ellipse */ + bool myOkDir; /* true when myPoint is defined */ + + Standard_Real myMajorRadius; + Standard_Real myMinorRadius; + + DlgRef_2Sel2Spin* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // BASICGUI_ELLIPSE_H diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx new file mode 100644 index 000000000..b5b649821 --- /dev/null +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -0,0 +1,290 @@ +// 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 : BasicGUI_LineDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BasicGUI_LineDlg.h" + +#include +#include +#include +#include + +//================================================================================= +// class : BasicGUI_LineDlg() +// purpose : Constructs a BasicGUI_LineDlg 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. +//================================================================================= +BasicGUI_LineDlg::BasicGUI_LineDlg(QWidget* parent, const char* name, BasicGUI* theBasicGUI, 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_LINE_2P"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_LINE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_LINE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_POINTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); + GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myBasicGUI = theBasicGUI; + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_LineDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_LineDlg::~BasicGUI_LineDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_LineDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myPoint1.SetCoord(0.0, 0.0, 0.0); + myPoint2.SetCoord(0.0, 0.0, 0.0); + myOkPoint1 = myOkPoint2 = false; + + /* Vertices Filter for all arguments */ + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* signals and slots connections */ + 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_LineDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BasicGUI_LineDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkPoint1 && myOkPoint2) + myBasicGUI->MakeLineAndDisplay(myPoint1, myPoint2); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_LineDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkPoint1 = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkPoint2 = false; + return; + } + + // nbSel == 1 + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + myEditCurrentArgument->setText(aString); + myOkPoint1 = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint2)) { + myEditCurrentArgument->setText(aString); + myOkPoint2 = true; + } + + if(myOkPoint1 && myOkPoint2 && myPoint1.Distance(myPoint2) > Precision::Confusion()) + this->MakeLineSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_LineDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + 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(myVertexFilter); + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_LineDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if(send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BasicGUI_LineDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myVertexFilter); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_LineDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : MakeLineSimulationAndDisplay() +// purpose : An arrow (cone topology) is added to 'modifiedShape' +// : to simulate a vector or an 'oriented line' display. The result is in 'modifiedShape'. +// : If an arrow can't be added returns false and 'modifiedShape' isn't modified ! +//================================================================================= +void BasicGUI_LineDlg::MakeLineSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape(); + TopoDS_Shape arrow; + if(myGeomBase->CreateArrowForLinearEdge(mySimulationTopoDs, arrow)) { + TopoDS_Compound Comp; + BRep_Builder B; + B.MakeCompound (Comp); + B.Add(Comp, mySimulationTopoDs); + B.Add(Comp, arrow); + mySimulationTopoDs = Comp; + } + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeLineSimulationAndDisplay"); + return; + } + return; +} diff --git a/src/BasicGUI/BasicGUI_LineDlg.h b/src/BasicGUI/BasicGUI_LineDlg.h new file mode 100644 index 000000000..a30885753 --- /dev/null +++ b/src/BasicGUI/BasicGUI_LineDlg.h @@ -0,0 +1,75 @@ +// 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 : BasicGUI_LineDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_LINE_H +#define DIALOGBOX_LINE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel_QTD.h" + +#include "BasicGUI.h" +#include "GEOM_ShapeTypeFilter.hxx" + +//================================================================================= +// class : BasicGUI_LineDlg +// purpose : +//================================================================================= +class BasicGUI_LineDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BasicGUI_LineDlg(QWidget* parent = 0, const char* name = 0, BasicGUI* theBasicGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BasicGUI_LineDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakeLineSimulationAndDisplay(); + + BasicGUI* myBasicGUI; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */ + + gp_Pnt myPoint1; /* Points containing the vector */ + gp_Pnt myPoint2; + bool myOkPoint1; /* Are true when myPoint is defined */ + bool myOkPoint2; + + DlgRef_2Sel_QTD* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + +}; + +#endif // DIALOGBOX_LINE_H diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx new file mode 100644 index 000000000..cd429b1bc --- /dev/null +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -0,0 +1,588 @@ +// 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 : BasicGUI_PlaneDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BasicGUI_PlaneDlg.h" + +#include +#include +#include +#include +#include +#include +#include "QAD_Config.h" + +//================================================================================= +// class : BasicGUI_PlaneDlg() +// purpose : Constructs a BasicGUI_PlaneDlg 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. +//================================================================================= +BasicGUI_PlaneDlg::BasicGUI_PlaneDlg(QWidget* parent, const char* name, BasicGUI* theBasicGUI, 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_PLANE_PV"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_DXYZ"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_PLANE_FACE"))); + QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_PLANE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_PLANE")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->setPixmap(image2); + + GroupPointDirection = new DlgRef_2Sel1Spin(this, "GroupPointDirection"); + GroupPointDirection->GroupBox1->setTitle(tr("GEOM_PLANE_PV")); + GroupPointDirection->TextLabel1->setText(tr("GEOM_POINT")); + GroupPointDirection->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPointDirection->TextLabel3->setText(tr("GEOM_PLANE_SIZE")); + GroupPointDirection->PushButton1->setPixmap(image3); + GroupPointDirection->PushButton2->setPixmap(image3); + + GroupPointPlusCoordinates = new DlgRef_1Sel4Spin(this, "GroupPointPlusCoordinates" ); + GroupPointPlusCoordinates->GroupBox1->setTitle(tr("GEOM_PLANE_PVC")); + GroupPointPlusCoordinates->TextLabel1->setText(tr("GEOM_POINT")); + GroupPointPlusCoordinates->TextLabel2->setText(tr("GEOM_COOR")); + GroupPointPlusCoordinates->TextLabel3->setText(tr("GEOM_DX")); + GroupPointPlusCoordinates->TextLabel4->setText(tr("GEOM_DY")); + GroupPointPlusCoordinates->TextLabel5->setText(tr("GEOM_DZ")); + GroupPointPlusCoordinates->TextLabel6->setText(tr("GEOM_PLANE_SIZE")); + GroupPointPlusCoordinates->PushButton1->setPixmap(image3); + + GroupFace = new DlgRef_1Sel1Spin(this, "GroupFace"); + GroupFace->GroupBox1->setTitle(tr("GEOM_FACE")); + GroupFace->TextLabel1->setText(tr("GEOM_SELECTION")); + GroupFace->TextLabel2->setText(tr("GEOM_PLANE_SIZE")); + GroupFace->PushButton1->setPixmap(image3); + + Layout1->addWidget(GroupPointDirection, 1, 0); + Layout1->addWidget(GroupPointPlusCoordinates, 1, 0); + Layout1->addWidget(GroupFace, 1, 0); + /***************************************************************/ + + /* Initialisation */ + myBasicGUI = theBasicGUI; + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_PlaneDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_PlaneDlg::~BasicGUI_PlaneDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::Init() +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupPointDirection->LineEdit1; + + myPoint1.SetCoord(0.0, 0.0, 0.0); + myOkPoint1 = myOkDirection = myOkCoordinates = myOkPlanarFace = false; + + /* Filters definition */ + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom); + myFaceFilter = new GEOM_FaceFilter(StdSelect_Plane, myGeom); + /* Filter for the next selection */ + mySelection->AddFilter(myVertexFilter); + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + this->myTrimSize = 2000.0; + + /* min, max, step and decimals for spin boxes */ + GroupPointDirection->SpinBox_DX->RangeStepAndValidator(0.001, 10000000.0, step, 3); + GroupPointDirection->SpinBox_DX->SetValue(myTrimSize); + + 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, 3); + GroupPointPlusCoordinates->SpinBox_S->SetValue(myTrimSize) ; + + GroupFace->SpinBox_DX->RangeStepAndValidator(0.001, 10000000.0, step, 3); + GroupFace->SpinBox_DX->SetValue(myTrimSize); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + + connect(GroupPointDirection->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPointDirection->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPointPlusCoordinates->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupFace->PushButton1, SIGNAL(clicked()), this, SLOT( SetEditCurrentArgument())); + + connect(GroupPointDirection->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPointDirection->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPointPlusCoordinates->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupFace->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPointPlusCoordinates->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPointPlusCoordinates->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPointPlusCoordinates->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPointPlusCoordinates->SpinBox_S, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPointDirection->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupFace->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPointPlusCoordinates->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPointPlusCoordinates->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPointPlusCoordinates->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPointPlusCoordinates->SpinBox_S, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPointDirection->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupFace->SpinBox_DX, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* Displays Dialog */ + GroupPointPlusCoordinates->hide(); + GroupFace->hide(); + GroupPointDirection->show(); + this->show(); + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId) +{ + myConstructorId = constructorId; + mySelection->ClearFilters(); + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + myOkPoint1 = myOkDirection = myOkCoordinates = myOkPlanarFace = false; + + switch (constructorId) + { + case 0: /* plane from a point and a direction (vector, edge...) */ + { + GroupPointPlusCoordinates->hide(); + GroupFace->hide(); + resize(0, 0); + GroupPointDirection->show(); + + myEditCurrentArgument = GroupPointDirection->LineEdit1; + GroupPointDirection->LineEdit1->setText(tr("")); + GroupPointDirection->LineEdit2->setText(tr("")); + + /* for the first argument */ + mySelection->AddFilter(myVertexFilter); + break; + } + case 1: /* plane from a point and vector coordinates */ + { + GroupPointDirection->hide(); + GroupFace->hide(); + resize(0, 0); + GroupPointPlusCoordinates->show(); + + myEditCurrentArgument = GroupPointPlusCoordinates->LineEdit1; + GroupPointPlusCoordinates->LineEdit1->setText(tr("")); + GroupPointPlusCoordinates->SpinBox_DX->SetValue(0.0); + GroupPointPlusCoordinates->SpinBox_DY->SetValue(0.0); + GroupPointPlusCoordinates->SpinBox_DZ->SetValue(1.0); + myOkCoordinates = true; + + /* for the first argument */ + mySelection->AddFilter(myVertexFilter); + break; + } + case 2: /* plane from a planar face selection */ + { + GroupPointDirection->hide(); + GroupPointPlusCoordinates->hide(); + resize(0, 0); + GroupFace->show(); + + myEditCurrentArgument = GroupFace->LineEdit1; + GroupFace->LineEdit1->setText(tr("")); + + /* for the first argument */ + mySelection->AddFilter(myFaceFilter); + break; + } + } + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + switch(myConstructorId) + { + case 0 : /* args are myPoint1 and myDx, myDy, myDz from a vector(edge) */ + { + if(myOkPoint1 && myOkDirection) + myBasicGUI->MakePlaneAndDisplay(myPoint1, myDx, myDy, myDz, myTrimSize); + break; + } + case 1 : /* args are myPoint1 and myDx, myDy, myDz from a Spin Box */ + { + if(myOkPoint1) + myBasicGUI->MakePlaneAndDisplay(myPoint1, myDx, myDy, myDz, myTrimSize); + break; + } + case 2 : /* arg is a planar face selection */ + { + if(myOkPlanarFace) + myBasicGUI->MakePlaneAndDisplay(myPoint1, myDx, myDy, myDz, myTrimSize); + break; + } + } + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void BasicGUI_PlaneDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + QString aString = ""; + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + switch (myConstructorId) + { + case 0: + { + if(myEditCurrentArgument == GroupPointDirection->LineEdit1) { + GroupPointDirection->LineEdit1->setText(""); + myOkPoint1 = false ; + } + else if(myEditCurrentArgument == GroupPointDirection->LineEdit2) { + GroupPointDirection->LineEdit2->setText(""); + myOkDirection = false ; + } + break; + } + case 1: + { + if(myEditCurrentArgument == GroupPointPlusCoordinates->LineEdit1) { + GroupPointPlusCoordinates->LineEdit1->setText("") ; + myOkPoint1 = false ; + } + break; + } + case 2: + { + if(myEditCurrentArgument == GroupFace->LineEdit1) { + GroupFace->LineEdit1->setText("") ; + if(aString.compare("") == 0) + myOkPlanarFace = false; + else + myOkPlanarFace = true; + } + break; + } + } + return ; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return ; + + /* FIRST CONSTRUCTOR */ + if(myEditCurrentArgument == GroupPointDirection->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + GroupPointDirection->LineEdit1->setText(aString); + myOkPoint1 = true; + } + else if( myEditCurrentArgument == GroupPointDirection->LineEdit2) { + /* We verify if the selection is a linear edge */ + gp_Pnt Pfirst, Plast; + if( myGeomBase->LinearEdgeExtremities(S, Pfirst, Plast)) { + myGeomBase->GetBipointDxDyDz(Pfirst, Plast, myDx, myDy, myDz); + GroupPointDirection->LineEdit2->setText(aString); + myOkDirection = true; + myTrimSize = GroupPointDirection->SpinBox_DX->GetValue(); + } + } + + /* SECOND CONSTRUCTOR */ + else if(myEditCurrentArgument == GroupPointPlusCoordinates->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + GroupPointPlusCoordinates->LineEdit1->setText(aString); + /* Get arguments */ + myDx = GroupPointPlusCoordinates->SpinBox_DX->GetValue(); + myDy = GroupPointPlusCoordinates->SpinBox_DY->GetValue(); + myDz = GroupPointPlusCoordinates->SpinBox_DZ->GetValue(); + myTrimSize = GroupPointPlusCoordinates->SpinBox_S->GetValue(); + myOkPoint1 = true; + myOkCoordinates = true; + } + + /* THIRD CONSTRUCTOR */ + else if(myEditCurrentArgument == GroupFace->LineEdit1) { + if(myOkPlanarFace) { + GroupFace->LineEdit1->setText(aString); + BRepAdaptor_Surface surf(TopoDS::Face(S)); + gp_Pln Plane = surf.Plane(); + + gp_Pnt myPoint1 = Plane.Location(); + gp_Ax1 ax = Plane.Axis(); + myDx = (ax.Direction()).X(); + myDy = (ax.Direction()).Y(); + myDz = (ax.Direction()).Z(); + myTrimSize = GroupFace->SpinBox_DX->GetValue(); + } + } + + /* Call method simulation */ + if((myOkPoint1 && myOkDirection) || (myOkPoint1 && myOkCoordinates) || myOkPlanarFace) { + if(myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion()*Precision::Confusion()) + this->MakePlaneSimulationAndDisplay(); + } + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + mySelection->ClearFilters(); + + switch(myConstructorId) + { + case 0: + { + if(send == GroupPointDirection->PushButton1) { + GroupPointDirection->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPointDirection->LineEdit1; + mySelection->AddFilter(myVertexFilter); + } + else if(send == GroupPointDirection->PushButton2) { + GroupPointDirection->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPointDirection->LineEdit2; + /* Edge filter here */ + mySelection->AddFilter(myEdgeFilter); + } + break; + } + case 1: + { + if(send == GroupPointPlusCoordinates->PushButton1) { + GroupPointPlusCoordinates->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPointPlusCoordinates->LineEdit1; + /* Vertex filter here */ + mySelection->AddFilter(myVertexFilter); + } + break; + } + case 2: + { + if(send == GroupFace->PushButton1) { + GroupFace->LineEdit1->setFocus(); + myEditCurrentArgument = GroupFace->LineEdit1; + /* Face filter here */ + mySelection->AddFilter(myFaceFilter); + } + break; + } + } + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPointDirection->LineEdit1) + myEditCurrentArgument = GroupPointDirection->LineEdit1; + else if (send == GroupPointDirection->LineEdit2) + myEditCurrentArgument = GroupPointDirection->LineEdit2; + else if (send == GroupPointPlusCoordinates->LineEdit1) + myEditCurrentArgument = GroupPointPlusCoordinates->LineEdit1; + else if (send == GroupFace->LineEdit1) + myEditCurrentArgument = GroupFace->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return ; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::ValueChangedInSpinBox(double newValue) +{ + QObject* send = (QObject*)sender(); + + if(send == GroupPointPlusCoordinates->SpinBox_DX) + myDx = newValue; + else if(send == GroupPointPlusCoordinates->SpinBox_DY) + myDy = newValue; + else if(send == GroupPointPlusCoordinates->SpinBox_DZ) + myDz = newValue; + else if(send == GroupPointDirection->SpinBox_DX || send == GroupPointPlusCoordinates->SpinBox_S || send == GroupFace->SpinBox_DX) { + myTrimSize = newValue; + } else + return; + + if((myOkPoint1 && myOkDirection) || (myOkPoint1 && myOkCoordinates) || myOkPlanarFace) { + if(myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion() * Precision::Confusion()) + this->MakePlaneSimulationAndDisplay(); + } + return; +} + + +//================================================================================= +// function : MakePlaneSimulationAndDisplay(() +// purpose : +//================================================================================= +void BasicGUI_PlaneDlg::MakePlaneSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + gp_Dir aDirection(myDx, myDy, myDz); + /* We make a trimmed plane */ + gp_Pln gplane(myPoint1, aDirection); + mySimulationTopoDs = BRepBuilderAPI_MakeFace(gplane, -myTrimSize, +myTrimSize, -myTrimSize, +myTrimSize); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE( "Exception catched in MakePlaneSimulation" << endl ); + return; + } + return; +} diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.h b/src/BasicGUI/BasicGUI_PlaneDlg.h new file mode 100644 index 000000000..d22895569 --- /dev/null +++ b/src/BasicGUI/BasicGUI_PlaneDlg.h @@ -0,0 +1,95 @@ +// 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 : BasicGUI_PlaneDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_PLANE_H +#define DIALOGBOX_PLANE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel1Spin.h" +#include "DlgRef_1Sel4Spin.h" +#include "DlgRef_1Sel1Spin.h" + +#include "BasicGUI.h" + +#include "GEOM_FaceFilter.hxx" +#include "GEOM_ShapeTypeFilter.hxx" + +//================================================================================= +// class : BasicGUI_PlaneDlg +// purpose : +//================================================================================= +class BasicGUI_PlaneDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BasicGUI_PlaneDlg(QWidget* parent = 0, const char* name = 0, BasicGUI* theBasicGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BasicGUI_PlaneDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakePlaneSimulationAndDisplay(); + + BasicGUI* myBasicGUI; + + double step; + int myConstructorId; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filters selection */ + Handle(GEOM_ShapeTypeFilter) myEdgeFilter; + Handle(GEOM_FaceFilter) myFaceFilter; + + gp_Pnt myPoint1; /* Point on the plane */ + + Standard_Real myDx; + Standard_Real myDy; + Standard_Real myDz; + Standard_Real myTrimSize; + + bool myOkPoint1; /* true when argument is defined */ + bool myOkDirection; + bool myOkCoordinates; + bool myOkPlanarFace; + + DlgRef_2Sel1Spin* GroupPointDirection; + DlgRef_1Sel4Spin* GroupPointPlusCoordinates; + DlgRef_1Sel1Spin* GroupFace; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void SetEditCurrentArgument(); + void ConstructorsClicked(int constructorId); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_PLANE_H diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx new file mode 100644 index 000000000..51b287dd2 --- /dev/null +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -0,0 +1,566 @@ +// 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 : BasicGUI_PointDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BasicGUI_PointDlg.h" + +#include "QAD_RightFrame.h" +#include "OCCViewer_Viewer3d.h" + +#include +#include +#include +#if OCC_VERSION_MAJOR >= 5 +#include +#else +#include +#endif + +//================================================================================= +// class : BasicGUI_PointDlg() +// purpose : Constructs a BasicGUI_PointDlg 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. +//================================================================================= +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"))); + 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")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_POINTS")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + 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_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); + /***************************************************************/ + + /* Initialisations */ + myBasicGUI = theBasicGUI; + Init(ic); +} + + +//======================================================================= +// function : ~BasicGUI_PointDlg() +// purpose : Destructor +//======================================================================= +BasicGUI_PointDlg::~BasicGUI_PointDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::Init(const Handle(AIS_InteractiveContext)& ic) +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupDimensions->LineEdit1; + + myIC = ic; + myParameter = 0.50; + myPoint.SetCoord(0.0, 0.0, 0.0); + myOkEdge = false; + + myGeomGUI->myState = 0; + + /* Vertices Filter for all arguments */ + 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(); + + /* min, max, step and decimals for spin boxes */ + double specificStep = 0.1; + 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(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + myLocalContextId = myIC->OpenLocalContext(); + //myGeomBase->SetDisplayedObjectList(); + /* sub shapes selection */ + myLocalContextMode = TopAbs_VERTEX; + myIC->ActivateStandardMode(myLocalContextMode); + myUseLocalContext = true; + } + else + myUseLocalContext = false; + + TopoDS_Shape S; + bool displayPoint = true; + if(myGeomBase->GetTopoFromSelection(mySelection, S)) { + /* Filter a possibly previous selection and try to put it into coordinates */ + 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(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupDimensions->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupDimensions->SpinBox_DX, 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)), GroupDimensions->SpinBox_DX, 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())); + + /* displays Dialog */ + GroupDimensions->hide(); + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) +{ + myConstructorId = constructorId; + mySelection->ClearFilters(); + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + disconnect(mySelection, 0, this, 0); + + switch (constructorId) + { + case 0: + { + if(myUseLocalContext == false && QAD_Application::getDesktop()->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(); + + /* Display point simulation */ + PointIntoCoordinates(myPoint, true); + break; + } + case 1: + { + if(myUseLocalContext == true && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } + + GroupPoints->hide(); + resize(0, 0); + GroupDimensions->show(); + + myEditCurrentArgument = GroupDimensions->LineEdit1; + GroupDimensions->LineEdit1->setText(""); + myOkEdge = false; + + /* filter for next selections */ + mySelection->AddFilter(myEdgeFilter); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + } + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::ClickOnOk() +{ + this->ClickOnApply(); + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if(mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + /* Close local context */ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } + + switch(myConstructorId) + { + case 0 : + { + /* Recup args and call method */ + 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(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + /* no display if a local context is opened */ + myLocalContextId = myIC->OpenLocalContext(); + //myGeomBase->SetDisplayedObjectList(); + /* sub shapes selection */ + myLocalContextMode = TopAbs_VERTEX; + myIC->ActivateStandardMode(myLocalContextMode); + myUseLocalContext = true; + } + 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 && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + if(myIC->HasOpenedContext()) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } + } + + myGeomGUI->myState = -1; + GEOMBase_Skeleton::ClickOnCancel(); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed (for constructors not using local context) +//================================================================================= +void BasicGUI_PointDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + myOkEdge = false; + return; + } + + // nbSel == 1 + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(S.ShapeType() == TopAbs_EDGE) { + if(CalculateVertexOnCurve(TopoDS::Edge(S), myParameter, mySimulationTopoDs)) { + if(myGeomBase->VertexToPoint(mySimulationTopoDs, myPoint)) { + GroupDimensions->LineEdit1->setText(aString); + myOkEdge = true; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + } + } + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupDimensions->LineEdit1) + myEditCurrentArgument = GroupDimensions->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupDimensions->PushButton1) { + GroupDimensions->LineEdit1->setFocus(); + myEditCurrentArgument = GroupDimensions->LineEdit1; + mySelection->AddFilter(myEdgeFilter); + this->SelectionIntoArgument(); + } + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : to reactivate this dialog box when mouse enter onto the window +//================================================================================= +void BasicGUI_PointDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//======================================================================= +// function : closeEvent() +// purpose : +//======================================================================= +void BasicGUI_PointDlg::closeEvent(QCloseEvent* e) +{ + /* same than click on cancel button */ + this->ClickOnCancel(); +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::ActivateThisDialog( ) +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + myGeomGUI->myState = 0; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + myLocalContextId = myIC->OpenLocalContext(); + //myGeomBase->SetDisplayedObjectList(); + /* sub shapes selection */ + myLocalContextMode = TopAbs_VERTEX; + myIC->ActivateStandardMode(myLocalContextMode); + myUseLocalContext = true; + } + + if(myConstructorId == 1) + mySelection->AddFilter(myEdgeFilter); + + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : public slot to deactivate if active +//================================================================================= +void BasicGUI_PointDlg::DeactivateActiveDialog() +{ + if(myConstructorId == 0 && QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } + myGeomGUI->myState = -1; + GEOMBase_Skeleton::DeactivateActiveDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue) +{ + DlgRef_SpinBox* send = (DlgRef_SpinBox*)sender(); + double vx, vy, vz; + + if(send == GroupPoints->SpinBox_DX) { + vx = newValue; + vy = GroupPoints->SpinBox_DY->GetValue(); + vz = GroupPoints->SpinBox_DZ->GetValue(); + } else if(send == GroupPoints->SpinBox_DY) { + vx = GroupPoints->SpinBox_DX->GetValue(); + vy = newValue; + 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 == GroupDimensions->SpinBox_DX) { + myParameter = newValue; + } else + return; + + switch(myConstructorId) + { + case 0: // default constructor + { + myPoint.SetCoord(vx, vy, vz); + mySimulationTopoDs = BRepBuilderAPI_MakeVertex (myPoint).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + break; + } + case 1: + { + this->SelectionIntoArgument(); + break; + } + } + return; +} + + +//================================================================================= +// function : CalculateVertexOnCurve() +// purpose : Calculate a Vertex on the curve given by 'anEdge'. +// : The position of resultVertex is given by aParameter. +// : For a linear edge, aParameter=0.0 gives the first vertex of edge +// : aParameter=1.0 gives the last vertex of edge +// : aParameter=0.5 gives the vertex on the middle of edge +// : It is possible to get vertices out of edge using values > 1.0 or < 0.0 +//================================================================================= +bool BasicGUI_PointDlg::CalculateVertexOnCurve(const TopoDS_Edge& anEdge, const Standard_Real aParameter, TopoDS_Shape& resultVertex) +{ +#if OCC_VERSION_MAJOR >= 5 + if(anEdge.IsNull() || !BRepAlgo::IsValid(anEdge)) +#else + if(anEdge.IsNull() || !BRepAlgoAPI::IsValid(anEdge)) +#endif + return false; + + Standard_Real first, last; + Handle(Geom_Curve) curv = BRep_Tool::Curve(anEdge, first, last); + if(!curv->IsCN(0)) + return false; + + Standard_Real param; + if(anEdge.Orientation() == TopAbs_FORWARD) + param = first + (last-first) * aParameter; + else + param = last + (first-last) * aParameter; + + gp_Pnt paramPoint; + curv->D0(param, paramPoint); + resultVertex = BRepBuilderAPI_MakeVertex(paramPoint); + return true; +} + + +//======================================================================= +// funcion : PointIntoCoordinates() +// purpose : Sets user point coordinates into this dialog Spin boxes +// : and displays it or not according to 'bool displayPoint' +//======================================================================= +void BasicGUI_PointDlg::PointIntoCoordinates(gp_Pnt P, bool displayPoint) +{ + 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); + } + return; +} diff --git a/src/BasicGUI/BasicGUI_PointDlg.h b/src/BasicGUI/BasicGUI_PointDlg.h new file mode 100644 index 000000000..2ee583633 --- /dev/null +++ b/src/BasicGUI/BasicGUI_PointDlg.h @@ -0,0 +1,101 @@ +// 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 : BasicGUI_PointDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_POINT_H +#define DIALOGBOX_POINT_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel1Spin.h" +#include "DlgRef_3Spin.h" + +#include "BasicGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" +#include + +//================================================================================= +// class : BasicGUI_PointDlg +// purpose : +//================================================================================= +class BasicGUI_PointDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BasicGUI_PointDlg(QWidget* parent = 0, const char* name = 0, BasicGUI* theBasicGUI = 0, SALOME_Selection* Sel = 0, const Handle(AIS_InteractiveContext)& ic = 0, bool modal = FALSE, WFlags fl = 0); + + ~BasicGUI_PointDlg(); + +private : + void Init(const Handle(AIS_InteractiveContext)& ic); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); + + BasicGUI* myBasicGUI; + + double step; + int myConstructorId; + Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* filter for selection */ + + gp_Pnt myPoint; /* Is 'mySimulationTopoDs' */ + bool myOkEdge; /* true when an edge is selected by user */ + double myParameter; /* Parameter used to create a vertex on edge (point on curve) */ + + /* Interactive and local context management see also : bool UseLocalContext() */ + Handle(AIS_InteractiveContext) myIC; /* Interactive context from IAPP */ + Standard_Integer myLocalContextId; /* identify a local context for this method */ + TopAbs_ShapeEnum myLocalContextMode; /* identify a selection mode into local context */ + bool myUseLocalContext; /* true when method as opened a local context */ + + DlgRef_1Sel1Spin* GroupDimensions; + DlgRef_3Spin* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked(int constructorId); + void ValueChangedInSpinBox(double newValue); + + bool CalculateVertexOnCurve(const TopoDS_Edge& anEdge, + const Standard_Real aParameter, + TopoDS_Shape& resultVertex); + +public: + void PointIntoCoordinates(gp_Pnt P, bool displayPoint); + /* return true if method has opened a local context */ + bool UseLocalContext(){return myUseLocalContext;}; + +}; + +#endif // DIALOGBOX_POINT_H diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx new file mode 100644 index 000000000..6d4eb0d24 --- /dev/null +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -0,0 +1,467 @@ +// 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 : BasicGUI_VectorDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BasicGUI_VectorDlg.h" + +#include "QAD_Config.h" +#include +#include +#include +#include +#include + +//================================================================================= +// class : BasicGUI_VectorDlg() +// purpose : Constructs a BasicGUI_VectorDlg 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. +//================================================================================= +BasicGUI_VectorDlg::BasicGUI_VectorDlg(QWidget* parent, const char* name, BasicGUI* theBasicGUI, 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_VECTOR_2P"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_VECTOR_DXYZ"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_VECTOR_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_VECTOR")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_POINTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); + GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + + GroupDimensions = new DlgRef_3Spin1Check(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_COORDINATES")); + GroupDimensions->TextLabel1->setText(tr("GEOM_DX")); + GroupDimensions->TextLabel2->setText(tr("GEOM_DY")); + GroupDimensions->TextLabel3->setText(tr("GEOM_DZ")); + GroupDimensions->CheckBox1->setText(tr("GEOM_REVERSE_VECTOR")); + + Layout1->addWidget(GroupPoints, 1, 0); + Layout1->addWidget(GroupDimensions, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myBasicGUI = theBasicGUI; + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_VectorDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_VectorDlg::~BasicGUI_VectorDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::Init() +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupPoints->LineEdit1; + + myDx = 0.0; + myDy = 0.0; + myDz = 200.0; + myPoint1.SetCoord(0.0, 0.0, 0.0); + myPoint2.SetCoord(0.0, 0.0, 0.0); + myOkPoint1 = myOkPoint2 = false; + + /* Vertices Filter for all arguments */ + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + /* min, max, step and decimals for spin boxes */ + 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); + + GroupDimensions->SpinBox_DX->SetValue(myDx); + GroupDimensions->SpinBox_DY->SetValue(myDy); + GroupDimensions->SpinBox_DZ->SetValue(myDz); + + GroupDimensions->CheckBox1->setChecked(FALSE); + + /* signals and slots connections */ + 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(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + 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(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(GroupDimensions->CheckBox1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupDimensions->hide(); + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BasicGUI_VectorDlg::ConstructorsClicked(int constructorId) +{ + myConstructorId = constructorId; + mySelection->ClearFilters(); + myGeomBase->EraseSimulationShape(); + disconnect(mySelection, 0, this, 0); + myOkPoint1 = myOkPoint2 = false; + + switch (constructorId) + { + case 0: + { + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(""); + GroupPoints->LineEdit2->setText(""); + + /* filter for next selection */ + mySelection->AddFilter(myVertexFilter); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + case 1: + { + GroupPoints->hide(); + resize( 0, 0 ); + GroupDimensions->show(); + + myDx = 0.0; + myDy = 0.0; + myDz = 200.0; + + GroupDimensions->SpinBox_DX->SetValue(myDx); + GroupDimensions->SpinBox_DY->SetValue(myDy); + GroupDimensions->SpinBox_DZ->SetValue(myDz); + + myPoint1.SetCoord(0.0, 0.0, 0.0) ; + myPoint2.SetCoord(myDx, myDy, myDz); + + GroupDimensions->CheckBox1->setChecked(FALSE); + + mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape(); + /* Add arrow in simulation */ + bool noNeedToTest = AddArrowToSimulation(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + break; + } + } + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + switch(myConstructorId) + { + case 0 : + { + if(myOkPoint1 && myOkPoint2) + myBasicGUI->MakeVectorAndDisplay(myPoint1, myPoint2); + break ; + } + case 1 : + { + /* Recup args and call method */ + myDx = GroupDimensions->SpinBox_DX->GetValue(); + myDy = GroupDimensions->SpinBox_DY->GetValue(); + myDz = GroupDimensions->SpinBox_DZ->GetValue(); + myPoint1.SetCoord(0.0, 0.0, 0.0); + myPoint2.SetCoord(myDx, myDy, myDz); + myBasicGUI->MakeVectorAndDisplay(myPoint1, myPoint2); + break; + } + } + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_VectorDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel != 1) { + if (myEditCurrentArgument == GroupPoints->LineEdit1) + myOkPoint1 = false; + else if ( myEditCurrentArgument == GroupPoints->LineEdit2) + myOkPoint2 = false; + return; + } + + // nbSel == 1 + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + myEditCurrentArgument->setText(aString); + myOkPoint1 = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint2)) { + myEditCurrentArgument->setText(aString); + myOkPoint2 = true; + } + + if(myOkPoint1 && myOkPoint2 && myPoint1.Distance(myPoint2) > Precision::Confusion()) { + mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape(); + /* Add arrow in simulation */ + bool noNeedToTest = this->AddArrowToSimulation(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::SetEditCurrentArgument() +{ + if(myConstructorId != 0) + return; + + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + } + mySelection->AddFilter(myVertexFilter); + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void BasicGUI_VectorDlg::ValueChangedInSpinBox(double newValue) +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + QObject* send = (QObject*)sender(); + + if(send == GroupDimensions->SpinBox_DX) + myDx = newValue; + else if (send == GroupDimensions->SpinBox_DY) + myDy = newValue; + else if (send == GroupDimensions->SpinBox_DZ) + myDz = newValue; + + myPoint1.SetCoord(0.0, 0.0, 0.0); + myPoint2.SetCoord(myDx, myDy, myDz); + + if(myPoint1.Distance(myPoint2) > Precision::Confusion()) { // mySimulationTopoDs + mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape(); + /* Create simulation vector with an arrow */ + this->AddArrowToSimulation(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + return; +} + + +//================================================================================= +// function : AddArrowToSimulation() +// purpose : An arrow (cone topology) is added to 'modifiedShape' +// : to simulate a vector or an 'oriented line' display. The result is in 'modifiedShape'. +// : If an arrow can't be added returns false and 'modifiedShape' isn't modified ! +//================================================================================= +bool BasicGUI_VectorDlg::AddArrowToSimulation(TopoDS_Shape& modifiedShape) +{ + TopoDS_Shape arrow; + /* Try to add a cone simulation shape to show direction of a linear edge */ + if(myGeomBase->CreateArrowForLinearEdge(modifiedShape, arrow)) { + TopoDS_Compound Comp; + BRep_Builder B; + B.MakeCompound (Comp); + B.Add(Comp, modifiedShape); + B.Add(Comp, arrow); + modifiedShape = Comp; + return true; + } + return false; +} + + +//================================================================================= +// function : ReverseVector() +// purpose : 'state' not used here +//================================================================================= +void BasicGUI_VectorDlg::ReverseVector(int state) +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + myDx = -myDx; + 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); + myPoint2.SetCoord(myDx, myDy, myDz); + + /* In the appropriate constructor */ + if(myPoint1.Distance(myPoint2) > Precision::Confusion()) { + mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape(); + /* Add arrow in simulation */ + bool noNeedToTest = this->AddArrowToSimulation(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + return; +} diff --git a/src/BasicGUI/BasicGUI_VectorDlg.h b/src/BasicGUI/BasicGUI_VectorDlg.h new file mode 100644 index 000000000..41636b165 --- /dev/null +++ b/src/BasicGUI/BasicGUI_VectorDlg.h @@ -0,0 +1,86 @@ +// 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 : BasicGUI_VectorDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_VECTOR_H +#define DIALOGBOX_VECTOR_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel_QTD.h" +#include "DlgRef_3Spin1Check.h" + +#include "BasicGUI.h" +#include "GEOM_ShapeTypeFilter.hxx" + +//================================================================================= +// class : BasicGUI_VectorDlg +// purpose : +//================================================================================= +class BasicGUI_VectorDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BasicGUI_VectorDlg(QWidget* parent = 0, const char* name = 0, BasicGUI* theBasicGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BasicGUI_VectorDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + bool AddArrowToSimulation(TopoDS_Shape& modifiedShape); + + BasicGUI* myBasicGUI; + + double step; + int myConstructorId; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */ + + gp_Pnt myPoint1; /* Points containing the vector */ + gp_Pnt myPoint2; + bool myOkPoint1; /* Are true when myPoint is defined */ + bool myOkPoint2; + double myDx; + double myDy; + double myDz; + + DlgRef_2Sel_QTD* GroupPoints; + DlgRef_3Spin1Check* GroupDimensions; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked(int constructorId); + void ValueChangedInSpinBox(double newValue); + void ReverseVector(int state); + +}; + +#endif // DIALOGBOX_VECTOR_H diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx new file mode 100644 index 000000000..1403f8f02 --- /dev/null +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx @@ -0,0 +1,217 @@ +// 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 : BasicGUI_WorkingPlaneDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM + +using namespace std; +#include "BasicGUI_WorkingPlaneDlg.h" + +#include +#include +#include +#include + +//================================================================================= +// class : BasicGUI_WorkingPlaneDlg() +// purpose : Constructs a BasicGUI_WorkingPlaneDlg 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. +//================================================================================= +BasicGUI_WorkingPlaneDlg::BasicGUI_WorkingPlaneDlg(QWidget* parent, const char* name, BasicGUI* theBasicGUI, 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_WPLANE_FACE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_WPLANE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_WPLANE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupWPlane = new DlgRef_1Sel_QTD(this, "GroupWPlane"); + GroupWPlane->GroupBox1->setTitle(tr("GEOM_WPLANE_FACE")); + GroupWPlane->TextLabel1->setText(tr("GEOM_SELECTION")); + GroupWPlane->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupWPlane, 1, 0); + /***************************************************************/ + + /* Initialisation */ + myBasicGUI = theBasicGUI; + Init(); +} + + +//================================================================================= +// function : ~BasicGUI_WorkingPlaneDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BasicGUI_WorkingPlaneDlg::~BasicGUI_WorkingPlaneDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupWPlane->LineEdit1; + + myOkPlane = false; + + /* Filter definition */ + myFaceFilter = new GEOM_FaceFilter(StdSelect_Plane, myGeom); + mySelection->AddFilter(myFaceFilter); /* filter for next selection */ + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupWPlane->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupWPlane->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupWPlane->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if(myOkPlane) + myBasicGUI->MakeWorkingPlane(myLoc, myDir); + + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + myOkPlane = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + BRepAdaptor_Surface surf(TopoDS::Face(S)); + gp_Pln Plane = surf.Plane(); + myLoc = Plane.Location(); + myDir = Plane.Axis().Direction(); + + GroupWPlane->LineEdit1->setText(aString); + myOkPlane = true; + + /* no simulation */ + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument() +{ + GroupWPlane->LineEdit1->setFocus(); + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::LineEditReturnPressed() +{ + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myFaceFilter); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BasicGUI_WorkingPlaneDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} diff --git a/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h new file mode 100644 index 000000000..6e9b5baf6 --- /dev/null +++ b/src/BasicGUI/BasicGUI_WorkingPlaneDlg.h @@ -0,0 +1,74 @@ +// 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 : BasicGUI_WorkingPlaneDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM + +#ifndef DIALOGBOX_WORKINGPLANE_H +#define DIALOGBOX_WORKINGPLANE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel_QTD.h" + +#include "BasicGUI.h" + +#include "GEOM_FaceFilter.hxx" + +//================================================================================= +// class : BasicGUI_WorkingPlaneDlg +// purpose : +//================================================================================= +class BasicGUI_WorkingPlaneDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BasicGUI_WorkingPlaneDlg( QWidget* parent = 0, const char* name = 0, BasicGUI* theBasicGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~BasicGUI_WorkingPlaneDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + + BasicGUI* myBasicGUI; + + Handle(GEOM_FaceFilter) myFaceFilter; /* filter for selection */ + + gp_Pnt myLoc; + gp_Dir myDir; + bool myOkPlane; /* to check when arguments are defined */ + + DlgRef_1Sel_QTD* GroupWPlane; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_WORKINGPLANE_H diff --git a/src/BasicGUI/Makefile.in b/src/BasicGUI/Makefile.in new file mode 100644 index 000000000..2dc8edf1b --- /dev/null +++ b/src/BasicGUI/Makefile.in @@ -0,0 +1,75 @@ +# GEOM BASICGUI : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= BasicGUI_PointDlg.h + +# Libraries targets +LIB = libBasicGUI.la + +LIB_SRC = BasicGUI.cxx \ + BasicGUI_PointDlg.cxx \ + BasicGUI_LineDlg.cxx \ + BasicGUI_CircleDlg.cxx \ + BasicGUI_EllipseDlg.cxx \ + BasicGUI_ArcDlg.cxx \ + BasicGUI_VectorDlg.cxx \ + BasicGUI_PlaneDlg.cxx \ + BasicGUI_WorkingPlaneDlg.cxx + +LIB_MOC = \ + BasicGUI.h \ + BasicGUI_PointDlg.h \ + BasicGUI_LineDlg.h \ + BasicGUI_CircleDlg.h \ + BasicGUI_EllipseDlg.h \ + BasicGUI_ArcDlg.h \ + BasicGUI_VectorDlg.h \ + BasicGUI_PlaneDlg.h \ + BasicGUI_WorkingPlaneDlg.h + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lGEOMFiltersSelection -lGEOMBase + +@CONCLUDE@ diff --git a/src/BooleanGUI/BooleanGUI.cxx b/src/BooleanGUI/BooleanGUI.cxx new file mode 100644 index 000000000..da6531ff2 --- /dev/null +++ b/src/BooleanGUI/BooleanGUI.cxx @@ -0,0 +1,138 @@ +// 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 : BooleanGUI.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "BooleanGUI.h" + +#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include "BooleanGUI_FuseDlg.h" // Method FUSE +#include "BooleanGUI_CommonDlg.h" // Method COMMON +#include "BooleanGUI_CutDlg.h" // Method CUT +#include "BooleanGUI_SectionDlg.h" // Method SECTION + +//======================================================================= +// function : BooleanGUI() +// purpose : Constructor +//======================================================================= +BooleanGUI::BooleanGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; +} + + +//======================================================================= +// function : ~BooleanGUI() +// purpose : Destructor +//======================================================================= +BooleanGUI::~BooleanGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool BooleanGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + BooleanGUI* myBooleanGUI = new BooleanGUI(); + myBooleanGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + + switch (theCommandID) + { + case 5011: // FUSE + { + BooleanGUI_FuseDlg *aDlg = new BooleanGUI_FuseDlg(parent, "", myBooleanGUI, Sel); + break; + } + case 5012: // COMMON + { + BooleanGUI_CommonDlg *aDlg = new BooleanGUI_CommonDlg(parent, "", myBooleanGUI, Sel); + break; + } + case 5013: // CUT + { + BooleanGUI_CutDlg *aDlg = new BooleanGUI_CutDlg(parent, "", myBooleanGUI, Sel); + break; + } + case 5014: // SECTION + { + BooleanGUI_SectionDlg *aDlg = new BooleanGUI_SectionDlg(parent, "", myBooleanGUI, Sel); + break; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//======================================================================= +// function : MakeBooleanAndDisplay() +// purpose : +//======================================================================= +void BooleanGUI::MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2, const short operation) +{ + try { + GEOM::GEOM_Shape_ptr result = myGeom->MakeBoolean(Shape1, Shape2, operation); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + result->NameType(type); + + if (myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return BooleanGUI::OnGUIEvent(theCommandID, parent);} +} diff --git a/src/BooleanGUI/BooleanGUI.h b/src/BooleanGUI/BooleanGUI.h new file mode 100644 index 000000000..6fb9cde55 --- /dev/null +++ b/src/BooleanGUI/BooleanGUI.h @@ -0,0 +1,58 @@ +// 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 : BooleanGUI.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef BOOLEANGUI_H +#define BOOLEANGUI_H + +#include "GEOMBase.h" + +//================================================================================= +// class : BooleanGUI +// purpose : +//================================================================================= +class BooleanGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + BooleanGUI(); + ~BooleanGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + + void MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1, + GEOM::GEOM_Shape_ptr Shape2, + const short operation); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif diff --git a/src/BooleanGUI/BooleanGUI_CommonDlg.cxx b/src/BooleanGUI/BooleanGUI_CommonDlg.cxx new file mode 100644 index 000000000..7e881536f --- /dev/null +++ b/src/BooleanGUI/BooleanGUI_CommonDlg.cxx @@ -0,0 +1,250 @@ +// 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 : BooleanGUI_CommonDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BooleanGUI_CommonDlg.h" + +//================================================================================= +// class : BooleanGUI_CommonDlg() +// purpose : Constructs a BooleanGUI_CommonDlg 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. +//================================================================================= +BooleanGUI_CommonDlg::BooleanGUI_CommonDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, 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_COMMON"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_COMMON_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_COMMON")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupCommon = new DlgRef_2Sel_QTD(this, "GroupCommon"); + GroupCommon->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupCommon->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1")); + GroupCommon->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2")); + GroupCommon->PushButton1->setPixmap(image1); + GroupCommon->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupCommon, 1, 0); + /***************************************************************/ + + /* Initialisation */ + myBooleanGUI = theBooleanGUI; + Init(); +} + + +//================================================================================= +// function : ~BooleanGUI_CommonDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BooleanGUI_CommonDlg::~BooleanGUI_CommonDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BooleanGUI_CommonDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupCommon->LineEdit1; + + myShape1.Nullify(); + myShape2.Nullify(); + myOkShape1 = myOkShape2 = false; + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupCommon->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupCommon->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupCommon->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupCommon->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupCommon->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BooleanGUI_CommonDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BooleanGUI_CommonDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + + if(myOkShape1 && myOkShape2) + myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 1); + + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void BooleanGUI_CommonDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupCommon->LineEdit1) + myOkShape1 = false; + else if( myEditCurrentArgument == GroupCommon->LineEdit2) + myOkShape2 = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupCommon->LineEdit1) { + myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape1 = S; + GroupCommon->LineEdit1->setText(aString); + myOkShape1 = true; + } + else if(myEditCurrentArgument == GroupCommon->LineEdit2) { + myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape2 = S; + GroupCommon->LineEdit2->setText(aString); + myOkShape2 = true; + } + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BooleanGUI_CommonDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupCommon->PushButton1) { + GroupCommon->LineEdit1->setFocus(); + myEditCurrentArgument = GroupCommon->LineEdit1; + } + else if(send == GroupCommon->PushButton2) { + GroupCommon->LineEdit2->setFocus(); + myEditCurrentArgument = GroupCommon->LineEdit2; + } + SelectionIntoArgument(); + + return; +} + + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BooleanGUI_CommonDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupCommon->LineEdit1) + myEditCurrentArgument = GroupCommon->LineEdit1; + else if(send == GroupCommon->LineEdit2) + myEditCurrentArgument = GroupCommon->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BooleanGUI_CommonDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void BooleanGUI_CommonDlg::enterEvent(QEvent * e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} diff --git a/src/BooleanGUI/BooleanGUI_CommonDlg.h b/src/BooleanGUI/BooleanGUI_CommonDlg.h new file mode 100644 index 000000000..f592e6df0 --- /dev/null +++ b/src/BooleanGUI/BooleanGUI_CommonDlg.h @@ -0,0 +1,76 @@ +// 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 : BooleanGUI_CommonDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_COMMON_H +#define DIALOGBOX_COMMON_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel_QTD.h" + +#include "BooleanGUI.h" + +#include + +//================================================================================= +// class : BooleanGUI_CommonDlg +// purpose : +//================================================================================= +class BooleanGUI_CommonDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BooleanGUI_CommonDlg(QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BooleanGUI_CommonDlg(); + +private: + void Init(); + void enterEvent(QEvent * e); + + BooleanGUI* myBooleanGUI; + + TopoDS_Shape myShape1; /* topology used */ + TopoDS_Shape myShape2; /* topology used */ + GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */ + GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */ + bool myOkShape1; + bool myOkShape2; /* to check when arguments are defined */ + + DlgRef_2Sel_QTD* GroupCommon; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_COMMON_H diff --git a/src/BooleanGUI/BooleanGUI_CutDlg.cxx b/src/BooleanGUI/BooleanGUI_CutDlg.cxx new file mode 100644 index 000000000..d3aaf9785 --- /dev/null +++ b/src/BooleanGUI/BooleanGUI_CutDlg.cxx @@ -0,0 +1,248 @@ +// 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 : BooleanGUI_CutDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BooleanGUI_CutDlg.h" + +//================================================================================= +// class : BooleanGUI_CutDlg() +// purpose : Constructs a BooleanGUI_CutDlg 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. +//================================================================================= +BooleanGUI_CutDlg::BooleanGUI_CutDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, 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_CUT"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_CUT_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_CUT")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupCut = new DlgRef_2Sel_QTD(this, "GroupCut"); + GroupCut->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupCut->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1")); + GroupCut->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2")); + GroupCut->PushButton1->setPixmap(image1); + GroupCut->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupCut, 1, 0); + /***************************************************************/ + + /* Initialisation */ + myBooleanGUI = theBooleanGUI; + Init(); +} + + +//================================================================================= +// function : ~BooleanGUI_CutDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BooleanGUI_CutDlg::~BooleanGUI_CutDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BooleanGUI_CutDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupCut->LineEdit1; + + myShape1.Nullify(); + myShape2.Nullify(); + myOkShape1 = myOkShape2 = false; + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupCut->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupCut->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupCut->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupCut->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupCut->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BooleanGUI_CutDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BooleanGUI_CutDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + + if(myOkShape1 && myOkShape2) + myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 2); + + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void BooleanGUI_CutDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupCut->LineEdit1) + myOkShape1 = false; + else if( myEditCurrentArgument == GroupCut->LineEdit2) + myOkShape2 = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupCut->LineEdit1) { + myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape1 = S; + GroupCut->LineEdit1->setText(aString); + myOkShape1 = true; + } + else if(myEditCurrentArgument == GroupCut->LineEdit2) { + myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape2 = S; + GroupCut->LineEdit2->setText(aString); + myOkShape2 = true; + } + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BooleanGUI_CutDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupCut->PushButton1) { + GroupCut->LineEdit1->setFocus(); + myEditCurrentArgument = GroupCut->LineEdit1; + } + else if(send == GroupCut->PushButton2) { + GroupCut->LineEdit2->setFocus(); + myEditCurrentArgument = GroupCut->LineEdit2; + } + SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BooleanGUI_CutDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupCut->LineEdit1) + myEditCurrentArgument = GroupCut->LineEdit1; + else if(send == GroupCut->LineEdit2) + myEditCurrentArgument = GroupCut->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BooleanGUI_CutDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void BooleanGUI_CutDlg::enterEvent(QEvent * e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} diff --git a/src/BooleanGUI/BooleanGUI_CutDlg.h b/src/BooleanGUI/BooleanGUI_CutDlg.h new file mode 100644 index 000000000..46738f7f3 --- /dev/null +++ b/src/BooleanGUI/BooleanGUI_CutDlg.h @@ -0,0 +1,76 @@ +// 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 : BooleanGUI_CutDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_CUT_H +#define DIALOGBOX_CUT_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel_QTD.h" + +#include "BooleanGUI.h" + +#include + +//================================================================================= +// class : BooleanGUI_CutDlg +// purpose : +//================================================================================= +class BooleanGUI_CutDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BooleanGUI_CutDlg( QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + ~BooleanGUI_CutDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + + BooleanGUI* myBooleanGUI; + + TopoDS_Shape myShape1; /* topology used to fuse */ + TopoDS_Shape myShape2; /* topology used to fuse */ + GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */ + GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */ + bool myOkShape1; /* to check when arguments are defined */ + bool myOkShape2; + + DlgRef_2Sel_QTD* GroupCut; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_CUT_H diff --git a/src/BooleanGUI/BooleanGUI_FuseDlg.cxx b/src/BooleanGUI/BooleanGUI_FuseDlg.cxx new file mode 100644 index 000000000..14a741cc3 --- /dev/null +++ b/src/BooleanGUI/BooleanGUI_FuseDlg.cxx @@ -0,0 +1,248 @@ +// 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 : BooleanGUI_FuseDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BooleanGUI_FuseDlg.h" + +//================================================================================= +// class : BooleanGUI_FuseDlg() +// purpose : Constructs a BooleanGUI_FuseDlg 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. +//================================================================================= +BooleanGUI_FuseDlg::BooleanGUI_FuseDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, 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_FUSE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_FUSE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_FUSE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupFuse = new DlgRef_2Sel_QTD(this, "GroupFuse"); + GroupFuse->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupFuse->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1")); + GroupFuse->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2")); + GroupFuse->PushButton1->setPixmap(image1); + GroupFuse->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupFuse, 1, 0); + /***************************************************************/ + + /* Initialisation */ + myBooleanGUI = theBooleanGUI; + Init(); +} + + +//================================================================================= +// function : ~BooleanGUI_FuseDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BooleanGUI_FuseDlg::~BooleanGUI_FuseDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BooleanGUI_FuseDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupFuse->LineEdit1; + + myShape1.Nullify(); + myShape2.Nullify(); + myOkShape1 = myOkShape2 = false; + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupFuse->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupFuse->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupFuse->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupFuse->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupFuse->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BooleanGUI_FuseDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BooleanGUI_FuseDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + + if(myOkShape1 && myOkShape2) + myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 3); + + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void BooleanGUI_FuseDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupFuse->LineEdit1) + myOkShape1 = false; + else if( myEditCurrentArgument == GroupFuse->LineEdit2) + myOkShape2 = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupFuse->LineEdit1) { + myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape1 = S; + GroupFuse->LineEdit1->setText(aString); + myOkShape1 = true; + } + else if(myEditCurrentArgument == GroupFuse->LineEdit2) { + myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape2 = S; + GroupFuse->LineEdit2->setText(aString); + myOkShape2 = true; + } + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BooleanGUI_FuseDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupFuse->PushButton1) { + GroupFuse->LineEdit1->setFocus(); + myEditCurrentArgument = GroupFuse->LineEdit1; + } + else if(send == GroupFuse->PushButton2) { + GroupFuse->LineEdit2->setFocus(); + myEditCurrentArgument = GroupFuse->LineEdit2; + } + SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BooleanGUI_FuseDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupFuse->LineEdit1) + myEditCurrentArgument = GroupFuse->LineEdit1; + else if(send == GroupFuse->LineEdit2) + myEditCurrentArgument = GroupFuse->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BooleanGUI_FuseDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void BooleanGUI_FuseDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} diff --git a/src/BooleanGUI/BooleanGUI_FuseDlg.h b/src/BooleanGUI/BooleanGUI_FuseDlg.h new file mode 100644 index 000000000..799eb0b9d --- /dev/null +++ b/src/BooleanGUI/BooleanGUI_FuseDlg.h @@ -0,0 +1,76 @@ +// 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 : BooleanGUI_FuseDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_FUSE_H +#define DIALOGBOX_FUSE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel_QTD.h" + +#include "BooleanGUI.h" + +#include + +//================================================================================= +// class : BooleanGUI_FuseDlg +// purpose : +//================================================================================= +class BooleanGUI_FuseDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BooleanGUI_FuseDlg(QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BooleanGUI_FuseDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + + BooleanGUI* myBooleanGUI; + + TopoDS_Shape myShape1; /* topology used to fuse */ + TopoDS_Shape myShape2; /* topology used to fuse */ + GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */ + GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */ + bool myOkShape1; /* to check when arguments are defined */ + bool myOkShape2; + + DlgRef_2Sel_QTD* GroupFuse; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_FUSE_H diff --git a/src/BooleanGUI/BooleanGUI_SectionDlg.cxx b/src/BooleanGUI/BooleanGUI_SectionDlg.cxx new file mode 100644 index 000000000..d2c1c6a4a --- /dev/null +++ b/src/BooleanGUI/BooleanGUI_SectionDlg.cxx @@ -0,0 +1,249 @@ +// 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 : BooleanGUI_SectionDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BooleanGUI_SectionDlg.h" + +//================================================================================= +// class : BooleanGUI_SectionDlg() +// purpose : Constructs a BooleanGUI_SectionDlg 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. +//================================================================================= +BooleanGUI_SectionDlg::BooleanGUI_SectionDlg(QWidget* parent, const char* name, BooleanGUI* theBooleanGUI, 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_SECTION"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SECTION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SECTION")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupSection = new DlgRef_2Sel_QTD(this, "GroupSection"); + GroupSection->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupSection->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1")); + GroupSection->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2")); + GroupSection->PushButton1->setPixmap(image1); + GroupSection->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupSection, 1, 0); + /***************************************************************/ + + /* Initialisation */ + myBooleanGUI = theBooleanGUI; + Init(); +} + + +//================================================================================= +// function : ~BooleanGUI_SectionDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BooleanGUI_SectionDlg::~BooleanGUI_SectionDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BooleanGUI_SectionDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupSection->LineEdit1; + + myShape1.Nullify(); + myShape2.Nullify(); + myOkShape1 = myOkShape2 = false; + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupSection->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupSection->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupSection->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupSection->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupSection->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BooleanGUI_SectionDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BooleanGUI_SectionDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + + if(myOkShape1 && myOkShape2) + myBooleanGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 4); + + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void BooleanGUI_SectionDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupSection->LineEdit1) + myOkShape1 = false; + else if( myEditCurrentArgument == GroupSection->LineEdit2) + myOkShape2 = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupSection->LineEdit1) { + myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape1 = S; + GroupSection->LineEdit1->setText(aString); + myOkShape1 = true; + } + else if(myEditCurrentArgument == GroupSection->LineEdit2) { + myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape2 = S; + GroupSection->LineEdit2->setText(aString); + myOkShape2 = true; + } + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BooleanGUI_SectionDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupSection->PushButton1) { + GroupSection->LineEdit1->setFocus(); + myEditCurrentArgument = GroupSection->LineEdit1; + } + else if(send == GroupSection->PushButton2) { + GroupSection->LineEdit2->setFocus(); + myEditCurrentArgument = GroupSection->LineEdit2; + } + SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BooleanGUI_SectionDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupSection->LineEdit1) + myEditCurrentArgument = GroupSection->LineEdit1; + else if(send == GroupSection->LineEdit2) + myEditCurrentArgument = GroupSection->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BooleanGUI_SectionDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void BooleanGUI_SectionDlg::enterEvent(QEvent * e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} diff --git a/src/BooleanGUI/BooleanGUI_SectionDlg.h b/src/BooleanGUI/BooleanGUI_SectionDlg.h new file mode 100644 index 000000000..badf2afdf --- /dev/null +++ b/src/BooleanGUI/BooleanGUI_SectionDlg.h @@ -0,0 +1,76 @@ +// 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 : BooleanGUI_SectionDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header: + +#ifndef DIALOGBOX_SECTION_H +#define DIALOGBOX_SECTION_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel_QTD.h" + +#include "BooleanGUI.h" + +#include + +//================================================================================= +// class : BooleanGUI_SectionDlg +// purpose : +//================================================================================= +class BooleanGUI_SectionDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BooleanGUI_SectionDlg(QWidget* parent = 0, const char* name = 0, BooleanGUI* theBooleanGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BooleanGUI_SectionDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + + BooleanGUI* myBooleanGUI; + + TopoDS_Shape myShape1; /* topology used to fuse */ + TopoDS_Shape myShape2; /* topology used to fuse */ + GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */ + GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */ + bool myOkShape1; /* to check when arguments are defined */ + bool myOkShape2; + + DlgRef_2Sel_QTD* GroupSection; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_SECTION_H diff --git a/src/BooleanGUI/Makefile.in b/src/BooleanGUI/Makefile.in new file mode 100644 index 000000000..92de526ff --- /dev/null +++ b/src/BooleanGUI/Makefile.in @@ -0,0 +1,67 @@ +# GEOM BOOLEANGUI : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= + +# Libraries targets +LIB = libBooleanGUI.la + +LIB_SRC = BooleanGUI.cxx \ + BooleanGUI_FuseDlg.cxx \ + BooleanGUI_CommonDlg.cxx \ + BooleanGUI_CutDlg.cxx \ + BooleanGUI_SectionDlg.cxx + +LIB_MOC = \ + BooleanGUI.h \ + BooleanGUI_FuseDlg.h \ + BooleanGUI_CommonDlg.h \ + BooleanGUI_CutDlg.h \ + BooleanGUI_SectionDlg.h + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lGEOMBase + +@CONCLUDE@ diff --git a/src/BuildGUI/BuildGUI.cxx b/src/BuildGUI/BuildGUI.cxx new file mode 100644 index 000000000..4d404afc2 --- /dev/null +++ b/src/BuildGUI/BuildGUI.cxx @@ -0,0 +1,265 @@ +// 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 : BooleanGUI.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "BuildGUI.h" + +#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include "BuildGUI_EdgeDlg.h" // Method EDGE +#include "BuildGUI_WireDlg.h" // Method WIRE +#include "BuildGUI_FaceDlg.h" // Method FACE +#include "BuildGUI_ShellDlg.h" // Method SHELL +#include "BuildGUI_SolidDlg.h" // Method SOLID +#include "BuildGUI_CompoundDlg.h" // Method COMPOUND + +//======================================================================= +// function : BuildGUI() +// purpose : Constructor +//======================================================================= +BuildGUI::BuildGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; +} + + +//======================================================================= +// function : ~BuildGUI() +// purpose : Destructor +//======================================================================= +BuildGUI::~BuildGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool BuildGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + BuildGUI* myBuildGUI = new BuildGUI(); + myBuildGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + + switch (theCommandID) + { + case 4081: // GEOM::EDGE + { + BuildGUI_EdgeDlg *aDlg = new BuildGUI_EdgeDlg(parent, "", myBuildGUI, Sel); + break; + } + case 4082: // GEOM::WIRE + { + BuildGUI_WireDlg *aDlg = new BuildGUI_WireDlg(parent, "", myBuildGUI, Sel); + break; + } + case 4083: // GEOM::FACE + { + BuildGUI_FaceDlg *aDlg = new BuildGUI_FaceDlg(parent, "", myBuildGUI, Sel); + break; + } + case 4084: // GEOM::SHELL + { + BuildGUI_ShellDlg *aDlg = new BuildGUI_ShellDlg(parent, "", myBuildGUI, Sel); + break; + } + case 4085: // GEOM::SOLID + { + BuildGUI_SolidDlg *aDlg = new BuildGUI_SolidDlg(parent, "", myBuildGUI, Sel); + break; + } + case 4086: // GEOM::COMPOUND + { + BuildGUI_CompoundDlg *aDlg = new BuildGUI_CompoundDlg(parent, "", myBuildGUI, Sel); + break; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//===================================================================================== +// function : MakeLinearEdgeAndDisplay() +// purpose : +//===================================================================================== +void BuildGUI::MakeLinearEdgeAndDisplay(const gp_Pnt P1, const gp_Pnt P2) +{ + try { + GEOM::PointStruct ps1 = myGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z()); + GEOM::PointStruct ps2 = myGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z()); + GEOM::GEOM_Shape_var result = myGeom->MakeEdge(ps1, ps2); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(tr("GEOM_EDGE")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeWireAndDisplay() +// purpose : +//===================================================================================== +void BuildGUI::MakeWireAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->MakeWire(listShapesIOR); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(tr("GEOM_WIRE")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeFaceAndDisplay() +// purpose : +//===================================================================================== +void BuildGUI::MakeFaceAndDisplay(GEOM::GEOM_Shape_ptr aWire, const Standard_Boolean wantPlanar) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->MakeFace(aWire, wantPlanar); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + if (wantPlanar) + result->NameType(tr("GEOM_PLANE")); + else + result->NameType(tr("GEOM_FACE")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeShellAndDisplay() +// purpose : +//===================================================================================== +void BuildGUI::MakeShellAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->MakeShell(listShapesIOR); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(tr("GEOM_SHELL")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeSolidAndDisplay() +// purpose : +//===================================================================================== +void BuildGUI::MakeSolidAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->MakeSolid(listShapesIOR); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(tr("GEOM_SOLID")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeCompoundAndDisplay() +// purpose : +//===================================================================================== +void BuildGUI::MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->MakeCompound(listShapesIOR); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(tr("GEOM_COMPOUND")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return BuildGUI::OnGUIEvent(theCommandID, parent);} +} diff --git a/src/BuildGUI/BuildGUI.h b/src/BuildGUI/BuildGUI.h new file mode 100644 index 000000000..c8672d5ac --- /dev/null +++ b/src/BuildGUI/BuildGUI.h @@ -0,0 +1,62 @@ +// 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 : BuildGUI.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef BUILDGUI_H +#define BUILDGUI_H + +#include "GEOMBase.h" +#include + +//================================================================================= +// class : BuildGUI +// purpose : +//================================================================================= +class BuildGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + BuildGUI(); + ~BuildGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + + void MakeLinearEdgeAndDisplay(const gp_Pnt P1, const gp_Pnt P2); + void MakeWireAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); + void MakeFaceAndDisplay(GEOM::GEOM_Shape_ptr aWire, const Standard_Boolean wantPlanar); + void MakeShellAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); + void MakeSolidAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); + void MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif diff --git a/src/BuildGUI/BuildGUI_CompoundDlg.cxx b/src/BuildGUI/BuildGUI_CompoundDlg.cxx new file mode 100644 index 000000000..29d3b26a8 --- /dev/null +++ b/src/BuildGUI/BuildGUI_CompoundDlg.cxx @@ -0,0 +1,189 @@ +// 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 : BuildGUI_CompoundDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BuildGUI_CompoundDlg.h" + +//================================================================================= +// class : BuildGUI_CompoundDlg() +// purpose : Constructs a BuildGUI_CompoundDlg 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. +//================================================================================= +BuildGUI_CompoundDlg::BuildGUI_CompoundDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, 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_BUILD_COMPOUND"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_COMPOUND_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_COMPOUND")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myBuildGUI = theBuildGUI; + Init(); +} + + +//================================================================================= +// function : ~BuildGUI_CompoundDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BuildGUI_CompoundDlg::~BuildGUI_CompoundDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BuildGUI_CompoundDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + myOkListShapes = false; + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BuildGUI_CompoundDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BuildGUI_CompoundDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if(myOkListShapes) + myBuildGUI->MakeCompoundAndDisplay(myListShapes); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BuildGUI_CompoundDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + myOkListShapes = false; + int nbSel = mySelection->IObjectCount(); + if(nbSel == 0) + return; + aString = tr("%1_objects").arg(nbSel); + +// int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); +// if(nbSel <= 1) { +// myOkListShapes = false; +// return; +// } + + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes); + myEditCurrentArgument->setText(aString); + myOkListShapes = true; + /* no simulation */ + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BuildGUI_CompoundDlg::SetEditCurrentArgument() +{ + GroupPoints->LineEdit1->setFocus(); + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BuildGUI_CompoundDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BuildGUI_CompoundDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} diff --git a/src/BuildGUI/BuildGUI_CompoundDlg.h b/src/BuildGUI/BuildGUI_CompoundDlg.h new file mode 100644 index 000000000..deb8a153b --- /dev/null +++ b/src/BuildGUI/BuildGUI_CompoundDlg.h @@ -0,0 +1,69 @@ +// 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 : GEOMBase_Context*_CompoundDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_COMPOUND_H +#define DIALOGBOX_COMPOUND_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel_QTD.h" + +#include "BuildGUI.h" + +//================================================================================= +// class : BuildGUI_CompoundDlg +// purpose : +//================================================================================= +class BuildGUI_CompoundDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BuildGUI_CompoundDlg(QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BuildGUI_CompoundDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + + BuildGUI* myBuildGUI; + + GEOM::GEOM_Gen::ListOfIOR myListShapes; + bool myOkListShapes; /* to check when arguments is defined */ + + DlgRef_1Sel_QTD* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + +}; + +#endif // DIALOGBOX_COMPOUND_H diff --git a/src/BuildGUI/BuildGUI_EdgeDlg.cxx b/src/BuildGUI/BuildGUI_EdgeDlg.cxx new file mode 100644 index 000000000..f5b403f0d --- /dev/null +++ b/src/BuildGUI/BuildGUI_EdgeDlg.cxx @@ -0,0 +1,278 @@ +// 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 : BuildGUI_EdgeDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BuildGUI_EdgeDlg.h" + +#include +#include + +//================================================================================= +// class : BuildGUI_EdgeDlg() +// purpose : Constructs a BuildGUI_EdgeDlg 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. +//================================================================================= +BuildGUI_EdgeDlg::BuildGUI_EdgeDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, 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_BUILD_EDGE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_EDGE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_EDGE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_POINTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); + GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myBuildGUI = theBuildGUI; + Init(); +} + + +//================================================================================= +// function : ~BuildGUI_EdgeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BuildGUI_EdgeDlg::~BuildGUI_EdgeDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myPoint1.SetCoord(0.0, 0.0, 0.0); + myPoint2.SetCoord(0.0, 0.0, 0.0); + myOkPoint1 = myOkPoint2 = false; + + /* first filter used */ + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* signals and slots connections */ + 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkPoint1 && myOkPoint2) + myBuildGUI->MakeLinearEdgeAndDisplay(myPoint1, myPoint2); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BuildGUI_EdgeDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkPoint1 = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkPoint2 = false; + return; + } + + // nbSel == 1 + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + myEditCurrentArgument->setText(aString); + myOkPoint1 = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint2)) { + myEditCurrentArgument->setText(aString); + myOkPoint2 = true; + } + + if(myOkPoint1 && myOkPoint2 && myPoint1.Distance(myPoint2) > Precision::Confusion()) + this->MakeEdgeSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + 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(myVertexFilter); + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myVertexFilter); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BuildGUI_EdgeDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : MakeMirrorSimulationAndDisplay() +// purpose : S1 is a shape and S2 a mirror. +//================================================================================= +void BuildGUI_EdgeDlg::MakeEdgeSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeEdgeSimulationAndDisplay"); + return; + } + return; +} diff --git a/src/BuildGUI/BuildGUI_EdgeDlg.h b/src/BuildGUI/BuildGUI_EdgeDlg.h new file mode 100644 index 000000000..18c34e67e --- /dev/null +++ b/src/BuildGUI/BuildGUI_EdgeDlg.h @@ -0,0 +1,76 @@ +// 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 : BuildGUI_EdgeDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_EDGE_H +#define DIALOGBOX_EDGE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel_QTD.h" + +#include "BuildGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" + +//================================================================================= +// class : BuildGUI_EdgeDlg +// purpose : +//================================================================================= +class BuildGUI_EdgeDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BuildGUI_EdgeDlg(QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BuildGUI_EdgeDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakeEdgeSimulationAndDisplay(); + + BuildGUI* myBuildGUI; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */ + + gp_Pnt myPoint1; /* Points containing the vector */ + gp_Pnt myPoint2; + bool myOkPoint1; /* true when myPoint is defined */ + bool myOkPoint2; + + DlgRef_2Sel_QTD* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + +}; + +#endif // DIALOGBOX_EDGE_H diff --git a/src/BuildGUI/BuildGUI_FaceDlg.cxx b/src/BuildGUI/BuildGUI_FaceDlg.cxx new file mode 100644 index 000000000..340519af3 --- /dev/null +++ b/src/BuildGUI/BuildGUI_FaceDlg.cxx @@ -0,0 +1,219 @@ +// 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 : BuildGUI_FaceDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BuildGUI_FaceDlg.h" + +//================================================================================= +// class : BuildGUI_FaceDlg() +// purpose : Constructs a BuildGUI_FaceDlg 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. +//================================================================================= +BuildGUI_FaceDlg::BuildGUI_FaceDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, 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_BUILD_FACE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_FACE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_FACE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel1Check_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_FACE_FFW")); + GroupPoints->TextLabel1->setText(tr("GEOM_WIRE")); + GroupPoints->CheckButton1->setText(tr("GEOM_FACE_OPT")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myBuildGUI = theBuildGUI; + Init(); +} + + +//================================================================================= +// function : ~BuildGUI_FaceDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BuildGUI_FaceDlg::~BuildGUI_FaceDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BuildGUI_FaceDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->CheckButton1->setChecked(TRUE); + + myOkShape = false; + + myWireFilter = new GEOM_ShapeTypeFilter(TopAbs_WIRE, myGeom); + mySelection->AddFilter(myWireFilter); /* first filter used */ + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BuildGUI_FaceDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BuildGUI_FaceDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if(myOkShape) + myBuildGUI->MakeFaceAndDisplay(myGeomShape, GroupPoints->CheckButton1->isChecked()); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BuildGUI_FaceDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + myOkShape = false; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + return; + } + + // nbSel == 1! + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, myShape)) + return; + + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + + myEditCurrentArgument->setText(aString); + myOkShape = true; + /* no simulation */ + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BuildGUI_FaceDlg::SetEditCurrentArgument() +{ + GroupPoints->LineEdit1->setFocus(); + mySelection->ClearFilters(); + mySelection->AddFilter(myWireFilter); + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void BuildGUI_FaceDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BuildGUI_FaceDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myWireFilter); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BuildGUI_FaceDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} diff --git a/src/BuildGUI/BuildGUI_FaceDlg.h b/src/BuildGUI/BuildGUI_FaceDlg.h new file mode 100644 index 000000000..43fd93b40 --- /dev/null +++ b/src/BuildGUI/BuildGUI_FaceDlg.h @@ -0,0 +1,76 @@ +// 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 : BuildGUI_FaceDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_FACE_H +#define DIALOGBOX_FACE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel1Check_QTD.h" + +#include "BuildGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" + +//================================================================================= +// class : BuildGUI_FaceDlg +// purpose : +//================================================================================= +class BuildGUI_FaceDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BuildGUI_FaceDlg(QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BuildGUI_FaceDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + + BuildGUI* myBuildGUI; + + /* Filter selection */ + Handle(GEOM_ShapeTypeFilter) myWireFilter; + + TopoDS_Shape myShape; /* topology used to fuse */ + GEOM::GEOM_Shape_var myGeomShape; /* is myShape */ + bool myOkShape; /* to check when arguments is defined */ + + DlgRef_1Sel1Check_QTD* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + +}; + +#endif // DIALOGBOX_FACE_H diff --git a/src/BuildGUI/BuildGUI_ShellDlg.cxx b/src/BuildGUI/BuildGUI_ShellDlg.cxx new file mode 100644 index 000000000..8a33f4cf6 --- /dev/null +++ b/src/BuildGUI/BuildGUI_ShellDlg.cxx @@ -0,0 +1,199 @@ +// 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 : BuildGUI_ShellDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "BuildGUI_ShellDlg.h" + +#include "BuildGUI.h" +#include "QAD_Desktop.h" + +//================================================================================= +// class : BuildGUI_ShellDlg() +// purpose : Constructs a BuildGUI_ShellDlg 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. +//================================================================================= +BuildGUI_ShellDlg::BuildGUI_ShellDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, 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_BUILD_SHELL"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SHELL_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SHELL")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupShell = new DlgRef_1Sel_QTD(this, "GroupShell"); + GroupShell->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupShell->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupShell->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupShell, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myBuildGUI = theBuildGUI; + Init(); +} + + +//================================================================================= +// function : ~BuildGUI_ShellDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BuildGUI_ShellDlg::~BuildGUI_ShellDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BuildGUI_ShellDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupShell->LineEdit1; + myOkListShapes = false; + + myFaceFilter = new GEOM_FaceFilter(StdSelect_Plane, myGeom); + /* Filter for the next selection */ + mySelection->AddFilter(myFaceFilter) ; + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupShell->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupShell->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BuildGUI_ShellDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return ; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BuildGUI_ShellDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + + if(myOkListShapes) + myBuildGUI->MakeShellAndDisplay(myListShapes); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BuildGUI_ShellDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; + + myOkListShapes = false; + int nbSel = mySelection->IObjectCount(); + if(nbSel == 0) + return; + + aString = tr("%1_objects").arg(nbSel); + + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes); + myEditCurrentArgument->setText(aString); + myOkListShapes = true; + + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BuildGUI_ShellDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + mySelection->ClearFilters() ; + GroupShell->LineEdit1->setFocus(); + myEditCurrentArgument = GroupShell->LineEdit1; + mySelection->AddFilter(myFaceFilter); + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BuildGUI_ShellDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myFaceFilter); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BuildGUI_ShellDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} diff --git a/src/BuildGUI/BuildGUI_ShellDlg.h b/src/BuildGUI/BuildGUI_ShellDlg.h new file mode 100644 index 000000000..87f3d428e --- /dev/null +++ b/src/BuildGUI/BuildGUI_ShellDlg.h @@ -0,0 +1,73 @@ +// 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 : BuildGUI_ShellDlg.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DIALOGBOX_SHELL_H +#define DIALOGBOX_SHELL_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel_QTD.h" + +#include "BuildGUI.h" + +#include "GEOM_FaceFilter.hxx" + +//================================================================================= +// class : BuildGUI_ShellDlg +// purpose : +//================================================================================= +class BuildGUI_ShellDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BuildGUI_ShellDlg(QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BuildGUI_ShellDlg(); + +private: + void Init(); + void enterEvent(QEvent * e); + + BuildGUI* myBuildGUI; + + Handle(GEOM_FaceFilter) myFaceFilter; /* Filters selection */ + GEOM::GEOM_Gen::ListOfIOR myListShapes; + bool myOkListShapes; /* to check when arguments is defined */ + + DlgRef_1Sel_QTD* GroupShell; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void SetEditCurrentArgument(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_SHELL_H diff --git a/src/BuildGUI/BuildGUI_SolidDlg.cxx b/src/BuildGUI/BuildGUI_SolidDlg.cxx new file mode 100644 index 000000000..d47526194 --- /dev/null +++ b/src/BuildGUI/BuildGUI_SolidDlg.cxx @@ -0,0 +1,198 @@ +// 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 : BuildGUI_SolidDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "BuildGUI_SolidDlg.h" + +#include "BuildGUI.h" +#include "QAD_Desktop.h" + +//================================================================================= +// class : BuildGUI_SolidDlg() +// purpose : Constructs a BuildGUI_SolidDlg 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. +//================================================================================= +BuildGUI_SolidDlg::BuildGUI_SolidDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, 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_BUILD_SOLID"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SOLID_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SOLID")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupSolid = new DlgRef_1Sel_QTD(this, "GroupSolid"); + GroupSolid->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupSolid->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupSolid->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupSolid, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myBuildGUI = theBuildGUI; + Init(); +} + + +//================================================================================= +// function : ~BuildGUI_SolidDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BuildGUI_SolidDlg::~BuildGUI_SolidDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BuildGUI_SolidDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupSolid->LineEdit1; + myOkListShapes = false; + + myShellFilter = new GEOM_ShapeTypeFilter(TopAbs_SHELL, myGeom); + /* filter for next selection */ + mySelection->AddFilter(myShellFilter); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupSolid->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupSolid->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BuildGUI_SolidDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return ; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BuildGUI_SolidDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + + if(myOkListShapes) + myBuildGUI->MakeSolidAndDisplay(myListShapes); + + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BuildGUI_SolidDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; + + myOkListShapes = false; + int nbSel = mySelection->IObjectCount(); + if (nbSel == 0) + return; + + aString = tr("%1_objects").arg(nbSel); + + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes); + myEditCurrentArgument->setText(aString); + myOkListShapes = true; + + return ; +} + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BuildGUI_SolidDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + mySelection->ClearFilters() ; + GroupSolid->LineEdit1->setFocus(); + myEditCurrentArgument = GroupSolid->LineEdit1; + mySelection->AddFilter(myShellFilter); + SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BuildGUI_SolidDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myShellFilter); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BuildGUI_SolidDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} diff --git a/src/BuildGUI/BuildGUI_SolidDlg.h b/src/BuildGUI/BuildGUI_SolidDlg.h new file mode 100644 index 000000000..02ac32058 --- /dev/null +++ b/src/BuildGUI/BuildGUI_SolidDlg.h @@ -0,0 +1,73 @@ +// 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 : BuildGUI_SolidDlg.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DIALOGBOX_SOLID_H +#define DIALOGBOX_SOLID_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel_QTD.h" + +#include "BuildGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" + +//================================================================================= +// class : BuildGUI_SolidDlg +// purpose : +//================================================================================= +class BuildGUI_SolidDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BuildGUI_SolidDlg(QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BuildGUI_SolidDlg(); + +private: + void Init(); + void enterEvent(QEvent * e); + + BuildGUI* myBuildGUI; + + Handle(GEOM_ShapeTypeFilter) myShellFilter; /* filter for selection */ + GEOM::GEOM_Gen::ListOfIOR myListShapes; + bool myOkListShapes; /* to check when arguments is defined */ + + DlgRef_1Sel_QTD* GroupSolid; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void SetEditCurrentArgument(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_SOLID_H diff --git a/src/BuildGUI/BuildGUI_WireDlg.cxx b/src/BuildGUI/BuildGUI_WireDlg.cxx new file mode 100644 index 000000000..8b2ea49f9 --- /dev/null +++ b/src/BuildGUI/BuildGUI_WireDlg.cxx @@ -0,0 +1,183 @@ +// 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 : BuildGUI_WireDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BuildGUI_WireDlg.h" + +//================================================================================= +// class : BuildGUI_WireDlg() +// purpose : Constructs a BuildGUI_WireDlg 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. +//================================================================================= +BuildGUI_WireDlg::BuildGUI_WireDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, 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_BUILD_WIRE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_WIRE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_WIRE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_WIRE_CONNECT")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myBuildGUI = theBuildGUI; + Init(); +} + + +//================================================================================= +// function : ~BuildGUI_WireDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BuildGUI_WireDlg::~BuildGUI_WireDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BuildGUI_WireDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + myOkListShapes = false; + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BuildGUI_WireDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BuildGUI_WireDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if(myOkListShapes) + myBuildGUI->MakeWireAndDisplay(myListShapes); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BuildGUI_WireDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel < 1) { + myOkListShapes = false; + return; + } + + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes); + myEditCurrentArgument->setText(aString); + myOkListShapes = true; + /* no simulation */ + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BuildGUI_WireDlg::SetEditCurrentArgument() +{ + GroupPoints->LineEdit1->setFocus(); + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BuildGUI_WireDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BuildGUI_WireDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} diff --git a/src/BuildGUI/BuildGUI_WireDlg.h b/src/BuildGUI/BuildGUI_WireDlg.h new file mode 100644 index 000000000..5ef146c4d --- /dev/null +++ b/src/BuildGUI/BuildGUI_WireDlg.h @@ -0,0 +1,69 @@ +// 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 : BuildGUI_WireDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_WIRE_H +#define DIALOGBOX_WIRE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel_QTD.h" + +#include "BuildGUI.h" + +//================================================================================= +// class : BuildGUI_WireDlg +// purpose : +//================================================================================= +class BuildGUI_WireDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BuildGUI_WireDlg(QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BuildGUI_WireDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + + BuildGUI* myBuildGUI; + + GEOM::GEOM_Gen::ListOfIOR myListShapes; + bool myOkListShapes; /* to check when arguments is defined */ + + DlgRef_1Sel_QTD* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + +}; + +#endif // DIALOGBOX_WIRE_H diff --git a/src/BuildGUI/Makefile.in b/src/BuildGUI/Makefile.in new file mode 100644 index 000000000..3b29f7b59 --- /dev/null +++ b/src/BuildGUI/Makefile.in @@ -0,0 +1,71 @@ +# GEOM BUILDGUI : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= + +# Libraries targets +LIB = libBuildGUI.la + +LIB_SRC = BuildGUI.cxx \ + BuildGUI_EdgeDlg.cxx \ + BuildGUI_WireDlg.cxx \ + BuildGUI_FaceDlg.cxx \ + BuildGUI_ShellDlg.cxx \ + BuildGUI_SolidDlg.cxx \ + BuildGUI_CompoundDlg.cxx + +LIB_MOC = \ + BuildGUI.h \ + BuildGUI_EdgeDlg.h \ + BuildGUI_WireDlg.h \ + BuildGUI_FaceDlg.h \ + BuildGUI_ShellDlg.h \ + BuildGUI_SolidDlg.h \ + BuildGUI_CompoundDlg.h + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lGEOMFiltersSelection -lGEOMBase + +@CONCLUDE@ diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx new file mode 100644 index 000000000..b42972f89 --- /dev/null +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -0,0 +1,1007 @@ +// 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 : DisplayGUI.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "DisplayGUI.h" + +#include "QAD_RightFrame.h" +#include "GEOM_AssemblyBuilder.h" +#include "VTKViewer_ViewFrame.h" +#include "OCCViewer_ViewFrame.h" +#include "OCCViewer_Viewer3d.h" +#include "SALOMEGUI_ImportOperation.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include + +//======================================================================= +// function : DisplayGUI() +// purpose : Constructor +//======================================================================= +DisplayGUI::DisplayGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; +} + + +//======================================================================= +// function : ~DisplayGUI() +// purpose : Destructor +//======================================================================= +DisplayGUI::~DisplayGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + + switch (theCommandID) + { + case 211: // MENU VIEW - WIREFRAME/SHADING + { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + QApplication::setOverrideCursor(waitCursor); + + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + int themode = myRenderInter->GetDisplayMode(); + if(themode==0) { + myRenderInter->SetDisplayMode(1); + QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME")); + } + else { + myRenderInter->SetDisplayMode(0); + QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING")); + } + + QApplication::restoreOverrideCursor(); + } + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + QApplication::setOverrideCursor(Qt::waitCursor); + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + AIS_DisplayMode mode = (AIS_DisplayMode)ic->DisplayMode(); + AIS_DisplayMode newmode = (mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame); + + 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()); + ic->SetDisplayMode(aSh,Standard_Integer(newmode),true); + } + ite.Next(); + } + + ic->SetDisplayMode(newmode, Standard_False); + if(newmode == 1) + QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME")); + else + QAD_Application::getDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING")); + + QApplication::restoreOverrideCursor(); + } + break; + } + case 212: // MENU VIEW - DISPLAY ALL + { + myDisplayGUI->OnDisplayAll(); + break; + } + case 213: // MENU VIEW - DISPLAY ONLY + { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) + myDisplayGUI->OnVTKDisplayOnly(); + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + myDisplayGUI->OnDisplayOnly(); + break; + } + case 214: // MENU VIEW - ERASE ALL + { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) + ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->EraseAll(); + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + + ic->EraseAll(Standard_True, Standard_False); + ic->Display(v3d->getTrihedron()); + } + break; + } + case 215: // MENU VIEW - ERASE ONLY + { + myDisplayGUI->OnErase(); + break; + } + case 8031: // POPUP VIEWER - WIREFRAME/SHADING + { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + // VTK + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + + QApplication::setOverrideCursor(Qt::waitCursor); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IOS = It.Value(); + myRenderInter->SwitchRepresentation(IOS, false); + } + myRenderInter->Render(); + QApplication::restoreOverrideCursor(); + } + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + QApplication::setOverrideCursor(Qt::waitCursor); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + Handle(GEOM_AISShape) Shape = myDisplayGUI->myGeomBase->ConvertIOinGEOMAISShape(IObject, found, true); + if(!Shape.IsNull()) { + AIS_DisplayMode mode = (AIS_DisplayMode)Shape->DisplayMode(); + if(mode == -1) + mode = (AIS_DisplayMode)ic->DisplayMode(); + + ic->SetDisplayMode(Shape, mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame, false); + } + } + ic->UpdateCurrentViewer(); + } + QApplication::restoreOverrideCursor(); + break; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//================================================================================= +// function : BuildPresentation() +// purpose : static +//================================================================================= +void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO) +{ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + + OCCViewer_Viewer3d* v3d; + Handle(AIS_InteractiveContext) ic; + vtkRenderer* Renderer; + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + ic = v3d->getAISContext(); + } + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + Renderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + } + else + return; + + if(theIO.IsNull()) + MESSAGE("BuildPresentation(): null SALOME_InteractiveObject passed") + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + // VTK + + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); + + SALOMEDS::SObject_var obj = aStudy->FindObjectID(theIO->getEntry()); + + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + + if(myRenderInter->isInViewer(theIO)) { + myRenderInter->Display(theIO, false); + } + else { + // Create new actor + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + // this SObject may be GEOM module root SObject + + bool useSubItems = false; + SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj); + if(myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) { + while (anIter->More() && !useSubItems) { + SALOMEDS::SObject_var subobj = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttr; + if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { + if (!myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) { + anAttr = aTmpAttr; + obj = subobj; + useSubItems = true; + } + else + anIter->Next(); + } + else + anIter->Next(); + } + } + + while(useSubItems?anIter->More():!anAttr->_is_nil()) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var aShape = myDisplayGUI->myGeom->GetIORFromString(anIOR->Value()); + TopoDS_Shape Shape = myDisplayGUI->myGeomGUI->GetShapeReader().GetShape(myDisplayGUI->myGeom,aShape); + + if(obj->FindAttribute(anAttr, "AttributeName")) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + + vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* theAllActors = theRenderer->GetActors(); + theAllActors->InitTraversal(); + vtkActor* actor = (vtkActor*)theAllActors->GetNextActor(); + Handle(SALOME_InteractiveObject) anIObj; + // don't create new study object if it already exists + bool isDisplayed = false; + while(!(actor==NULL)) { + SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor); + if(Gactor!=NULL) { + if(Gactor->hasIO()) { + if(strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) { + isDisplayed = true; + anIObj = Gactor->getIO(); + if(!anIObj.IsNull()) myRenderInter->Display(anIObj, false); + } + } + } + actor=(vtkActor*)(theAllActors->GetNextActor()); + } + if(!isDisplayed) { + // open transaction + QAD_Operation* op = new SALOMEGUI_ImportOperation( QAD_Application::getDesktop()->getActiveStudy() ); + op->start(); + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, obj); + // commit transaction + op->finish(); + + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + int themode = myRenderInter->GetDisplayMode(); + + vtkActorCollection* theActors = + GEOM_AssemblyBuilder::BuildActors(Shape,0,themode,Standard_True); + theActors->InitTraversal(); + vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); + while(!(anActor==NULL)) { + GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); + Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myDisplayGUI->myGeomGUI->GetFatherior(),"GEOM"); + IO->setEntry(obj->GetID()); + GActor->setIO(IO); + GActor->setName(theIO->getName()); + + theRenderer->AddActor(GActor); + // renWin->Render(); + anActor = (vtkActor*)theActors->GetNextActor(); + } + } + } + // next item iteration + if(useSubItems) { + anIter->Next(); + anAttr = SALOMEDS::GenericAttribute::_nil(); + while(anIter->More() && anAttr->_is_nil()) { + SALOMEDS::SObject_var subobject = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttribute; + if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { + anAttr = aTmpAttribute; + obj = subobject; + } + else + anIter->Next(); + } + } + else + anAttr = SALOMEDS::GenericAttribute::_nil(); + } + } + } + } + // No viewer update should be done here! + //myRenderInter->Render(); + //QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser( true ); + } + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + + if(v3d->isInViewer(theIO, true)) { + Standard_Boolean found; + Handle(GEOM_AISShape) aSh = myDisplayGUI->myGeomBase->ConvertIOinGEOMAISShape(theIO, found, true); + if(found) { + ic->Display(aSh, false); + ic->AddOrRemoveCurrentObject(aSh, false); + } + + } + else { + SALOMEDS::SObject_var obj = aStudy->FindObjectID(theIO->getEntry()); + if(!obj->_is_nil()) { + MESSAGE("BuildPresentation(): SObject not null") + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + MESSAGE("BuildPresentation(): SObject has IOR") + // this SObject may be GEOM module root SObject + + bool useSubItems = false; + SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj); + if(myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) { + while(anIter->More() && !useSubItems) { + SALOMEDS::SObject_var subobj = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttr; + if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { + if(!myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) { + anAttr = aTmpAttr; + obj = subobj; + useSubItems = true; + } + else + anIter->Next(); + } + else + anIter->Next(); + } + } + + while(useSubItems?anIter->More():!anAttr->_is_nil()) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var aShape = myDisplayGUI->myGeom->GetIORFromString(anIOR->Value()); + TopoDS_Shape Shape = myDisplayGUI->myGeomGUI->GetShapeReader().GetShape(myDisplayGUI->myGeom,aShape); + if(Shape.IsNull()) + MESSAGE("BuildPresentation(): TopoDS_Shape is null!") + if(obj->FindAttribute(anAttr, "AttributeName")) { + MESSAGE("BuildPresentation(): SObject has Name") + aName = SALOMEDS::AttributeName::_narrow(anAttr); + // searchin for already displayed objects with the same shape + AIS_ListOfInteractive aDisplayed; + ic->DisplayedObjects(aDisplayed); + AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed); + Handle(AIS_Shape) anAISShape; + for(;anIObjects.More();anIObjects.Next()) { + anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value()); + if(!anAISShape.IsNull()) { + if(anAISShape->Shape().IsSame(Shape)) + break; + anAISShape.Nullify(); + } + } + if(!anAISShape.IsNull()) { + if(!ic->IsDisplayed(anAISShape)) + ic->Display(anAISShape, false); + } + else { + if(!useSubItems) { + // open transaction + QAD_Operation* op = new SALOMEGUI_ImportOperation( QAD_Application::getDesktop()->getActiveStudy() ); + op->start(); + if (fatherSF->_is_nil()) + MESSAGE("BuildPresentation(): fatherSF is nil!") + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, obj); + // commit transaction + op->finish(); + } + Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value()); + aSh->SetShadingColor(myDisplayGUI->myGeomBase->myShadingColor); + Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myDisplayGUI->myGeomGUI->GetFatherior(), "GEOM"); + IO->setEntry(obj->GetID()); + aSh->setIO(IO); + aSh->setName(aName->Value()); + ic->Display(aSh, false); + if(!useSubItems) + ic->AddOrRemoveCurrentObject(aSh, false); + } + } + // next item iteration + if(useSubItems) { + anIter->Next(); + anAttr=SALOMEDS::GenericAttribute::_nil(); + while (anIter->More() && anAttr->_is_nil()) { + SALOMEDS::SObject_var subobject = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttribute; + if(subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { + anAttr = aTmpAttribute; + obj = subobject; + } + else + anIter->Next(); + } + } + else + anAttr = SALOMEDS::GenericAttribute::_nil(); + } + } + } + } + // No viewer update should be done here! + //QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser( true ); + //ic->UpdateCurrentViewer(); + } +} + + +//===================================================================================== +// function : OnDisplayAll() +// purpose : +//===================================================================================== +void DisplayGUI::OnDisplayAll(bool onlyPreviousDisplayedObject) +{ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); + + //myContext->Display(v3d->getTrihedron()); + + if(!onlyPreviousDisplayedObject) { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM"); + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SC); + for(; it->More();it->Next()) { + SALOMEDS::SObject_var CSO = it->Value(); + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::GenericAttribute_var anAttr; + if(CSO->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + Standard_Boolean testResult; + Handle(GEOM_AISShape) aSh = myGeomBase->ConvertIORinGEOMAISShape(anIOR->Value(), testResult); + if(testResult) + myContext->Display(aSh); + else { + GEOM::GEOM_Shape_ptr aShape = myGeom->GetIORFromString(anIOR->Value()); + bool AddInSt = myGeomBase->mySettings_AddInStudy; + myGeomBase->mySettings_AddInStudy = false; + myGeomBase->Display(aShape); + myGeomBase->mySettings_AddInStudy = AddInSt; + } + } + } + } + else { + AIS_ListOfInteractive aListDisplayedObject; + myContext->DisplayedObjects(aListDisplayedObject); + AIS_ListIteratorOfListOfInteractive ite(aListDisplayedObject); + while(ite.More()) { + if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + if (aSh->hasIO()) { + Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); + if (v3d->isInViewer(GIO,true)) + myContext->Display(aSh); + } + } + ite.Next(); + } + } + } + else if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM"); + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SC); + for(; it->More();it->Next()) { + SALOMEDS::SObject_var CSO = it->Value(); + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::GenericAttribute_var anAttr; + if(CSO->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + Standard_Boolean testResult; + GEOM_Actor* aSh = myGeomBase->ConvertIORinGEOMActor(anIOR->Value(), testResult); + if(testResult) { + Handle(SALOME_InteractiveObject) IObject = aSh->getIO(); + ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->Display(IObject); + } + else { + GEOM::GEOM_Shape_ptr aShape = myGeom->GetIORFromString(anIOR->Value()); + bool AddInSt = myGeomBase->mySettings_AddInStudy; + myGeomBase->mySettings_AddInStudy = false; + myGeomBase->Display(aShape); + myGeomBase->mySettings_AddInStudy = AddInSt; + } + } + } + } + return; +} + + +//===================================================================================== +// function : OnVTKDisplayOnly() +// purpose : +//===================================================================================== +void DisplayGUI::OnVTKDisplayOnly() +{ + QApplication::setOverrideCursor(Qt::waitCursor); + + // Erase all not selected actors + vtkRenderer* aren = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* theActors = aren->GetActors(); + theActors->InitTraversal(); + vtkActor *ac = theActors->GetNextActor(); + while(!(ac==NULL)) { + if(ac->IsA("SALOME_Actor")) { + SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(ac); + if(!anActor->isHighlighted()) + anActor->VisibilityOff(); + } + ac = theActors->GetNextActor(); + } + + // Display selection + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); + + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + if(myRenderInter->isInViewer(IObject)) { + myRenderInter->Display(IObject); + } + else { + // Create new actor + if(!obj->_is_nil()) { + if(!obj->FindAttribute(anAttr, "AttributeIOR")) + break; + // If selected object contains displayable subobjects, then do nothing + SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj); + SALOMEDS::GenericAttribute_var aTmpAttr; + + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value()); + if(CORBA::is_nil(aShape)) continue; + TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + + if(obj->FindAttribute(anAttr, "AttributeName")) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + // open transaction + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); + op->start(); + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, obj); + // commit transaction + op->finish(); + + vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + int themode = myRenderInter->GetDisplayMode(); + vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(Shape, 0, themode, Standard_True); + theActors->InitTraversal(); + vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); + while(!(anActor==NULL)) { + GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); + GActor->setIO(IObject); + GActor->setName(IObject->getName()); + + theRenderer->AddActor(GActor); + vtkRenderWindow *renWin = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer()->GetRenderWindow(); + renWin->Render(); + anActor = (vtkActor*)theActors->GetNextActor(); + } + } + } + } + } + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(true); + + QApplication::restoreOverrideCursor(); + return; +} + + +//===================================================================================== +// function : OnDisplayOnly() +// purpose : +//===================================================================================== +void DisplayGUI::OnDisplayOnly() +{ + if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + AIS_ListOfInteractive List; + 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 (!ic->IsSelected( aSh )) { + ic->Erase(aSh, Standard_True, Standard_True); + } + } + ite.Next(); + } + + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + + SALOME_ListIteratorOfListIO It1(Sel->StoredIObjects()); + for(;It1.More();It1.Next()) { + Handle(SALOME_InteractiveObject) IObject = It1.Value(); + + SALOMEDS::SObject_var fatherSF = + aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); + if(v3d->isInViewer(IObject, true)) { + AIS_ListOfInteractive List1; + ic->ObjectsInCollector(List1); + AIS_ListIteratorOfListOfInteractive ite1(List1); + while(ite1.More()) { + if(ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value()); + if (aSh->hasIO()) { + Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); + if (IObject->isSame(GIO)) { + ic->Display(aSh); + ic->AddOrRemoveCurrentObject(aSh, true); + break; + } + } + } + ite1.Next(); + } + } + else { + if (IObject->hasEntry()) { + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + if (!obj->_is_nil()) { + if (obj->FindAttribute(anAttr, "AttributeIOR")) { + // this SObject may be GEOM module root SObject + + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value()); + if(CORBA::is_nil(aShape)) continue; + TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + + if(obj->FindAttribute(anAttr, "AttributeName")) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + // open transaction + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); + op->start(); + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, obj); + // commit transaction + op->finish(); + } + + Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value()); + Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myGeomGUI->GetFatherior(),"GEOM"); + + IO->setEntry(obj->GetID()); + aSh->setIO(IO); + aSh->setName(aName->Value()); + ic->Display(aSh); + ic->AddOrRemoveCurrentObject(aSh, true); + } + } + } + } + } +} + + +//===================================================================================== +// function : OnErase() +// purpose : +//===================================================================================== +void DisplayGUI::OnErase() +{ + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + // VTK + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + Handle(SALOME_InteractiveObject) anIObject; + for(;It.More();It.Next()) { + anIObject = It.Value(); + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + if(myRenderInter->isInViewer(anIObject)) { + myRenderInter->Erase(anIObject); + } + else { + SALOMEDS::SObject_var obj = aStudy->FindObjectID(anIObject->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + // this SObject may be GEOM module root SObject + SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj); + bool useSubItems = false; + while(anIter->More() && !useSubItems) { + SALOMEDS::SObject_var subobj = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttr; + if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { + anAttr = aTmpAttr; + obj = subobj; + useSubItems = true; + } + else + anIter->Next(); + } + + while(useSubItems?anIter->More():!anAttr->_is_nil()) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value()); + TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + if(obj->FindAttribute(anAttr, "AttributeName")) { + // searchin for already displayed objects with the same shape + vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* theAllActors = theRenderer->GetActors(); + theAllActors->InitTraversal(); + vtkActor* actor = (vtkActor*)theAllActors->GetNextActor(); + Handle(SALOME_InteractiveObject) anIObj; + // don't create new study object if it already exists + bool isDisplayed = false; + while(!(actor==NULL)) { + SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor); + if(Gactor!=NULL) { + if(Gactor->hasIO()) { + if(strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) { + isDisplayed = true; + anIObj = Gactor->getIO(); + if(!anIObj.IsNull()) + myRenderInter->Erase(anIObj); + } + } + } + actor=(vtkActor*)(theAllActors->GetNextActor()); + } + } + if(useSubItems) { + anIter->Next(); + anAttr=SALOMEDS::GenericAttribute::_nil(); + while(anIter->More() && anAttr->_is_nil()) { + SALOMEDS::SObject_var subobject = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttribute; + if(subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { + anAttr = aTmpAttribute; + obj = subobject; + } + else + anIter->Next(); + } + } + else + anAttr = SALOMEDS::GenericAttribute::_nil(); + } + } + } + } + } + } + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + // OCC + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + Handle(SALOME_InteractiveObject) anIObject; + for(;It.More();It.Next()) { + anIObject = It.Value(); + if(v3d->isInViewer(anIObject, true)) { + Standard_Boolean found; + Handle(GEOM_AISShape) aSh = myGeomBase->ConvertIOinGEOMAISShape(anIObject, found, true); + if(found) { + ic->Erase(aSh); + ic->AddOrRemoveCurrentObject(aSh, true); + } + } + else { + SALOMEDS::SObject_var obj = aStudy->FindObjectID(anIObject->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + // this SObject may be GEOM module root SObject + SALOMEDS::ChildIterator_var anIter = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument()->NewChildIterator(obj); + bool useSubItems = false; + while(anIter->More() && !useSubItems) { + SALOMEDS::SObject_var subobj = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttr; + if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { + anAttr = aTmpAttr; + obj = subobj; + useSubItems = true; + } + else + anIter->Next(); + } + + while(useSubItems?anIter->More():!anAttr->_is_nil()) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value()); + TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + if(obj->FindAttribute(anAttr, "AttributeName")) { + // searchin for already displayed objects with the same shape + AIS_ListOfInteractive aDisplayed; + ic->DisplayedObjects(aDisplayed); + AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed); + Handle(AIS_Shape) anAISShape; + for(;anIObjects.More();anIObjects.Next()) { + anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value()); + if(!anAISShape.IsNull()) { + if(anAISShape->Shape().IsSame(Shape)) + break; + anAISShape.Nullify(); + } + } + if(!anAISShape.IsNull()) { + if(ic->IsDisplayed(anAISShape)) + ic->Erase(anAISShape); + } + } + if(useSubItems) { + anIter->Next(); + anAttr=SALOMEDS::GenericAttribute::_nil(); + while(anIter->More() && anAttr->_is_nil()) { + SALOMEDS::SObject_var subobject = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttribute; + if(subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { + anAttr = aTmpAttribute; + obj = subobject; + } + else + anIter->Next(); + } + } + else + anAttr = SALOMEDS::GenericAttribute::_nil(); + } + } + } + } + } + } + Sel->ClearIObjects(); +} + + +//===================================================================================== +// function : PrepareSubShapeSelection() +// purpose : (localContextId of the method is opened and defined here) +//===================================================================================== +bool DisplayGUI::PrepareSubShapeSelection(const int SubShapeType, Standard_Integer& returnLocalContextId) +{ + //* Test the type of viewer */ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + /* local context opening */ + //myGeomBase->SetDisplayedObjectList(); + this->OnDisplayOnly(); + + returnLocalContextId = ic->OpenLocalContext(Standard_False, Standard_True, Standard_False, Standard_False); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + Handle(GEOM_AISShape) Shape = myGeomBase->ConvertIOinGEOMAISShape(IObject, found); + if(found && SubShapeType >= Shape->Shape().ShapeType()) { + ic->Load(Shape, (8 - SubShapeType), Standard_True); + ic->HilightWithColor(Shape, Quantity_NOC_RED); + } + } + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_SUBSHAPES")); + return true; +} + + +//===================================================================================== +// function : PrepareSubShapeSelectionArgumentShape() +// purpose : ( localContextId of the method is opened and defined here ) +//===================================================================================== +bool DisplayGUI::PrepareSubShapeSelectionArgumentShape(const TopoDS_Shape& aShape,const int SubShapeType, Standard_Integer& returnLocalContextId) +{ + //* Test the type of viewer */ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + if(aShape.IsNull()) + return false ; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + /* local context opening */ + //myGeomBase->SetDisplayedObjectList(); + this->OnDisplayOnly(); + + returnLocalContextId = ic->OpenLocalContext(Standard_False, Standard_True, Standard_False, Standard_False) ; + + Handle(GEOM_AISShape) Shape = new GEOM_AISShape(aShape, ""); + ic->Display(Shape, 0, (8 - SubShapeType)); + + // Not Load(...) but Display(...) + // ic->Load(Shape, (8 - SubShapeType), Standard_True); + ic->HilightWithColor(Shape, Quantity_NOC_RED); + + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_SUBSHAPES")); + return true; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return DisplayGUI::OnGUIEvent(theCommandID, parent);} + + void BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO) + {return DisplayGUI::BuildPresentation(theIO);} +} diff --git a/src/DisplayGUI/DisplayGUI.h b/src/DisplayGUI/DisplayGUI.h new file mode 100644 index 000000000..1c4aef111 --- /dev/null +++ b/src/DisplayGUI/DisplayGUI.h @@ -0,0 +1,66 @@ +// 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 : DisplayGUI.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DISPLAYGUI_H +#define DISPLAYGUI_H + +#include "GEOMBase.h" + +//================================================================================= +// class : GEOMBase_Display +// purpose : +//================================================================================= +class DisplayGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + DisplayGUI(); + ~DisplayGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + static void BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO); + + void OnDisplayAll(bool onlyPreviousDisplayedObject = false); + void OnVTKDisplayOnly(); + void OnDisplayOnly(); + void OnErase(); + + /* Method opening context for any sub shape selection */ + bool PrepareSubShapeSelection(const int SubShapeType, Standard_Integer& returnLocalContextId); + /* Method opening context for sub shape selection on an argument shape */ + bool PrepareSubShapeSelectionArgumentShape(const TopoDS_Shape& aShape, const int SubShapeType, + Standard_Integer& returnLocalContextId); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif diff --git a/src/DisplayGUI/Makefile.in b/src/DisplayGUI/Makefile.in new file mode 100644 index 000000000..d1cd6aa6a --- /dev/null +++ b/src/DisplayGUI/Makefile.in @@ -0,0 +1,59 @@ +# GEOM DISPLAYGUI : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets +LIB = libDisplayGUI.la + +# header files +EXPORT_HEADERS= DisplayGUI.h + +LIB_SRC = DisplayGUI.cxx + +LIB_MOC = \ + DisplayGUI.h + +LIB_CLIENT_IDL = SALOME_Exception.idl + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lGEOMBase + +@CONCLUDE@ diff --git a/src/DlgRef/DlgRef_1Sel1Check1List_QTD.cxx b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.cxx new file mode 100644 index 000000000..b629360ef --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.cxx @@ -0,0 +1,91 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel1Check1List_QTD.ui' +** +** Created: lun oct 27 16:18:55 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel1Check1List_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel1Check1List_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel1Check1List_QTD::DlgRef_1Sel1Check1List_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel1Check1List_QTD" ); + resize( 129, 104 ); + setCaption( trUtf8( "DlgRef_1Sel1Check1List_QTD" ) ); + DlgRef_1Sel1Check1List_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel1Check1List_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + QSpacerItem* spacer = new QSpacerItem( 0, 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 ); + + 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 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel1Check1List_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel1Check1List_QTD::~DlgRef_1Sel1Check1List_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel1Check1List_QTD.h b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.h new file mode 100644 index 000000000..d1b8893b3 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Check1List_QTD.h @@ -0,0 +1,47 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel1Check1List_QTD.ui' +** +** Created: lun oct 27 16:18:55 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL1CHECK1LIST_QTD_H +#define DLGREF_1SEL1CHECK1LIST_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QComboBox; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; + +class DlgRef_1Sel1Check1List_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel1Check1List_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel1Check1List_QTD(); + + QGroupBox* GroupBox1; + QRadioButton* CheckButton1; + QLabel* TextLabel2; + QComboBox* ComboBox1; + QLineEdit* LineEdit1; + QLabel* TextLabel1; + QPushButton* PushButton1; + + +protected: + QGridLayout* DlgRef_1Sel1Check1List_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_1SEL1CHECK1LIST_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel1Check_QTD.cxx b/src/DlgRef/DlgRef_1Sel1Check_QTD.cxx new file mode 100644 index 000000000..98de50013 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Check_QTD.cxx @@ -0,0 +1,79 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel1Check_QTD.ui' +** +** Created: ven oct 10 11:28:38 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel1Check_QTD::DlgRef_1Sel1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel1Check_QTD" ); + resize( 129, 76 ); + setCaption( trUtf8( "DlgRef_1Sel1Check_QTD" ) ); + DlgRef_1Sel1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel1Check_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"); + + 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 ); + QSpacerItem* spacer = new QSpacerItem( 0, 113, 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 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton1, 1, 1, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel1Check_QTD::~DlgRef_1Sel1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel1Check_QTD.h b/src/DlgRef/DlgRef_1Sel1Check_QTD.h new file mode 100644 index 000000000..7f083d9ff --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Check_QTD.h @@ -0,0 +1,44 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel1Check_QTD.ui' +** +** Created: ven oct 10 11:28:37 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL1CHECK_QTD_H +#define DLGREF_1SEL1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; + +class DlgRef_1Sel1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel1Check_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + QRadioButton* CheckButton1; + + +protected: + QGridLayout* DlgRef_1Sel1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_1SEL1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel1Spin.cxx b/src/DlgRef/DlgRef_1Sel1Spin.cxx new file mode 100644 index 000000000..86be0f2dd --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin.cxx @@ -0,0 +1,54 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DlgRef_1Sel1Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_1Sel1Spin.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel1Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_1Sel1Spin::DlgRef_1Sel1Spin(QWidget* parent, const char* name, WFlags fl) + :DlgRef_1Sel1Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout2->addWidget(SpinBox_DX, 0, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel1Spin::~DlgRef_1Sel1Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_1Sel1Spin.h b/src/DlgRef/DlgRef_1Sel1Spin.h new file mode 100644 index 000000000..64c560b7b --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin.h @@ -0,0 +1,47 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DlgRef_1Sel1Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_1SEL1SPIN_H +#define DLGREF_1SEL1SPIN_H + +#include "DlgRef_1Sel1Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_1Sel1Spin : public DlgRef_1Sel1Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_1Sel1Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel1Spin(); + + DlgRef_SpinBox* SpinBox_DX; + +}; + +#endif // DLGREF_1SEL1SPIN_H diff --git a/src/DlgRef/DlgRef_1Sel1Spin1Check.cxx b/src/DlgRef/DlgRef_1Sel1Spin1Check.cxx new file mode 100644 index 000000000..89196c2fc --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin1Check.cxx @@ -0,0 +1,54 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DlgRef_1Sel1Spin1Check.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_1Sel1Spin1Check.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel1Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_1Sel1Spin1Check::DlgRef_1Sel1Spin1Check(QWidget* parent, const char* name, WFlags fl) + :DlgRef_1Sel1Spin1Check_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout2->addWidget(SpinBox_DX, 0, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel1Spin1Check::~DlgRef_1Sel1Spin1Check() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_1Sel1Spin1Check.h b/src/DlgRef/DlgRef_1Sel1Spin1Check.h new file mode 100644 index 000000000..6d0b2d6e4 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin1Check.h @@ -0,0 +1,47 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DlgRef_1Sel1Spin1Check.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_1SEL1SPIN1CHECK_H +#define DLGREF_1SEL1SPIN1CHECK_H + +#include "DlgRef_1Sel1Spin1Check_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_1Sel1Spin1Check : public DlgRef_1Sel1Spin1Check_QTD +{ + Q_OBJECT + +public: + DlgRef_1Sel1Spin1Check(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_1Sel1Spin1Check(); + + DlgRef_SpinBox* SpinBox_DX; + +}; + +#endif // DLGREF_1SEL1SPIN1CHECK_H diff --git a/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.cxx b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.cxx new file mode 100644 index 000000000..12fc89820 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.cxx @@ -0,0 +1,95 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel1Spin1Check_QTD.ui' +** +** Created: lun nov 17 14:16:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel1Spin1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel1Spin1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel1Spin1Check_QTD::DlgRef_1Sel1Spin1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel1Spin1Check_QTD" ); + resize( 129, 106 ); + setCaption( trUtf8( "DlgRef_1Sel1Spin1Check_QTD" ) ); + DlgRef_1Sel1Spin1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel1Spin1Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + QSpacerItem* spacer = new QSpacerItem( 0, 120, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout2->addWidget( TextLabel2, 0, 0 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton1, 2, 2, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel1Spin1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel1Spin1Check_QTD::~DlgRef_1Sel1Spin1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.h b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.h new file mode 100644 index 000000000..cf3722b32 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin1Check_QTD.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel1Spin1Check_QTD.ui' +** +** Created: lun nov 17 14:16:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL1SPIN1CHECK_QTD_H +#define DLGREF_1SEL1SPIN1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QSpinBox; + +class DlgRef_1Sel1Spin1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel1Spin1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel1Spin1Check_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QPushButton* PushButton1; + QSpinBox* SpinBox1; + QLabel* TextLabel2; + QLineEdit* LineEdit1; + QRadioButton* CheckButton1; + + +protected: + QGridLayout* DlgRef_1Sel1Spin1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_1SEL1SPIN1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel1Spin_QTD.cxx b/src/DlgRef/DlgRef_1Sel1Spin_QTD.cxx new file mode 100644 index 000000000..34846e0e9 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin_QTD.cxx @@ -0,0 +1,89 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel1Spin_QTD.ui' +** +** Created: mar sep 23 16:05:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel1Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel1Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel1Spin_QTD::DlgRef_1Sel1Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel1Spin_QTD" ); + resize( 129, 87 ); + setCaption( trUtf8( "DlgRef_1Sel1Spin_QTD" ) ); + DlgRef_1Sel1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel1Spin_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"); + + 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 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + 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 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 0, 1 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel1Spin_QTD::~DlgRef_1Sel1Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel1Spin_QTD.h b/src/DlgRef/DlgRef_1Sel1Spin_QTD.h new file mode 100644 index 000000000..dba7a6e5c --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel1Spin_QTD.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel1Spin_QTD.ui' +** +** Created: mar sep 23 16:05:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL1SPIN_QTD_H +#define DLGREF_1SEL1SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_1Sel1Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel1Spin_QTD(); + + QGroupBox* GroupBox1; + QPushButton* PushButton1; + QLabel* TextLabel1; + QLineEdit* LineEdit1; + QLabel* TextLabel2; + QSpinBox* SpinBox1; + + +protected: + QGridLayout* DlgRef_1Sel1Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_1SEL1SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel2Spin.cxx b/src/DlgRef/DlgRef_1Sel2Spin.cxx new file mode 100644 index 000000000..f8471b369 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel2Spin.cxx @@ -0,0 +1,60 @@ +// 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_1Sel2Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_1Sel2Spin.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel2Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_1Sel2Spin::DlgRef_1Sel2Spin(QWidget* parent, const char* name, WFlags fl) + :DlgRef_1Sel2Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout2->addWidget(SpinBox_DX, 0, 1); + + SpinBox_DY = new DlgRef_SpinBox( GroupBox1, "SpinBox_DY"); + Layout2->addWidget(SpinBox_DY, 1, 1); + +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel2Spin::~DlgRef_1Sel2Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_1Sel2Spin.h b/src/DlgRef/DlgRef_1Sel2Spin.h new file mode 100644 index 000000000..33a11f4f5 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel2Spin.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_1Sel2Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_1SEL2SPIN_H +#define DLGREF_1SEL2SPIN_H + +#include "DlgRef_1Sel2Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_1Sel2Spin : public DlgRef_1Sel2Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_1Sel2Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_1Sel2Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + +}; + +#endif // DLGREF_1SEL2SPIN_H diff --git a/src/DlgRef/DlgRef_1Sel2Spin_QTD.cxx b/src/DlgRef/DlgRef_1Sel2Spin_QTD.cxx new file mode 100644 index 000000000..9e0e82546 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel2Spin_QTD.cxx @@ -0,0 +1,100 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel2Spin_QTD.ui' +** +** Created: jeu oct 2 11:08:05 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel2Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel2Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel2Spin_QTD::DlgRef_1Sel2Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel2Spin_QTD" ); + resize( 129, 115 ); + setCaption( trUtf8( "DlgRef_1Sel2Spin_QTD" ) ); + DlgRef_1Sel2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel2Spin_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"); + + 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, 1, 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 ); + + 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 ); + + 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, 1, 1, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 30, 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 ); + + DlgRef_1Sel2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel2Spin_QTD::~DlgRef_1Sel2Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel2Spin_QTD.h b/src/DlgRef/DlgRef_1Sel2Spin_QTD.h new file mode 100644 index 000000000..82cae8783 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel2Spin_QTD.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel2Spin_QTD.ui' +** +** Created: jeu oct 2 11:08:05 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL2SPIN_QTD_H +#define DLGREF_1SEL2SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_1Sel2Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel2Spin_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QLabel* TextLabel2; + QSpinBox* SpinBox2; + QLineEdit* LineEdit1; + QPushButton* PushButton1; + QLabel* TextLabel1; + + +protected: + QGridLayout* DlgRef_1Sel2Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_1SEL2SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel3Check_QTD.cxx b/src/DlgRef/DlgRef_1Sel3Check_QTD.cxx new file mode 100644 index 000000000..3778dd33e --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel3Check_QTD.cxx @@ -0,0 +1,89 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel3Check_QTD.ui' +** +** Created: lun nov 17 11:32:21 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel3Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel3Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel3Check_QTD::DlgRef_1Sel3Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel3Check_QTD" ); + resize( 129, 114 ); + setCaption( trUtf8( "DlgRef_1Sel3Check_QTD" ) ); + DlgRef_1Sel3Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel3Check_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + CheckButton2 = new QRadioButton( GroupBox1, "CheckButton2" ); + CheckButton2->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton2, 2, 2, 0, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 60, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 4, 2 ); + + CheckButton3 = new QRadioButton( GroupBox1, "CheckButton3" ); + CheckButton3->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton3, 3, 3, 0, 2 ); + + CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckButton1, 1, 1, 0, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel3Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel3Check_QTD::~DlgRef_1Sel3Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel3Check_QTD.h b/src/DlgRef/DlgRef_1Sel3Check_QTD.h new file mode 100644 index 000000000..248f7f773 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel3Check_QTD.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel3Check_QTD.ui' +** +** Created: lun nov 17 11:32:20 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL3CHECK_QTD_H +#define DLGREF_1SEL3CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; + +class DlgRef_1Sel3Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel3Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel3Check_QTD(); + + QGroupBox* GroupBox1; + QRadioButton* CheckButton2; + QLabel* TextLabel1; + QPushButton* PushButton1; + QRadioButton* CheckButton3; + QRadioButton* CheckButton1; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* DlgRef_1Sel3Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_1SEL3CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel3Spin.cxx b/src/DlgRef/DlgRef_1Sel3Spin.cxx new file mode 100644 index 000000000..8cf310421 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel3Spin.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_1Sel3Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_1Sel3Spin.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel3Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_1Sel3Spin::DlgRef_1Sel3Spin(QWidget* parent, const char* name, WFlags fl) + :DlgRef_1Sel3Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox3->close(TRUE); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout2->addWidget(SpinBox_DX, 0, 1); + + SpinBox_DY = new DlgRef_SpinBox( GroupBox1, "SpinBox_DY"); + Layout2->addWidget(SpinBox_DY, 1, 1); + + SpinBox_DZ = new DlgRef_SpinBox( GroupBox1, "SpinBox_DZ"); + Layout2->addWidget(SpinBox_DZ, 2, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel3Spin::~DlgRef_1Sel3Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_1Sel3Spin.h b/src/DlgRef/DlgRef_1Sel3Spin.h new file mode 100644 index 000000000..1cdad86b6 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel3Spin.h @@ -0,0 +1,49 @@ +// 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_1Sel3Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_1SEL3SPIN_H +#define DLGREF_1SEL3SPIN_H + +#include "DlgRef_1Sel3Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_1Sel3Spin : public DlgRef_1Sel3Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_1Sel3Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_1Sel3Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + DlgRef_SpinBox* SpinBox_DZ; + +}; + +#endif // DLGREF_1SEL3SPIN_H diff --git a/src/DlgRef/DlgRef_1Sel3Spin_QTD.cxx b/src/DlgRef/DlgRef_1Sel3Spin_QTD.cxx new file mode 100644 index 000000000..a4c3cb2d8 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel3Spin_QTD.cxx @@ -0,0 +1,111 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel3Spin_QTD.ui' +** +** Created: ven oct 24 15:55:11 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel3Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel3Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel3Spin_QTD::DlgRef_1Sel3Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel3Spin_QTD" ); + resize( 129, 143 ); + setCaption( trUtf8( "DlgRef_1Sel3Spin_QTD" ) ); + DlgRef_1Sel3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel3Spin_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"); + + 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"); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + 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, 1, 0 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + 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, 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, 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( TextLabel2, 0, 0 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel3Spin_QTD::~DlgRef_1Sel3Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel3Spin_QTD.h b/src/DlgRef/DlgRef_1Sel3Spin_QTD.h new file mode 100644 index 000000000..681d72f62 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel3Spin_QTD.h @@ -0,0 +1,50 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel3Spin_QTD.ui' +** +** Created: ven oct 24 15:55:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL3SPIN_QTD_H +#define DLGREF_1SEL3SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_1Sel3Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel3Spin_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + QSpinBox* SpinBox2; + QLabel* TextLabel3; + QSpinBox* SpinBox3; + QSpinBox* SpinBox1; + QLabel* TextLabel4; + QLabel* TextLabel2; + + +protected: + QGridLayout* DlgRef_1Sel3Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_1SEL3SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel4Spin.cxx b/src/DlgRef/DlgRef_1Sel4Spin.cxx new file mode 100644 index 000000000..107e5a426 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel4Spin.cxx @@ -0,0 +1,67 @@ +// 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_1Sel4Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_1Sel4Spin.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel4Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_1Sel4Spin::DlgRef_1Sel4Spin(QWidget* parent, const char* name, WFlags fl) + :DlgRef_1Sel4Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox3->close(TRUE); + SpinBox4->close(TRUE); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout3->addWidget(SpinBox_DX, 0, 2); + + SpinBox_DY = new DlgRef_SpinBox( GroupBox1, "SpinBox_DY"); + Layout3->addWidget(SpinBox_DY, 0, 4); + + SpinBox_DZ = new DlgRef_SpinBox( GroupBox1, "SpinBox_DZ"); + Layout3->addWidget(SpinBox_DZ, 0, 6); + + SpinBox_S = new DlgRef_SpinBox( GroupBox1, "SpinBox_S"); + Layout4->addWidget(SpinBox_S, 0, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel4Spin::~DlgRef_1Sel4Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_1Sel4Spin.h b/src/DlgRef/DlgRef_1Sel4Spin.h new file mode 100644 index 000000000..db4d2560d --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel4Spin.h @@ -0,0 +1,51 @@ +// 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_1Sel4Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_1SEL4SPIN_H +#define DLGREF_1SEL4SPIN_H + +#include "DlgRef_1Sel4Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_1Sel4Spin : public DlgRef_1Sel4Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_1Sel4Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel4Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + DlgRef_SpinBox* SpinBox_DZ; + + DlgRef_SpinBox* SpinBox_S; + +}; + +#endif // DLGREF_1SEL4SPIN_H diff --git a/src/DlgRef/DlgRef_1Sel4Spin_QTD.cxx b/src/DlgRef/DlgRef_1Sel4Spin_QTD.cxx new file mode 100644 index 000000000..319249c03 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel4Spin_QTD.cxx @@ -0,0 +1,132 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel4Spin_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel4Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel4Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel4Spin_QTD::DlgRef_1Sel4Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel4Spin_QTD" ); + resize( 284, 119 ); + setCaption( trUtf8( "DlgRef_1Sel4Spin_QTD" ) ); + DlgRef_1Sel4Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel4Spin_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"); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + 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, 5 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout3->addWidget( TextLabel3, 0, 1 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + Layout3->addWidget( TextLabel4, 0, 3 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox3, 0, 6 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox1, 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" ) ); + + Layout3->addWidget( TextLabel2, 0, 0 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout3->addWidget( SpinBox2, 0, 4 ); + + Layout1->addLayout( Layout3, 1, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 0 ); + + Layout4 = new QGridLayout( 0, 1, 1, 0, 6, "Layout4"); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setText( trUtf8( "TL6" ) ); + + Layout4->addWidget( TextLabel6, 0, 0 ); + + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + + Layout4->addWidget( SpinBox4, 0, 1 ); + + Layout1->addLayout( Layout4, 2, 0 ); + + Layout2 = new QHBoxLayout( 0, 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 ); + + 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 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + Layout2->addWidget( LineEdit1 ); + + Layout1->addLayout( Layout2, 0, 0 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel4Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel4Spin_QTD::~DlgRef_1Sel4Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel4Spin_QTD.h b/src/DlgRef/DlgRef_1Sel4Spin_QTD.h new file mode 100644 index 000000000..db64ea6ae --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel4Spin_QTD.h @@ -0,0 +1,55 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel4Spin_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL4SPIN_QTD_H +#define DLGREF_1SEL4SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_1Sel4Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel4Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel4Spin_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel5; + QLabel* TextLabel3; + QLabel* TextLabel4; + QSpinBox* SpinBox3; + QSpinBox* SpinBox1; + QLabel* TextLabel2; + QSpinBox* SpinBox2; + QLabel* TextLabel6; + QSpinBox* SpinBox4; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* DlgRef_1Sel4Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout3; + QGridLayout* Layout4; + QHBoxLayout* Layout2; +}; + +#endif // DLGREF_1SEL4SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel5Spin.cxx b/src/DlgRef/DlgRef_1Sel5Spin.cxx new file mode 100644 index 000000000..bc150405c --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel5Spin.cxx @@ -0,0 +1,71 @@ +// 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_1Sel5Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_1Sel5Spin.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel5Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_1Sel5Spin::DlgRef_1Sel5Spin(QWidget* parent, const char* name, WFlags fl) + :DlgRef_1Sel5Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox3->close(TRUE); + SpinBox4->close(TRUE); + SpinBox5->close(TRUE); + + SpinBox_1 = new DlgRef_SpinBox(GroupBox1, "SpinBox_1"); + Layout2->addWidget(SpinBox_1, 0, 1); + + SpinBox_2 = new DlgRef_SpinBox(GroupBox1, "SpinBox_2"); + Layout2->addWidget(SpinBox_2, 0, 3); + + SpinBox_3 = new DlgRef_SpinBox(GroupBox1, "SpinBox_3"); + Layout2->addWidget(SpinBox_3, 2, 1); + + SpinBox_4 = new DlgRef_SpinBox(GroupBox1, "SpinBox_4"); + Layout2->addWidget(SpinBox_4, 1, 1); + + SpinBox_5 = new DlgRef_SpinBox(GroupBox1, "SpinBox_5"); + Layout2->addWidget(SpinBox_5, 1, 3); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel5Spin::~DlgRef_1Sel5Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_1Sel5Spin.h b/src/DlgRef/DlgRef_1Sel5Spin.h new file mode 100644 index 000000000..cc145e319 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel5Spin.h @@ -0,0 +1,51 @@ +// 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_1Sel5Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_1SEL5SPIN_H +#define DLGREF_1SEL5SPIN_H + +#include "DlgRef_1Sel5Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_1Sel5Spin : public DlgRef_1Sel5Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_1Sel5Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel5Spin(); + + DlgRef_SpinBox* SpinBox_1; + DlgRef_SpinBox* SpinBox_2; + DlgRef_SpinBox* SpinBox_3; + DlgRef_SpinBox* SpinBox_4; + DlgRef_SpinBox* SpinBox_5; + +}; + +#endif // DLGREF_1SEL5SPIN_H diff --git a/src/DlgRef/DlgRef_1Sel5Spin_QTD.cxx b/src/DlgRef/DlgRef_1Sel5Spin_QTD.cxx new file mode 100644 index 000000000..b93242062 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel5Spin_QTD.cxx @@ -0,0 +1,133 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel5Spin_QTD.ui' +** +** Created: mar nov 18 11:19:14 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel5Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel5Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel5Spin_QTD::DlgRef_1Sel5Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel5Spin_QTD" ); + resize( 162, 143 ); + setCaption( trUtf8( "DlgRef_1Sel5Spin_QTD" ) ); + DlgRef_1Sel5Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel5Spin_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"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox2, 0, 3 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox3, 2, 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, 1, 0 ); + + 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 ); + + 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 ); + + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + SpinBox4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox4->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox4, 1, 1 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox1, 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" ) ); + + Layout2->addWidget( TextLabel6, 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 ); + + SpinBox5 = new QSpinBox( GroupBox1, "SpinBox5" ); + SpinBox5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox5->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox5, 1, 3 ); + + Layout1->addMultiCellLayout( Layout2, 1, 1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 120, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel5Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel5Spin_QTD::~DlgRef_1Sel5Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel5Spin_QTD.h b/src/DlgRef/DlgRef_1Sel5Spin_QTD.h new file mode 100644 index 000000000..5ec3e33cd --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel5Spin_QTD.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel5Spin_QTD.ui' +** +** Created: mar nov 18 11:19:13 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL5SPIN_QTD_H +#define DLGREF_1SEL5SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_1Sel5Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel5Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel5Spin_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QPushButton* PushButton1; + QSpinBox* SpinBox2; + QSpinBox* SpinBox3; + QLabel* TextLabel5; + QLabel* TextLabel3; + QLabel* TextLabel4; + QSpinBox* SpinBox4; + QSpinBox* SpinBox1; + QLabel* TextLabel6; + QLabel* TextLabel2; + QSpinBox* SpinBox5; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* DlgRef_1Sel5Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_1SEL5SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_1Sel_QTD.cxx b/src/DlgRef/DlgRef_1Sel_QTD.cxx new file mode 100644 index 000000000..90a136249 --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel_QTD.cxx @@ -0,0 +1,74 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Sel_QTD.ui' +** +** Created: lun sep 22 17:38:06 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Sel_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Sel_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Sel_QTD::DlgRef_1Sel_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Sel_QTD" ); + resize( 129, 57 ); + setCaption( trUtf8( "DlgRef_1Sel_QTD" ) ); + DlgRef_1Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel_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"); + + 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, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 1, 2 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 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 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_1Sel_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Sel_QTD::~DlgRef_1Sel_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Sel_QTD.h b/src/DlgRef/DlgRef_1Sel_QTD.h new file mode 100644 index 000000000..133d043cf --- /dev/null +++ b/src/DlgRef/DlgRef_1Sel_QTD.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Sel_QTD.ui' +** +** Created: lun sep 22 17:38:05 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SEL_QTD_H +#define DLGREF_1SEL_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class DlgRef_1Sel_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Sel_QTD(); + + QGroupBox* GroupBox1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + QLabel* TextLabel1; + + +protected: + QGridLayout* DlgRef_1Sel_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_1SEL_QTD_H diff --git a/src/DlgRef/DlgRef_1Spin.cxx b/src/DlgRef/DlgRef_1Spin.cxx new file mode 100644 index 000000000..20778cd4b --- /dev/null +++ b/src/DlgRef/DlgRef_1Spin.cxx @@ -0,0 +1,56 @@ +// 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_1Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_1Spin.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_1Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_1Spin::DlgRef_1Spin(QWidget* parent, const char* name, WFlags fl) + :DlgRef_1Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout1->addWidget(SpinBox_DX, 0, 1); + +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Spin::~DlgRef_1Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_1Spin.h b/src/DlgRef/DlgRef_1Spin.h new file mode 100644 index 000000000..470d62d83 --- /dev/null +++ b/src/DlgRef/DlgRef_1Spin.h @@ -0,0 +1,47 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DlgRef_1Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_1SPIN_H +#define DLGREF_1SPIN_H + +#include "DlgRef_1Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_1Spin : public DlgRef_1Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_1Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_1Spin(); + + DlgRef_SpinBox* SpinBox_DX; + +}; + +#endif // DLGREF_1SPIN_H diff --git a/src/DlgRef/DlgRef_1Spin_QTD.cxx b/src/DlgRef/DlgRef_1Spin_QTD.cxx new file mode 100644 index 000000000..aa54d9ad8 --- /dev/null +++ b/src/DlgRef/DlgRef_1Spin_QTD.cxx @@ -0,0 +1,68 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_1Spin_QTD.ui' +** +** Created: jeu sep 25 12:22:29 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_1Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_1Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_1Spin_QTD::DlgRef_1Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_1Spin_QTD" ); + resize( 124, 55 ); + setCaption( trUtf8( "DlgRef_1Spin_QTD" ) ); + DlgRef_1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 1 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 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 ); + + DlgRef_1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_1Spin_QTD::~DlgRef_1Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_1Spin_QTD.h b/src/DlgRef/DlgRef_1Spin_QTD.h new file mode 100644 index 000000000..d19f64043 --- /dev/null +++ b/src/DlgRef/DlgRef_1Spin_QTD.h @@ -0,0 +1,40 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_1Spin_QTD.ui' +** +** Created: jeu sep 25 12:22:29 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_1SPIN_QTD_H +#define DLGREF_1SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QSpinBox; + +class DlgRef_1Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_1Spin_QTD(); + + QGroupBox* GroupBox1; + QSpinBox* SpinBox1; + QLabel* TextLabel1; + + +protected: + QGridLayout* DlgRef_1Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_1SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_2Sel1Spin.cxx b/src/DlgRef/DlgRef_2Sel1Spin.cxx new file mode 100644 index 000000000..cb8499e99 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1Spin.cxx @@ -0,0 +1,54 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DlgRef_2Sel1Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_2Sel1Spin.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_2Sel1Spin::DlgRef_2Sel1Spin(QWidget* parent, const char* name, WFlags fl) + :DlgRef_2Sel1Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout2->addWidget(SpinBox_DX, 0, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel1Spin::~DlgRef_2Sel1Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_2Sel1Spin.h b/src/DlgRef/DlgRef_2Sel1Spin.h new file mode 100644 index 000000000..5bdc29962 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1Spin.h @@ -0,0 +1,47 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DlgRef_2Sel1Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_2SEL1SPIN_H +#define DLGREF_2SEL1SPIN_H + +#include "DlgRef_2Sel1Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_2Sel1Spin : public DlgRef_2Sel1Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_2Sel1Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel1Spin(); + + DlgRef_SpinBox* SpinBox_DX; + +}; + +#endif // DLGREF_2SEL1SPIN_H diff --git a/src/DlgRef/DlgRef_2Sel1Spin1Check.cxx b/src/DlgRef/DlgRef_2Sel1Spin1Check.cxx new file mode 100644 index 000000000..c4d8c0619 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1Spin1Check.cxx @@ -0,0 +1,54 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DlgRef_2Sel1Spin1Check.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_2Sel1Spin1Check.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_2Sel1Spin1Check::DlgRef_2Sel1Spin1Check(QWidget* parent, const char* name, WFlags fl) + :DlgRef_2Sel1Spin1Check_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout2->addWidget(SpinBox_DX, 0, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel1Spin1Check::~DlgRef_2Sel1Spin1Check() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_2Sel1Spin1Check.h b/src/DlgRef/DlgRef_2Sel1Spin1Check.h new file mode 100644 index 000000000..f26c0bfbe --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1Spin1Check.h @@ -0,0 +1,47 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : DlgRef_2Sel1Spin1Check.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_2SEL1SPIN1CHECK_H +#define DLGREF_2SEL1SPIN1CHECK_H + +#include "DlgRef_2Sel1Spin1Check_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_2Sel1Spin1Check : public DlgRef_2Sel1Spin1Check_QTD +{ + Q_OBJECT + +public: + DlgRef_2Sel1Spin1Check(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_2Sel1Spin1Check(); + + DlgRef_SpinBox* SpinBox_DX; + +}; + +#endif // DLGREF_2SEL1SPIN1CHECK_H diff --git a/src/DlgRef/DlgRef_2Sel1Spin1Check_QTD.cxx b/src/DlgRef/DlgRef_2Sel1Spin1Check_QTD.cxx new file mode 100644 index 000000000..7fa002f40 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1Spin1Check_QTD.cxx @@ -0,0 +1,111 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel1Spin1Check_QTD.ui' +** +** Created: mer oct 1 16:20:02 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel1Spin1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel1Spin1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel1Spin1Check_QTD::DlgRef_2Sel1Spin1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel1Spin1Check_QTD" ); + resize( 129, 117 ); + setCaption( trUtf8( "DlgRef_2Sel1Spin1Check_QTD" ) ); + DlgRef_2Sel1Spin1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel1Spin1Check_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"); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 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 ); + + 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 ); + + 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 ); + QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 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 ); + + 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 ); + + CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + Layout2->addWidget( CheckButton1, 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" ) ); + + Layout2->addWidget( TextLabel3, 0, 0 ); + + Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel1Spin1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel1Spin1Check_QTD::~DlgRef_2Sel1Spin1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel1Spin1Check_QTD.h b/src/DlgRef/DlgRef_2Sel1Spin1Check_QTD.h new file mode 100644 index 000000000..cbc33b9c0 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1Spin1Check_QTD.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel1Spin1Check_QTD.ui' +** +** Created: mer oct 1 16:20:02 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL1SPIN1CHECK_QTD_H +#define DLGREF_2SEL1SPIN1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QSpinBox; + +class DlgRef_2Sel1Spin1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel1Spin1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel1Spin1Check_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit1; + QLabel* TextLabel1; + QLabel* TextLabel2; + QLineEdit* LineEdit2; + QPushButton* PushButton1; + QPushButton* PushButton2; + QSpinBox* SpinBox1; + QRadioButton* CheckButton1; + QLabel* TextLabel3; + + +protected: + QGridLayout* DlgRef_2Sel1Spin1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_2SEL1SPIN1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_2Sel1Spin_QTD.cxx b/src/DlgRef/DlgRef_2Sel1Spin_QTD.cxx new file mode 100644 index 000000000..9c27921ac --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1Spin_QTD.cxx @@ -0,0 +1,105 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel1Spin_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel1Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel1Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel1Spin_QTD::DlgRef_2Sel1Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel1Spin_QTD" ); + resize( 129, 117 ); + setCaption( trUtf8( "DlgRef_2Sel1Spin_QTD" ) ); + DlgRef_2Sel1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel1Spin_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"); + + 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 ); + + 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 ); + + 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 ); + + 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 ); + + 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 ); + + Layout1->addMultiCellLayout( Layout2, 2, 2, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel1Spin_QTD::~DlgRef_2Sel1Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel1Spin_QTD.h b/src/DlgRef/DlgRef_2Sel1Spin_QTD.h new file mode 100644 index 000000000..8f1f48985 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel1Spin_QTD.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel1Spin_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL1SPIN_QTD_H +#define DLGREF_2SEL1SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_2Sel1Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel1Spin_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit1; + QPushButton* PushButton2; + QLabel* TextLabel1; + QLineEdit* LineEdit2; + QPushButton* PushButton1; + QLabel* TextLabel2; + QSpinBox* SpinBox1; + QLabel* TextLabel3; + + +protected: + QGridLayout* DlgRef_2Sel1Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_2SEL1SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_2Sel2Spin.cxx b/src/DlgRef/DlgRef_2Sel2Spin.cxx new file mode 100644 index 000000000..660206876 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin.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_2Sel2Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_2Sel2Spin.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_2Sel2Spin::DlgRef_2Sel2Spin(QWidget* parent, const char* name, WFlags fl) + :DlgRef_2Sel2Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout2->addWidget(SpinBox_DX, 0, 1); + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout2->addWidget(SpinBox_DY, 1, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel2Spin::~DlgRef_2Sel2Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_2Sel2Spin.h b/src/DlgRef/DlgRef_2Sel2Spin.h new file mode 100644 index 000000000..4300521ef --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin.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_2Sel2Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_2SEL2SPIN_H +#define DLGREF_2SEL2SPIN_H + +#include "DlgRef_2Sel2Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_2Sel2Spin : public DlgRef_2Sel2Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_2Sel2Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_2Sel2Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + +}; + +#endif // DLGREF_2SEL2SPIN_H 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_2Sel2Spin_QTD.cxx b/src/DlgRef/DlgRef_2Sel2Spin_QTD.cxx new file mode 100644 index 000000000..045cf651b --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin_QTD.cxx @@ -0,0 +1,116 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel2Spin_QTD.ui' +** +** Created: jeu sep 25 12:10:29 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel2Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel2Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel2Spin_QTD::DlgRef_2Sel2Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel2Spin_QTD" ); + resize( 129, 145 ); + setCaption( trUtf8( "DlgRef_2Sel2Spin_QTD" ) ); + DlgRef_2Sel2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel2Spin_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"); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + 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 ); + + 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 ); + + Layout1->addMultiCellLayout( Layout2, 2, 2, 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 ); + + 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, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + Layout1->addWidget( TextLabel1, 0, 0 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + Layout1->addWidget( PushButton1, 0, 1 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 2 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel2Spin_QTD::~DlgRef_2Sel2Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel2Spin_QTD.h b/src/DlgRef/DlgRef_2Sel2Spin_QTD.h new file mode 100644 index 000000000..dd6bd6c83 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel2Spin_QTD.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel2Spin_QTD.ui' +** +** Created: jeu sep 25 12:10:29 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL2SPIN_QTD_H +#define DLGREF_2SEL2SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_2Sel2Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel2Spin_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit1; + QSpinBox* SpinBox2; + QLabel* TextLabel4; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QPushButton* PushButton2; + QLabel* TextLabel2; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit2; + + +protected: + QGridLayout* DlgRef_2Sel2Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_2SEL2SPIN_QTD_H diff --git a/src/DlgRef/DlgRef_2Sel3Spin.cxx b/src/DlgRef/DlgRef_2Sel3Spin.cxx new file mode 100644 index 000000000..a0a9999f8 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel3Spin.cxx @@ -0,0 +1,60 @@ +// 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_2Sel3Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_2Sel3Spin.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_2Sel3Spin::DlgRef_2Sel3Spin(QWidget* parent, const char* name, WFlags fl) + :DlgRef_2Sel3Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox3->close(TRUE); + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout2->addWidget(SpinBox_DX, 0, 1); + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout2->addWidget(SpinBox_DY, 1, 1); + SpinBox_DZ = new DlgRef_SpinBox(GroupBox1, "SpinBox_DZ"); + Layout2->addWidget(SpinBox_DZ, 2, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel3Spin::~DlgRef_2Sel3Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_2Sel3Spin.h b/src/DlgRef/DlgRef_2Sel3Spin.h new file mode 100644 index 000000000..367e8b55d --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel3Spin.h @@ -0,0 +1,49 @@ +// 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_2Sel3Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_2SEL3SPIN_H +#define DLGREF_2SEL3SPIN_H + +#include "DlgRef_2Sel3Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_2Sel3Spin : public DlgRef_2Sel3Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_2Sel3Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_2Sel3Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + DlgRef_SpinBox* SpinBox_DZ; + +}; + +#endif // DLGREF_2SEL3SPIN_H diff --git a/src/DlgRef/DlgRef_2Sel3Spin_QTD.cxx b/src/DlgRef/DlgRef_2Sel3Spin_QTD.cxx new file mode 100644 index 000000000..be815e3ec --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel3Spin_QTD.cxx @@ -0,0 +1,127 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel3Spin_QTD.ui' +** +** Created: jeu sep 25 16:18:43 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel3Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel3Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel3Spin_QTD::DlgRef_2Sel3Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel3Spin_QTD" ); + resize( 129, 173 ); + setCaption( trUtf8( "DlgRef_2Sel3Spin_QTD" ) ); + DlgRef_2Sel3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel3Spin_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"); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 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 ); + + 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 ); + + 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 ); + + 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 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL4" ) ); + + Layout2->addWidget( TextLabel5, 2, 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 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout2->addWidget( SpinBox3, 2, 1 ); + + Layout1->addMultiCellLayout( Layout2, 2, 2, 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 ); + QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 2 ); + + 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 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel3Spin_QTD::~DlgRef_2Sel3Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel3Spin_QTD.h b/src/DlgRef/DlgRef_2Sel3Spin_QTD.h new file mode 100644 index 000000000..9dbbd5f5d --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel3Spin_QTD.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel3Spin_QTD.ui' +** +** Created: jeu sep 25 16:18:43 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL3SPIN_QTD_H +#define DLGREF_2SEL3SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; +class QSpinBox; + +class DlgRef_2Sel3Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel3Spin_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit1; + QLabel* TextLabel1; + QLabel* TextLabel2; + QLabel* TextLabel3; + QSpinBox* SpinBox2; + QLabel* TextLabel4; + QLabel* TextLabel5; + QSpinBox* SpinBox1; + QSpinBox* SpinBox3; + QPushButton* PushButton1; + QLineEdit* LineEdit2; + QPushButton* PushButton2; + + +protected: + QGridLayout* DlgRef_2Sel3Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; + QGridLayout* Layout2; +}; + +#endif // DLGREF_2SEL3SPIN_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_2Sel_QTD.cxx b/src/DlgRef/DlgRef_2Sel_QTD.cxx new file mode 100644 index 000000000..8dc9f08e4 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel_QTD.cxx @@ -0,0 +1,90 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Sel_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Sel_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Sel_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Sel_QTD::DlgRef_2Sel_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Sel_QTD" ); + resize( 129, 87 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "DlgRef_2Sel_QTD" ) ); + DlgRef_2Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Sel_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"); + + 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, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 2, 2 ); + + 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 ); + + 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 ); + + 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 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Sel_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Sel_QTD::~DlgRef_2Sel_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Sel_QTD.h b/src/DlgRef/DlgRef_2Sel_QTD.h new file mode 100644 index 000000000..07cb6c569 --- /dev/null +++ b/src/DlgRef/DlgRef_2Sel_QTD.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Sel_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SEL_QTD_H +#define DLGREF_2SEL_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class DlgRef_2Sel_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Sel_QTD(); + + QGroupBox* GroupBox1; + QPushButton* PushButton1; + QLineEdit* LineEdit2; + QPushButton* PushButton2; + QLabel* TextLabel1; + QLabel* TextLabel2; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* DlgRef_2Sel_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_2SEL_QTD_H diff --git a/src/DlgRef/DlgRef_2Spin.cxx b/src/DlgRef/DlgRef_2Spin.cxx new file mode 100644 index 000000000..f66c33baa --- /dev/null +++ b/src/DlgRef/DlgRef_2Spin.cxx @@ -0,0 +1,60 @@ +// 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_2Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_2Spin.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_2Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_2Spin::DlgRef_2Spin(QWidget* parent, const char* name, WFlags fl) + :DlgRef_2Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout1->addWidget(SpinBox_DX, 0, 1); + + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout1->addWidget(SpinBox_DY, 1, 1); + +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Spin::~DlgRef_2Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_2Spin.h b/src/DlgRef/DlgRef_2Spin.h new file mode 100644 index 000000000..306593117 --- /dev/null +++ b/src/DlgRef/DlgRef_2Spin.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_2Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_2SPIN_H +#define DLGREF_2SPIN_H + +#include "DlgRef_2Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_2Spin : public DlgRef_2Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_2Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_2Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + +}; + +#endif // DLGREF_2SPIN_H diff --git a/src/DlgRef/DlgRef_2Spin_QTD.cxx b/src/DlgRef/DlgRef_2Spin_QTD.cxx new file mode 100644 index 000000000..bb6948f73 --- /dev/null +++ b/src/DlgRef/DlgRef_2Spin_QTD.cxx @@ -0,0 +1,79 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_2Spin_QTD.ui' +** +** Created: jeu sep 25 12:10:30 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_2Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_2Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_2Spin_QTD::DlgRef_2Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_2Spin_QTD" ); + resize( 124, 83 ); + setCaption( trUtf8( "DlgRef_2Spin_QTD" ) ); + DlgRef_2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_2Spin_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"); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 1 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 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 ); + + 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 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_2Spin_QTD::~DlgRef_2Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_2Spin_QTD.h b/src/DlgRef/DlgRef_2Spin_QTD.h new file mode 100644 index 000000000..bcf59c686 --- /dev/null +++ b/src/DlgRef/DlgRef_2Spin_QTD.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_2Spin_QTD.ui' +** +** Created: jeu sep 25 12:10:30 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_2SPIN_QTD_H +#define DLGREF_2SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QSpinBox; + +class DlgRef_2Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_2Spin_QTD(); + + QGroupBox* GroupBox1; + QSpinBox* SpinBox2; + QSpinBox* SpinBox1; + QLabel* TextLabel1; + QLabel* TextLabel2; + + +protected: + QGridLayout* DlgRef_2Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_2SPIN_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_3Sel_QTD.cxx b/src/DlgRef/DlgRef_3Sel_QTD.cxx new file mode 100644 index 000000000..832f64940 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel_QTD.cxx @@ -0,0 +1,106 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_3Sel_QTD.ui' +** +** Created: lun sep 29 11:05:21 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_3Sel_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_3Sel_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_3Sel_QTD::DlgRef_3Sel_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_3Sel_QTD" ); + resize( 129, 117 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "DlgRef_3Sel_QTD" ) ); + DlgRef_3Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_3Sel_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"); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + Layout1->addWidget( LineEdit3, 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 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + Layout1->addWidget( LineEdit2, 1, 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 ); + + 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 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 159, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 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 ); + + 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 ); + + 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 ); + + DlgRef_3Sel_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Sel_QTD::~DlgRef_3Sel_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_3Sel_QTD.h b/src/DlgRef/DlgRef_3Sel_QTD.h new file mode 100644 index 000000000..eba5a2c67 --- /dev/null +++ b/src/DlgRef/DlgRef_3Sel_QTD.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_3Sel_QTD.ui' +** +** Created: lun sep 29 11:05:21 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_3SEL_QTD_H +#define DLGREF_3SEL_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class DlgRef_3Sel_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_3Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Sel_QTD(); + + QGroupBox* GroupBox1; + QLineEdit* LineEdit3; + QPushButton* PushButton1; + QLineEdit* LineEdit2; + QLabel* TextLabel1; + QLabel* TextLabel3; + QLineEdit* LineEdit1; + QLabel* TextLabel2; + QPushButton* PushButton3; + QPushButton* PushButton2; + + +protected: + QGridLayout* DlgRef_3Sel_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_3SEL_QTD_H diff --git a/src/DlgRef/DlgRef_3Spin.cxx b/src/DlgRef/DlgRef_3Spin.cxx new file mode 100644 index 000000000..07237c2ed --- /dev/null +++ b/src/DlgRef/DlgRef_3Spin.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_3Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_3Spin.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_3Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_3Spin::DlgRef_3Spin(QWidget* parent, const char* name, WFlags fl) + :DlgRef_3Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox3->close(TRUE); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout1->addWidget(SpinBox_DX, 0, 1); + + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout1->addWidget(SpinBox_DY, 1, 1); + + SpinBox_DZ = new DlgRef_SpinBox(GroupBox1, "SpinBox_DZ"); + Layout1->addWidget(SpinBox_DZ, 2, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Spin::~DlgRef_3Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_3Spin.h b/src/DlgRef/DlgRef_3Spin.h new file mode 100644 index 000000000..855f00b5d --- /dev/null +++ b/src/DlgRef/DlgRef_3Spin.h @@ -0,0 +1,49 @@ +// 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_3Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_3SPIN_H +#define DLGREF_3SPIN_H + +#include "DlgRef_3Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_3Spin : public DlgRef_3Spin_QTD +{ + Q_OBJECT + +public: + DlgRef_3Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + DlgRef_SpinBox* SpinBox_DZ; + +}; + +#endif // DLGREF_3SPIN_H diff --git a/src/DlgRef/DlgRef_3Spin1Check.cxx b/src/DlgRef/DlgRef_3Spin1Check.cxx new file mode 100644 index 000000000..7e622ab82 --- /dev/null +++ b/src/DlgRef/DlgRef_3Spin1Check.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_3Spin1Check.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "DlgRef_3Spin1Check.h" + +#include +#include +#include + +/* + * Constructs a DlgRef_3Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +DlgRef_3Spin1Check::DlgRef_3Spin1Check(QWidget* parent, const char* name, WFlags fl) + :DlgRef_3Spin1Check_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox3->close(TRUE); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout1->addWidget(SpinBox_DX, 0, 1); + + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout1->addWidget(SpinBox_DY, 1, 1); + + SpinBox_DZ = new DlgRef_SpinBox(GroupBox1, "SpinBox_DZ"); + Layout1->addWidget(SpinBox_DZ, 2, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Spin1Check::~DlgRef_3Spin1Check() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/DlgRef/DlgRef_3Spin1Check.h b/src/DlgRef/DlgRef_3Spin1Check.h new file mode 100644 index 000000000..c792015c2 --- /dev/null +++ b/src/DlgRef/DlgRef_3Spin1Check.h @@ -0,0 +1,49 @@ +// 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_3Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DLGREF_3SPIN1CHECK_H +#define DLGREF_3SPIN1CHECK_H + +#include "DlgRef_3Spin1Check_QTD.h" +#include "DlgRef_SpinBox.h" + +class DlgRef_3Spin1Check : public DlgRef_3Spin1Check_QTD +{ + Q_OBJECT + +public: + DlgRef_3Spin1Check(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~DlgRef_3Spin1Check(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + DlgRef_SpinBox* SpinBox_DZ; + +}; + +#endif // DLGREF_3SPIN1CHECK_H diff --git a/src/DlgRef/DlgRef_3Spin1Check_QTD.cxx b/src/DlgRef/DlgRef_3Spin1Check_QTD.cxx new file mode 100644 index 000000000..2509bd63b --- /dev/null +++ b/src/DlgRef/DlgRef_3Spin1Check_QTD.cxx @@ -0,0 +1,96 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_3Spin1Check_QTD.ui' +** +** Created: dim sep 28 18:11:19 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_3Spin1Check_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_3Spin1Check_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_3Spin1Check_QTD::DlgRef_3Spin1Check_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_3Spin1Check_QTD" ); + resize( 124, 130 ); + setCaption( trUtf8( "DlgRef_3Spin1Check_QTD" ) ); + DlgRef_3Spin1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_3Spin1Check_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"); + + CheckBox1 = new QRadioButton( GroupBox1, "CheckBox1" ); + CheckBox1->setText( trUtf8( "" ) ); + + Layout1->addMultiCellWidget( CheckBox1, 3, 3, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 4, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->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" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox3, 2, 1 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 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 ); + + 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 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_3Spin1Check_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Spin1Check_QTD::~DlgRef_3Spin1Check_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_3Spin1Check_QTD.h b/src/DlgRef/DlgRef_3Spin1Check_QTD.h new file mode 100644 index 000000000..f292ff982 --- /dev/null +++ b/src/DlgRef/DlgRef_3Spin1Check_QTD.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_3Spin1Check_QTD.ui' +** +** Created: dim sep 28 18:11:19 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_3SPIN1CHECK_QTD_H +#define DLGREF_3SPIN1CHECK_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QRadioButton; +class QSpinBox; + +class DlgRef_3Spin1Check_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_3Spin1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Spin1Check_QTD(); + + QGroupBox* GroupBox1; + QRadioButton* CheckBox1; + QSpinBox* SpinBox2; + QLabel* TextLabel3; + QSpinBox* SpinBox3; + QSpinBox* SpinBox1; + QLabel* TextLabel1; + QLabel* TextLabel2; + + +protected: + QGridLayout* DlgRef_3Spin1Check_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_3SPIN1CHECK_QTD_H diff --git a/src/DlgRef/DlgRef_3Spin_QTD.cxx b/src/DlgRef/DlgRef_3Spin_QTD.cxx new file mode 100644 index 000000000..2066934c5 --- /dev/null +++ b/src/DlgRef/DlgRef_3Spin_QTD.cxx @@ -0,0 +1,90 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_3Spin_QTD.ui' +** +** Created: mar sep 23 16:05:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_3Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_3Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +DlgRef_3Spin_QTD::DlgRef_3Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "DlgRef_3Spin_QTD" ); + resize( 124, 111 ); + setCaption( trUtf8( "DlgRef_3Spin_QTD" ) ); + DlgRef_3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_3Spin_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"); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + QSpacerItem* spacer = new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 1 ); + + 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 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox3, 2, 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 ); + + 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 ); + + GroupBox1Layout->addLayout( Layout1, 0, 0 ); + + DlgRef_3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_3Spin_QTD::~DlgRef_3Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_3Spin_QTD.h b/src/DlgRef/DlgRef_3Spin_QTD.h new file mode 100644 index 000000000..dceddcc97 --- /dev/null +++ b/src/DlgRef/DlgRef_3Spin_QTD.h @@ -0,0 +1,44 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_3Spin_QTD.ui' +** +** Created: mar sep 23 16:05:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_3SPIN_QTD_H +#define DLGREF_3SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QSpinBox; + +class DlgRef_3Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + DlgRef_3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~DlgRef_3Spin_QTD(); + + QGroupBox* GroupBox1; + QSpinBox* SpinBox2; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QSpinBox* SpinBox3; + QLabel* TextLabel1; + QLabel* TextLabel2; + + +protected: + QGridLayout* DlgRef_3Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout1; +}; + +#endif // DLGREF_3SPIN_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/DlgRef_Skeleton_QTD.cxx b/src/DlgRef/DlgRef_Skeleton_QTD.cxx new file mode 100644 index 000000000..cb1100af3 --- /dev/null +++ b/src/DlgRef/DlgRef_Skeleton_QTD.cxx @@ -0,0 +1,111 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'DlgRef_Skeleton_QTD.ui' +** +** Created: mar sep 23 15:06:58 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "DlgRef_Skeleton_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a DlgRef_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. + */ +DlgRef_Skeleton_QTD::DlgRef_Skeleton_QTD( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "DlgRef_Skeleton_QTD" ); + resize( 307, 147 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "DlgRef_Skeleton_QTD" ) ); + setSizeGripEnabled( TRUE ); + DlgRef_Skeleton_QTDLayout = new QGridLayout( this, 1, 1, 11, 6, "DlgRef_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 QHBoxLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + + Layout3 = new QHBoxLayout( 0, 0, 6, "Layout3"); + + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( trUtf8( "&Ok" ) ); + Layout3->addWidget( buttonOk ); + + buttonApply = new QPushButton( GroupButtons, "buttonApply" ); + buttonApply->setText( trUtf8( "&Apply" ) ); + Layout3->addWidget( buttonApply ); + QSpacerItem* spacer = new QSpacerItem( 91, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout3->addItem( spacer ); + + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( trUtf8( "&Cancel" ) ); + Layout3->addWidget( buttonCancel ); + GroupButtonsLayout->addLayout( Layout3 ); + + 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 ); + + RadioButton2 = new QRadioButton( GroupConstructors, "RadioButton2" ); + RadioButton2->setText( trUtf8( "" ) ); + Layout2->addWidget( RadioButton2 ); + + RadioButton3 = new QRadioButton( GroupConstructors, "RadioButton3" ); + RadioButton3->setText( trUtf8( "" ) ); + Layout2->addWidget( RadioButton3 ); + + 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 ); + + DlgRef_Skeleton_QTDLayout->addLayout( Layout1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +DlgRef_Skeleton_QTD::~DlgRef_Skeleton_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/DlgRef/DlgRef_Skeleton_QTD.h b/src/DlgRef/DlgRef_Skeleton_QTD.h new file mode 100644 index 000000000..f16363d60 --- /dev/null +++ b/src/DlgRef/DlgRef_Skeleton_QTD.h @@ -0,0 +1,50 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'DlgRef_Skeleton_QTD.ui' +** +** Created: mar sep 23 15:06:57 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef DLGREF_SKELETON_QTD_H +#define DLGREF_SKELETON_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QPushButton; +class QRadioButton; + +class DlgRef_Skeleton_QTD : public QDialog +{ + Q_OBJECT + +public: + DlgRef_Skeleton_QTD( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~DlgRef_Skeleton_QTD(); + + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonApply; + QPushButton* buttonCancel; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + QRadioButton* RadioButton3; + QGroupBox* GroupMedium; + + +protected: + QGridLayout* DlgRef_Skeleton_QTDLayout; + QGridLayout* Layout1; + QHBoxLayout* GroupButtonsLayout; + QHBoxLayout* Layout3; + QGridLayout* GroupConstructorsLayout; + QHBoxLayout* Layout2; +}; + +#endif // DLGREF_SKELETON_QTD_H diff --git a/src/GEOMGUI/GeometryGUI_SpinBox.cxx b/src/DlgRef/DlgRef_SpinBox.cxx similarity index 72% rename from src/GEOMGUI/GeometryGUI_SpinBox.cxx rename to src/DlgRef/DlgRef_SpinBox.cxx index eec132f44..5dc0e0463 100644 --- a/src/GEOMGUI/GeometryGUI_SpinBox.cxx +++ b/src/DlgRef/DlgRef_SpinBox.cxx @@ -21,27 +21,32 @@ // // // -// File : GeometryGUI_SpinBox.cxx +// File : DlgRef_SpinBox.cxx // Author : Lucien PIGNOLONI // Module : GEOM // $Header$ using namespace std; -#include "GeometryGUI_SpinBox.h" -#include "GeometryGUI.h" +#include "DlgRef_SpinBox.h" + #include -//#include -//#include "utilities.h" //================================================================================= -// class : GeometryGUI_SpinBox() +// class : DlgRef_SpinBox() // purpose : constructor of specific widget accepting floats in double precision. //================================================================================= -GeometryGUI_SpinBox::GeometryGUI_SpinBox( QWidget* parent, const char* name ) -: QAD_SpinBoxDbl( parent, name) +DlgRef_SpinBox::DlgRef_SpinBox(QWidget* parent, const char* name) +: QAD_SpinBoxDbl(parent, name) +{ +} + + +//================================================================================= +// function : ~DlgRef_SpinBox() +// purpose : destructor +//================================================================================= +DlgRef_SpinBox::~DlgRef_SpinBox() { - /* when step value is changed in myGeomGUI */ - connect( GeometryGUI::GetGeometryGUI(), SIGNAL( SignalDefaultStepValueChanged( double )), this, SLOT( SetStep( double ) ) ); } @@ -49,53 +54,50 @@ GeometryGUI_SpinBox::GeometryGUI_SpinBox( QWidget* parent, const char* name ) // function : SetStep() [SLOT] // purpose : //================================================================================= -void GeometryGUI_SpinBox::SetStep( double newStep ) +void DlgRef_SpinBox::SetStep(double newStep) { - setLineStep( newStep ); + setLineStep(newStep); } -//================================================================================= -// function : ~GeometryGUI_SpinBox() -// purpose : destructor -//================================================================================= -GeometryGUI_SpinBox::~GeometryGUI_SpinBox() -{ -} //================================================================================= // function : SetValue() // purpose : //================================================================================= -void GeometryGUI_SpinBox::SetValue( double v ) +void DlgRef_SpinBox::SetValue(double v) { - setValue( v ); + setValue(v); } + //================================================================================= // function : GetValue() // purpose : returns a double //================================================================================= -double GeometryGUI_SpinBox::GetValue( ) +double DlgRef_SpinBox::GetValue() { return value(); } + //================================================================================= // function : GetString() // purpose : returns a QString //================================================================================= -QString GeometryGUI_SpinBox::GetString( ) +QString DlgRef_SpinBox::GetString() { return cleanText(); } + //================================================================================= // function : RangeStepAndValidator() // purpose : //================================================================================= -void GeometryGUI_SpinBox::RangeStepAndValidator( double min, double max, double step, unsigned short decimals ) +void DlgRef_SpinBox::RangeStepAndValidator(double min, double max,double step, + unsigned short decimals) { - setRange( min, max ); - setLineStep( step ); - ( ( QDoubleValidator* )validator() )->setRange( min, max, decimals ) ; + setRange(min, max); + setLineStep(step); + ((QDoubleValidator*)validator())->setRange(min, max, decimals); } diff --git a/src/GEOMGUI/GeometryGUI_SpinBox.h b/src/DlgRef/DlgRef_SpinBox.h similarity index 74% rename from src/GEOMGUI/GeometryGUI_SpinBox.h rename to src/DlgRef/DlgRef_SpinBox.h index d5c60d14f..eec1c40e5 100644 --- a/src/GEOMGUI/GeometryGUI_SpinBox.h +++ b/src/DlgRef/DlgRef_SpinBox.h @@ -21,7 +21,7 @@ // // // -// File : GeometryGUI_SpinBox.h +// File : DlgRef_SpinBox.h // Author : Lucien PIGNOLONI // Module : GEOM // $Header$ @@ -31,30 +31,27 @@ #include "QAD_SpinBoxDbl.h" -class GeometryGUI ; - //================================================================================= -// class : GeometryGUI_SpinBox +// class : DlgRef_SpinBox // purpose : Derivated from QSpinBox class and modified to accept floats //================================================================================= -class GeometryGUI_SpinBox : public QAD_SpinBoxDbl +class DlgRef_SpinBox : public QAD_SpinBoxDbl { Q_OBJECT public : - GeometryGUI_SpinBox( QWidget* parent, const char* name = 0 ); - ~GeometryGUI_SpinBox(); + DlgRef_SpinBox(QWidget* parent, const char* name = 0); + ~DlgRef_SpinBox(); - void RangeStepAndValidator( double min = -1000000.0, - double max = +1000000.0, - double step = 100.0, - unsigned short decimals = 3 ); - void SetValue( double v ); - double GetValue(); + void RangeStepAndValidator(double min = -1000000.0, double max = +1000000.0, + double step = 100.0, unsigned short decimals = 3); + void SetValue(double v); + double GetValue(); QString GetString(); public slots: - void SetStep( double newStep ); + void SetStep(double newStep); }; + #endif // GEOMSPINBOX_H diff --git a/src/DlgRef/Makefile.in b/src/DlgRef/Makefile.in new file mode 100644 index 000000000..c6ed3784e --- /dev/null +++ b/src/DlgRef/Makefile.in @@ -0,0 +1,142 @@ +# GEOM DLGREF : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets +LIB = libDlgRef.la + +LIB_SRC = DlgRef_Skeleton_QTD.cxx \ + DlgRef_1Sel_QTD.cxx \ + DlgRef_2Sel_QTD.cxx \ + DlgRef_3Sel_QTD.cxx \ + DlgRef_1Sel1Check_QTD.cxx \ + DlgRef_1Sel3Check_QTD.cxx \ + DlgRef_1Sel1Check1List_QTD.cxx \ + DlgRef_1Sel1Spin_QTD.cxx \ + DlgRef_1Sel2Spin_QTD.cxx \ + DlgRef_1Sel3Spin_QTD.cxx \ + DlgRef_1Sel4Spin_QTD.cxx \ + DlgRef_1Sel5Spin_QTD.cxx \ + DlgRef_2Sel1Spin_QTD.cxx \ + DlgRef_2Sel2Spin_QTD.cxx \ + DlgRef_2Sel3Spin_QTD.cxx \ + DlgRef_1Sel1Spin1Check_QTD.cxx \ + DlgRef_2Sel1Spin1Check_QTD.cxx \ + DlgRef_2Sel2Spin1Check_QTD.cxx \ + DlgRef_2Sel4Spin1Check_QTD.cxx \ + DlgRef_3Sel4Spin2Check_QTD.cxx \ + DlgRef_4Sel1List_QTD.cxx \ + DlgRef_1Spin_QTD.cxx \ + DlgRef_2Spin_QTD.cxx \ + DlgRef_3Spin_QTD.cxx \ + DlgRef_3Spin1Check_QTD.cxx \ + DlgRef_SpinBox.cxx \ + DlgRef_1Sel1Spin.cxx \ + DlgRef_1Sel2Spin.cxx \ + DlgRef_1Sel3Spin.cxx \ + DlgRef_1Sel4Spin.cxx \ + DlgRef_1Sel5Spin.cxx \ + DlgRef_2Sel1Spin.cxx \ + DlgRef_2Sel2Spin.cxx \ + DlgRef_2Sel3Spin.cxx \ + DlgRef_1Sel1Spin1Check.cxx \ + DlgRef_2Sel1Spin1Check.cxx \ + DlgRef_2Sel2Spin1Check.cxx \ + DlgRef_2Sel4Spin1Check.cxx \ + DlgRef_3Sel4Spin2Check.cxx \ + DlgRef_1Spin.cxx \ + DlgRef_2Spin.cxx \ + DlgRef_3Spin.cxx \ + DlgRef_3Spin1Check.cxx + +LIB_MOC = \ + DlgRef_Skeleton_QTD.h \ + DlgRef_1Sel_QTD.h \ + DlgRef_2Sel_QTD.h \ + DlgRef_3Sel_QTD.h \ + DlgRef_1Sel1Check_QTD.h \ + DlgRef_1Sel3Check_QTD.h \ + DlgRef_1Sel1Check1List_QTD.h \ + DlgRef_1Sel1Spin_QTD.h \ + DlgRef_1Sel2Spin_QTD.h \ + DlgRef_1Sel3Spin_QTD.h \ + DlgRef_1Sel4Spin_QTD.h \ + DlgRef_1Sel5Spin_QTD.h \ + DlgRef_2Sel1Spin_QTD.h \ + DlgRef_2Sel2Spin_QTD.h \ + DlgRef_2Sel3Spin_QTD.h \ + DlgRef_1Sel1Spin1Check_QTD.h \ + DlgRef_2Sel1Spin1Check_QTD.h \ + DlgRef_2Sel2Spin1Check_QTD.h \ + DlgRef_2Sel4Spin1Check_QTD.h \ + DlgRef_3Sel4Spin2Check_QTD.h \ + DlgRef_4Sel1List_QTD.h \ + DlgRef_1Spin_QTD.h \ + DlgRef_2Spin_QTD.h \ + DlgRef_3Spin_QTD.h \ + DlgRef_3Spin1Check_QTD.h \ + DlgRef_SpinBox.h \ + DlgRef_1Sel1Spin.h \ + DlgRef_1Sel2Spin.h \ + DlgRef_1Sel3Spin.h \ + DlgRef_1Sel4Spin.h \ + DlgRef_1Sel5Spin.h \ + DlgRef_2Sel1Spin.h \ + DlgRef_2Sel2Spin.h \ + DlgRef_2Sel3Spin.h \ + DlgRef_1Sel1Spin1Check.h \ + DlgRef_2Sel1Spin1Check.h \ + DlgRef_2Sel2Spin1Check.h \ + DlgRef_2Sel4Spin1Check.h \ + DlgRef_3Sel4Spin2Check.h \ + DlgRef_1Spin.h \ + DlgRef_2Spin.h \ + DlgRef_3Spin.h \ + DlgRef_3Spin1Check.h + +# header files +EXPORT_HEADERS= $(LIB_MOC) + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file +CPPFLAGS += $(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += + +@CONCLUDE@ diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel1Check1List_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel1Check1List_QTD.ui new file mode 100644 index 000000000..677fe88ff --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_1Sel1Check1List_QTD.ui @@ -0,0 +1,157 @@ + +DlgRef_1Sel1Check1List_QTD + + + DlgRef_1Sel1Check1List_QTD + + + + 0 + 0 + 129 + 104 + + + + DlgRef_1Sel1Check1List_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 166 + + + + + + CheckButton1 + + + + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + ComboBox1 + + + + 7 + 0 + 0 + 0 + + + + + + LineEdit1 + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel1Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel1Check_QTD.ui new file mode 100644 index 000000000..93c1da336 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_1Sel1Check_QTD.ui @@ -0,0 +1,128 @@ + +DlgRef_1Sel1Check_QTD + + + DlgRef_1Sel1Check_QTD + + + + 0 + 0 + 129 + 76 + + + + DlgRef_1Sel1Check_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 113 + + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit1 + + + + + CheckButton1 + + + + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel1Spin1Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel1Spin1Check_QTD.ui new file mode 100644 index 000000000..27b1ad9e3 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_1Sel1Spin1Check_QTD.ui @@ -0,0 +1,173 @@ + +DlgRef_1Sel1Spin1Check_QTD + + + DlgRef_1Sel1Spin1Check_QTD + + + + 0 + 0 + 129 + 106 + + + + DlgRef_1Sel1Spin1Check_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 120 + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + + + LineEdit1 + + + + + CheckButton1 + + + + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel1Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel1Spin_QTD.ui new file mode 100644 index 000000000..e3551d166 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_1Sel1Spin_QTD.ui @@ -0,0 +1,165 @@ + +DlgRef_1Sel1Spin_QTD + + + DlgRef_1Sel1Spin_QTD + + + + 0 + 0 + 129 + 87 + + + + DlgRef_1Sel1Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + LineEdit1 + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + + + Spacer7 + + + Vertical + + + Expanding + + + + 0 + 16 + + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel2Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel2Spin_QTD.ui new file mode 100644 index 000000000..641264bb6 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_1Sel2Spin_QTD.ui @@ -0,0 +1,194 @@ + +DlgRef_1Sel2Spin_QTD + + + DlgRef_1Sel2Spin_QTD + + + + 0 + 0 + 129 + 115 + + + + DlgRef_1Sel2Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + + + LineEdit1 + + + + + Spacer7 + + + Vertical + + + Expanding + + + + 0 + 30 + + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel3Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel3Check_QTD.ui new file mode 100644 index 000000000..113ad786c --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_1Sel3Check_QTD.ui @@ -0,0 +1,144 @@ + +DlgRef_1Sel3Check_QTD + + + DlgRef_1Sel3Check_QTD + + + + 0 + 0 + 129 + 114 + + + + DlgRef_1Sel3Check_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + CheckButton2 + + + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 60 + + + + + + CheckButton3 + + + + + + + + CheckButton1 + + + + + + + + LineEdit1 + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel3Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel3Spin_QTD.ui new file mode 100644 index 000000000..de8d35e33 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_1Sel3Spin_QTD.ui @@ -0,0 +1,223 @@ + +DlgRef_1Sel3Spin_QTD + + + DlgRef_1Sel3Spin_QTD + + + + 0 + 0 + 129 + 143 + + + + DlgRef_1Sel3Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit1 + + + + + Spacer6 + + + Vertical + + + Expanding + + + + 0 + 150 + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + SpinBox3 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel4Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel4Spin_QTD.ui new file mode 100644 index 000000000..49a0cd1c2 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_1Sel4Spin_QTD.ui @@ -0,0 +1,292 @@ + +DlgRef_1Sel4Spin_QTD + + + DlgRef_1Sel4Spin_QTD + + + + 0 + 0 + 284 + 119 + + + + DlgRef_1Sel4Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel5 + + + + 0 + 0 + 0 + 0 + + + + TL5 + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + SpinBox3 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + + + Spacer6 + + + Vertical + + + Expanding + + + + 0 + 16 + + + + + + Layout4 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel6 + + + + 0 + 0 + 0 + 0 + + + + TL6 + + + + + SpinBox4 + + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit1 + + + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel5Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel5Spin_QTD.ui new file mode 100644 index 000000000..c1bca88db --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_1Sel5Spin_QTD.ui @@ -0,0 +1,281 @@ + +DlgRef_1Sel5Spin_QTD + + + DlgRef_1Sel5Spin_QTD + + + + 0 + 0 + 162 + 143 + + + + DlgRef_1Sel5Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox3 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel5 + + + + 0 + 0 + 0 + 0 + + + + TL5 + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + SpinBox4 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel6 + + + + 0 + 0 + 0 + 0 + + + + TL6 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + SpinBox5 + + + + 7 + 0 + 0 + 0 + + + + + + + + Spacer6 + + + Vertical + + + Expanding + + + + 0 + 120 + + + + + + LineEdit1 + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_1Sel_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Sel_QTD.ui new file mode 100644 index 000000000..3816fd110 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_1Sel_QTD.ui @@ -0,0 +1,128 @@ + +DlgRef_1Sel_QTD + + + DlgRef_1Sel_QTD + + + + 0 + 0 + 129 + 57 + + + + DlgRef_1Sel_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + 7 + 7 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Spacer8 + + + Vertical + + + Expanding + + + + 0 + 16 + + + + + + LineEdit1 + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_1Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_1Spin_QTD.ui new file mode 100644 index 000000000..ddeca8757 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_1Spin_QTD.ui @@ -0,0 +1,112 @@ + +DlgRef_1Spin_QTD + + + DlgRef_1Spin_QTD + + + + 0 + 0 + 124 + 55 + + + + DlgRef_1Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 16 + + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_2Sel1Spin1Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_2Sel1Spin1Check_QTD.ui new file mode 100644 index 000000000..a06de5cb4 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_2Sel1Spin1Check_QTD.ui @@ -0,0 +1,210 @@ + +DlgRef_2Sel1Spin1Check_QTD + + + DlgRef_2Sel1Spin1Check_QTD + + + + 0 + 0 + 129 + 117 + + + + DlgRef_2Sel1Spin1Check_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + LineEdit1 + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + LineEdit2 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 20 + + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + CheckButton1 + + + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_2Sel1Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_2Sel1Spin_QTD.ui new file mode 100644 index 000000000..053cae186 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_2Sel1Spin_QTD.ui @@ -0,0 +1,202 @@ + +DlgRef_2Sel1Spin_QTD + + + DlgRef_2Sel1Spin_QTD + + + + 0 + 0 + 129 + 117 + + + + DlgRef_2Sel1Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + LineEdit1 + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + LineEdit2 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 16 + + + + + + + + + + + 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_2Sel2Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_2Sel2Spin_QTD.ui new file mode 100644 index 000000000..b935dc89a --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_2Sel2Spin_QTD.ui @@ -0,0 +1,231 @@ + +DlgRef_2Sel2Spin_QTD + + + DlgRef_2Sel2Spin_QTD + + + + 0 + 0 + 129 + 145 + + + + DlgRef_2Sel2Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + LineEdit1 + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 20 + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit2 + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_2Sel3Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_2Sel3Spin_QTD.ui new file mode 100644 index 000000000..e51bd758a --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_2Sel3Spin_QTD.ui @@ -0,0 +1,260 @@ + +DlgRef_2Sel3Spin_QTD + + + DlgRef_2Sel3Spin_QTD + + + + 0 + 0 + 129 + 173 + + + + DlgRef_2Sel3Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + LineEdit1 + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + TextLabel5 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox3 + + + + 7 + 0 + 0 + 0 + + + + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 20 + + + + + + LineEdit2 + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + + + + + + 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_2Sel_QTD.ui b/src/DlgRef/UIFiles/DlgRef_2Sel_QTD.ui new file mode 100644 index 000000000..46e7f5b7e --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_2Sel_QTD.ui @@ -0,0 +1,165 @@ + +DlgRef_2Sel_QTD + + + DlgRef_2Sel_QTD + + + + 0 + 0 + 129 + 87 + + + + + 5 + 7 + 0 + 0 + + + + DlgRef_2Sel_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 0 + 16 + + + + + + LineEdit2 + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + LineEdit1 + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_2Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_2Spin_QTD.ui new file mode 100644 index 000000000..3fe8a9fe0 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_2Spin_QTD.ui @@ -0,0 +1,141 @@ + +DlgRef_2Spin_QTD + + + DlgRef_2Spin_QTD + + + + 0 + 0 + 124 + 83 + + + + DlgRef_2Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 16 + + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + + + + + + 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_3Sel_QTD.ui b/src/DlgRef/UIFiles/DlgRef_3Sel_QTD.ui new file mode 100644 index 000000000..0fe998827 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_3Sel_QTD.ui @@ -0,0 +1,202 @@ + +DlgRef_3Sel_QTD + + + DlgRef_3Sel_QTD + + + + 0 + 0 + 129 + 117 + + + + + 5 + 7 + 0 + 0 + + + + DlgRef_3Sel_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + LineEdit3 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit2 + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + LineEdit1 + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 0 + 159 + + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + PushButton3 + + + + 0 + 0 + 0 + 0 + + + + + + + + + PushButton2 + + + + 0 + 0 + 0 + 0 + + + + + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_3Spin1Check_QTD.ui b/src/DlgRef/UIFiles/DlgRef_3Spin1Check_QTD.ui new file mode 100644 index 000000000..fd3317f2d --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_3Spin1Check_QTD.ui @@ -0,0 +1,178 @@ + +DlgRef_3Spin1Check_QTD + + + DlgRef_3Spin1Check_QTD + + + + 0 + 0 + 124 + 130 + + + + DlgRef_3Spin1Check_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + CheckBox1 + + + + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 20 + + + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + SpinBox3 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/DlgRef_3Spin_QTD.ui b/src/DlgRef/UIFiles/DlgRef_3Spin_QTD.ui new file mode 100644 index 000000000..96f6b4dfb --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_3Spin_QTD.ui @@ -0,0 +1,170 @@ + +DlgRef_3Spin_QTD + + + DlgRef_3Spin_QTD + + + + 0 + 0 + 124 + 111 + + + + DlgRef_3Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 16 + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox3 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + + + + + + 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/DlgRef_Skeleton_QTD.ui b/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui new file mode 100644 index 000000000..0c6e57718 --- /dev/null +++ b/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui @@ -0,0 +1,225 @@ + +DlgRef_Skeleton_QTD + + + DlgRef_Skeleton_QTD + + + + 0 + 0 + 307 + 147 + + + + + 5 + 7 + 0 + 0 + + + + DlgRef_Skeleton_QTD + + + true + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + GroupButtons + + + + 7 + 0 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + buttonOk + + + &Ok + + + + + buttonApply + + + &Apply + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 91 + 0 + + + + + + buttonCancel + + + &Cancel + + + + + + + + + GroupConstructors + + + + 5 + 0 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + RadioButton1 + + + + + + + + RadioButton2 + + + + + + + + RadioButton3 + + + + + + + + + + + + GroupMedium + + + + 7 + 7 + 0 + 0 + + + + + + + + + + + + diff --git a/src/DlgRef/UIFiles/ui_to_cxx b/src/DlgRef/UIFiles/ui_to_cxx new file mode 100755 index 000000000..d65425f35 --- /dev/null +++ b/src/DlgRef/UIFiles/ui_to_cxx @@ -0,0 +1,76 @@ +#!/bin/sh + +#uic -o DlgRef_Skeleton_QTD.h DlgRef_Skeleton_QTD.ui +#uic -o DlgRef_Skeleton_QTD.cxx -impl DlgRef_Skeleton_QTD.h DlgRef_Skeleton_QTD.ui + +#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_1Sel1Spin_QTD.h DlgRef_1Sel1Spin_QTD.ui +#uic -o DlgRef_1Sel1Spin_QTD.cxx -impl DlgRef_1Sel1Spin_QTD.h DlgRef_1Sel1Spin_QTD.ui + +#uic -o DlgRef_1Sel1Spin1Check_QTD.h DlgRef_1Sel1Spin1Check_QTD.ui +#uic -o DlgRef_1Sel1Spin1Check_QTD.cxx -impl DlgRef_1Sel1Spin1Check_QTD.h DlgRef_1Sel1Spin1Check_QTD.ui + +#uic -o DlgRef_1Sel2Spin_QTD.h DlgRef_1Sel2Spin_QTD.ui +#uic -o DlgRef_1Sel2Spin_QTD.cxx -impl DlgRef_1Sel2Spin_QTD.h DlgRef_1Sel2Spin_QTD.ui + +#uic -o DlgRef_1Sel3Spin_QTD.h DlgRef_1Sel3Spin_QTD.ui +#uic -o DlgRef_1Sel3Spin_QTD.cxx -impl DlgRef_1Sel3Spin_QTD.h DlgRef_1Sel3Spin_QTD.ui + +#uic -o DlgRef_1Sel4Spin_QTD.h DlgRef_1Sel4Spin_QTD.ui +#uic -o DlgRef_1Sel4Spin_QTD.cxx -impl DlgRef_1Sel4Spin_QTD.h DlgRef_1Sel4Spin_QTD.ui + +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_1Sel3Check_QTD.h DlgRef_1Sel3Check_QTD.ui +#uic -o DlgRef_1Sel3Check_QTD.cxx -impl DlgRef_1Sel3Check_QTD.h DlgRef_1Sel3Check_QTD.ui + +#uic -o DlgRef_1Sel1Check1List_QTD.h DlgRef_1Sel1Check1List_QTD.ui +#uic -o DlgRef_1Sel1Check1List_QTD.cxx -impl DlgRef_1Sel1Check1List_QTD.h DlgRef_1Sel1Check1List_QTD.ui + +#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 + +#uic -o DlgRef_2Sel1Spin1Check_QTD.h DlgRef_2Sel1Spin1Check_QTD.ui +#uic -o DlgRef_2Sel1Spin1Check_QTD.cxx -impl DlgRef_2Sel1Spin1Check_QTD.h DlgRef_2Sel1Spin1Check_QTD.ui + +#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_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 + +#uic -o DlgRef_2Spin_QTD.h DlgRef_2Spin_QTD.ui +#uic -o DlgRef_2Spin_QTD.cxx -impl DlgRef_2Spin_QTD.h DlgRef_2Spin_QTD.ui + +#uic -o DlgRef_3Spin_QTD.h DlgRef_3Spin_QTD.ui +#uic -o DlgRef_3Spin_QTD.cxx -impl DlgRef_3Spin_QTD.h DlgRef_3Spin_QTD.ui + +#uic -o DlgRef_3Spin1Check_QTD.h DlgRef_3Spin1Check_QTD.ui +#uic -o DlgRef_3Spin1Check_QTD.cxx -impl DlgRef_3Spin1Check_QTD.h DlgRef_3Spin1Check_QTD.ui diff --git a/src/EntityGUI/EntityGUI.cxx b/src/EntityGUI/EntityGUI.cxx new file mode 100644 index 000000000..4234a8477 --- /dev/null +++ b/src/EntityGUI/EntityGUI.cxx @@ -0,0 +1,920 @@ +// 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 : EntityGUI.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "EntityGUI.h" + +#include "QAD_RightFrame.h" +#include "OCCViewer_Viewer3d.h" +#include "VTKViewer_ViewFrame.h" +#include "GEOM_AssemblyBuilder.h" +#include "SALOMEGUI_ImportOperation.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "DisplayGUI.h" +#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE + +//======================================================================= +// function : EntityGUI() +// purpose : Constructor +//======================================================================= +EntityGUI::EntityGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; +} + + +//======================================================================= +// function : ~EntityGUI() +// purpose : Destructor +//======================================================================= +EntityGUI::~EntityGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool EntityGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + EntityGUI* myEntityGUI = new EntityGUI(); + myEntityGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); + + switch (theCommandID) + { + case 404: // SKETCHER + { + ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTop(); // DCQ : 28/02/2002 + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + + myEntityGUI->myGeomGUI->GetSketcher() = Sketch(v3d->getViewer3d()); + myEntityGUI->myGeomGUI->myState = 2; + + Mb->setItemChecked(4052, false); + Mb->setItemChecked(4053, false); + + myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(LENGTH_PARAMETER, Mb->isItemChecked(4061)); + myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(ANGLE_PARAMETER, Mb->isItemChecked(4062)); + myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(RADIUS_PARAMETER, Mb->isItemChecked(4063)); + myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(XVALUE_PARAMETER, Mb->isItemChecked(4064)); + myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(YVALUE_PARAMETER, Mb->isItemChecked(4065)); + + myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); + break; + } + case 4041: // SKETCH Segment + { + myEntityGUI->myGeomGUI->GetSketcher().ChangeMode(SEGMENT); + break; + } + case 4042: // SKETCH Arc + { + myEntityGUI->myGeomGUI->GetSketcher().ChangeMode(ARC_CHORD); + break; + } + case 4043: // SKETCH Set Angle + { + myEntityGUI->OnSketchSetAngle(); + break; + } + case 4044: // SKETCH Set X + { + myEntityGUI->OnSketchSetx(); + break; + } + case 4045: // SKETCH Set Y + { + myEntityGUI->OnSketchSety(); + break; + } + case 4046: // SKETCH Delete + { + myEntityGUI->OnSketchDelete(); + break; + } + case 4047: // SKETCH End + { + myEntityGUI->OnSketchEnd(); + break; + } + case 4048: // SKETCH Close + { + myEntityGUI->OnSketchClose(); + break; + } + case 4051: // sketcher Set Plane + { + //TO DO + break; + } + case 4052: // sketcher TANGENT + { + Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); + if(Mb->isItemChecked(theCommandID) == true) + myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(TANGENT); + else + myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); + + Mb->setItemChecked(4053, false); + break; + } + case 4053: // sketcher PERPENDICULAR + { + Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); + if(Mb->isItemChecked(theCommandID) == true) + myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(PERPENDICULAR); + else + myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); + + Mb->setItemChecked(4052, false); + break; + } + case 4061: // SKETCH OptionsOnofflengthdimension + { + Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); + myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(LENGTH_PARAMETER, Mb->isItemChecked(theCommandID)); + break; + } + case 4062: // SKETCH OptionsOnoffangledimension + { + Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); + myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(ANGLE_PARAMETER, Mb->isItemChecked(theCommandID)); + break; + } + case 4063: // SKETCH OptionsOnoffradiusdimension + { + Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); + myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(RADIUS_PARAMETER, Mb->isItemChecked(theCommandID)); + break; + } + case 4064: // SKETCH OptionsOnoffxdimension + { + Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); + myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(XVALUE_PARAMETER, Mb->isItemChecked(theCommandID)); + break; + } + case 4065: // SKETCH OptionsOnoffydimension + { + Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); + myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(YVALUE_PARAMETER, Mb->isItemChecked(theCommandID)); + break; + } + case 407: // EXPLODE : use ic + { + Handle(AIS_InteractiveContext) ic; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + ic = v3d->getAISContext(); + } + EntityGUI_SubShapeDlg *aDlg = new EntityGUI_SubShapeDlg(parent, "", myEntityGUI, Sel, ic); + break ; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//======================================================================= +// function : OnSketchSetAngle() +// purpose : +//======================================================================= +void EntityGUI::OnSketchSetAngle() +{ + Standard_Real anAngle = myGeomGUI->GetSketcher().GetSegmentAngle()/PI180; + Sketch::fitInResol(anAngle); + Standard_Boolean res = false; + QString Value = QString("%1").arg(anAngle); + anAngle = myGeomBase->Parameter(res, Value, tr("GEOM_MEN_ANGLE"), tr("GEOM_MEN_ENTER_ANGLE"), + -180.0, +180.0, 6) * PI180; + + if(res) { + myGeomGUI->GetSketcher().SetSegmentAngle(anAngle); + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); + Mb->setItemChecked(4052, false); + Mb->setItemChecked(4053, false); + } + return; +} + + +//======================================================================= +// function : OnSketchSetx() +// purpose : +//======================================================================= +void EntityGUI::OnSketchSetx() +{ + Standard_Boolean res = false; + double X = myGeomBase->Parameter(res, "0.", tr("GEOM_MEN_X"), tr("GEOM_MEN_SKETCHER_X"), + 2.0 * Precision::Confusion(), 1E6, 6); + if(res) + myGeomGUI->GetSketcher().SetXDimension(X); + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); + Mb->setItemChecked(4052, false); + Mb->setItemChecked(4053, false); + return; +} + + +//======================================================================= +// function : OnSketchSety() +// purpose : +//======================================================================= +void EntityGUI::OnSketchSety() +{ + Standard_Boolean res = false; + double Y = myGeomBase->Parameter(res, "0.", tr("GEOM_MEN_Y"), tr("GEOM_MEN_SKETCHER_Y"), 2.0 * Precision::Confusion(), 1E6, 6); + if(res) + myGeomGUI->GetSketcher().SetYDimension(Y); + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); + Mb->setItemChecked(4052, false); + Mb->setItemChecked(4053, false); + return; +} + + +//======================================================================= +// function : OnSketchDelete() +// purpose : +//======================================================================= +void EntityGUI::OnSketchDelete() +{ + if(myGeomGUI->GetSketcher().GetmyEdgesNumber() == 1) { + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); + Mb->setItemEnabled(405, false); // SKETCH CONTRAINTS + myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); + } + + if(myGeomGUI->GetSketcher().Delete()) + myGeomGUI->myState = -1; + return; +} + + +//======================================================================= +// function : OnSketchClose() +// purpose : +//======================================================================= +void EntityGUI::OnSketchClose() +{ + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) myContext = v3d->getAISContext(); + + TopoDS_Wire W = myGeomGUI->GetSketcher().Close(); + if(!W.IsNull()) { + GEOM::GEOM_Gen::ListOfIOR_var listShapes = new GEOM::GEOM_Gen::ListOfIOR; + listShapes->length(0); + unsigned int i = 0; + + BRepTools_WireExplorer Ex(W); + while(Ex.More()) { + TopoDS_Edge E = Ex.Current(); + gp_Pnt pt1, pt2; + + pt1 = BRep_Tool::Pnt(TopExp::FirstVertex(E)); + pt2 = BRep_Tool::Pnt(TopExp::LastVertex(E)); + + gp_Pnt CenterPoint; + Handle(Geom_Curve) Curve; + Handle(Geom_Circle) Circle; + gp_Circ Circ; + Standard_Real First,Last; + + Curve = BRep_Tool::Curve(E,First,Last); + if(Curve->IsKind(STANDARD_TYPE(Geom_Circle))) { + Circle = Handle(Geom_Circle)::DownCast(Curve); // pointer on geom_circ + Circ = Circle->Circ(); // gp_Circ + + Curve->D0((First + Last) / 2., CenterPoint); + + GEOM::PointStruct pI = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z()); + GEOM::PointStruct pC = myGeom->MakePointStruct(CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z()); + GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z()); + + GEOM::GEOM_Shape_var arc; + + try { + arc = myGeom->MakeArc(pI, pC, pE); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + listShapes->length(i+1); + listShapes[i] = strdup(arc->Name()); + i++; + } + else { + GEOM::PointStruct pI = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z()); + GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z()); + GEOM::GEOM_Shape_var segment; + + try { + segment = myGeom->MakeEdge(pI,pE); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + listShapes->length(i+1); + listShapes[i] = strdup(segment->Name()); + i++; + } + Ex.Next(); + } + GEOM::GEOM_Shape_var Wire = myGeom->MakeWire(listShapes); + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, Wire); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + Wire->NameType(type); + + if(myGeomBase->Display(Wire)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + myGeomGUI->myState = -1; + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); + Mb->setItemEnabled(405, false); // SKETCH CONTRAINTS + myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); + return; +} + + +//======================================================================= +// function : OnSketchEnd() +// purpose : +//======================================================================= +void EntityGUI::OnSketchEnd() +{ + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); + + TopoDS_Wire W = myGeomGUI->GetSketcher().End(); + if(!W.IsNull()) { + GEOM::GEOM_Gen::ListOfIOR_var listShapes = new GEOM::GEOM_Gen::ListOfIOR; + listShapes->length(0); + unsigned int i = 0; + + BRepTools_WireExplorer Ex(W); + while(Ex.More()) { + TopoDS_Edge E = TopoDS::Edge(Ex.Current()); + + gp_Pnt pt1, pt2; + pt1 = BRep_Tool::Pnt(TopExp::FirstVertex(E)); + pt2 = BRep_Tool::Pnt(TopExp::LastVertex(E)); + + gp_Pnt CenterPoint; + Handle(Geom_Curve) Curve; + Handle(Geom_Circle) Circle; + gp_Circ Circ; + Standard_Real First,Last; + + Curve = BRep_Tool::Curve(E,First,Last); + if(Curve->IsKind(STANDARD_TYPE(Geom_Circle))) { + Circle = Handle(Geom_Circle)::DownCast(Curve); // pointer on geom_circ + Circ = Circle->Circ(); // gp_Circ + + Curve->D0((First + Last) / 2., CenterPoint); + + GEOM::PointStruct pI = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z()); + GEOM::PointStruct pC = myGeom->MakePointStruct(CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z()); + GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z()); + + GEOM::GEOM_Shape_var arc; + + try { + arc = myGeom->MakeArc(pI, pC, pE); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + listShapes->length(i+1); + listShapes[i] = strdup(arc->Name()); + i++; + } else { + GEOM::PointStruct pI = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z()); + GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z()); + GEOM::GEOM_Shape_var segment; + + try { + segment = myGeom->MakeEdge(pI,pE); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + listShapes->length(i+1); + listShapes[i] = strdup(segment->Name()); + i++; + } + Ex.Next(); + } + + GEOM::GEOM_Shape_var Wire = myGeom->MakeWire(listShapes); + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, Wire); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + Wire->NameType(type); + + if(myGeomBase->Display(Wire)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + myGeomGUI->myState = -1; + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); + Mb->setItemEnabled(405, false); // SKETCH CONTRAINTS + myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); + return; +} + + +//===================================================================================== +// function : SObjectExist() +// purpose : +//===================================================================================== +bool EntityGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR) +{ + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->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 +//===================================================================================== +bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType) +{ + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); + if(theObj->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return false; + } + + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributePixMap_var aPixmap; + + /* We create a sub object for each sub shape as attribute of the main object */ + /* Each sub object contains list (length=1) containing its index in the main shape */ + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); + GEOM::GEOM_Gen::ListOfGeomShapes_var listGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes; + GEOM::GEOM_Shape_var aResult; + + try { + listGeomShapes = myGeom->SubShapeAll(aShape, SubShapeType); + if(listGeomShapes->length() < 1) { + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT")); + return false; + } + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + /* open transaction */ + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); + op->start(); + + TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + TopoDS_Shape mainShape; + bool main = false; + while(!main) { + if(aShape->IsMainShape()) { + mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + main = true; + } + else + aShape = myGeom->GetIORFromString(aShape->MainName()); + } + + /* Loop on each sub shape created */ + /* int i = 1 ; /* index for the nameType */ + for(int j=0; jlength(); j++) { + /* Get each sub shape extracted CORBA and OCC */ + aResult = listGeomShapes[j] ; + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); + + if (S.IsNull()) { + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT")); + return false; + } + + /* Set the nameType of sub shape */ + char* nameG = (char *)malloc(20); + Standard_CString Type; + if(myGeomBase->GetShapeTypeString(S, Type)) { + aResult->NameType(Type); + sprintf(nameG, "%s_%d", Type, myGeomBase->GetIndex(S, mainShape, SubShapeType)); + } + else { + aResult->NameType(tr("GEOM_SHAPE")); + sprintf(nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); + } + SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name()); + + bool allreadyexist = false; + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + Handle(GEOM_AISShape) result = new GEOM_AISShape(S, nameG); + Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); + + MESSAGE ("SO->_is_nil() " << SO->_is_nil()) + + if(SO->_is_nil()) { + SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(nameG); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(aResult->Name()); + + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + MESSAGE(" Type " << S.ShapeType()) + if (S.ShapeType() == TopAbs_COMPOUND) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); + else if(S.ShapeType() == TopAbs_COMPSOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); + else if(S.ShapeType() == TopAbs_SOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); + else if(S.ShapeType() == TopAbs_SHELL) + aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); + else if(S.ShapeType() == TopAbs_FACE) + aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); + else if(S.ShapeType() == TopAbs_WIRE) + aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); + else if(S.ShapeType() == TopAbs_EDGE) + aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); + else if(S.ShapeType() == TopAbs_VERTEX) + aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); + + MESSAGE(" aPixmap->GetPixMap " << aPixmap->GetPixMap()) + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, newObj); + IO->setEntry(newObj->GetID()); + + aResult->StudyShapeId(newObj->GetID()); + } + else { + allreadyexist = true; + if(!this->SObjectExist(theObj, aResult->Name())) { + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); + aStudyBuilder->Addreference(newObj1, SO); + IO->setEntry(SO->GetID()); + aResult->StudyShapeId(SO->GetID()); + } + } + + result->setIO(IO); + result->setName(nameG); + if(!allreadyexist) + ic->Display(result); + + } + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + int themode = myRenderInter->GetDisplayMode(); + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + + Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); + + if(SO->_is_nil()) { + SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(aResult->Name()); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(nameG); + + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + if(S.ShapeType() == TopAbs_COMPOUND) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); + else if(S.ShapeType() == TopAbs_COMPSOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); + else if(S.ShapeType() == TopAbs_SOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); + else if(S.ShapeType() == TopAbs_SHELL) + aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); + else if(S.ShapeType() == TopAbs_FACE) + aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); + else if(S.ShapeType() == TopAbs_WIRE) + aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); + else if(S.ShapeType() == TopAbs_EDGE) + aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); + else if(S.ShapeType() == TopAbs_VERTEX) + aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, newObj); + IO->setEntry(newObj->GetID()); + } + else { + allreadyexist = true; + if(!this->SObjectExist(theObj, aResult->Name())) { + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); + aStudyBuilder->Addreference(newObj1, SO); + IO->setEntry(SO->GetID()); + } + } + + if(!allreadyexist) { + vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(S,0,themode,Standard_True); + theActors->InitTraversal(); + vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); + while(!(anActor==NULL)) { + GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); + GActor->setIO(IO); + GActor->setName(nameG); + theRenderer->AddActor(GActor); + renWin->Render(); + anActor = (vtkActor*)theActors->GetNextActor(); + } + } + } + } + + /* commit transaction */ + op->finish(); + + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY")); + return true; +} + + +//===================================================================================== +// function : OnSubShapeGetSelected() +// purpose : +//===================================================================================== +bool EntityGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext) +{ + //* Test the type of viewer */ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); + if(theObj->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return false; + } + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + + if( myUseLocalContext == false ) { + /* local context is from DialogBox */ + MESSAGE("Error : No local context opened for sub shapes method" << endl ) ; + return false ; + } + + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString( ShapeTopoIOR ); + TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + + TopoDS_Shape mainShape; + bool main = false; + while(!main) { + if(aShape->IsMainShape()) { + mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + main = true; + } + else + aShape = myGeom->GetIORFromString(aShape->MainName()); + } + + GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; + ic->InitSelected(); + int nbSelected = ic->NbSelected(); + ListOfID->length(nbSelected); + + TopoDS_Compound compound; + ic->InitSelected(); /* to init again */ + BRep_Builder B; + B.MakeCompound(compound); + + int i = 0; + /* We create a unique compound containing all the sub shapes selected by user as attribute of the main shape */ + /* the compound is homogenous by selection */ + while(ic->MoreSelected()) { + int index = myGeomBase->GetIndex(ic->SelectedShape(), mainShape, SubShapeType); + ListOfID[i] = index; + B.Add(compound, ic->SelectedShape()); + i++; + ic->NextSelected(); + } + + /* Test if user has selected sub shapes */ + if(ListOfID->length() < 1) + return false; + + GEOM::GEOM_Shape_var aResult; + try { + aResult = myGeom->SubShape(aShape, SubShapeType, ListOfID); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + /* local context from DialogBox */ + ic->CloseLocalContext(aLocalContextId); + myUseLocalContext = false ; + + char* nameG = (char *)malloc(20); + Standard_CString Type; + + Handle(GEOM_AISShape) result; + Handle(GEOM_InteractiveObject) IO; + + if(nbSelected == 1) { + TopExp_Explorer Exp (compound, TopAbs_ShapeEnum(SubShapeType)); + if(Exp.More()) { + if(myGeomBase->GetShapeTypeString(Exp.Current(),Type)) { + aResult->NameType(Type); + sprintf (nameG, "%s_%d", Type, myGeomBase->GetIndex( Exp.Current(), mainTopo, SubShapeType)); + } + else { + aResult->NameType(tr("GEOM_SHAPE")); + sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); + } + result = new GEOM_AISShape(Exp.Current(), nameG); + IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); + } + } + else { + if ( myGeomBase->GetShapeTypeString(compound,Type)) { + aResult->NameType(Type); + sprintf (nameG, "%s_%d", Type, myGeomGUI->GetNbGeom()++); + } else { + aResult->NameType(tr("GEOM_SHAPE")); + sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); + } + result = new GEOM_AISShape(compound, nameG); + IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); + } + + SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name()); + + /* open transaction */ + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); + op->start(); + + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributePixMap_var aPixmap; + + bool allreadyexist = false; + + if(SO->_is_nil()) { + SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(aResult->Name()); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(result->getName()); + + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + if(result->Shape().ShapeType() == TopAbs_COMPOUND) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); + else if(result->Shape().ShapeType() == TopAbs_COMPSOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); + else if(result->Shape().ShapeType() == TopAbs_SOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); + else if(result->Shape().ShapeType() == TopAbs_SHELL) + aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); + else if(result->Shape().ShapeType() == TopAbs_FACE) + aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); + else if(result->Shape().ShapeType() == TopAbs_WIRE) + aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); + else if(result->Shape().ShapeType() == TopAbs_EDGE) + aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); + else if(result->Shape().ShapeType() == TopAbs_VERTEX) + aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, newObj); + + IO->setEntry(newObj->GetID()); + aResult->StudyShapeId(newObj->GetID()); + } + else { + allreadyexist = true; + if(!this->SObjectExist(theObj, aResult->Name())) { + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); + aStudyBuilder->Addreference(newObj1, SO); + + IO->setEntry(SO->GetID()); + aResult->StudyShapeId(SO->GetID()); + } + } + + /* commit transaction */ + op->finish(); + + result->setIO(IO); + result->setName(nameG); + + if(!allreadyexist) + ic->Display(result); + + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY")); + return true; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return EntityGUI::OnGUIEvent(theCommandID, parent);} +} diff --git a/src/EntityGUI/EntityGUI.h b/src/EntityGUI/EntityGUI.h new file mode 100644 index 000000000..863e310ed --- /dev/null +++ b/src/EntityGUI/EntityGUI.h @@ -0,0 +1,69 @@ +// 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 : EntityGUI.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef ENTITYGUI_H +#define ENTITYGUI_H + +#include "GEOMBase.h" + +//================================================================================= +// class : EntityGUI +// purpose : +//================================================================================= +class EntityGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + EntityGUI(); + ~EntityGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + + /* Sketcher management */ + void OnSketchSetAngle(); + void OnSketchSetx(); + void OnSketchSety(); + + void OnSketchDelete(); + void OnSketchClose(); + void OnSketchEnd(); + + /* 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); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx new file mode 100644 index 000000000..28923363f --- /dev/null +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -0,0 +1,572 @@ +// 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 : EntityGUI_SubShapeDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "EntityGUI_SubShapeDlg.h" + +#include "DisplayGUI.h" +#include "QAD_RightFrame.h" +#include "OCCViewer_Viewer3d.h" + +#include +#include + +#include + +//================================================================================= +// class : EntityGUI_SubShapeDlg() +// purpose : Constructs a EntityGUI_SubShapeDlg 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. +//================================================================================= +EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(QWidget* parent, const char* name, EntityGUI* theEntityGUI, SALOME_Selection* Sel, Handle(AIS_InteractiveContext) ic, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUBSHAPE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SUBSHAPE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SUB_SHAPE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel1Check1List_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_SUBSHAPE_TYPE")); + GroupPoints->CheckButton1->setText(tr("GEOM_SUBSHAPE_SELECT")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myEntityGUI = theEntityGUI; + Init(ic); +} + + +//================================================================================= +// function : ~EntityGUI_SubShapeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +EntityGUI_SubShapeDlg::~EntityGUI_SubShapeDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::Init(Handle(AIS_InteractiveContext) ic) +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myWithShape = true; + myAbort = myOkShape = myUseLocalContext = false; + myIC = ic; + myLocalContextId = -1; + + /* type for sub shape selection */ + GroupPoints->ComboBox1->insertItem("Compound"); + GroupPoints->ComboBox1->insertItem("Compsolid"); + GroupPoints->ComboBox1->insertItem("Solid"); + GroupPoints->ComboBox1->insertItem("Shell"); + GroupPoints->ComboBox1->insertItem("Face"); + GroupPoints->ComboBox1->insertItem("Wire"); + GroupPoints->ComboBox1->insertItem("Edge"); + GroupPoints->ComboBox1->insertItem("Vertex"); + GroupPoints->ComboBox1->insertItem("Shape"); + + myShapeType = GroupPoints->ComboBox1->currentItem(); + myOkSelectSubMode = GroupPoints->CheckButton1->isChecked(); + + if(QAD_Application::getDesktop()->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())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); + connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(AllOrNotAll())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::ClickOnOk() +{ + this->ClickOnApply(); + + /* User has aborted or not operation of explode all with many sub shapes */ + if(myAbort == false) + this->ClickOnCancel(); + else + myAbort = false; + + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + bool testResult = false; + myAbort = false; /* Not aborted by default */ + + /* Explode all sub shapes */ + if(myOkShape && !myOkSelectSubMode) { + /* More than 30 subshapes : ask confirmation */ + unsigned int nb = NumberOfSubShapes(myShape, myShapeType); + if(nb > 30) { + const QString caption = tr("GEOM_CONFIRM"); + const QString text = tr("GEOM_CONFIRM_INFO").arg(nb); + const QString button0 = tr("GEOM_BUT_EXPLODE"); + const QString button1 = tr("GEOM_BUT_CANCEL"); + + if(QMessageBox::warning(this, caption, text, button0, button1) == 0) + testResult = myEntityGUI->OnSubShapeGetAll(myShape, myShapeIOR, myShapeType); + else + myAbort = true; /* aborted */ + } + else + testResult = myEntityGUI->OnSubShapeGetAll(myShape, myShapeIOR, myShapeType); + } + /* explode only selected sub shapes */ + else if(myOkShape && myOkSelectSubMode) + testResult = myEntityGUI->OnSubShapeGetSelected(myShape, myShapeIOR, myShapeType, myLocalContextId, myUseLocalContext); + + if(!testResult) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + myAbort = true; + } + else + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + + /* Reset all arguments and local context to allow user a new selection ...*/ + this->ResetStateOfDialog(); + return; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::ClickOnCancel() +{ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + } + GEOMBase_Skeleton::ClickOnCancel(); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +// : used only by SelectButtonC1A1 (LineEditC1A1) +//================================================================================= +void EntityGUI_SubShapeDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + this->ResetStateOfDialog(); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + myOkShape = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(!IO->hasEntry()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return; + } + + if(!S.IsNull() && S.ShapeType() != TopAbs_VERTEX) { + if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { + Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); + myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ + myEditCurrentArgument->setText(aString); + myShape = S; + myOkShape = true; + } + else { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + myShapeIOR = anIOR->Value(); + myOkShape = true; + myShape = S; + GroupPoints->LineEdit1->setText(aString); + } + } + } + + int SelectedShapeType = GroupPoints->ComboBox1->currentItem(); + int count = GroupPoints->ComboBox1->count(); + + if(myWithShape) + count = count - 1; + + int i = 0; + while(i <= myShape.ShapeType()) { + GroupPoints->ComboBox1->removeItem(0); + i++; + } + + if(myShape.ShapeType()==TopAbs_COMPOUND) { + if(myWithShape == false) { + GroupPoints->ComboBox1->insertItem("Shape"); + myWithShape = true; + } + } + else { + if(myWithShape == true) { + GroupPoints->ComboBox1->removeItem(GroupPoints->ComboBox1->count() - 1); + myWithShape = false; + } + } + + int count1 = GroupPoints->ComboBox1->count(); + if(myWithShape) + count1 = count1 - 1; + + if(SelectedShapeType > myShape.ShapeType()) { + if(SelectedShapeType == 8) { + if(myShape.ShapeType() != TopAbs_COMPOUND) { + GroupPoints->ComboBox1->setCurrentItem(0); + myShapeType = 8 - count1; + } + } + else { + GroupPoints->ComboBox1->setCurrentItem(count1 - count + SelectedShapeType); + myShapeType = 8 - count1 + GroupPoints->ComboBox1->currentItem(); + } + } + else { + GroupPoints->ComboBox1->setCurrentItem(0); + myShapeType = 8 - count1; + } + } + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::DeactivateActiveDialog() +{ + if(GroupConstructors->isEnabled()) { + this->ResetStateOfDialog(); + GEOMBase_Skeleton::DeactivateActiveDialog(); + } + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + GroupPoints->CheckButton1->setEnabled(true); + else + GroupPoints->CheckButton1->setEnabled(false); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::closeEvent(QCloseEvent* e) +{ + /* same than click on cancel button */ + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ResetStateOfDialog() +// purpose : Completely reset the state of method including local context +//================================================================================= +void EntityGUI_SubShapeDlg::ResetStateOfDialog() +{ + if(myAbort == true) { + myOkShape = false; + myEditCurrentArgument->setText(""); + } + + int SelectedShapeType = GroupPoints->ComboBox1->currentItem(); + int count = GroupPoints->ComboBox1->count(); + if(myWithShape) + count = count - 1; + + /* type for sub shape selection */ + GroupPoints->ComboBox1->clear(); + GroupPoints->ComboBox1->insertItem("Compound"); + GroupPoints->ComboBox1->insertItem("Compsolid"); + GroupPoints->ComboBox1->insertItem("Solid"); + GroupPoints->ComboBox1->insertItem("Shell"); + GroupPoints->ComboBox1->insertItem("Face"); + GroupPoints->ComboBox1->insertItem("Wire"); + GroupPoints->ComboBox1->insertItem("Edge"); + GroupPoints->ComboBox1->insertItem("Vertex"); + GroupPoints->ComboBox1->insertItem("Shape"); + myWithShape=true; + GroupPoints->ComboBox1->setCurrentItem(8 - count + SelectedShapeType); + myOkSelectSubMode = false; + + /* unpress buttons : due to abort box*/ + buttonApply->setDown(FALSE); + buttonOk->setDown(FALSE); + GroupPoints->CheckButton1->setChecked(FALSE); + + /* Close its local contact if opened */ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + } + return; +} + + +//================================================================================= +// function : AllOrNotAll() +// purpose : Allow user selection of all or only selected sub shapes +// : Called when 'CheckButton1' state change +//================================================================================= +void EntityGUI_SubShapeDlg::AllOrNotAll() +{ + /* No sub shape selection if main shape not selected */ + if(!myOkShape) { + this->ResetStateOfDialog(); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")); + return; + } + + if(myShapeType ==TopAbs_SHAPE && myShape.ShapeType()==TopAbs_COMPOUND) { + /* Select sub shapes mode not checked */ + myOkSelectSubMode = false; + GroupPoints->CheckButton1->setChecked( FALSE ); + //no meaning to allow user selection for type = shape + //TODO - add another message + //QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ; + return; + } + + myOkSelectSubMode = GroupPoints->CheckButton1->isChecked(); + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + } + else { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER")); + return; + } + + if(myOkShape && myOkSelectSubMode) { + /* local context is defined into the method */ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelection(myShapeType, myLocalContextId); + myUseLocalContext = true; + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")); + } + return; +} + + +//================================================================================= +// function : ComboTextChanged() +// purpose : +//================================================================================= +void EntityGUI_SubShapeDlg::ComboTextChanged() +{ + if(myOkShape) + myShapeType = GroupPoints->ComboBox1->currentItem() + myShape.ShapeType() + 1; + else + myShapeType = GroupPoints->ComboBox1->currentItem(); + + /* Select sub shapes mode not checked */ + GroupPoints->CheckButton1->setChecked(FALSE); + myOkSelectSubMode = FALSE; + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + } + return; +} + + +//================================================================================= +// function : NumberOfSubShapes() +// purpose : +//================================================================================= +unsigned int EntityGUI_SubShapeDlg::NumberOfSubShapes(const TopoDS_Shape& S, const int shapeType) +{ + if(S.IsNull()) + return 0; + + unsigned int index = 0; + TopExp_Explorer Exp(S, TopAbs_ShapeEnum(shapeType)); + TopTools_MapOfShape M; + while(Exp.More()) { + if(M.Add(Exp.Current())) + index++; + Exp.Next(); + } + M.Clear(); + return index; +} diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.h b/src/EntityGUI/EntityGUI_SubShapeDlg.h new file mode 100644 index 000000000..cd85ce051 --- /dev/null +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.h @@ -0,0 +1,89 @@ +// 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 : EntityGUI_SubShapeDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_SUBSHAPE_H +#define DIALOGBOX_SUBSHAPE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel1Check1List_QTD.h" + +#include "EntityGUI.h" + +//================================================================================= +// class : EntityGUI_SubShapeDlg +// purpose : +//================================================================================= +class EntityGUI_SubShapeDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + EntityGUI_SubShapeDlg(QWidget* parent = 0, const char* name = 0, EntityGUI* theEntityGUI = 0, SALOME_Selection* Sel = 0, Handle(AIS_InteractiveContext) ic = 0, bool modal = FALSE, WFlags fl = 0); + ~EntityGUI_SubShapeDlg(); + +private : + void Init(Handle(AIS_InteractiveContext) ic); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); + + void ResetStateOfDialog(); + unsigned int NumberOfSubShapes(const TopoDS_Shape& S, const int shapeType); + + EntityGUI* myEntityGUI; + + /* Interactive and local context management see also : bool myUseLocalContext() */ + Handle(AIS_InteractiveContext) myIC; /* Interactive context */ + Standard_Integer myLocalContextId; /* identify a local context used by this method */ + bool myUseLocalContext; /* true when this method as opened a local context */ + + TopoDS_Shape myShape; + bool myOkShape; + char* myShapeIOR; + int myShapeType; + + bool myWithShape; /* check if Shape item exists */ + bool myOkSelectSubMode; /* true = sub mode selection activated */ + bool myAbort; /* Indicate if sub Shape All has been aborted by user */ + + DlgRef_1Sel1Check1List_QTD* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ClickOnCancel(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void AllOrNotAll(); + void ComboTextChanged(); + +}; + +#endif // DIALOGBOX_SUBSHAPE_H diff --git a/src/EntityGUI/Makefile.in b/src/EntityGUI/Makefile.in new file mode 100644 index 000000000..3883eebab --- /dev/null +++ b/src/EntityGUI/Makefile.in @@ -0,0 +1,61 @@ +# GEOM ENTITYGUI : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets +LIB = libEntityGUI.la + +# header files +EXPORT_HEADERS= + +LIB_SRC = EntityGUI.cxx \ + EntityGUI_SubShapeDlg.cxx + +LIB_MOC = \ + EntityGUI.h \ + EntityGUI_SubShapeDlg.h + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lGEOMFiltersSelection -lDisplayGUI + +@CONCLUDE@ diff --git a/src/GEOM/GEOM_Gen_i.cc b/src/GEOM/GEOM_Gen_i.cc index fbc67a229..3816897ae 100644 --- a/src/GEOM/GEOM_Gen_i.cc +++ b/src/GEOM/GEOM_Gen_i.cc @@ -46,12 +46,15 @@ using namespace std; #include #include #include +#include +#include #include #include #include #include #include #include +#include #include #include @@ -129,6 +132,7 @@ using namespace std; #include #include #include +#include #include #include #include @@ -3629,6 +3633,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 @@ -4260,7 +4352,6 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeCompound( const GEOM::GEOM_Gen::ListOfIOR& } - //================================================================================ // function : MakeEdge() // purpose : Make a linear edge with 2 points @@ -4333,7 +4424,6 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeWire( const GEOM::GEOM_Gen::ListOfIOR& List } - //================================================================================= // function : MakeRevolution() // purpose : diff --git a/src/GEOM/GEOM_Gen_i.hh b/src/GEOM/GEOM_Gen_i.hh index 34ad61d8f..753e98e89 100644 --- a/src/GEOM/GEOM_Gen_i.hh +++ b/src/GEOM/GEOM_Gen_i.hh @@ -586,6 +586,10 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, throw (SALOME::SALOME_Exception) ; GEOM::GEOM_Shape_ptr MakeFace (GEOM::GEOM_Shape_ptr wire, CORBA::Boolean wantplanarface) throw (SALOME::SALOME_Exception) ; + GEOM::GEOM_Shape_ptr MakeShell (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) + throw (SALOME::SALOME_Exception) ; + GEOM::GEOM_Shape_ptr MakeSolid (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) + throw (SALOME::SALOME_Exception) ; //-------------------------------------------------------------------// diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx new file mode 100644 index 000000000..438a1e541 --- /dev/null +++ b/src/GEOMBase/GEOMBase.cxx @@ -0,0 +1,1488 @@ +// 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 : GEOMBase.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "GEOMBase.h" + +//// SALOME Includes +# include "Utils_ORB_INIT.hxx" +# include "Utils_SINGLETON.hxx" + +#include "QAD_RightFrame.h" +#include "QAD_MessageBox.h" +#include "QAD_Resource.h" + +#include "GEOM_AssemblyBuilder.h" +#include "VTKViewer_ViewFrame.h" +#include "OCCViewer_ViewPort3d.h" +#include "OCCViewer_Viewer3d.h" + +#include "SALOME_ListIteratorOfListIO.hxx" +#include "SALOMEGUI_ImportOperation.h" +#include "SALOMEGUI_NameDlg.h" + +// // Open CASCADE Includes +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +// // QT Includes +#include + +#include "GEOMBase_aParameterDlg.h" + +//================================================================================= +// class : CustomItem +// purpose : Set Font to a text. +//================================================================================= +class CustomItem : public QCustomMenuItem +{ +public: + CustomItem(const QString& s, const QFont& f) + :string(s), font(f){}; + ~CustomItem(){} + + void paint(QPainter* p, const QColorGroup& /*cg*/, bool /*act*/, + bool /*enabled*/, int x, int y, int w, int h) + { + p->setFont(font); + p->drawText(x, y, w, h, AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string); + } + + QSize sizeHint() + { + return QFontMetrics(font).size(AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string); + } + +private: + QString string; + QFont font; + +}; + + +//======================================================================= +// function : GEOMBase() +// purpose : Constructor +//======================================================================= +GEOMBase::GEOMBase() : + QObject() +{ + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; + + /* Shading Color */ + QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed"); + QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen"); + QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue"); + if(!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty()) + myShadingColor = Quantity_Color(SCr.toInt()/255., SCg.toInt()/255., SCb.toInt()/255., Quantity_TOC_RGB); + else + myShadingColor = Quantity_Color(Quantity_NOC_GOLDENROD); + + QString AddInStudy = QAD_CONFIG->getSetting("Geometry:SettingsAddInStudy"); + if(!AddInStudy.isEmpty()) + mySettings_AddInStudy = AddInStudy.toInt(); + else + mySettings_AddInStudy = 1; +} + + +//======================================================================= +// function : ~GEOMBase() +// purpose : Destructor +//======================================================================= +GEOMBase::~GEOMBase() +{ +} + + +//================================================================================= +// function : CustomPopup() +// purpose : [static] +//================================================================================= +bool GEOMBase::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, + const QString& theParent, const QString& theObject) +{ + GEOMBase* myGeomBase = new GEOMBase(); + QAD_Study* ActiveStudy = parent->getActiveStudy(); + + /* Deactivate any non modal dialog box to get the neutral point */ + myGeomBase->myGeomGUI->EmitSignalDeactivateDialog(); + + SALOME_Selection* Sel = SALOME_Selection::Selection(ActiveStudy->getSelection()); + int nbSel = Sel->IObjectCount(); + + if((nbSel == 0)) + return false; + + if(ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + if(theParent.compare("Viewer") == 0) { + if(theObject.compare("Component") == 0) { + popup->removeItem(QAD_DisplayOnly_Popup_ID); + return true; + } + else { + QFont f = QApplication::font(); + f.setBold(TRUE); + if(nbSel == 1) { + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + popup->removeItem(QAD_TopLabel_Popup_ID); + popup->insertItem(new CustomItem (QString(IObject->getName()), f), QAD_TopLabel_Popup_ID, 0); + if(IObject->hasEntry()) + popup->setItemEnabled(804, false); //Add in Study Menu + else + popup->setItemEnabled(804, true); //Add in Study Menu + + if(IObject->IsKind(STANDARD_TYPE(GEOM_InteractiveObject))) { + Standard_Boolean found; + Handle(GEOM_AISShape) Result = myGeomBase->ConvertIOinGEOMAISShape(IObject, found, true); + + if(found) { + if(Result->DisplayMode() == 1) + popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu + else + popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu + } + } + + if(!(v3d->isInViewer(IObject) && v3d->isVisible(IObject))) + popup->removeItem(QAD_Erase_Popup_ID); + else + popup->removeItem(QAD_Display_Popup_ID); + } + else { + popup->removeItem(QAD_DisplayOnly_Popup_ID); + popup->removeItem(QAD_TopLabel_Popup_ID); + popup->insertItem(new CustomItem (tr("GEOM_MEN_POPUP_NAME").arg(nbSel), f), QAD_TopLabel_Popup_ID, 0); + popup->setItemEnabled(804, false); //Add in Study Menu + } + } + return true; + } + else if(theParent.compare("ObjectBrowser") == 0) { + popup->removeItem(QAD_TopLabel_Popup_ID); + int id = popup->idAt(0); // separator + if(id < 0) + popup->removeItem(id); + + // checking for GEOM label in the selected list + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + Handle(SALOME_InteractiveObject) anIObject; + + bool useSubItems = false; + bool needOpen = false; + bool needDisplay = false; + bool needErase = false; + SALOMEDS::GenericAttribute_var aTmpAttr; + for(;It.More();It.Next()) { + anIObject = It.Value(); + if(!anIObject->hasEntry()) + continue; + + if(v3d->isInViewer(anIObject) && v3d->isVisible(anIObject)) + needErase = true; + else + needDisplay = true; + SALOMEDS::SObject_var obj = ActiveStudy->getStudyDocument()->FindObjectID(anIObject->getEntry()); + if(!obj->_is_nil()) { + GEOM::GEOM_Shape_var aShape; + if(obj->FindAttribute(aTmpAttr, "AttributeIOR")) { + char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value(); + if(str && strlen(str)) + aShape = myGeomBase->myGeom->GetIORFromString(str); + } + else if(obj->FindAttribute(aTmpAttr, "AttributePersistentRef")) + needOpen = true; + + if(aShape->_is_nil()) { + SALOMEDS::ChildIterator_var anIter = ActiveStudy->getStudyDocument()->NewChildIterator(obj); + while(anIter->More()) { + SALOMEDS::SObject_var subobj = anIter->Value(); + if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { + useSubItems = true; + needErase = true; + needDisplay = true; + } + else if(subobj->FindAttribute(aTmpAttr, "AttributePersistentRef")) { + needOpen = true; + useSubItems = true; + } + anIter->Next(); + } + } + } + } + // remove useless popup items + if(nbSel != 1) + popup->removeItem(901); // rename + if(useSubItems) + popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only + + if(!needOpen) { + int index = popup->indexOf(9024); // open + popup->removeItem(9024); + popup->removeItemAt(index); // separator under Open + + if (!needDisplay) + popup->removeItem(QAD_Display_Popup_ID); + if (!needErase) + popup->removeItem(QAD_Erase_Popup_ID); + + if(!needDisplay && !needErase) { + int id = popup->idAt(popup->count()-1); // last item + popup->removeItem(id); // separator + } + } + else { + popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only + popup->removeItem(QAD_Display_Popup_ID); + popup->removeItem(QAD_Erase_Popup_ID); + if (nbSel != 1) { + int id = popup->idAt(popup->count()-1); // last item + popup->removeItem(id); // separator + } + } + return true; + } + } + else if(ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + // MESSAGE ( " CUSTOM POPUP VIEWER VTK ") + if((theParent.compare("Viewer") == 0)) { + popup->setItemEnabled(8034, false); //Isos Menu + if(theObject.compare("Component") == 0) { + popup->removeItem(QAD_DisplayOnly_Popup_ID); + return true; + } + + //int id = popup->idAt(0); + QFont f = QApplication::font(); + f.setBold(TRUE); + + if(nbSel == 1) { + Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); + popup->removeItem(QAD_TopLabel_Popup_ID); + popup->insertItem(new CustomItem (QString(IObject->getName()), f), QAD_TopLabel_Popup_ID, 0); + if(IObject->hasEntry()) { + popup->setItemEnabled(804, false); //Add in Study Menu + SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument(); + SALOMEDS::SObject_var SO = aStudy->FindObjectID(IObject->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!SO->_is_nil()) { + if(SO->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + Standard_Boolean found; + GEOM_Actor* Result = myGeomBase->ConvertIORinGEOMActor(anIOR->Value(), found, true); + if(found) { + if(Result->getDisplayMode() == 1) + popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu + else + popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu + + if(!Result->GetVisibility()) + popup->removeItem(QAD_Erase_Popup_ID); + else + popup->removeItem(QAD_Display_Popup_ID); + } + else + popup->removeItem(QAD_Erase_Popup_ID); + } + } + } + else + popup->setItemEnabled(804, true); //Add in Study Menu + } + else { + popup->removeItem(QAD_DisplayOnly_Popup_ID); + popup->removeItem(QAD_TopLabel_Popup_ID); + popup->insertItem( new CustomItem (tr("GEOM_MEN_POPUP_NAME").arg(nbSel), f), QAD_TopLabel_Popup_ID, 0); + popup->setItemEnabled(804, false); //Add in Study Menu + } + return true; + } + else if(theParent.compare("ObjectBrowser") == 0) { + popup->removeItem(QAD_TopLabel_Popup_ID); + int id = popup->idAt(0); // separator + if(id < 0) + popup->removeItem(id); + + // checking for GEOM label in the selected list + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + Handle(SALOME_InteractiveObject) anIObject; + + bool useSubItems = false; + bool needOpen = false; + bool needDisplay = false; + bool needErase = false; + SALOMEDS::GenericAttribute_var aTmpAttr; + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + for(;It.More();It.Next()) { + anIObject = It.Value(); + if(!anIObject->hasEntry()) + continue; + + if(myRenderInter->isInViewer(anIObject) && myRenderInter->isVisible(anIObject)) + needErase = true; + else + needDisplay = true; + + SALOMEDS::SObject_var obj = ActiveStudy->getStudyDocument()->FindObjectID(anIObject->getEntry()); + if(!obj->_is_nil()) { + GEOM::GEOM_Shape_var aShape; + if(obj->FindAttribute(aTmpAttr, "AttributeIOR")) { + char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value(); + if(str && strlen(str)) + aShape = myGeomBase->myGeom->GetIORFromString(str); + } + else if(obj->FindAttribute(aTmpAttr, "AttributePersistentRef")) + needOpen = true; + + if(aShape->_is_nil()) { + SALOMEDS::ChildIterator_var anIter = ActiveStudy->getStudyDocument()->NewChildIterator(obj); + while(anIter->More()) { + SALOMEDS::SObject_var subobj = anIter->Value(); + if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { + useSubItems = true; + needDisplay = true; + needErase = true; + } + else if(subobj->FindAttribute(aTmpAttr, "AttributePersistentRef")) { + needOpen = true; + useSubItems = true; + } + anIter->Next(); + } + } + } + } + // remove useless popup items + if(nbSel != 1) + popup->removeItem(901); // rename + if(useSubItems) + popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only + + if(!needOpen) { + int index = popup->indexOf(9024); // open + popup->removeItem(9024); + popup->removeItemAt(index); // separator under Open + + if(!needDisplay) + popup->removeItem(QAD_Display_Popup_ID); + if(!needErase) + popup->removeItem(QAD_Erase_Popup_ID); + if(!needDisplay && !needErase) { + int id = popup->idAt(popup->count()-1); // last item + popup->removeItem(id); // separator + } + } + else { + popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only + popup->removeItem(QAD_Display_Popup_ID); + popup->removeItem(QAD_Erase_Popup_ID); + if(nbSel!=1) { + int id = popup->idAt(popup->count()-1); // last item + popup->removeItem(id); // separator + } + } + return true; + } + } + else { // other viewer types not supported. + while(1) { + int id = popup->idAt(0); + if(id <= QAD_TopLabel_Popup_ID && id != -1) + popup->removeItemAt(0); + else + break; + } + popup->removeItem(QAD_DisplayOnly_Popup_ID); + popup->removeItem(QAD_Display_Popup_ID); + popup->removeItem(QAD_Erase_Popup_ID); + int id = popup->idAt(popup->count() - 1); // last item + if(id < 0 && id != -1) + popup->removeItem(id); // separator + return false; + } + return false; +} + + +//===================================================================================== +// function : Display() +// purpose : Displays a CORBA shape +//===================================================================================== +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(QAD_Application::getDesktop()->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 = QAD_Application::getDesktop()->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(QAD_Application::getDesktop()->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"); + QAD_Application::getDesktop()->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(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->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(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + Handle(GEOM_AISShape) theResult = new GEOM_AISShape(shape, nameG.ToCString()); + theResult->SetShadingColor(myShadingColor); + 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); + } + + // DCQ Sel->AddIObject(IO, false); + QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Repaint(); + if(mySettings_AddInStudy) + AddInStudy(false, IO); + + return true; +} + + +//===================================================================================== +// function : AddInStudy() +// purpose : anIOShape or a selected shape +//===================================================================================== +bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject)& anIO) +{ + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + if (!(!mySettings_AddInStudy || selection)) { + Sel->ClearIObjects(); + } + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->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(QAD_Application::getDesktop()->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()); + + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); + + Handle(GEOM_AISShape) GAISShape; + GEOM_Actor* GActor; + Handle(GEOM_InteractiveObject) GIO; + bool found = false; + + // VTK + if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + vtkRenderer *Renderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + + vtkActorCollection* theActors = Renderer->GetActors(); + theActors->InitTraversal(); + 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; + } + // OCC + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + AIS_ListOfInteractive List; + 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(); + } + + if(!found) + return false; + } + + if(!mySettings_AddInStudy || selection) { + QString Name = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), anIO->getName()); + if(!Name.isEmpty()) { + // VTK + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) + GActor->setName(strdup(Name.latin1())); + // OCC + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + GAISShape->setName(strdup(Name.latin1())); + } + else + return false; + } + + // open transaction + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); + op->start(); + + SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(father); + + 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(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + GActor->setIO(GIO); + aName->SetValue(GActor->getName()); + } + // OCC + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + GAISShape->setIO(GIO); + aName->SetValue(GAISShape->getName()); + } + + 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); + + 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); + } + op->finish(); + + if(!mySettings_AddInStudy || selection) + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); + else { + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(false); + // DCQ Sel->AddIObject(GIO); + } + return true; +} + + +//===================================================================================== +// 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; +} + + +//===================================================================================== +// 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 = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + tds = this->GetShapeFromIOR(anIOR->Value()); + if(tds.IsNull()) + return false; + else + return true; + } + } + } + + 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; + } + + return false; +} + + +//======================================================================= +// 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); + } + return nbSel; +} + + +//================================================================================= +// function : GetShapeTypeString() +// purpose : for a single shape +//================================================================================= +bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& aTypeString) +{ + if(aShape.IsNull()) { + aTypeString = "aNullShape"; + return false; + } + switch(aShape.ShapeType()) + { + case TopAbs_COMPOUND: + { + aTypeString = strdup(tr("GEOM_COMPOUND")); + return true; + } + case TopAbs_COMPSOLID: + { + aTypeString = strdup(tr("GEOM_COMPOUNDSOLID")) ; + return true ; + } + case TopAbs_SOLID: + { + aTypeString = strdup(tr("GEOM_SOLID")) ; + return true ; + } + case TopAbs_SHELL: + { + aTypeString = strdup(tr("GEOM_SHELL")) ; + return true ; + } + case TopAbs_FACE: + { + BRepAdaptor_Surface surf(TopoDS::Face(aShape)); + if(surf.GetType() == GeomAbs_Plane) { + aTypeString = strdup(tr("GEOM_PLANE")); + return true; + } + else if(surf.GetType() == GeomAbs_Cylinder) { + aTypeString = strdup(tr("GEOM_SURFCYLINDER")); + return true; + } + else if(surf.GetType() == GeomAbs_Sphere) { + aTypeString = strdup(tr("GEOM_SURFSPHERE")); + return true ; + } + else if(surf.GetType() == GeomAbs_Torus) { + aTypeString = strdup(tr("GEOM_SURFTORUS")); + return true ; + } + else if(surf.GetType() == GeomAbs_Cone) { + aTypeString = strdup(tr("GEOM_SURFCONE")); + return true ; + } + else { + aTypeString = strdup(tr("GEOM_FACE")); + return true; + } + } + case TopAbs_WIRE: + { + aTypeString = strdup(tr("GEOM_WIRE")); + return true; + } + case TopAbs_EDGE: + { + BRepAdaptor_Curve curv(TopoDS::Edge(aShape)); + if(curv.GetType() == GeomAbs_Line) { + if((Abs(curv.FirstParameter()) >= 1E6) || (Abs(curv.LastParameter()) >= 1E6)) + aTypeString = strdup(tr("GEOM_LINE")); + else + aTypeString = strdup(tr("GEOM_EDGE")); + return true; + } + else if(curv.GetType() == GeomAbs_Circle) { + if(curv.IsClosed()) + aTypeString = strdup(tr("GEOM_CIRCLE")); + else + aTypeString = strdup(tr("GEOM_ARC")); + return true; + } + else { + aTypeString = strdup(tr("GEOM_EDGE")); + return true; + } + } + case TopAbs_VERTEX: + { + aTypeString = strdup(tr("GEOM_VERTEX")); + return true; + } + case TopAbs_SHAPE: + { + aTypeString = strdup(tr("GEOM_SHAPE")); + return true; + } + } + 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 = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); + for(int i = 0; i < nbSf; i++) { + QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); + if(sf->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + AIS_ListOfInteractive List; + ic->DisplayedObjects(List); + AIS_ListOfInteractive List1; + ic->ObjectsInCollector(List1); + List.Append(List1); + + AIS_ListIteratorOfListOfInteractive ite(List); + while(ite.More()) { + if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + if(aSh->hasIO()) { + Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); + Standard_CString theIOR = GIO->getIOR(); + if(strcmp(IOR, theIOR) == 0) { + if(onlyInActiveView) { + if(sf == QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()) { + testResult = true; + resultShape = aSh; + return resultShape; + } + } + else { + testResult = true; + resultShape = aSh; + return resultShape; + } + } + } + } + ite.Next(); + } + } + } + return resultShape; +} + + +//======================================================================= +// function : ConvertIORinGEOMActor() +// purpose : +//======================================================================= +GEOM_Actor* GEOMBase::ConvertIORinGEOMActor(const char* IOR, Standard_Boolean& testResult, bool onlyInActiveView) +{ + int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); + for(int i = 0; i < nbSf; i++) { + QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); + if(sf->getTypeView() == VIEW_VTK) { + vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* theActors = Renderer->GetActors(); + theActors->InitTraversal(); + vtkActor *ac = theActors->GetNextActor(); + while(!(ac==NULL)) { + if( ac->IsA("GEOM_Actor")) { + GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(ac); + if(anActor->hasIO()) { + Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(anActor->getIO()); + Standard_CString theIOR = GIO->getIOR(); + if(strcmp(IOR, theIOR) == 0) { + if(onlyInActiveView) { + if(sf == QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()) { + testResult = true; + return anActor; + } + } + else { + testResult = true; + return anActor; + } + } + } + } + ac = theActors->GetNextActor(); + } + } + } + testResult = false; + return GEOM_Actor::New(); +} + + +//======================================================================= +// function : ConvertIOinGEOMAISShape() +// purpose : +//======================================================================= +Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult, bool onlyInActiveView) +{ + Handle(GEOM_AISShape) res; + int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); + for(int i = 0; i < nbSf; i++) { + QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); + if(sf->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + AIS_ListOfInteractive List; + ic->DisplayedObjects(List); + AIS_ListOfInteractive List1; + ic->ObjectsInCollector(List1); + List.Append(List1); + + AIS_ListIteratorOfListOfInteractive ite(List); + while(ite.More()) { + if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + if(aSh->hasIO()) { + Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); + if(GIO->isSame(IO)) { + if(onlyInActiveView) { + if(sf == QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()) { + testResult = true; + return aSh; + } + } + else { + testResult = true; + return aSh; + } + } + } + } + ite.Next(); + } + } + } + testResult = false; + return res; +} + + +//======================================================================= +// function : ConvertIOinGEOMShape() +// purpose : +//======================================================================= +GEOM::GEOM_Shape_ptr GEOMBase::ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) +{ + GEOM::GEOM_Shape_var aShape; + testResult = false; + + /* case SObject */ + if(IO->hasEntry()) { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + aShape = myGeom->GetIORFromString(anIOR->Value()); + if(!CORBA::is_nil(aShape)) + testResult = true; + return aShape._retn(); + } + } + } + /* case Graphical Object */ + if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { + Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IO); + Standard_CString ior = GIObject->getIOR(); + + aShape = myGeom->GetIORFromString(ior); + if(!CORBA::is_nil(aShape)) + testResult = true; + return aShape._retn(); + } + return aShape._retn(); +} + + +//======================================================================= +// 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 = QAD_Application::getDesktop()->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++; + } + } + listIOR.length(j); +} + + +//================================================================================ +// function : SetDisplayedObjectList() +// purpose : +//================================================================================ +// void GEOMBase::SetDisplayedObjectList() +// { +// if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) +// return; + +// OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); +// myGeomGUI->GetListDisplayedObject().Clear(); + +// Handle (AIS_InteractiveContext) aContext = v3d->getAISContext(); +// aContext->DisplayedObjects(myGeomGUI->GetListDisplayedObject()); +// } + + +//===================================================================================== +// 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(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + try { + /* erase any previous */ + ic->Erase(mySimulationShape, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape); + mySimulationShape = new AIS_Shape(TopoDS_Shape()); + mySimulationShape->Set(S); + mySimulationShape->SetColor(Quantity_NOC_VIOLET); + ic->Deactivate(mySimulationShape); + ic->Display(mySimulationShape, Standard_False); + ic->UpdateCurrentViewer(); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in GEOMBase::DisplaySimulationShape "); + } + mySimulationShape->UnsetColor(); + return; +} + + +//================================================================================== +// function : EraseSimulationShape() +// purpose : Clears the display of 'mySimulationShape' a pure graphical shape +//================================================================================== +void GEOMBase::EraseSimulationShape() +{ + int count = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); + for(int i = 0; i < count; i++) { + if(QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + ic->Erase(mySimulationShape, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape); + ic->UpdateCurrentViewer(); + } + } +} + + +//================================================================================= +// 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(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC || tds.ShapeType() != TopAbs_EDGE) + return false; + + OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort(); + Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)vp)->getView(); + Standard_Real Width, Height; + view3d->Size(Width, Height); + 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 : 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; +} + + +//================================================================================= +// 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; +} + + +//================================================================================= +// 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; + + curv.D0(curv.FirstParameter(), P1); + curv.D0(curv.LastParameter(), P2); + + if(P1.Distance(P2) <= Precision::Confusion()) + return false; + + return true; +} + + +//======================================================================= +// function : Parameter() +// purpose : return a parameter (float) from a dialog box +// +// avalue1 : is a float or integer used as a default value displayed +// aTitle1 : is the title for aValue1 +// aTitle : is the main title +// bottom : maximum value to be entered +// top : minimum value to be entered +// decimals : number of decimals +//======================================================================= +double GEOMBase::Parameter(Standard_Boolean& res, const char* aValue1, const char* aTitle1, const char* aTitle, const double bottom, const double top, const int decimals) +{ + GEOMBase_aParameterDlg * Dialog = new GEOMBase_aParameterDlg(aValue1, aTitle1, QAD_Application::getDesktop(), aTitle, TRUE, 0, bottom, top, decimals); + int r = Dialog->exec(); + float X = 0.0; + if(r == QDialog::Accepted) { + res = Standard_True; + X = Dialog->getValue(); + } + else + res = Standard_False; + delete Dialog; + return X; +} + + +//======================================================================= +// 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 = QAD_Application::getDesktop()->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 : 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; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext, + const QString & theParent, const QString & theObject) + {return GEOMBase::CustomPopup(parent, popup, theContext, theParent, theObject);} +} diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h new file mode 100644 index 000000000..db3bb1daa --- /dev/null +++ b/src/GEOMBase/GEOMBase.h @@ -0,0 +1,123 @@ +// 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 : GEOMBase.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef GEOMBASE_H +#define GEOMBASE_H + +#include "GEOMContext.h" + +// SALOME Includes +#include "QAD_Config.h" +#include "SALOME_Selection.h" +#include "GEOM_Actor.h" +#include "GEOM_AISShape.hxx" +#include "GEOM_InteractiveObject.hxx" + +// Open CASCADE Includes +#include + +// IDL Headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +//================================================================================= +// class : GEOMBase +// purpose : +//================================================================================= +class GEOMBase : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + GEOMBase(); + ~GEOMBase(); + + static bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, + const QString& theParent, const QString& theObject); + + bool Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name = ""); + bool AddInStudy(bool selection = false, const Handle(SALOME_InteractiveObject)& anIO = 0); + + /* 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); + void ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, + GEOM::GEOM_Gen::ListOfIOR& listIOR); + + Handle(GEOM_AISShape) ConvertIORinGEOMAISShape(const char * IOR, + Standard_Boolean& testResult, + bool onlyInActiveView = false); + GEOM_Actor* ConvertIORinGEOMActor(const char * IOR, Standard_Boolean& testResult, + bool onlyInActiveView = false); + + /* Geometry */ + bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P); + + /* 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(); + + /* 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 */ + + Quantity_Color myShadingColor; + Handle(AIS_Shape) mySimulationShape; /* AIS shape used only during topo/geom simulations */ + bool mySettings_AddInStudy; + +}; + +#endif + diff --git a/src/GEOMBase/GEOMBase_Skeleton.cxx b/src/GEOMBase/GEOMBase_Skeleton.cxx new file mode 100644 index 000000000..85b4f326f --- /dev/null +++ b/src/GEOMBase/GEOMBase_Skeleton.cxx @@ -0,0 +1,174 @@ +// 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 : GEOMBase_Skeleton.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "GEOMBase_Skeleton.h" + +//================================================================================= +// class : GEOMBase_Skeleton() +// purpose : Constructs a GEOMBase_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. +//================================================================================= +GEOMBase_Skeleton::GEOMBase_Skeleton(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl) + :DlgRef_Skeleton_QTD(parent, name, modal, fl) +{ + if (!name) + setName("GEOMBase_Skeleton"); + + buttonCancel->setText(tr("GEOM_BUT_CLOSE")); + buttonOk->setText(tr("GEOM_BUT_OK")); + buttonApply->setText(tr("GEOM_BUT_APPLY")); + + GroupMedium->close(TRUE); + resize(0, 0); + + Init(Sel); +} + + +//================================================================================= +// function : ~GEOMBase_Skeleton() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GEOMBase_Skeleton::~GEOMBase_Skeleton() +{ + // no need to delete child widgets, Qt does it all for us + this->destroy(TRUE, TRUE); +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void GEOMBase_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(buttonCancel, 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 GEOMBase_Skeleton::ClickOnCancel() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + mySelection->ClearFilters(); + disconnect(mySelection, 0, this, 0); + + //myGeomGUI->ResetState(); + reject(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void GEOMBase_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 GEOMBase_Skeleton::DeactivateActiveDialog() +{ + this->setEnabled(false); + mySelection->ClearFilters(); + //myGeomGUI->ResetState(); + disconnect(mySelection, 0, this, 0); + myGeomBase->EraseSimulationShape(); + myGeomGUI->SetActiveDialogBox(0); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void GEOMBase_Skeleton::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + myGeomGUI->EmitSignalDeactivateDialog(); + this->setEnabled(true); + myGeomGUI->SetActiveDialogBox((QDialog*)this); + return; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void GEOMBase_Skeleton::closeEvent(QCloseEvent* e) +{ + /* same than click on cancel button */ + this->ClickOnCancel(); + return; +} diff --git a/src/GEOMBase/GEOMBase_Skeleton.h b/src/GEOMBase/GEOMBase_Skeleton.h new file mode 100644 index 000000000..0ec58c125 --- /dev/null +++ b/src/GEOMBase/GEOMBase_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 : GEOMBase_Skeleton.h +// Author : Damine COQUERET +// Module : GEOM +// $Header: + +#ifndef GEOMBASE_SKELETON_H +#define GEOMBASE_SKELETON_H + +#include "DlgRef_Skeleton_QTD.h" + +#include "GEOMBase.h" + +#include +#include +#include +#include +#include +#include + +class GEOMBase_Skeleton : public DlgRef_Skeleton_QTD +{ + Q_OBJECT + +public: + GEOMBase_Skeleton(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~GEOMBase_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 // GEOMBASE_SKELETON_H diff --git a/src/GEOMBase/GEOMBase_aParameterDlg.cxx b/src/GEOMBase/GEOMBase_aParameterDlg.cxx new file mode 100644 index 000000000..8f7b87797 --- /dev/null +++ b/src/GEOMBase/GEOMBase_aParameterDlg.cxx @@ -0,0 +1,156 @@ +// 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 : GEOMBase_aParameterDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "GEOMBase_aParameterDlg.h" +#include "QAD_SpinBoxDbl.h" +#include "QAD_Tools.h" + +#include + +#include +#include +#include +#include +#include +#include + +//====================================================================================== +// function : GEOMBase_aParameterDlg() +// purpose : Constructs a GEOMBase_aParametertDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f' +// +// avalue1 : is a float or integer used as default value in edit line +// aTitle1 : is the prompt for aValue1 +// aTitle : is the title for the user in dialog box +// +// bottom : the minimal value to be entered +// top : the maximum value to be entered +// decimals : number of decimals to be entered +// +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +// +//====================================================================================== +GEOMBase_aParameterDlg::GEOMBase_aParameterDlg(const char *aValue1, const char *aTitle1, QWidget* parent, const char* name, bool modal, WFlags fl, const double bottom, const double top, const int decimals) + :QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + if(!name) + setName( "MyParameterDialog" ); + resize(288, 81); + setCaption(name); /* appears on the title bar */ + setSizeGripEnabled(TRUE); + + QGridLayout* topLayout = new QGridLayout(this); + topLayout->setSpacing(6); + topLayout->setMargin(11); + + QGroupBox* mainGrp = new QGroupBox(this, "mainGrp"); + mainGrp->setColumnLayout(0, Qt::Vertical); + mainGrp->layout()->setSpacing(0); + mainGrp->layout()->setMargin(0); + QGridLayout* mainGrpLayout = new QGridLayout(mainGrp->layout()); + mainGrpLayout->setAlignment(Qt::AlignTop); + mainGrpLayout ->setSpacing(6); + mainGrpLayout->setMargin(11); + topLayout->addWidget(mainGrp, 0, 0); + + /* aTitle1 : text prompt on left of edit line */ + QLabel* TextLabel1 = new QLabel(mainGrp, "TextLabel1"); + TextLabel1->setText(tr(aTitle1)); + mainGrpLayout->addWidget(TextLabel1, 0, 0); + + mySpinBox = new QAD_SpinBoxDbl(mainGrp, "mySpinBox"); + mySpinBox->setPrecision(12); + mySpinBox->setRange(bottom, top); + ((QDoubleValidator*)(mySpinBox->validator()))->setRange(bottom, top, decimals); + mySpinBox->setValue(QString(aValue1).toDouble()); + mainGrpLayout->addWidget(mySpinBox, 0, 1); + + QGroupBox* btnGrp = new QGroupBox(this, "btnGrp"); + btnGrp->setColumnLayout(0, Qt::Vertical); + btnGrp->layout()->setSpacing(0); + btnGrp->layout()->setMargin(0); + QGridLayout* btnGrpLayout = new QGridLayout(btnGrp->layout()); + btnGrpLayout->setAlignment(Qt::AlignTop); + btnGrpLayout->setSpacing(6); + btnGrpLayout->setMargin(11); + topLayout->addWidget(btnGrp, 1, 0); + + /* Ok button */ + myButtonOk = new QPushButton(btnGrp, "buttonOk"); + myButtonOk->setText(tr("GEOM_BUT_OK")); + myButtonOk->setAutoDefault(TRUE); + myButtonOk->setDefault(TRUE); + btnGrpLayout->addWidget(myButtonOk, 0, 0); + + btnGrpLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1); + + /* Cancel button */ + myButtonCancel = new QPushButton(btnGrp, "buttonCancel"); + myButtonCancel->setText(tr("GEOM_BUT_CANCEL")); + myButtonCancel->setAutoDefault(TRUE); + btnGrpLayout->addWidget(myButtonCancel, 0, 2); + + /* signals and slots connections */ + connect(myButtonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(myButtonCancel, SIGNAL(clicked()), this, SLOT(reject())); + + /* Move widget on the botton right corner of main widget */ + QAD_Tools::centerWidget(this, parent); +} + + +//====================================================================================== +// function : ~GEOMBase_aParameterDlg() destructor +// purpose : Destroys the object and frees any allocated resources +//====================================================================================== +GEOMBase_aParameterDlg::~GEOMBase_aParameterDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//====================================================================================== +// function : GEOMBase_aParameterDlg::setValue +// purpose : sets value +//====================================================================================== +void GEOMBase_aParameterDlg::setValue(double val) +{ + mySpinBox->setValue(val); +} + + +//====================================================================================== +// function : GEOMBase_aParameterDlg::getValue +// purpose : gets value +//====================================================================================== +double GEOMBase_aParameterDlg::getValue() +{ + return mySpinBox->value(); +} diff --git a/src/GEOMGUI/GeometryGUI_aParameterDlg.h b/src/GEOMBase/GEOMBase_aParameterDlg.h similarity index 62% rename from src/GEOMGUI/GeometryGUI_aParameterDlg.h rename to src/GEOMBase/GEOMBase_aParameterDlg.h index 6e65998a4..e14d9dbda 100644 --- a/src/GEOMGUI/GeometryGUI_aParameterDlg.h +++ b/src/GEOMBase/GEOMBase_aParameterDlg.h @@ -21,51 +21,39 @@ // // // -// File : GeometryGUI_aParameterDlg.h +// File : GEOMBase_aParameterDlg.h // Author : Lucien PIGNOLONI // Module : GEOM // $Header$ -#ifndef GeometryGUI_aParameterDLG_H -#define GeometryGUI_aParameterDLG_H +#ifndef GEOMBase_aParameterDLG_H +#define GEOMBase_aParameterDLG_H #include class QPushButton; -class GeometryGUI; class QAD_SpinBoxDbl; //================================================================================= -// class : GeometryGUI_aParameterDlg +// class : GEOMBase_aParameterDlg // purpose : //================================================================================= -class GeometryGUI_aParameterDlg : public QDialog +class GEOMBase_aParameterDlg : public QDialog { Q_OBJECT public: - GeometryGUI_aParameterDlg( const char* aValue1 = "25", - const char* aTitle1 = "Value :", - QWidget* parent = 0, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0, - const double bottom = -1E6, - const double top = +1E6, - const int decimals = 6 ) ; + GEOMBase_aParameterDlg(const char* aValue1 = "25", const char* aTitle1 = "Value :", QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const double bottom = -1E6, const double top = +1E6, const int decimals = 6); + ~GEOMBase_aParameterDlg(); - ~GeometryGUI_aParameterDlg(); - - void setValue( double val ); + void setValue(double val); double getValue(); private: - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - - QPushButton* myButtonOk; - QPushButton* myButtonCancel; + QPushButton* myButtonOk; + QPushButton* myButtonCancel; QAD_SpinBoxDbl* mySpinBox; - + }; -#endif // GeometryGUI_aParameterDlg.h +#endif // GEOMBase_aParameterDlg.h diff --git a/src/GEOMBase/Makefile.in b/src/GEOMBase/Makefile.in new file mode 100644 index 000000000..42082e5fe --- /dev/null +++ b/src/GEOMBase/Makefile.in @@ -0,0 +1,66 @@ +# GEOM GEOMBASE : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets +LIB = libGEOMBase.la + +# header files +EXPORT_HEADERS= GEOMBase.h \ + GEOMBase_Skeleton.h + +LIB_SRC = GEOMBase.cxx \ + GEOMBase_Skeleton.cxx \ + GEOMBase_aParameterDlg.cxx + +LIB_MOC = \ + GEOMBase.h \ + GEOMBase_Skeleton.h \ + GEOMBase_aParameterDlg.h + +LIB_CLIENT_IDL = SALOME_Exception.idl \ + SALOMEDS.idl \ + SALOMEDS_Attributes.idl + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lDlgRef -lGEOMContext + +@CONCLUDE@ diff --git a/src/GEOMContext/GEOMContext.cxx b/src/GEOMContext/GEOMContext.cxx new file mode 100644 index 000000000..210807916 --- /dev/null +++ b/src/GEOMContext/GEOMContext.cxx @@ -0,0 +1,163 @@ +// +// 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 : GEOMContext.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "GEOMContext.h" +#include "QAD_Tools.h" + +/* The object itself created in the static method 'GetOrCreateGEOMBase()' */ +static GEOMContext* GeomGUI = 0; + +//======================================================================= +// function : GEOMContext() +// purpose : Constructor +//======================================================================= +GEOMContext::GEOMContext() : + QObject() +{ +} + + +//======================================================================= +// function : ~GEOMContext() +// purpose : Destructor +//======================================================================= +GEOMContext::~GEOMContext() +{ +} + + +//======================================================================= +// function : GetGEOMContext() static +// purpose : Returns current 'GeomGUI' a static pointer +//======================================================================= +GEOMContext* GEOMContext::GetGeomGUI() +{ + return GeomGUI; +} + + +//======================================================================= +// function : GetOrCreateGEOMBase() +// purpose : Gets or create an object 'GEOMBase' with initialisations +// : Returns 'GeomGUI' as a pointer +//======================================================================= +GEOMContext* GEOMContext::GetOrCreateGeomGUI(QAD_Desktop* desktop) +{ + if(GeomGUI == 0) { + GeomGUI = new GEOMContext(); + Engines::Component_var comp = desktop->getEngine("FactoryServer", "GEOM"); + GeomGUI->myComponentGeom = GEOM::GEOM_Gen::_narrow(comp); + + GeomGUI->myState = -1; + GeomGUI->myActiveDialogBox = 0; + GeomGUI->myFatherior = ""; + GeomGUI->myGUILibrary = OSD_SharedLibrary(); + + /* GetCurrentStudy */ + int studyId = desktop->getActiveStudy()->getStudyId(); + GeomGUI->myComponentGeom->GetCurrentStudy(studyId); + GeomGUI->myNbGeom = GeomGUI->myComponentGeom->NbLabels(); + } + + return GeomGUI; +} + + +//======================================================================= +// function : LoadLibrary() +// purpose : +//======================================================================= +bool GEOMContext::LoadLibrary(QString GUILibrary) +{ + QCString libs; + QFileInfo fileInfo; + QString GUILib, fileString, dir; + + if(libs = getenv("LD_LIBRARY_PATH")) { + QStringList dirList = QStringList::split(":", libs, false); // skip empty entries + for(int i = dirList.count()-1; i >= 0; i--) { + dir = dirList[i]; + fileString = QAD_Tools::addSlash(dir) + GUILibrary; + fileInfo.setFile(fileString); + if(fileInfo.exists()) { + GUILib = fileInfo.fileName(); + break; + } + } + } + + myGUILibrary.SetName(TCollection_AsciiString((char*)GUILib.latin1()).ToCString()); + bool res = myGUILibrary.DlOpen(OSD_RTLD_LAZY); + if(!res) + cout<<"Can't open library : "< +#include + +//================================================================================= +// class : GEOMContext +// purpose : +//================================================================================= +class GEOMContext : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + GEOMContext(); + ~GEOMContext(); + +private : + QDialog* myActiveDialogBox; /* Unique active dialog box */ + int myNbGeom; /* Unique name for a geom entity */ + GEOM_Client myShapeReader; + Standard_CString myFatherior; + Sketch mySketcher; + +public : + static GEOMContext* GetOrCreateGeomGUI(QAD_Desktop* desktop); + static GEOMContext* GetGeomGUI(); + + OSD_SharedLibrary myGUILibrary; + GEOM::GEOM_Gen_var myComponentGeom; + int myState; /* Identify a method */ + + /* Returns the active DialogBox */ + QDialog* GetActiveDialogBox(){return myActiveDialogBox ;}; + int& GetNbGeom(){return myNbGeom;}; + GEOM_Client& GetShapeReader(){return myShapeReader;}; + Standard_CString& GetFatherior(){return myFatherior;}; + Sketch& GetSketcher(){return mySketcher;}; + + bool LoadLibrary(QString GUILibrary); + + /* Sets 'myActiveDialogBox' a pointer to the active Dialog Box */ + void SetActiveDialogBox(QDialog* aDlg); + + /* Non modal dialog boxes magement */ + void EmitSignalDeactivateDialog(); + void EmitSignalCloseAllDialogs(); + void EmitSignalDefaultStepValueChanged(double newVal); + +signals : + void SignalDeactivateActiveDialog(); + void SignalCloseAllDialogs(); + void SignalDefaultStepValueChanged(double newVal); + +}; + +#endif + diff --git a/src/GEOMGUI/GEOM_icons.po b/src/GEOMContext/GEOM_icons.po similarity index 95% rename from src/GEOMGUI/GEOM_icons.po rename to src/GEOMContext/GEOM_icons.po index ae40262ff..ed64a379c 100644 --- a/src/GEOMGUI/GEOM_icons.po +++ b/src/GEOMContext/GEOM_icons.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "POT-Creation-Date: 2001-06-14 09:11:49 PM CEST\n" -"PO-Revision-Date: YYYY-MM-DD\n" +"PO-Revision-Date: 2003-09-22 16:39+0200\n" "Last-Translator: FULLNAME \n" "Content-Type: text/plain; charset=iso-8859-1\n" @@ -190,6 +190,10 @@ msgstr "build_face.png" msgid "ICON_DLG_BUILD_SHELL" msgstr "build_shell.png" +#SolidDlg +msgid "ICON_DLG_BUILD_SOLID" +msgstr "build_solid.png" + #WireDlg msgid "ICON_DLG_BUILD_WIRE" msgstr "build_wire.png" @@ -342,4 +346,17 @@ msgstr "multirotationdouble.png" msgid "ICON_DLG_ELLIPSE_PV" msgstr "ellipsepointvector.png" +#SplineDlg +msgid "ICON_DLG_SPLINE" +msgstr "spline.png" + +#SplineDlg +msgid "ICON_DLG_BEZIER" +msgstr "bezier.png" + +#SplineDlg +msgid "ICON_DLG_INTERPOL" +msgstr "interpol.png" + + diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMContext/GEOM_msg_en.po similarity index 89% rename from src/GEOMGUI/GEOM_msg_en.po rename to src/GEOMContext/GEOM_msg_en.po index 665a35438..1b91d57f8 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMContext/GEOM_msg_en.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "POT-Creation-Date: 2002-03-19 09:35:48 AM CET\n" -"PO-Revision-Date: YYYY-MM-DD\n" +"PO-Revision-Date: 2003-10-27 17:32+0100\n" "Last-Translator: FULLNAME \n" "Content-Type: text/plain; charset=iso-8859-1\n" @@ -157,6 +157,10 @@ msgstr "IGES Files ( *.iges *.igs )" msgid "GEOM_MEN_IMPORT_STEP" msgstr "STEP Files ( *.step *.stp )" +#: GeometryGUI.cxx:3763 +msgid "GEOM_MEN_LOAD_SCRIPT" +msgstr "PYTHON Files ( *.py )" + #: GeometryGUI.cxx:2931 msgid "GEOM_MEN_ISOS" msgstr "Select Number Of Isos" @@ -1005,9 +1009,9 @@ msgstr "Sewing Topologies" msgid "GEOM_SHELL_TITLE" msgstr "Shell Construction" -#: GeometryGUI_ShellDlg.cxx:74 -msgid "GEOM_SHELL_LIST" -msgstr "List Of Connected Faces" +#: GeometryGUI_SolidDlg.cxx:74 +msgid "GEOM_SOLID_TITLE" +msgstr "Solid Construction" #: GeometryGUI_SphereDlg.cxx:50 msgid "GEOM_SPHERE_TITLE" @@ -1151,29 +1155,147 @@ msgstr "Wireframe" msgid "GEOM_MEN_SHADING" msgstr "\nShading" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT" +msgid "GEOM_RECONSTRUCTION_LIMIT" msgstr "Reconstruction Limit" -msgid "GeometryGUI_PartitionDlg::SUPPRESS_RESULT" +msgid "GEOM_SUPPRESS_RESULT" msgstr "Suppress Result" -msgid "GeometryGUI_PartitionDlg::SUPPRESS_RESULT_INSIDE" +msgid "GEOM_SUPPRESS_RESULT_INSIDE" msgstr "Inside" -msgid "GeometryGUI_PartitionDlg::SUPPRESS_RESULT_OUTSIDE" +msgid "GEOM_SUPPRESS_RESULT_OUTSIDE" msgstr "Outside" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_SHAPE" +msgid "GEOM_RECONSTRUCTION_LIMIT_SHAPE" msgstr "Shape" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_SOLID" +msgid "GEOM_RECONSTRUCTION_LIMIT_SOLID" msgstr "Solid" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_SHELL" +msgid "GEOM_RECONSTRUCTION_LIMIT_SHELL" msgstr "Shell" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_FACE" +msgid "GEOM_RECONSTRUCTION_LIMIT_FACE" msgstr "Face" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_WIRE" +msgid "GEOM_RECONSTRUCTION_LIMIT_WIRE" msgstr "Wire" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_EDGE" +msgid "GEOM_RECONSTRUCTION_LIMIT_EDGE" msgstr "Edge" -msgid "GeometryGUI_PartitionDlg::RECONSTRUCTION_LIMIT_VERTEX" +msgid "GEOM_RECONSTRUCTION_LIMIT_VERTEX" msgstr "Vertex" + +msgid "GEOM_SPLINE_TITLE" +msgstr "Spline Construction" +msgid "GEOM_SPLINE" +msgstr "Spline" +msgid "GEOM_BEZIER" +msgstr "Bezier" +msgid "GEOM_INTERPOL" +msgstr "Interpolation" + +# +#============================================================================== +# + +msgid "GEOM_SKETCHER_EL" +msgstr "Element Type" + +msgid "GEOM_BUT_CLOSE_SKETCH" +msgstr "Close Sketcher" + +msgid "GEOM_BUT_END_SKETCH" +msgstr "End Sketcher" + +msgid "GEOM_SKETCHER_TITLE" +msgstr "Spline Construction" + +msgid "GEOM_SKETCHER_POINT" +msgstr "Point" + +msgid "GEOM_SKETCHER_SEGMENT" +msgstr "Segment" + +msgid "GEOM_SKETCHER_ARC" +msgstr "Arc" + +msgid "GEOM_SKETCHER_DIR" +msgstr "Direction" + +msgid "GEOM_SKETCHER_POINT2" +msgstr "Point :" + +msgid "GEOM_SKETCHER_DEST" +msgstr "Destination" + +msgid "GEOM_SKETCHER_ABS" +msgstr "Absolute" + +msgid "GEOM_SKETCHER_REL" +msgstr "Relative" + +msgid "GEOM_SKETCHER_SEL" +msgstr "Selection" + +msgid "GEOM_SKETCHER_ANGLE" +msgstr "Angle" + +msgid "GEOM_SKETCHER_PER" +msgstr "Perpendicular" + +msgid "GEOM_SKETCHER_TAN" +msgstr "Tangent" + +msgid "GEOM_SKETCHER_VXVY" +msgstr "VX-VY" + +msgid "GEOM_SKETCHER_LENGTH" +msgstr "Length" + +msgid "GEOM_SKETCHER_X" +msgstr "X" + +msgid "GEOM_SKETCHER_Y" +msgstr "Y" + +msgid "GEOM_SKETCHER_X2" +msgstr "X :" + +msgid "GEOM_SKETCHER_Y2" +msgstr "Y :" + +msgid "GEOM_SKETCHER_X3" +msgstr "Abs. X :" + +msgid "GEOM_SKETCHER_Y3" +msgstr "Abs. Y :" + +msgid "GEOM_SKETCHER_DX2" +msgstr "DX :" + +msgid "GEOM_SKETCHER_DY2" +msgstr "DY :" + +msgid "GEOM_SKETCHER_VX2" +msgstr "VX :" + +msgid "GEOM_SKETCHER_VY2" +msgstr "VY :" + +msgid "GEOM_SKETCHER_LENGTH2" +msgstr "Length :" + +msgid "GEOM_SKETCHER_ANGLE2" +msgstr "Angle :" + +msgid "GEOM_SKETCHER_RADIUS2" +msgstr "Radius :" + +msgid "GEOM_SKETCHER_UNDO" +msgstr "Undo" + +msgid "GEOM_SKETCHER_APPLY" +msgstr "Apply" + +msgid "GEOM_SKETCHER_VALUES" +msgstr "Values" + +msgid "GEOM_SKETCHER_TYPE" +msgstr "Type" diff --git a/src/GEOMGUI/GEOM_msg_fr.po b/src/GEOMContext/GEOM_msg_fr.po similarity index 100% rename from src/GEOMGUI/GEOM_msg_fr.po rename to src/GEOMContext/GEOM_msg_fr.po diff --git a/src/GEOMContext/Makefile.in b/src/GEOMContext/Makefile.in new file mode 100644 index 000000000..ffb273015 --- /dev/null +++ b/src/GEOMContext/Makefile.in @@ -0,0 +1,65 @@ +# GEOM GEOMCONTEXT : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets +LIB = libGEOMContext.la + +# ressources files +PO_FILES = \ + GEOM_icons.po \ + GEOM_msg_en.po \ + GEOM_msg_fr.po + +# header files +EXPORT_HEADERS= GEOMContext.h + +LIB_SRC = GEOMContext.cxx + +LIB_MOC = \ + GEOMContext.h + +LIB_CLIENT_IDL = SALOME_Exception.idl + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMSketcher -L${KERNEL_ROOT_DIR}/lib/salome + +@CONCLUDE@ diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 080d48b0a..357507e17 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -29,238 +29,28 @@ using namespace std; #include "GeometryGUI.h" -// SALOME Includes -# include "Utils_ORB_INIT.hxx" -# include "Utils_SINGLETON.hxx" - -#include "QAD.h" -#include "QAD_Tools.h" -#include "QAD_Config.h" -#include "QAD_Settings.h" -#include "QAD_RightFrame.h" -#include "QAD_MessageBox.h" -#include "QAD_Resource.h" -#include "QAD_FileDlg.h" - -#include "OCCViewer_ViewPort.h" -#include "OCCViewer_ViewPort3d.h" -#include "OCCViewer_Viewer3d.h" - -#include "SALOME_NamingService.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" -#include "SALOME_InteractiveObject.hxx" - -#include "SALOMEGUI_ImportOperation.h" -#include "SALOMEGUI_QtCatchCorbaException.hxx" -#include "SALOMEGUI_NameDlg.h" -#include "utilities.h" - // Open CASCADE Includes -#include -#include -#include -#include -#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +// SALOME Includes +#include "QAD_RightFrame.h" +#include "QAD_Config.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -//VRV: OCC 4.0 migration -#include -#include -#include -//#include -//VRV: OCC 4.0 migration - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -// QT Includes -#define INCLUDE_MENUITEM_DEF -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "VTKViewer_RenderWindowInteractor.h" +#include "OCCViewer_Viewer3d.h" +#include "OCCViewer_ViewPort3d.h" #include "VTKViewer_ViewFrame.h" -#include "GEOM_Actor.h" -#include "GEOM_Client.hxx" -#include "GEOM_AISShape.hxx" -#include "GEOM_AssemblyBuilder.h" -#include "GEOM_InteractiveObject.hxx" - - -#include "GeometryGUI_aParameterDlg.h" - -#include "GeometryGUI_PointDlg.h" // Method POINT -#include "GeometryGUI_BoxDlg.h" // Method BOX -#include "GeometryGUI_VectorDlg.h" // Method VECTOR -#include "GeometryGUI_PlaneDlg.h" // Method PLANE -#include "GeometryGUI_PrismDlg.h" // Method PRISM -#include "GeometryGUI_FuseDlg.h" // Method FUSE -#include "GeometryGUI_CommonDlg.h" // Method COMMON -#include "GeometryGUI_CutDlg.h" // Method CUT -#include "GeometryGUI_SectionDlg.h" // Method SECTION - -#include "GeometryGUI_LineDlg.h" // Method LINE -#include "GeometryGUI_ScaleDlg.h" // Method SCALE -#include "GeometryGUI_MirrorDlg.h" // Method MIRROR -#include "GeometryGUI_SphereDlg.h" // Method SPHERE -#include "GeometryGUI_CircleDlg.h" // Method CIRCLE -#include "GeometryGUI_EllipseDlg.h" // Method ELLIPSE -#include "GeometryGUI_RevolDlg.h" // Method REVOL -#include "GeometryGUI_RotationDlg.h" // Method ROTATION -#include "GeometryGUI_TranslationDlg.h" // Method TRANSLATION -#include "GeometryGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION -#include "GeometryGUI_MultiRotationDlg.h" // Method MULTI ROTATION -#include "GeometryGUI_ArcDlg.h" // Method ARC -#include "GeometryGUI_PipeDlg.h" // Method PIPE -#include "GeometryGUI_CylinderDlg.h" // Method CYLINDER -#include "GeometryGUI_ConeDlg.h" // Method CONE -#include "GeometryGUI_TorusDlg.h" // Method TORUS -#include "GeometryGUI_FillingDlg.h" // Method FILLING -#include "GeometryGUI_SewingDlg.h" // Method SEWING -#include "GeometryGUI_CompoundDlg.h" // Method GEOM::COMPOUND -#include "GeometryGUI_EdgeDlg.h" // Method GEOM::EDGE -#include "GeometryGUI_OrientationDlg.h" // Method ORIENTATION -#include "GeometryGUI_PartitionDlg.h" // Method PARTITION -#include "GeometryGUI_SubShapeDlg.h" // Method EXPLODE -#include "GeometryGUI_WireDlg.h" // Method GEOM::WIRE -#include "GeometryGUI_WorkingPlaneDlg.h" // Method WORKING PLANE -#include "GeometryGUI_PropertiesDlg.h" // Method PROPERTIES -#include "GeometryGUI_CenterMassDlg.h" // Method CENTER MASS -#include "GeometryGUI_InertiaDlg.h" // Method INERTIA -#include "GeometryGUI_FaceDlg.h" // Method GEOM::FACE -#include "GeometryGUI_FilletDlg.h" // Method FILLET -#include "GeometryGUI_ChamferDlg.h" // Method CHAMFER -#include "GeometryGUI_FillingHoleDlg.h" // Method FILLING HOLE -#include "GeometryGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES -#include "GeometryGUI_CheckShape.h" // Method CHECKSHAPE -#include "GeometryGUI_ArchimedeDlg.h" // Method ARCHIMEDE -#include "GeometryGUI_TransparencyDlg.h" // Method TRANSPARENCY adjustement -#include "GeometryGUI_NbIsosDlg.h" // Method ISOS adjustement -#include "GeometryGUI_BndBoxDlg.h" // Method BNDBOX -#include "GeometryGUI_MaxToleranceDlg.h" // Method MAXTOLERANCE -#include "GeometryGUI_WhatisDlg.h" // Method WHATIS -#include "GeometryGUI_DistanceDlg.h" // Method DISTANCE -#include "GeometryGUI_SuppressHoleDlg.h" // Method SUPPRESS HOLE - - -static Handle(AIS_Shape) theConstructionShape = new AIS_Shape(TopoDS_Shape()); -static Handle(GEOM_AISShape) theSelectedShape = new GEOM_AISShape(TopoDS_Shape(), ""); - -static AIS_ListOfInteractive ListDisplayedObject; - -static bool Settings_AddInStudy = false; -static bool Settings_Copy = false; -static Standard_CString Fatherior = ""; -static GEOM_Client ShapeReader; - -/* The object itself created in the static method 'GetOrCreateGeometryGUI()' */ -static GeometryGUI* GeomGUI = 0; - - - -//======================================================================= -// class : CustomItem -// purpose : Set Font to a text. -//======================================================================= -class CustomItem : public QCustomMenuItem -{ -public: - CustomItem( const QString& s, const QFont& f ) - : string( s ), font( f ){}; - ~CustomItem(){} - - void paint( QPainter* p, const QColorGroup& /*cg*/, bool /*act*/, bool /*enabled*/, int x, int y, int w, int h ) - { - p->setFont ( font ); - p->drawText( x, y, w, h, AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string ); - } - - QSize sizeHint() - { - return QFontMetrics( font ).size( AlignHCenter | AlignVCenter | ShowPrefix | DontClip, string ); - } -private: - QString string; - QFont font; -}; +#include "SALOME_Selection.h" +/* The object itself created in the static method 'GetOrCreateGEOMBase()' */ +static GEOMContext* GeomGUI = 0; +typedef bool OGE(int, QAD_Desktop*); +typedef bool OMP(QMouseEvent*, QAD_Desktop*, QAD_StudyFrame*); +typedef void BP(const Handle(SALOME_InteractiveObject)&); +typedef bool CP(QAD_Desktop*, QPopupMenu*, const QString&, + const QString&, const QString&); //======================================================================= // function : GeometryGUI() @@ -271,6 +61,7 @@ GeometryGUI::GeometryGUI() : { } + //======================================================================= // function : ~GeometryGUI() // purpose : Destructor @@ -281,6908 +72,526 @@ GeometryGUI::~GeometryGUI() //======================================================================= -// function : GetGeometryGUI() static -// purpose : Returns current 'GeomGUI' a static pointer -//======================================================================= -GeometryGUI* GeometryGUI::GetGeometryGUI( ) -{ - return GeomGUI; -} - - -//===================================================================================== -// function : GetIndex() -// purpose : Get the index of a sub shape in a main shape : index start at 1 -//===================================================================================== -int GeometryGUI::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 : GetOrCreateGeometryGUI() -// purpose : Gets or create an object 'GeometryGUI' with initialisations +// function : GetOrCreateGEOMBase() +// purpose : Gets or create an object 'GEOMBase' with initialisations // : Returns 'GeomGUI' as a pointer //======================================================================= -GeometryGUI* GeometryGUI::GetOrCreateGeometryGUI( QAD_Desktop* desktop ) +GEOMContext* GeometryGUI::GetOrCreateGeometryGUI(QAD_Desktop* desktop) { - if( GeomGUI == 0 ) { - GeomGUI = new GeometryGUI; - GeomGUI->myActiveDialogBox = 0 ; - GeomGUI->mySimulationShape = new AIS_Shape(TopoDS_Shape()); - GeomGUI->myState = -1 ; - GeomGUI->myDesktop = desktop ; - GeomGUI->myActiveStudy = desktop->getActiveStudy(); - GeomGUI->mySimulationActor = vtkActorCollection::New() ; - - GeomGUI->myShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD ); - - Engines::Component_var comp = desktop->getEngine("FactoryServer", "GEOM"); - GeomGUI->myComponentGeom = GEOM::GEOM_Gen::_narrow(comp); - - /* GetCurrentStudy */ - int studyId = GeomGUI->myActiveStudy->getStudyId(); - GeomGUI->myComponentGeom->GetCurrentStudy(studyId); - - GeomGUI->myNbGeom = GeomGUI->myComponentGeom->NbLabels(); - } else { - /* study may have changed */ - GeomGUI->myActiveStudy = desktop->getActiveStudy(); - } + GeomGUI = GeomGUI->GetOrCreateGeomGUI(desktop); return GeomGUI; } -//================================================================================= -// function : VertexToPoint() -// purpose : If S can be converted in a gp_Pnt returns true and the result is P -//================================================================================= -bool GeometryGUI::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 ; -} - - -//================================================================================= -// 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 GeometryGUI::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 ; - - curv.D0( curv.FirstParameter(), P1 ); - curv.D0( curv.LastParameter(), P2 ); - - if( P1.Distance(P2) <= Precision::Confusion() ) - return false ; - - return true ; -} - -//================================================================================= -// function : GetBipointDxDyDz() -// purpose : -//================================================================================= -void GeometryGUI::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 ; -} - -//======================================================================= -// function : GetTopoFromSelection() -// purpose : Define tds from a single selection and retuen true -//======================================================================= -bool GeometryGUI::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 = GeomGUI->myActiveStudy->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 ; - } - } - } - - 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 ; - } - - return false; -} - - - -//===================================================================================== -// function : PrepareSubShapeSelection() -// purpose : ( localContextId of the method is opened and defined here) -//===================================================================================== -bool GeometryGUI::PrepareSubShapeSelection(const int SubShapeType, Standard_Integer& returnLocalContextId) -{ - //* Test the type of viewer */ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - return false; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - /* local context opening */ - SetDisplayedObjectList() ; - OnDisplayOnly(); - - returnLocalContextId = ic->OpenLocalContext(Standard_False, Standard_True, Standard_False, Standard_False) ; - SALOME_Selection* Sel = SALOME_Selection::Selection( this->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - for(;It.More();It.Next()) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - Standard_Boolean found; - Handle(GEOM_AISShape) Shape = ConvertIOinGEOMAISShape(IObject, found); - if ( found && SubShapeType >= Shape->Shape().ShapeType()) { - ic->Load(Shape, (8 - SubShapeType), Standard_True); - ic->HilightWithColor(Shape, Quantity_NOC_RED); - } - } - myDesktop->putInfo (tr("GEOM_PRP_SELECT_SUBSHAPES")); - return true ; -} - - - -//===================================================================================== -// function : PrepareSubShapeSelectionArgumentShape() -// purpose : ( localContextId of the method is opened and defined here ) -//===================================================================================== -bool GeometryGUI::PrepareSubShapeSelectionArgumentShape( const TopoDS_Shape& aShape, - const int SubShapeType, - Standard_Integer& returnLocalContextId ) -{ - //* Test the type of viewer */ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - return false; - - if( aShape.IsNull() ) - return false ; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - /* local context opening */ - SetDisplayedObjectList() ; - OnDisplayOnly(); - - returnLocalContextId = ic->OpenLocalContext(Standard_False, Standard_True, Standard_False, Standard_False) ; - - Handle(GEOM_AISShape) Shape = new GEOM_AISShape(aShape, "") ; - ic->Display(Shape, 0, (8 - SubShapeType)); - - // Not Load(...) but Display(...) - // ic->Load(Shape, (8 - SubShapeType), Standard_True); - ic->HilightWithColor(Shape, Quantity_NOC_RED); - - myDesktop->putInfo (tr("GEOM_PRP_SELECT_SUBSHAPES")); - return true ; -} - - - -//======================================================================= -// function : GetNameOfSelectedIObjects() -// purpose : Define the name geom++ or other name of mono or multi sel. -//======================================================================= -int GeometryGUI::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 ); - } - return nbSel; -} - - -//======================================================================= -// function : ConvertIOinGEOMAISShape() -// purpose : -//======================================================================= -Handle(GEOM_AISShape) GeometryGUI::ConvertIOinGEOMAISShape( const Handle(SALOME_InteractiveObject)& IO, - Standard_Boolean& testResult, - bool onlyInActiveView ) -{ - Handle(GEOM_AISShape) res; - int nbSf = myActiveStudy->getStudyFramesCount(); - for ( int i = 0; i < nbSf; i++ ) { - QAD_StudyFrame* sf = myActiveStudy->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 == myActiveStudy->getActiveStudyFrame() ) { - testResult = true; - return aSh; - } - } else { - testResult = true; - return aSh; - } - } - } - } - ite.Next(); - } - } - } - testResult = false; - return res; -} - -//======================================================================= -// function : ConvertIORinGEOMAISShape() -// purpose : -//======================================================================= -Handle(GEOM_AISShape) GeometryGUI::ConvertIORinGEOMAISShape( const char * IOR, - Standard_Boolean& testResult, - bool onlyInActiveView ) -{ -Handle(GEOM_AISShape) resultShape; -testResult = false; - int nbSf = myActiveStudy->getStudyFramesCount(); - for ( int i = 0; i < nbSf; i++ ) - { - QAD_StudyFrame* sf = myActiveStudy->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 == myActiveStudy->getActiveStudyFrame() ) - { - testResult = true; - resultShape = aSh; - return resultShape; - } - } - else - { - testResult = true; - resultShape = aSh; - return resultShape; - } - } - } - } - ite.Next(); - } - } - } -return resultShape; -} -//======================================================================= -// function : ConvertIORinGEOMActor() -// purpose : -//======================================================================= -GEOM_Actor* GeometryGUI::ConvertIORinGEOMActor( const char * IOR, - Standard_Boolean& testResult, - bool onlyInActiveView ) -{ - int nbSf = GeomGUI->myActiveStudy->getStudyFramesCount(); - for ( int i = 0; i < nbSf; i++ ) { - QAD_StudyFrame* sf = myActiveStudy->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 == GeomGUI->myActiveStudy->getActiveStudyFrame() ) { - testResult = true; - return anActor; - } - } else { - testResult = true; - return anActor; - } - } - } - } - ac = theActors->GetNextActor(); - } - } - } - testResult = false; - return GEOM_Actor::New(); -} - -//======================================================================= -// function : ConvertIOinGEOMShape() -// purpose : -//======================================================================= -GEOM::GEOM_Shape_ptr GeometryGUI::ConvertIOinGEOMShape( const Handle(SALOME_InteractiveObject)& IO, - Standard_Boolean& testResult ) -{ - GEOM::GEOM_Shape_var aShape ; - testResult = false ; - - /* case SObject */ - if ( IO->hasEntry() ) { - SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->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 = myComponentGeom->GetIORFromString(anIOR->Value()) ; - if(!CORBA::is_nil(aShape)) testResult = true ; - return aShape._retn(); - } - } - } - /* case Graphical Object */ - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - Standard_CString ior = GIObject->getIOR(); - aShape = myComponentGeom->GetIORFromString(ior) ; - if(!CORBA::is_nil(aShape)) testResult = true ; - return aShape._retn(); - } - return aShape._retn(); -} - - -//======================================================================= -// function : ConvertListOfIOInListOfIOR() -// purpose : -//======================================================================= -void GeometryGUI::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 = GeomGUI->myActiveStudy->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++; - } - } - listIOR.length(j) ; -} - - -//================================================================================= -// function : GetShapeTypeString() -// purpose : for a single shape -//================================================================================= -bool GeometryGUI::GetShapeTypeString( const TopoDS_Shape& aShape, Standard_CString& aTypeString ) -{ - if( aShape.IsNull() ) { - aTypeString = "aNullShape" ; - return false ; - } - switch (aShape.ShapeType() ) - { - case TopAbs_COMPOUND: - { aTypeString = strdup(tr("GEOM_COMPOUND")) ; return true ; } - case TopAbs_COMPSOLID: - { aTypeString = strdup(tr("GEOM_COMPOUNDSOLID")) ; return true ; } - case TopAbs_SOLID: - { aTypeString = strdup(tr("GEOM_SOLID")) ; return true ; } - case TopAbs_SHELL: - { aTypeString = strdup(tr("GEOM_SHELL")) ; return true ; } - case TopAbs_FACE: - { - BRepAdaptor_Surface surf(TopoDS::Face(aShape)); - if ( surf.GetType() == GeomAbs_Plane ) { - aTypeString = strdup(tr("GEOM_PLANE")) ; - return true ; - } else if ( surf.GetType() == GeomAbs_Cylinder ) { - aTypeString = strdup(tr("GEOM_SURFCYLINDER")) ; - return true ; - } else if ( surf.GetType() == GeomAbs_Sphere ) { - aTypeString = strdup(tr("GEOM_SURFSPHERE")) ; - return true ; - } else if ( surf.GetType() == GeomAbs_Torus ) { - aTypeString = strdup(tr("GEOM_SURFTORUS")) ; - return true ; - } else if ( surf.GetType() == GeomAbs_Cone ) { - aTypeString = strdup(tr("GEOM_SURFCONE")) ; - return true ; - } else { - aTypeString = strdup(tr("GEOM_FACE")) ; - return true ; - } - } - case TopAbs_WIRE: - { aTypeString = strdup(tr("GEOM_WIRE")) ; return true ; } - case TopAbs_EDGE: - { - BRepAdaptor_Curve curv(TopoDS::Edge(aShape)); - if ( curv.GetType() == GeomAbs_Line ) { - if ( (Abs(curv.FirstParameter()) >= 1E6 ) || - (Abs(curv.LastParameter()) >= 1E6 )) { - aTypeString = strdup(tr("GEOM_LINE")) ; - } else - aTypeString = strdup(tr("GEOM_EDGE")) ; - return true ; - } else if ( curv.GetType() == GeomAbs_Circle ) { - if ( curv.IsClosed() ) - aTypeString = strdup(tr("GEOM_CIRCLE")) ; - else - aTypeString = strdup(tr("GEOM_ARC")) ; - return true ; - } else { - aTypeString = strdup(tr("GEOM_EDGE")) ; - return true ; - } - } - case TopAbs_VERTEX: - { aTypeString = strdup(tr("GEOM_VERTEX")) ; return true ; } - 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 GeometryGUI::CreateArrowForLinearEdge( const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone ) -{ - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_OCC || tds.ShapeType() != TopAbs_EDGE ) - return false; - - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)myActiveStudy->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 GeometryGUI::SelectionByNameInDialogs( QWidget* aWidget, const QString& objectUserName, SALOME_Selection* Sel ) -{ - - /* Find SObject with name in component GEOM */ - SALOMEDS::Study_var ST = this->myActiveStudy->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 : MakePointAndDisplay -// purpose : -//======================================================================= -void GeometryGUI::MakePointAndDisplay( const double x, const double y, const double z ) -{ - try { - GEOM::GEOM_Shape_var P = myComponentGeom->MakeVertex( x, y, z ); - P->NameType( tr("GEOM_VERTEX") ); - if ( Display( P, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - - -//======================================================================= -// function : MakeVectorAndDisplay() -// purpose : -//======================================================================= -void GeometryGUI::MakeVectorAndDisplay( const gp_Pnt P1, const gp_Pnt P2 ) -{ - try { - GEOM::PointStruct pstruct1 = myComponentGeom->MakePointStruct( P1.X(), P1.Y(), P1.Z() ) ; - GEOM::PointStruct pstruct2 = myComponentGeom->MakePointStruct( P2.X(), P2.Y(), P2.Z() ) ; - GEOM::GEOM_Shape_var Vector = myComponentGeom->MakeVector( pstruct1, pstruct2 ); - Vector->NameType(tr("GEOM_VECTOR")); - if ( Display( Vector, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - - -//======================================================================= -// function : MakeBoxAndDisplay() -// purpose : -//======================================================================= -void GeometryGUI::MakeBoxAndDisplay( const gp_Pnt P1, const gp_Pnt P2 ) -{ - try { - GEOM::GEOM_Shape_var box = myComponentGeom->MakeBox( P1.X(), P1.Y(), P1.Z(), P2.X(), P2.Y(), P2.Z() ); - box->NameType(tr("GEOM_BOX")); - if ( Display( box, "") ) { - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - - - - -//======================================================================= -// function : MakePlaneAndDisplay() -// purpose : Plane point is P1 and dx, dy, dz define a normal vector -//======================================================================= -void GeometryGUI::MakePlaneAndDisplay( const gp_Pnt P1, const Standard_Real dx, - const Standard_Real dy, const Standard_Real dz, - const Standard_Real TrimSize ) -{ - try { - gp_Dir aDirection; - aDirection.SetCoord(dx, dy, dz) ; - gp_Ax2 Axis( P1, aDirection ); - - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z() ) ; - GEOM::PointStruct d = myComponentGeom->MakePointStruct(aDirection.X(), aDirection.Y(), aDirection.Z()) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - GEOM::GEOM_Shape_ptr plane = myComponentGeom->MakePlane(pstruct, dstruct, TrimSize) ; - plane->NameType(tr("GEOM_PLANE")); - if ( Display( plane, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - - -//======================================================================= -// function : MakeWorkingPlane() -// purpose : Change the point of view3d -//======================================================================= -void GeometryGUI::MakeWorkingPlane( const gp_Pnt P, const gp_Dir D) -{ - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_OCC) { - GeomGUI->myDesktop->putInfo( tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; - return ; - } - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort(); - Handle( V3d_View) view3d = ((OCCViewer_ViewPort3d*)vp)->getView(); - view3d->SetAt( P.X(), P.Y(), P.Z() ); - view3d->SetProj( D.X(), D.Y(), D.Z() ); - myDesktop->putInfo(tr("GEOM_PRP_DONE")); -} - - -//======================================================================= -// function : MakePrismAndDisplay() -// purpose : P1 and P2 is to define a vector for prism -//======================================================================= -void GeometryGUI::MakePrismAndDisplay( GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2 ) -{ - try { - GEOM::PointStruct PS1 = myComponentGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z() ) ; - GEOM::PointStruct PS2 = myComponentGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z() ) ; - if( BaseShape->_is_nil() ) { - myDesktop->putInfo (tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - - GEOM::GEOM_Shape_ptr result = myComponentGeom->MakePrism( BaseShape, PS1, PS2 ) ; - if (result->_is_nil()) { - myDesktop->putInfo (tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result); - Standard_CString type; - GetShapeTypeString(S,type); - result->NameType( type ); - - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeLineAndDisplay() -// purpose : Create an infinite oriented line (linear edge in fact) -//===================================================================================== -void GeometryGUI::MakeLineAndDisplay( const gp_Pnt InitPoint, const gp_Pnt LastPoint ) -{ - gp_Pnt P1,P2; - double dx, dy, dz ; - GetBipointDxDyDz( InitPoint, LastPoint, dx, dy, dz ) ; - Standard_Real length = InitPoint.Distance(LastPoint) ; - if( length <= Precision::Confusion() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return ; - } - - Standard_Real coeff = 1E6 / length ; - - /* To create a line with length = 1E6 */ - /* Precision::Infinite() is 1E100 in OCC */ - P1.SetX( InitPoint.X() - (coeff * dx) ) ; - P1.SetY( InitPoint.Y() - (coeff * dy) ) ; - P1.SetZ( InitPoint.Z() - (coeff * dz) ) ; - - P2.SetX( LastPoint.X() + (coeff * dx) ) ; - P2.SetY( LastPoint.Y() + (coeff * dy) ) ; - P2.SetZ( LastPoint.Z() + (coeff * dz) ) ; - - try { - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z()) ; - GEOM::PointStruct d = myComponentGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z()) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - - GEOM::GEOM_Shape_ptr result = myComponentGeom->MakeLine(pstruct, dstruct) ; - if(result->_is_nil()) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return ; - } - result->NameType(tr("GEOM_LINE")); - - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_READY")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - - -//======================================================================= -// function : MakeBooleanAndDisplay() -// purpose : -//======================================================================= -void GeometryGUI::MakeBooleanAndDisplay( GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2, const short operation ) -{ - try { - GEOM::GEOM_Shape_ptr result = myComponentGeom->MakeBoolean( Shape1, Shape2, operation ) ; - if (result->_is_nil()) { - myDesktop->putInfo (tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result); - Standard_CString type; - GetShapeTypeString(S,type); - result->NameType( type ); - - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeSphere() -// purpose : -//===================================================================================== -void GeometryGUI::MakeSphereAndDisplay( const gp_Pnt aCenterPoint, const double aRadius ) -{ - try { - if( aRadius <= Precision::Confusion() ) { - QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("GEOM_WRN_WARNING"), - tr ("GEOM_WRN_RADIUS_NULL"), tr ("GEOM_BUT_YES") ); - return ; - } - GEOM::GEOM_Shape_ptr result = myComponentGeom->MakeSphere(aCenterPoint.X(),aCenterPoint.Y(),aCenterPoint.Z(), aRadius); - result->NameType(tr("GEOM_SPHERE")); - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeConeAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeConeAndDisplay( const gp_Pnt BasePoint, - const gp_Dir aDir, - const double Radius1, - const double Radius2, - const double aHeight ) -{ - try { - if( ( Radius1 <= Precision::Confusion() && Radius2 <= Precision::Confusion() ) || aHeight <= Precision::Confusion() ) - return ; - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct( BasePoint.X(), BasePoint.Y(), BasePoint.Z() ) ; - GEOM::PointStruct d = myComponentGeom->MakePointStruct( aDir.X(), aDir.Y(), aDir.Z() ) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeCone( pstruct, dstruct, Radius1, Radius2, aHeight ) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return ; - } - result->NameType(tr("GEOM_CONE")); - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeCylinderAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeCylinderAndDisplay( const gp_Pnt BasePoint, - const gp_Dir aDir, - const double Radius, - const double aHeight ) -{ - try { - if( Radius <= Precision::Confusion() || aHeight <= Precision::Confusion() ) - return ; - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct( BasePoint.X(), BasePoint.Y(), BasePoint.Z() ) ; - GEOM::PointStruct d = myComponentGeom ->MakePointStruct( aDir.X(), aDir.Y(), aDir.Z() ) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeCylinder(pstruct, dstruct, Radius, aHeight) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return ; - } - result->NameType(tr("GEOM_CYLINDER")); - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeTorusAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeTorusAndDisplay( const gp_Pnt BasePoint, - const gp_Dir aDir, - const double Radius1, - const double Radius2 ) -{ - try { - if( Radius1 <= Precision::Confusion() || Radius2 <= Precision::Confusion() ) - return ; - - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct( BasePoint.X(), BasePoint.Y(), BasePoint.Z() ) ; - GEOM::PointStruct d = myComponentGeom ->MakePointStruct( aDir.X(), aDir.Y(), aDir.Z() ) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeTorus(pstruct, dstruct, Radius1, Radius2) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return ; - } - result->NameType(tr("GEOM_TORUS")); - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakePipeAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakePipeAndDisplay( GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Shape_ptr aBase ) -{ - try { - GEOM::GEOM_Shape_ptr result = myComponentGeom->MakePipe(aPath, aBase); - if ( !result->_is_nil() && Display( result, "") ) { - - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result); - Standard_CString type; - GetShapeTypeString(S,type); - result->NameType( type ); - - myDesktop->putInfo( tr("GEOM_PRP_DONE") ); - } - else { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - } - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeFillingAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeFillingAndDisplay( GEOM::GEOM_Shape_ptr SectionShape, - const short mindeg, - const short maxdeg, - const double tol3d, - const double tol2d, - const short nbiter ) -{ - try { - GEOM::GEOM_Shape_ptr result = myComponentGeom->MakeFilling( SectionShape, - mindeg, maxdeg, - tol3d, tol2d, nbiter ); - if (result->_is_nil()) { - myDesktop->putInfo (tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result); - Standard_CString type; - GetShapeTypeString(S,type); - result->NameType( type ); - - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - return ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - - - -//===================================================================================== -// function : MakeMirrorAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeMirrorAndDisplay( GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2 ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeMirrorByPlane( Shape1, Shape2 ); - if (result->_is_nil()) { - myDesktop->putInfo (tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - result->NameType( Shape1->NameType() ); - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeSewingAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeSewingAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, - const Standard_Real precision ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeSewing(listShapesIOR, precision) ; - if( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result); - Standard_CString type; - GetShapeTypeString(S,type); - result->NameType( type ); - - if( Display( result, "") ) - myDesktop ->putInfo(tr("GEOM_PRP_DONE")) ; - return ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - - -//===================================================================================== -// function : MakeCompoundAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeCompoundAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeCompound(listShapesIOR) ; - if( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - result->NameType(tr("GEOM_COMPOUND")); - if( Display( result, "" )) - myDesktop->putInfo(tr("GEOM_PRP_DONE")) ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeFaceAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeFaceAndDisplay( GEOM::GEOM_Shape_ptr aWire, const Standard_Boolean wantPlanar ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeFace( aWire, wantPlanar) ; - if( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - if ( wantPlanar ) - result->NameType(tr("GEOM_PLANE")); - else - result->NameType(tr("GEOM_FACE")); - if( Display( result, "") ) - myDesktop ->putInfo(tr("GEOM_PRP_DONE")) ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - - -//===================================================================================== -// function : MakeLinearEdgeAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeLinearEdgeAndDisplay( const gp_Pnt P1, const gp_Pnt P2 ) -{ - try { - GEOM::PointStruct ps1 = myComponentGeom->MakePointStruct( P1.X(), P1.Y(), P1.Z() ) ; - GEOM::PointStruct ps2 = myComponentGeom->MakePointStruct( P2.X(), P2.Y(), P2.Z() ) ; - GEOM::GEOM_Shape_var result = myComponentGeom->MakeEdge( ps1, ps2 ) ; - if( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - result->NameType(tr("GEOM_EDGE")); - if( Display( result, "") ) - myDesktop ->putInfo(tr("GEOM_PRP_DONE")) ; - } - catch(const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeOrientationChangeAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeOrientationChangeAndDisplay( GEOM::GEOM_Shape_ptr Shape ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->OrientationChange( Shape ) ; - if( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - result->NameType( Shape->NameType() ); - if ( Display( result, "" )) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - return ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - - -//===================================================================================== -// function : MakeScaleAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeScaleAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Pnt centralPoint, const Standard_Real factor ) -{ - try { - GEOM::PointStruct P = myComponentGeom->MakePointStruct(centralPoint.X(), centralPoint.Y(), centralPoint.Z() ) ; - GEOM::GEOM_Shape_var result = myComponentGeom->MakeScaleTransform(Shape, P, factor) ; - // result->NameType(tr("GEOM_SCALE")); - result->NameType( Shape->NameType() ); - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - else - myDesktop->putInfo (tr("GEOM_PRP_NULLSHAPE")) ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//======================================================================================= -// function : MakeRevolutionAndDisplay() -// purpose : -//======================================================================================= -void GeometryGUI::MakeRevolutionAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc, const gp_Dir dir, const Standard_Real revolAngle ) -{ - try { - GEOM::AxisStruct axis = myComponentGeom->MakeAxisStruct(loc.X(), loc.Y(), loc.Z(), dir.X(), dir.Y(), dir.Z() ) ; - GEOM::GEOM_Shape_ptr result = myComponentGeom->MakeRevolution(Shape, axis, revolAngle) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return ; - } - - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result); - Standard_CString type; - GetShapeTypeString(S,type); - result->NameType( type ); - - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//======================================================================================= -// function : MakeRotationAndDisplay() -// purpose : -//======================================================================================= -void GeometryGUI::MakeRotationAndDisplay( GEOM::GEOM_Shape_ptr Shape, - const gp_Pnt loc, - const gp_Dir dir, - const Standard_Real angle ) -{ - try { - const GEOM::AxisStruct axis = myComponentGeom->MakeAxisStruct(loc.X(), loc.Y(), loc.Z(), dir.X(), dir.Y(), dir.Z() ) ; - GEOM::GEOM_Shape_var result = myComponentGeom->MakeRotation(Shape, axis, angle); - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType( Shape->NameType() ); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//================================================================================= -// function : MakeTranslationAndDisplay() -// purpose : Translate a shape -//================================================================================= -void GeometryGUI::MakeTranslationAndDisplay( GEOM::GEOM_Shape_ptr Shape, gp_Vec V ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeTranslation( Shape, V.X(), V.Y(), V.Z() ) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType( Shape->NameType() ); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - -//================================================================================= -// function : MakeMultiTranslation1DAndDisplay() -// purpose : Multi-Translate a shape -//================================================================================= -void GeometryGUI::MakeMultiTranslation1DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const double Step, const short NbTimes ) -{ - try { - GEOM::PointStruct d = myComponentGeom->MakePointStruct( Dir.X(), Dir.Y(), Dir.Z() ) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeMultiTranslation1D( Shape, dstruct, Step, NbTimes ); - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType( tr("GEOM_COMPOUND") ); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//================================================================================= -// function : MakeMultiTranslation2DAndDisplay() -// purpose : Multi-Translate a shape -//================================================================================= -void GeometryGUI::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 ) -{ - try { - GEOM::PointStruct d1 = myComponentGeom->MakePointStruct( Dir1.X(), Dir1.Y(), Dir1.Z() ) ; - GEOM::DirStruct dstruct1 = myComponentGeom->MakeDirection(d1) ; - GEOM::PointStruct d2 = myComponentGeom->MakePointStruct( Dir2.X(), Dir2.Y(), Dir2.Z() ) ; - GEOM::DirStruct dstruct2 = myComponentGeom->MakeDirection(d2) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeMultiTranslation2D( Shape, dstruct1, Step1, NbTimes1, dstruct2, Step2, NbTimes2 ); - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType( tr("GEOM_COMPOUND") ); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//================================================================================= -// function : MakeMultiRotation1DAndDisplay() -// purpose : Multi-Rotate a shape -//================================================================================= -void GeometryGUI::MakeMultiRotation1DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const gp_Pnt Loc, const short NbTimes ) -{ - try { - GEOM::PointStruct d = myComponentGeom->MakePointStruct( Dir.X(), Dir.Y(), Dir.Z() ) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct( Loc.X(), Loc.Y(), Loc.Z() ) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeMultiRotation1D( Shape, dstruct, pstruct, NbTimes ); - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType( tr("GEOM_COMPOUND") ); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//================================================================================= -// function : MakeMultiRotation2DAndDisplay() -// purpose : Multi-Rotate a shape -//================================================================================= -void GeometryGUI::MakeMultiRotation2DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const gp_Pnt Loc, const double Ang, const short NbTimes1, const double Step, const short NbTimes2 ) -{ - try { - GEOM::PointStruct d = myComponentGeom->MakePointStruct( Dir.X(), Dir.Y(), Dir.Z() ) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct( Loc.X(), Loc.Y(), Loc.Z() ) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeMultiRotation2D( Shape, dstruct, pstruct, Ang, NbTimes1, Step, NbTimes2 ); - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType( tr("GEOM_COMPOUND") ); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - - -//======================================================================================= -// function : MakeArcAndDisplay() -// purpose : Make an arc of circle from InitPoint to CirclePoint and passing on EndPoint -//======================================================================================= -void GeometryGUI::MakeArcAndDisplay( gp_Pnt InitPoint, gp_Pnt CirclePoint, gp_Pnt EndPoint ) -{ - gp_Vec v1( CirclePoint, InitPoint ) ; - gp_Vec v2( CirclePoint, EndPoint ) ; - if( v1.IsParallel(v2, Precision::Angular() ) ) - return ; - - try { - GEOM::PointStruct pI = myComponentGeom->MakePointStruct( InitPoint.X(), InitPoint.Y(), InitPoint.Z() ); - GEOM::PointStruct pC = myComponentGeom->MakePointStruct( CirclePoint.X(), CirclePoint.Y(), CirclePoint.Z() ); - GEOM::PointStruct pE = myComponentGeom->MakePointStruct( EndPoint.X(), EndPoint.Y(), EndPoint.Z() ); - GEOM::GEOM_Shape_var result = myComponentGeom->MakeArc(pI, pC, pE) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return ; - } - result->NameType(tr("GEOM_ARC")); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeCircleAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeCircleAndDisplay( const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Radius ) -{ - try { - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct( CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z() ) ; - GEOM::PointStruct d = myComponentGeom->MakePointStruct( dir.X(), dir.Y(), dir.Z() ) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeCircle(pstruct, dstruct, Radius) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType(tr("GEOM_CIRCLE")); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeEllipseAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeEllipseAndDisplay( const gp_Pnt CenterPoint, - const gp_Dir dir, - const Standard_Real Major_Radius, - const Standard_Real Minor_Radius ) -{ - try { - GEOM::PointStruct pstruct = myComponentGeom->MakePointStruct( CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z() ) ; - GEOM::PointStruct d = myComponentGeom->MakePointStruct( dir.X(), dir.Y(), dir.Z() ) ; - GEOM::DirStruct dstruct = myComponentGeom->MakeDirection(d) ; - - GEOM::GEOM_Shape_var result = myComponentGeom->MakeEllipse(pstruct, dstruct, Major_Radius, Minor_Radius) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType(tr("GEOM_ELLIPSE")); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakeWireAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeWireAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeWire(listShapesIOR) ; - if( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - result->NameType(tr("GEOM_WIRE")); - if( Display( result, "") ) - myDesktop ->putInfo(tr("GEOM_PRP_DONE")) ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - - -//===================================================================================== -// function : MakePartitionAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakePartitionAndDisplay (const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, - const GEOM::GEOM_Gen::ListOfIOR& listToolsIOR, - const GEOM::GEOM_Gen::ListOfIOR& listKeepInsIOR, - const GEOM::GEOM_Gen::ListOfIOR& listRemoveInsIOR, - const GEOM::shape_type limit) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->Partition(listShapesIOR, - listToolsIOR, - listKeepInsIOR, - listRemoveInsIOR, - (CORBA::Short) limit); - if( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_NULLSHAPE")) ; - return ; - } - result->NameType(tr("GEOM_PARTITION")); - if( Display( result, "") ) - myDesktop ->putInfo(tr("GEOM_PRP_DONE")) ; - return ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - -//======================================================================= -// function : SetState() -// purpose : Sets myState = aState a private field indicating which methode is active -//======================================================================= -void GeometryGUI::SetState(int aState ) -{ this->myState = aState ; return ; } - - -//======================================================================= -// function : ResetState() -// purpose : Sets myState = -1 a private field indicating which methode is active -//======================================================================= -void GeometryGUI::ResetState() -{ this->myState = -1 ; return ; } - - -//======================================================================= -// function : EmitSignalDeactivateDialog() -// purpose : Emit a signal to deactivate the active dialog Box -//======================================================================= -void GeometryGUI::EmitSignalDeactivateDialog() -{ - emit this->SignalDeactivateActiveDialog() ; - return ; -} - -//======================================================================= -// function : EmitSignalCloseAllDialogs() -// purpose : Emit a signal to deactivate all non modal dialogs box -//======================================================================= -void GeometryGUI::EmitSignalCloseAllDialogs() -{ - emit this->SignalCloseAllDialogs() ; - return ; -} - - -//======================================================================= -// function : GetActiveDialogBox() -// purpose : -//======================================================================= -QDialog* GeometryGUI::GetActiveDialogBox() -{ - return this->myActiveDialogBox ; -} - - -//======================================================================= -// function : SetActiveDialogBox() -// purpose : -//======================================================================= -void GeometryGUI::SetActiveDialogBox(QDialog* aDlg) -{ - this->myActiveDialogBox = (QDialog*)aDlg ; - return ; -} - - -//======================================================================= -// function : GetActiveStudy() -// purpose : -//======================================================================= -QAD_Study* GeometryGUI::GetActiveStudy() -{ - return this->myActiveStudy ; -} - - -//======================================================================= -// function : GetActiveDesktop() -// purpose : -//======================================================================= -QAD_Desktop* GeometryGUI::GetDesktop() -{ - return this->myDesktop ; -} - - -//===================================================================================== -// function : OnSubShapeGetAll() -// purpose : Explode a shape in all sub shapes with a SubShapeType -//===================================================================================== -bool GeometryGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType) -{ - SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument(); - SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR( ShapeTopoIOR ); - if ( theObj->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); - return false ; - } - - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myActiveStudy->getActiveStudyFrame()->entry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIOR; - SALOMEDS::AttributePixMap_var aPixmap; - - /* We create a sub object for each sub shape as attribute of the main object */ - /* Each sub object contains list (length=1) containing its index in the main shape */ - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR ); - GEOM::GEOM_Gen::ListOfGeomShapes_var listGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes; - GEOM::GEOM_Shape_var aResult ; - - try { - listGeomShapes = myComponentGeom->SubShapeAll( aShape, SubShapeType ); - if( listGeomShapes->length() < 1 ) { - myDesktop->putInfo (tr("GEOM_PRP_ABORT")); - return false ; - } - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - /* open transaction */ - QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy ); - op->start(); - - TopoDS_Shape mainTopo = ShapeReader.GetShape(myComponentGeom, aShape); - TopoDS_Shape mainShape; - bool main = false; - while ( !main ) { - if ( aShape->IsMainShape() ) { - mainShape = ShapeReader.GetShape(myComponentGeom, aShape); - main = true; - } else - aShape = myComponentGeom->GetIORFromString( aShape->MainName() ); - } - - /* Loop on each sub shape created */ - /* int i = 1 ; /* index for the nameType */ - for( int j=0; jlength(); j++) { - - /* Get each sub shape extracted CORBA and OCC */ - aResult = listGeomShapes[j] ; - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, aResult); - - if ( S.IsNull() ) { - myDesktop->putInfo (tr("GEOM_PRP_ABORT")); - return false; - } - -// NRI : Following lines are commented according to bugID SAL695 (see history) -// BRepCheck_Analyzer anAnalyzer(S); -// if(!anAnalyzer.IsValid()) { -// myDesktop->putInfo (tr("GEOM_PRP_ABORT")); -// MESSAGE("#### An exploded shape number "<< j << " is not valid"); -// op->abort(); -// return false; -// } - - /* Set the nameType of sub shape */ - char* nameG = (char *)malloc(20); - Standard_CString Type; - if ( GetShapeTypeString(S, Type) ) { - aResult->NameType( Type ); - sprintf (nameG, "%s_%d", Type, GetIndex( S, mainShape, SubShapeType ) ); - } - else { - aResult->NameType( tr("GEOM_SHAPE") ); - sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), this->myNbGeom++ ); - } - SALOMEDS::SObject_var SO = aStudy->FindObjectIOR( aResult->Name() ); - - bool allreadyexist = false; - - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - Handle(GEOM_AISShape) result = new GEOM_AISShape( S, nameG ); - Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), Fatherior, "GEOM"); - - MESSAGE ( "SO->_is_nil() " << SO->_is_nil() ) - - if ( SO->_is_nil() ) { - SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject( theObj ); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(nameG); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(aResult->Name()); - - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - MESSAGE( " Type " << S.ShapeType() ) - if ( S.ShapeType() == TopAbs_COMPOUND ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" ); - } else if ( S.ShapeType() == TopAbs_COMPSOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" ); - } else if ( S.ShapeType() == TopAbs_SOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" ); - } else if ( S.ShapeType() == TopAbs_SHELL ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" ); - } else if ( S.ShapeType() == TopAbs_FACE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" ); - } else if ( S.ShapeType() == TopAbs_WIRE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" ); - } else if ( S.ShapeType() == TopAbs_EDGE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" ); - } else if ( S.ShapeType() == TopAbs_VERTEX ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" ); - } - - MESSAGE ( " aPixmap->GetPixMap " << aPixmap->GetPixMap() ) - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, newObj); - IO->setEntry(newObj->GetID()); - - aResult->StudyShapeId( newObj->GetID() ); - } else { - allreadyexist = true; - if ( ! SObjectExist(theObj, aResult->Name()) ) { - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); - aStudyBuilder->Addreference(newObj1, SO); - IO->setEntry(SO->GetID()); - aResult->StudyShapeId( SO->GetID() ); - } - } - - result->setIO( IO ); - result->setName( nameG ); - if ( !allreadyexist ) - ic->Display(result); - - } else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - int themode = myRenderInter->GetDisplayMode(); - vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); - vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); - - Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), Fatherior,"GEOM"); - - if ( SO->_is_nil() ) { - SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject( theObj ); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(aResult->Name()); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(nameG); - - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - if ( S.ShapeType() == TopAbs_COMPOUND ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" ); - } else if ( S.ShapeType() == TopAbs_COMPSOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" ); - } else if ( S.ShapeType() == TopAbs_SOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" ); - } else if ( S.ShapeType() == TopAbs_SHELL ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" ); - } else if ( S.ShapeType() == TopAbs_FACE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" ); - } else if ( S.ShapeType() == TopAbs_WIRE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" ); - } else if ( S.ShapeType() == TopAbs_EDGE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" ); - } else if ( S.ShapeType() == TopAbs_VERTEX ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" ); - } - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, newObj); - IO->setEntry(newObj->GetID()); - } else { - allreadyexist = true; - if ( ! SObjectExist(theObj, aResult->Name()) ) { - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); - aStudyBuilder->Addreference(newObj1, SO); - IO->setEntry(SO->GetID()); - } - } - - if ( !allreadyexist ) { - vtkActorCollection* theActors = - GEOM_AssemblyBuilder::BuildActors(S,0,themode,Standard_True); - theActors->InitTraversal(); - vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); - while(!(anActor==NULL)) { - GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor ); - GActor->setIO( IO ); - GActor->setName( nameG ); - theRenderer->AddActor(GActor); - renWin->Render(); - anActor = (vtkActor*)theActors->GetNextActor(); - } - } - } - } - - /* commit transaction */ - op->finish(); - - myActiveStudy->updateObjBrowser(); - myDesktop->putInfo (tr("GEOM_PRP_READY")); - return true ; -} - - - -//===================================================================================== -// function : GetIndexSubShapeSelected() -// purpose : Define a ListOfID of sub shapes selected in ShapeTopo with SubShapeType -// : Method used by Dialogs -//===================================================================================== -bool GeometryGUI::GetIndexSubShapeSelected( const TopoDS_Shape& ShapeTopo, - const int SubShapeType, - GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID, - Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) -{ - //* Test the type of viewer */ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - return false; - } - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)this->myActiveStudy->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 : OnSubShapeGetSelected() -// purpose : -//===================================================================================== -bool GeometryGUI::OnSubShapeGetSelected( const TopoDS_Shape& ShapeTopo, - const char* ShapeTopoIOR, - const int SubShapeType, - Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) -{ - //* Test the type of viewer */ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - return false; - } - - SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument(); - SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR( ShapeTopoIOR ); - if ( theObj->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); - return false ; - } - - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - if( myUseLocalContext == false ) { - /* local context is from DialogBox */ - MESSAGE("Error : No local context opened for sub shapes method" << endl ) ; - return false ; - } - - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR ); - TopoDS_Shape mainTopo = ShapeReader.GetShape(myComponentGeom, aShape); - - TopoDS_Shape mainShape; - bool main = false; - while ( !main ) { - if ( aShape->IsMainShape() ) { - mainShape = ShapeReader.GetShape(myComponentGeom, aShape); - main = true; - } else - aShape = myComponentGeom->GetIORFromString( aShape->MainName() ); - } - - GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; - ic->InitSelected(); - int nbSelected = ic->NbSelected(); - ListOfID->length(nbSelected); - - TopoDS_Compound compound; - ic->InitSelected(); /* to init again */ - BRep_Builder B; - B.MakeCompound( compound ); - - int i = 0; - /* We create a unique compound containing all the sub shapes selected by user as attribute of the main shape */ - /* the compound is homogenous by selection */ - while(ic->MoreSelected()) { - int index = GetIndex( ic->SelectedShape(), mainShape, SubShapeType ); - ListOfID[i] = index ; - B.Add( compound, ic->SelectedShape() ); - i++; - ic->NextSelected(); - } - - /* Test if user has selected sub shapes */ - if( ListOfID->length() < 1 ) - return false ; - - GEOM::GEOM_Shape_var aResult ; - try { - aResult = myComponentGeom->SubShape( aShape, SubShapeType, ListOfID ); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - /* local context from DialogBox */ - ic->CloseLocalContext(aLocalContextId) ; - myUseLocalContext = false ; - - char* nameG = (char *)malloc(20); - Standard_CString Type; - - Handle(GEOM_AISShape) result; - Handle(GEOM_InteractiveObject) IO ; - - // if ( ! SObjectExist(theObj, aResult->Name()) ) { - if ( nbSelected == 1 ) { - TopExp_Explorer Exp ( compound, TopAbs_ShapeEnum(SubShapeType) ); - if ( Exp.More() ) { - if ( GetShapeTypeString(Exp.Current(),Type) ) { - aResult->NameType( Type ); - sprintf (nameG, "%s_%d", Type, GetIndex( Exp.Current(), mainTopo, SubShapeType ) ); - } else { - aResult->NameType( tr("GEOM_SHAPE") ); - sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), this->myNbGeom++ ); - } - result = new GEOM_AISShape( Exp.Current(), nameG ); - IO = new GEOM_InteractiveObject(aResult->Name(), Fatherior, "GEOM"); - } - } - else { - if ( GetShapeTypeString(compound,Type) ) { - aResult->NameType( Type ); - sprintf (nameG, "%s_%d", Type, this->myNbGeom++ ); - } else { - aResult->NameType( tr("GEOM_SHAPE") ); - sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), this->myNbGeom++ ); - } - result = new GEOM_AISShape( compound, nameG ); - IO = new GEOM_InteractiveObject(aResult->Name(), Fatherior, "GEOM"); - } - - SALOMEDS::SObject_var SO = aStudy->FindObjectIOR( aResult->Name() ); - - /* open transaction */ - QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy ); - op->start(); - - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myActiveStudy->getActiveStudyFrame()->entry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIOR; - SALOMEDS::AttributePixMap_var aPixmap; - - bool allreadyexist = false; - - if ( SO->_is_nil() ) { - SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject( theObj ); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(aResult->Name()); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(result->getName()); - - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - if ( result->Shape().ShapeType() == TopAbs_COMPOUND ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" ); - } else if ( result->Shape().ShapeType() == TopAbs_COMPSOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" ); - } else if ( result->Shape().ShapeType() == TopAbs_SOLID ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" ); - } else if ( result->Shape().ShapeType() == TopAbs_SHELL ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" ); - } else if ( result->Shape().ShapeType() == TopAbs_FACE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" ); - } else if ( result->Shape().ShapeType() == TopAbs_WIRE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" ); - } else if ( result->Shape().ShapeType() == TopAbs_EDGE ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" ); - } else if ( result->Shape().ShapeType() == TopAbs_VERTEX ) { - aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" ); - } - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, newObj); - - IO->setEntry(newObj->GetID()); - aResult->StudyShapeId(newObj->GetID()); - } else { - allreadyexist = true; - if ( ! SObjectExist(theObj, aResult->Name()) ) { - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); - aStudyBuilder->Addreference(newObj1, SO); - - IO->setEntry(SO->GetID()); - aResult->StudyShapeId(SO->GetID()); - } - } - - /* commit transaction */ - op->finish(); - - result->setIO( IO ); - result->setName( nameG ); - - if ( !allreadyexist ) - ic->Display(result); - - this->OnDisplayAll(true); - myActiveStudy->updateObjBrowser(); - myDesktop->putInfo (tr("GEOM_PRP_READY")); - - return true ; -} - - -//===================================================================================== -// function : OnSuppressFaces() -// purpose : To suppress faces from a shape -// : The result is one or more shells/faces as main shapes ! -//===================================================================================== -bool GeometryGUI::OnSuppressFaces( const TopoDS_Shape& ShapeTopo, - const char* ShapeTopoIOR, - const Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) -{ - /* Test the type of viewer */ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - return false; - } - - SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument(); - SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR( ShapeTopoIOR ); - if ( theObj->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); - return false ; - } - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - if( myUseLocalContext == false ) { - /* local context is from DialogBox */ - MESSAGE("Error : No local context opened for suppress faces method" << endl ) ; - return false ; - } - - GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; - ic->InitSelected(); - int nbSelected = ic->NbSelected(); - ListOfID->length(nbSelected); - - /* Create a list of indices of faces to be suppressed */ - int i = 0; - const int SubShapeType = 4 ; /* GEOM::FACE type */ - ic->InitSelected(); /* to repositioning at beginning */ - while( ic->MoreSelected() ) { - int index = GetIndex( ic->SelectedShape(), ShapeTopo, SubShapeType ); - ListOfID[i] = index ; - i++; - ic->NextSelected(); - } - - /* Close local context opened in DialogBox */ - ic->CloseLocalContext(aLocalContextId) ; - myUseLocalContext = false ; - - /* Here is the main shape */ - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR ); - GEOM::GEOM_Gen::ListOfGeomShapes_var listGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes; - - /* Call geom method that return a list of shells/faces as result of suppress */ - try { - listGeomShapes = myComponentGeom->SuppressFaces( aShape, ListOfID ); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - /* Test list of shells/faces */ - if( listGeomShapes->length() < 1 ) { - return false ; - } - - /* Loop on each object created */ - for( int i=0; ilength(); i++ ) { - - GEOM::GEOM_Shape_var aShellOrFace = listGeomShapes[i] ; - TopoDS_Shape S = ShapeReader.GetShape( this->myComponentGeom, aShellOrFace ); - - if( S.IsNull() ) { - return false ; - } - - char* nameG = (char *)malloc(20); - Standard_CString Type; - if ( GetShapeTypeString(S, Type) ) { - aShellOrFace->NameType( Type ); - sprintf (nameG, "%s_%d", Type, this->myNbGeom++); - } - else { - aShellOrFace->NameType( tr("GEOM_SHAPE") ); - sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), this->myNbGeom++ ); - } - - /* Display with name */ - if( !Display( aShellOrFace, nameG) ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return false ; - } - } - - myDesktop->putInfo (tr("GEOM_PRP_READY")); - return true ; -} - - -//===================================================================================== -// function : OnSuppressHole() -// purpose : To suppress an hole on a shape 'ShapeTopo'. -// : 'ListOfIdEndFace' may be an empty list. -// : This means that hole do not traverse ShapeTopo. -// : Warning : the hole to be suppressed must be defined by one or two single closed wires ! -//===================================================================================== -bool GeometryGUI::OnSuppressHole( const char* ShapeTopoIOR, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdFace, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWire, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace ) -{ - /* Test the type of viewer */ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - return false; - } - - try { - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR ); - GEOM::GEOM_Shape_var aResult = myComponentGeom->SuppressHole( aShape, ListOfIdFace, ListOfIdWire, ListOfIdEndFace ) ; - - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, aResult); - Standard_CString type; - GetShapeTypeString(S,type); - aResult->NameType( type ); - - if ( Display( aResult, "" ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return true ; -} - - -//===================================================================================== -// function : OnSuppressHolesInFaceOrShell() -// purpose : To suppress one or more holes on a face -// : 'ListOfIdWires' contains indices or wires/holes. -//===================================================================================== -bool GeometryGUI::OnSuppressHolesInFaceOrShell( const char* ShapeTopoIOR, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires ) -{ - /* Test the type of viewer */ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - return false; - } - - try { - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR ); - GEOM::GEOM_Shape_var aResult = myComponentGeom->SuppressHolesInFaceOrShell( aShape, ListOfIdWires ) ; - - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, aResult); - Standard_CString type; - GetShapeTypeString(S,type); - aResult->NameType( type ); - - if ( Display( aResult, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return true ; -} - - - -//======================================================================= -// function : activeStudyChanged() -// purpose : static -//======================================================================= -void GeometryGUI::activeStudyChanged( QAD_Desktop* parent ) -{ - MESSAGE ("GeometryGUI::activeStudyChanged init.") - /* Create or retrieve an object GeomGUI */ - GeometryGUI::GetOrCreateGeometryGUI(parent); - if(GeomGUI != 0) { - - if (GeomGUI->myState == CURRENT_SKETCH) { - GeomGUI->mySketcher.Clear(); - GeomGUI->ResetState(); - } - - QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar(); - bool ViewOCC = false; - if ( GeomGUI->myDesktop->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) - ViewOCC = true; - - Mb->setItemEnabled( 312, ViewOCC); //Sketch - Mb->setItemEnabled( 309, ViewOCC); //SuppressFace - Mb->setItemEnabled( 314, ViewOCC); //SuppressHole - - Mb->setItemEnabled( 703, ViewOCC);// ShadingColor Settings - Mb->setItemEnabled( 704, ViewOCC);// Isos Settings - - GeomGUI->EraseSimulationShape() ; - GeomGUI->EmitSignalCloseAllDialogs() ; - GeomGUI = 0 ; - } - - // GeomGUI->SetSettings( parent ); - // MESSAGE ("GeometryGUI::activeStudyChanged done.") - return ; -} - - -//======================================================================= -// function : DefineDlgPosition() -// purpose : Define x and y the default position for a dialog box -//======================================================================= -bool GeometryGUI::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 : OnGUIEvent() [static] // purpose : manage all events on GUI //======================================================================= -bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { - /* Create or retrieve an object GeomGUI */ GeometryGUI::GetOrCreateGeometryGUI(parent); - SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - - OCCViewer_Viewer3d* v3d; - Handle(AIS_InteractiveContext) ic; - vtkRenderer* Renderer; + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); + bool ViewOCC; - QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar(); - - bool ViewOCC = false; - - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - v3d = ((OCCViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - ic = v3d->getAISContext(); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) ViewOCC = true; - Mb->setItemEnabled( 312, ViewOCC);//Sketch - Mb->setItemEnabled( 309, ViewOCC);//SuppressFace - Mb->setItemEnabled( 314, ViewOCC);//SuppressHole - - Mb->setItemEnabled( 703, ViewOCC);// ShadingColor Settings - Mb->setItemEnabled( 704, ViewOCC);// Isos Settings + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) + ViewOCC = false; + else + return false; - } else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - Renderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + Mb->setItemEnabled(404, ViewOCC);//SKETCHER + Mb->setItemEnabled(406, ViewOCC);//SKETCHER - // OnSuppressFaces, OnSuppressHole, SETTINGS - SHADING COLOR, SETTINGS - ISOS, SETTINGS : STEP VALUE FOR SPIN BOXES, SKETCHER, ISOS - POPUP VIEWER, - Mb->setItemEnabled( 312, ViewOCC);//Sketch - Mb->setItemEnabled( 309, ViewOCC);//SuppressFace - Mb->setItemEnabled( 314, ViewOCC);//SuppressHole - - Mb->setItemEnabled( 703, ViewOCC);// ShadingColor Settings - Mb->setItemEnabled( 704, ViewOCC);// Isos Settings - } else { - return 0; + Mb->setItemEnabled(603, ViewOCC);//SuppressFace + Mb->setItemEnabled(604, ViewOCC);//SuppressHole + + Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings + Mb->setItemEnabled(414, ViewOCC);// Isos Settings + + if(theCommandID == 4041 || // SKETCHER - POPUP VIEWER - SEGMENT + theCommandID == 4042 || // SKETCHER - POPUP VIEWER - ARC + theCommandID == 4043 || // SKETCHER - POPUP VIEWER - SET ANGLE + theCommandID == 4044 || // SKETCHER - POPUP VIEWER - SET X + theCommandID == 4045 || // SKETCHER - POPUP VIEWER - SET Y + theCommandID == 4046 || // SKETCHER - POPUP VIEWER - DELETE + theCommandID == 4047 || // SKETCHER - POPUP VIEWER - END + theCommandID == 4048 || // SKETCHER - POPUP VIEWER - CLOSE + theCommandID == 4051 || // SKETCHER - MENU - SET PLANE + theCommandID == 4052 || // SKETCHER - MENU - TANGENT + theCommandID == 4053 || // SKETCHER - MENU - PERPENDICULAR + theCommandID == 4061 || // SKETCHER - MENU - LENGTH + theCommandID == 4062 || // SKETCHER - MENU - ANGLE + theCommandID == 4063 || // SKETCHER - MENU - RADIUS + theCommandID == 4064 || // SKETCHER - MENU - X + theCommandID == 4065) { // SKETCHER - MENU - Y + if(!GeomGUI->LoadLibrary("libEntityGUI.so")) + return false; } - - if (GeomGUI->myState == CURRENT_SKETCH && theCommandID != 10000 && theCommandID != 10001 && theCommandID != 10002 && theCommandID != 10003 && theCommandID != 10004 && theCommandID != 10006 && theCommandID != 10007 && theCommandID != 10008 && theCommandID != 10010 && theCommandID != 10011 && theCommandID != 10012 && theCommandID != 10013 && theCommandID != 10014 && theCommandID != 3133 && theCommandID != 3134) - return false; - - switch (theCommandID) - { - case 31: // COPY - GeomGUI->OnEditCopy(); - break; - - case 33: // DELETE - GeomGUI->OnEditDelete(); - break; - - case 111: - { - GeomGUI->SetState(111); - GeomGUI->Import(); - GeomGUI->ResetState(); - break; - } - case 112: - { - GeomGUI->SetState(112); - GeomGUI->Import(); - GeomGUI->ResetState(); - break; - } - case 113: // IMPORT STEP - { - GeomGUI->SetState(113); - GeomGUI->Import(); - GeomGUI->ResetState(); - break; - } - - case 121: // EXPORT BREP - { - GeomGUI->SetState(121); - GeomGUI->Export(); - GeomGUI->ResetState(); - break; - } - - case 122: // EXPORT IGES - { - GeomGUI->SetState(122); - GeomGUI->Export(); - GeomGUI->ResetState(); - break; - } - - case 123: // EXPORT STEP - { - GeomGUI->SetState(123); - GeomGUI->Export(); - GeomGUI->ResetState(); - break; - } - - case 303: // EXPLODE : use ic - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_SubShapeDlg *aDlg = new GeometryGUI_SubShapeDlg( parent, "", Sel, ic ) ; - break ; - } - - case 304: // GEOM::EDGE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_EdgeDlg *aDlg = new GeometryGUI_EdgeDlg( parent, "", Sel ) ; - break ; - } - - case 305: // GEOM::WIRE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_WireDlg *aDlg = new GeometryGUI_WireDlg( parent, "", Sel ) ; - break ; - } - - case 306: // GEOM::FACE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_FaceDlg *aDlg = new GeometryGUI_FaceDlg ( parent, "", Sel ) ; - break ; - } - - case 308: // GEOM::COMPOUND - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_CompoundDlg *aDlg = new GeometryGUI_CompoundDlg ( parent, "", Sel ) ; - break ; - } - - case 309: // SUPPRESS FACES : use ic - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_SuppressFacesDlg *aDlg = new GeometryGUI_SuppressFacesDlg( parent, "", Sel, ic ) ; - break ; - } - - case 314: // SUPPRESS HOLES : use ic - { - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_SuppressHoleDlg *aDlg = new GeometryGUI_SuppressHoleDlg( parent, "", Sel, ic ) ; - } - else { - GeomGUI->myDesktop->putInfo( tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; - } - break ; - } - case 501: // SEWING - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_SewingDlg *aDlg = new GeometryGUI_SewingDlg ( parent, "", Sel ) ; - break ; - } - - case 502: // ORIENTATION - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_OrientationDlg *aDlg = new GeometryGUI_OrientationDlg( parent, "", Sel ) ; - break ; - } - - case 601: // PROPERTIES (Length, surface, volume) - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_PropertiesDlg *aDlg = new GeometryGUI_PropertiesDlg( parent, "", Sel ) ; - break ; - } - - case 604: // CDG : Center of mass - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_CenterMassDlg *aDlg = new GeometryGUI_CenterMassDlg ( parent, "", Sel ) ; - break ; - } - - case 605: // INERTIA - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_InertiaDlg *aDlg = new GeometryGUI_InertiaDlg( parent, "", Sel ) ; - break ; - } - - case 607: // MAXTOLERANCE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_MaxToleranceDlg *aDlg = new GeometryGUI_MaxToleranceDlg( parent, "", Sel ) ; - break ; - } - - case 608: // WHATIS - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_WhatisDlg *aDlg = new GeometryGUI_WhatisDlg( parent, "", Sel ) ; - break ; - } - - case 609: // CHECKSHAPE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_CheckShape *aDlg = new GeometryGUI_CheckShape( parent, "", Sel ) ; - break ; - } - - case 701: // SETTINGS - COPY - { - QMenuData* pp; - QMenuItem* item = parent->menuBar()->findItem(701,&pp); - bool check = !pp->isItemChecked(701); - pp->setItemChecked(701,check); - Settings_Copy = check; - QAD_CONFIG->addSetting( "Geometry:SettingsCopy", Settings_Copy ); - break; - } - - case 702: // SETTINGS - ADD IN STUDY - { - QMenuData* pp; - QMenuItem* item = parent->menuBar()->findItem(702,&pp); - bool check = !pp->isItemChecked(702); - pp->setItemChecked(702,check); - Settings_AddInStudy = check; - - QAD_CONFIG->addSetting( "Geometry:SettingsAddInStudy", Settings_AddInStudy ); - break; - } - - case 703: // SETTINGS - SHADING COLOR - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - break; - - QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed"); - QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen"); - QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue"); - QColor color; - if( !SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty() ) { - color = QColor (SCr.toInt(), - SCg.toInt(), - SCb.toInt()); - } else { - Quantity_Color Default = Quantity_Color(); - color = QColor ( (int)Default.Red() * 255.0, - (int)Default.Green()* 255.0, - (int)Default.Blue() * 255.0 ); - } - - QColor c = QColorDialog::getColor( color, QAD_Application::getDesktop() ); - if ( c.isValid() ) { - GeomGUI->myShadingColor = Quantity_Color(c.red() / 255.0, - c.green()/ 255.0, - c.blue() / 255.0, - Quantity_TOC_RGB); - - 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()); - aSh->SetShadingColor( GeomGUI->myShadingColor ); - ic->Redisplay( aSh, Standard_True, Standard_True); - } - ite.Next(); - } - - ic->UpdateCurrentViewer(); - - QAD_CONFIG->addSetting("Geometry:SettingsShadingColorRed", c.red() ); - QAD_CONFIG->addSetting("Geometry:SettingsShadingColorGreen", c.green() ); - QAD_CONFIG->addSetting("Geometry:SettingsShadingColorBlue", c.blue() ); - } - break; - } - - - case 704: // SETTINGS - ISOS - { - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - break; - - QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU"); - QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV"); - if ( !IsoU.isEmpty() ) - ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt()); - else - IsoU = "1"; - if ( !IsoV.isEmpty() ) - ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt()); - else - IsoV = "1"; - - GeometryGUI_NbIsosDlg * NbIsosDlg = new GeometryGUI_NbIsosDlg( QAD_Application::getDesktop(), - tr("GEOM_MEN_ISOS"), TRUE ); - int UIso = IsoU.toInt(); - int VIso = IsoV.toInt(); - - NbIsosDlg->SpinBoxU->setValue(UIso) ; - NbIsosDlg->SpinBoxV->setValue(VIso) ; - - if ( NbIsosDlg->exec() ) { - UIso = NbIsosDlg->SpinBoxU->text().toInt() ; - VIso = NbIsosDlg->SpinBoxV->text().toInt() ; - - ic->DefaultDrawer()->UIsoAspect()->SetNumber(UIso); - ic->DefaultDrawer()->VIsoAspect()->SetNumber(VIso); - QAD_CONFIG->addSetting( "Geometry:SettingsIsoU", NbIsosDlg->SpinBoxU->text() ); /* text format */ - QAD_CONFIG->addSetting( "Geometry:SettingsIsoV", NbIsosDlg->SpinBoxV->text() ); /* text format */ - } - - AIS_ListOfInteractive List; - ic->DisplayedObjects(List); - AIS_ListOfInteractive List1; - ic->ObjectsInCollector(List1); - List.Append(List1); - - AIS_ListIteratorOfListOfInteractive ite(List); - ic->InitCurrent(); - if ( ic->NbCurrents() ) - while (ite.More()) { - if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { - - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); - Handle (AIS_Drawer) CurDrawer; - CurDrawer = aSh->Attributes(); - CurDrawer->UIsoAspect()->SetNumber( UIso ); - CurDrawer->VIsoAspect()->SetNumber( VIso ); - ic->SetLocalAttributes(aSh, CurDrawer); - ic->Redisplay(aSh); - } - ite.Next(); - } - ic->UpdateCurrentViewer(); - break; - } - - case 705: // SETTINGS : STEP VALUE FOR SPIN BOXES - { - //NRI if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - //NRI break; - - QString step = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ); - if( step.isEmpty() ) - step = "100.0" ; - - Standard_Boolean res = false ; - double dd = Parameter( res, QString("%1").arg(step), tr("GEOM_MEN_STEP_LABEL"), tr("GEOM_STEP_TITLE"), 0.001, 10000.0, 3 ) ; - if( res ) { - QAD_CONFIG->addSetting( "Geometry:SettingsGeomStep", QString("%1").arg(dd) ) ; - - /* Emit signal to GeometryGUI_SpinBoxes */ - GeomGUI->SignalDefaultStepValueChanged( dd ) ; - } - else - parent->putInfo(tr("GEOM_PRP_ABORT")); - - break ; - } - - case 801: // ADD IN STUDY - POPUP VIEWER - { - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - const SALOME_ListIO& ListSelected = Sel->StoredIObjects(); - SALOME_ListIteratorOfListIO It( ListSelected ); - for ( ; It.More(); It.Next() ) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - GeomGUI->AddInStudy(true, IObject); - } - /* Is set on the dialog box */ - QApplication::restoreOverrideCursor(); - break; - } - - case 901: // RENAME - { - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - for ( ; It.More(); It.Next() ) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - if ( !obj->_is_nil() ) { - if (obj->FindAttribute(anAttr, "AttributeName")) { - aName = SALOMEDS::AttributeName::_narrow(anAttr); - - QString nm = QString( aName->Value() ); - nm = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), nm ); - if ( !nm.isEmpty() ) { - QApplication::setOverrideCursor( Qt::waitCursor ); - GeomGUI->myActiveStudy->renameIObject( IObject, nm ); - QApplication::restoreOverrideCursor(); - } - } - } - } - break; - } - - case 903: // DISPLAY OBJECT BROWSER - { - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - // VTK - QApplication::setOverrideCursor( Qt::waitCursor ); - - SALOMEDS::SObject_var fatherSF = - aStudy->FindObjectID(GeomGUI->myActiveStudy->getActiveStudyFrame()->entry()); - - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - - for(;It.More();It.Next()) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); - - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIOR; - - if(myRenderInter->isInViewer(IObject)) { - myRenderInter->Display(IObject); - } - else { - // Create new actor - if ( !obj->_is_nil() ) { - if ( obj->FindAttribute(anAttr, "AttributeIOR")) { - // this SObject may be GEOM module root SObject - SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj); - bool useSubItems = false; - while (anIter->More() && !useSubItems) { - SALOMEDS::SObject_var subobj = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttr; - if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { - anAttr = aTmpAttr; - obj = subobj; - useSubItems = true; - } else anIter->Next(); - } - - while(useSubItems?anIter->More():!anAttr->_is_nil()) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value()); - TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape); - - if (obj->FindAttribute(anAttr, "AttributeName")) { - aName = SALOMEDS::AttributeName::_narrow(anAttr); - - vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); - vtkActorCollection* theAllActors = theRenderer->GetActors(); - theAllActors->InitTraversal(); - vtkActor* actor = (vtkActor*)theAllActors->GetNextActor(); - Handle(SALOME_InteractiveObject) anIObj; - // don't create new study object if it already exists - bool isDisplayed = false; - while(!(actor==NULL)) { - SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor); - if (Gactor!=NULL) { - if (Gactor->hasIO()) { - if (strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) { - isDisplayed = true; - anIObj = Gactor->getIO(); - if (!anIObj.IsNull()) myRenderInter->Display(anIObj); - } - } - } - actor=(vtkActor*)(theAllActors->GetNextActor()); - } - if (!isDisplayed) { - // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( GeomGUI->myActiveStudy ); - op->start(); - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, obj); - // commit transaction - op->finish(); - - vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); - int themode = myRenderInter->GetDisplayMode(); - - vtkActorCollection* theActors = - GEOM_AssemblyBuilder::BuildActors(Shape,0,themode,Standard_True); - theActors->InitTraversal(); - vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); - while(!(anActor==NULL)) { - GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor ); - Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), Fatherior,"GEOM"); - IO->setEntry(obj->GetID()); - GActor->setIO( IO ); - GActor->setName( IObject->getName() ); - - theRenderer->AddActor(GActor); - renWin->Render(); - anActor = (vtkActor*)theActors->GetNextActor(); - } - } - } - // next item iteration - if (useSubItems) { - anIter->Next(); - anAttr = SALOMEDS::GenericAttribute::_nil(); - while (anIter->More() && anAttr->_is_nil()) { - SALOMEDS::SObject_var subobject = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttribute; - if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { - anAttr = aTmpAttribute; - obj = subobject; - } else anIter->Next(); - } - } else anAttr = SALOMEDS::GenericAttribute::_nil(); - } - } - } - } - } - GeomGUI->myActiveStudy->updateObjBrowser( true ); - QApplication::restoreOverrideCursor(); - - } else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - QApplication::setOverrideCursor( Qt::waitCursor ); - - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - for(;It.More();It.Next()) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - - SALOMEDS::SObject_var fatherSF = - aStudy->FindObjectID( GeomGUI->myActiveStudy->getActiveStudyFrame()->entry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIOR; - - if ( v3d->isInViewer( IObject, true ) ) { - Standard_Boolean found; - Handle(GEOM_AISShape) aSh = GeomGUI->ConvertIOinGEOMAISShape( IObject, found, true ); - if ( found ) { - ic->Display(aSh); - ic->AddOrRemoveCurrentObject(aSh, true); - } - - } else { - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); - if ( !obj->_is_nil() ) { - if ( obj->FindAttribute(anAttr, "AttributeIOR")) { - // this SObject may be GEOM module root SObject - SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj); - bool useSubItems = false; - while (anIter->More() && !useSubItems) { - SALOMEDS::SObject_var subobj = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttr; - if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { - anAttr = aTmpAttr; - obj = subobj; - useSubItems = true; - } else anIter->Next(); - } - while(useSubItems?anIter->More():!anAttr->_is_nil()) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value()); - TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape); - if (obj->FindAttribute(anAttr, "AttributeName")) { - aName = SALOMEDS::AttributeName::_narrow(anAttr); - // searchin for already displayed objects with the same shape - AIS_ListOfInteractive aDisplayed; - ic->DisplayedObjects(aDisplayed); - AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed); - Handle(AIS_Shape) anAISShape; - for(;anIObjects.More();anIObjects.Next()) { - anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value()); - if (!anAISShape.IsNull()) { - if (anAISShape->Shape().IsSame(Shape)) break; - anAISShape.Nullify(); - } - } - if (!anAISShape.IsNull()) { - if (!ic->IsDisplayed(anAISShape)) ic->Display(anAISShape); - } else { - if (!useSubItems) { - // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( GeomGUI->myActiveStudy ); - op->start(); - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, obj); - // commit transaction - op->finish(); - } - - Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value()); - aSh->SetShadingColor( GeomGUI->myShadingColor ); - Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), - Fatherior, - "GEOM"); - IO->setEntry(obj->GetID()); - aSh->setIO( IO ); - aSh->setName( aName->Value() ); - ic->Display (aSh); - if (!useSubItems) ic->AddOrRemoveCurrentObject(aSh, true); - } - } - // next item iteration - if (useSubItems) { - anIter->Next(); - anAttr=SALOMEDS::GenericAttribute::_nil(); - while (anIter->More() && anAttr->_is_nil()) { - SALOMEDS::SObject_var subobject = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttribute; - if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { - anAttr = aTmpAttribute; - obj = subobject; - } else anIter->Next(); - } - } else anAttr = SALOMEDS::GenericAttribute::_nil(); - } - } - } - } - } - GeomGUI->myActiveStudy->updateObjBrowser( true ); - QApplication::restoreOverrideCursor(); - } - break; - } - - case 3011: // POINT - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_PointDlg *aDlg = new GeometryGUI_PointDlg( parent, "", Sel, ic ) ; - break; - } - - case 3012: // LINE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_LineDlg *aDlg = new GeometryGUI_LineDlg( parent, "", Sel ) ; - break ; - } - - case 3013: // CIRCLE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_CircleDlg *aDlg = new GeometryGUI_CircleDlg( parent, "", Sel ) ; - break ; - } - - case 3014: // ELLIPSE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_EllipseDlg *aDlg = new GeometryGUI_EllipseDlg( parent, "", Sel ) ; - break ; - } - - case 3015: // ARC - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_ArcDlg *aDlg = new GeometryGUI_ArcDlg( parent, "", Sel ) ; - break ; - } - - case 3016: // VECTOR - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_VectorDlg *aDlg = new GeometryGUI_VectorDlg( parent, "", Sel ) ; - break; - } - - case 3017: // PLANE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_PlaneDlg *aDlg = new GeometryGUI_PlaneDlg( parent, "", Sel ) ; - break; - } - - case 3018: // WORKING PLANE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_WorkingPlaneDlg *aDlg = new GeometryGUI_WorkingPlaneDlg( parent, "", Sel ) ; - break; - } - - case 312: // SKETCHER - { - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC) - break; - - GeomGUI->EmitSignalDeactivateDialog() ; - - ((OCCViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTop(); // DCQ : 28/02/2002 - - GeomGUI->mySketcher = Sketch( v3d->getViewer3d() ); - GeomGUI->SetState(CURRENT_SKETCH); - - QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar(); - QMenuData* pp; - - QMenuItem* item = Mb->findItem(10010,&pp); - GeomGUI->mySketcher.SetParameterVisibility(LENGTH_PARAMETER,pp->isItemChecked(10010)); - item = Mb->findItem(10011,&pp); - GeomGUI->mySketcher.SetParameterVisibility(ANGLE_PARAMETER,pp->isItemChecked(10011)); - item = Mb->findItem(10012,&pp); - GeomGUI->mySketcher.SetParameterVisibility(RADIUS_PARAMETER,pp->isItemChecked(10012)); - item = Mb->findItem(10013,&pp); - GeomGUI->mySketcher.SetParameterVisibility(XVALUE_PARAMETER,pp->isItemChecked(10013)); - item = Mb->findItem(10014,&pp); - GeomGUI->mySketcher.SetParameterVisibility(YVALUE_PARAMETER,pp->isItemChecked(10014)); - - GeomGUI->mySketcher.SetTransitionStatus(NOCONSTRAINT); - item = Mb->findItem(3133,&pp); - pp->setItemChecked(3133,false); - item = Mb->findItem(3134,&pp); - pp->setItemChecked(3134,false); - break; - } - - case 3021: // BOX - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_BoxDlg *aDlg = new GeometryGUI_BoxDlg( parent, "", Sel ) ; - break; - } - - case 3022: // CYLINDER - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_CylinderDlg *aDlg = new GeometryGUI_CylinderDlg( parent, "", Sel ) ; - break; - } - - case 3023: // SPHERE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_SphereDlg *aDlg = new GeometryGUI_SphereDlg( parent, "", Sel ) ; - break; - } - - case 3024: // TORUS - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_TorusDlg *aDlg = new GeometryGUI_TorusDlg( parent, "", Sel ) ; - break; - } - - case 3025: // CONE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_ConeDlg *aDlg = new GeometryGUI_ConeDlg( parent, "", Sel ) ; - break; - } - - case 3131: - { - break; - } - - case 3133: // sketcher - { - QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(3133,&pp); - pp->setItemChecked(3133,!pp->isItemChecked(3133)); - if (pp->isItemChecked(3133) == true) - GeomGUI->mySketcher.SetTransitionStatus(TANGENT); - else - GeomGUI->mySketcher.SetTransitionStatus(NOCONSTRAINT); - - pp->setItemChecked(3134,false); - break; - } - - case 3134: // sketcher - { - QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(3134,&pp); - pp->setItemChecked(3134,!pp->isItemChecked(3134)); - if (pp->isItemChecked(3134) == true) - GeomGUI->mySketcher.SetTransitionStatus(PERPENDICULAR); - else - GeomGUI->mySketcher.SetTransitionStatus(NOCONSTRAINT); - - pp->setItemChecked(3133,false); - break; - } - - case 4011: // FUSE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_FuseDlg *aDlg = new GeometryGUI_FuseDlg( parent, "", Sel ) ; - break; - } - - case 4012: // COMMON - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_CommonDlg *aDlg = new GeometryGUI_CommonDlg( parent, "", Sel ) ; - break; - } - - case 4013: // CUT - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_CutDlg *aDlg = new GeometryGUI_CutDlg( parent, "", Sel ) ; - break; - } - - case 4014: // SECTION - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_SectionDlg *aDlg = new GeometryGUI_SectionDlg( parent, "", Sel ) ; - break; - } - - case 4021: // TRANSLATION - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_TranslationDlg *aDlg = new GeometryGUI_TranslationDlg( parent, "", Sel ) ; - break; - } - - case 4022: // ROTATION - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_RotationDlg *aDlg = new GeometryGUI_RotationDlg( parent, "", Sel ) ; - break; - } - - case 4030: // MULTI TRANSLATION - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_MultiTranslationDlg *aDlg = new GeometryGUI_MultiTranslationDlg( parent, "", Sel ) ; - break; - } - - case 4040: // MULTI ROTATION - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_MultiRotationDlg *aDlg = new GeometryGUI_MultiRotationDlg( parent, "", Sel ) ; - break; - } - - case 4023: // MIRROR - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_MirrorDlg *aDlg = new GeometryGUI_MirrorDlg( parent, "", Sel ) ; - break; - } - - case 4024: // SCALE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_ScaleDlg *aDlg = new GeometryGUI_ScaleDlg( parent, "", Sel ) ; - break; - } - - case 4025: // PARTITION - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_PartitionDlg *aDlg = new GeometryGUI_PartitionDlg( parent, "", Sel ) ; - break; - } - - case 4026: // ARCHIMEDE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_ArchimedeDlg *aDlg = new GeometryGUI_ArchimedeDlg( parent, "", Sel ) ; - break; - } - - case 4027: // FILLET - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_FilletDlg *aDlg = new GeometryGUI_FilletDlg( parent, "", Sel, ic ) ; - break; - } - - case 4028: // CHAMFER - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_ChamferDlg *aDlg = new GeometryGUI_ChamferDlg( parent, "", Sel, ic ) ; - break; - } - - case 4031: // PRISM - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_PrismDlg *aDlg = new GeometryGUI_PrismDlg( parent, "", Sel ) ; - break; - } - - case 4032: // REVOL - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_RevolDlg *aDlg = new GeometryGUI_RevolDlg( parent, "", Sel ) ; - break; - } - - case 4033: // FILLING - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_FillingDlg *aDlg = new GeometryGUI_FillingDlg( parent, "", Sel ) ; - break; - } - - case 4034: // PIPE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_PipeDlg *aDlg = new GeometryGUI_PipeDlg(parent, "", Sel ) ; - break; - } - - case 5001: // CHECK GEOMETRY - { - QAD_PyEditor* PyEditor = GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getPyEditor(); - PyEditor->setText("from GEOM_usinggeom import *\n"); - PyEditor->setText(">>> "); - PyEditor->handleReturn(); - break; - } - - case 6021: // SHADING - WIREFRAME - { - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - VTKViewer_RenderWindowInteractor* myRenderInter= - ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - QApplication::setOverrideCursor(waitCursor); - - int themode = myRenderInter->GetDisplayMode(); - if( themode==0 ) { - myRenderInter->SetDisplayMode(1); - GeomGUI->GetDesktop()->menuBar()->changeItem(6021, tr("GEOM_MEN_WIREFRAME") ); - } else { - myRenderInter->SetDisplayMode(0); - GeomGUI->GetDesktop()->menuBar()->changeItem(6021, tr("GEOM_MEN_SHADING") ); - } - - QApplication::restoreOverrideCursor(); - - } else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - AIS_DisplayMode mode = ( AIS_DisplayMode )ic->DisplayMode(); - QApplication::setOverrideCursor( Qt::waitCursor ); - AIS_DisplayMode newmode = (mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame); - - 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()); - ic->SetDisplayMode(aSh,Standard_Integer(newmode),true); - } - ite.Next(); - } - - ic->SetDisplayMode( newmode, Standard_False); - if ( newmode == 1 ) - GeomGUI->GetDesktop()->menuBar()->changeItem(6021, tr("GEOM_MEN_WIREFRAME") ); - else - GeomGUI->GetDesktop()->menuBar()->changeItem(6021, tr("GEOM_MEN_SHADING") ); - - QApplication::restoreOverrideCursor(); - } - break; - } - - case 6022: // DISPLAY ALL - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) - //VTK - ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll(); - else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) - GeomGUI->OnDisplayAll(); - break; - } - - case 6023: // DISPLAY ONLY - case 8023: // DISPLAY ONLY - POPUP VIEWER - { - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - // VTK - GeomGUI->OnVTKDisplayOnly(); - } - else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) - GeomGUI->OnDisplayOnly(); - break; - } - - case 6024: // ERASE ALL - { - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - //VTK - ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->EraseAll(); - } - else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - ic->EraseAll(Standard_True, Standard_False); - ic->Display(v3d->getTrihedron()); - } - - //NRI SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); - //NRI Sel->ClearInteractiveObjects(); - break; - } - - case 6025 : // ERASE ONLY - case 8022 : // ERASE - POPUP VIEWER - { - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - // VTK - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - Handle(SALOME_InteractiveObject) anIObject; - for(;It.More();It.Next()) { - anIObject = It.Value(); - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - if(myRenderInter->isInViewer(anIObject)) { - myRenderInter->Erase(anIObject); - } else { - SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() ); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if ( !obj->_is_nil() ) { - if ( obj->FindAttribute(anAttr, "AttributeIOR")) { - // this SObject may be GEOM module root SObject - SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj); - bool useSubItems = false; - while (anIter->More() && !useSubItems) { - SALOMEDS::SObject_var subobj = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttr; - if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { - anAttr = aTmpAttr; - obj = subobj; - useSubItems = true; - } else anIter->Next(); - } - - while(useSubItems?anIter->More():!anAttr->_is_nil()) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value()); - TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape); - if (obj->FindAttribute(anAttr, "AttributeName")) { - // searchin for already displayed objects with the same shape - vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); - vtkActorCollection* theAllActors = theRenderer->GetActors(); - theAllActors->InitTraversal(); - vtkActor* actor = (vtkActor*)theAllActors->GetNextActor(); - Handle(SALOME_InteractiveObject) anIObj; - // don't create new study object if it already exists - bool isDisplayed = false; - while(!(actor==NULL)) { - SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor); - if (Gactor!=NULL) { - if (Gactor->hasIO()) { - if (strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) { - isDisplayed = true; - anIObj = Gactor->getIO(); - if (!anIObj.IsNull()) myRenderInter->Erase(anIObj); - } - } - } - actor=(vtkActor*)(theAllActors->GetNextActor()); - } - } - if (useSubItems) { - anIter->Next(); - anAttr=SALOMEDS::GenericAttribute::_nil(); - while (anIter->More() && anAttr->_is_nil()) { - SALOMEDS::SObject_var subobject = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttribute; - if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { - anAttr = aTmpAttribute; - obj = subobject; - } else anIter->Next(); - } - } else anAttr = SALOMEDS::GenericAttribute::_nil(); - } - } - } - } - } -// SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); -// for(;It.More();It.Next()) { -// Handle(SALOME_InteractiveObject) IOS = It.Value(); - // GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getVTKView()->getRWInteractor()->Erase(IOS);; - } - else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - // OCC - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - Handle(SALOME_InteractiveObject) anIObject; - for(;It.More();It.Next()) { - anIObject = It.Value(); - if ( v3d->isInViewer( anIObject, true ) ) { - Standard_Boolean found; - Handle(GEOM_AISShape) aSh = GeomGUI->ConvertIOinGEOMAISShape( anIObject, found, true ); - if ( found ) { - ic->Erase(aSh); - ic->AddOrRemoveCurrentObject(aSh, true); - } - } else { - SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() ); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if ( !obj->_is_nil() ) { - if ( obj->FindAttribute(anAttr, "AttributeIOR")) { - // this SObject may be GEOM module root SObject - SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj); - bool useSubItems = false; - while (anIter->More() && !useSubItems) { - SALOMEDS::SObject_var subobj = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttr; - if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { - anAttr = aTmpAttr; - obj = subobj; - useSubItems = true; - } else anIter->Next(); - } - - while(useSubItems?anIter->More():!anAttr->_is_nil()) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value()); - TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape); - if (obj->FindAttribute(anAttr, "AttributeName")) { - // searchin for already displayed objects with the same shape - AIS_ListOfInteractive aDisplayed; - ic->DisplayedObjects(aDisplayed); - AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed); - Handle(AIS_Shape) anAISShape; - for(;anIObjects.More();anIObjects.Next()) { - anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value()); - if (!anAISShape.IsNull()) { - if (anAISShape->Shape().IsSame(Shape)) break; - anAISShape.Nullify(); - } - } - if (!anAISShape.IsNull()) { - if (ic->IsDisplayed(anAISShape)) ic->Erase(anAISShape); - } - } - if (useSubItems) { - anIter->Next(); - anAttr=SALOMEDS::GenericAttribute::_nil(); - while (anIter->More() && anAttr->_is_nil()) { - SALOMEDS::SObject_var subobject = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttribute; - if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { - anAttr = aTmpAttribute; - obj = subobject; - } else anIter->Next(); - } - } else anAttr = SALOMEDS::GenericAttribute::_nil(); - } - } - } - } - } - } - Sel->ClearIObjects(); - break; - } - - - case 6060: // BOUNDING BOX - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_BndBoxDlg *aDlg = new GeometryGUI_BndBoxDlg(parent, "", Sel ) ; - break ; - } - - case 6061: // MIN DISTANCE - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_DistanceDlg *aDlg = new GeometryGUI_DistanceDlg(parent, "", Sel ) ; - break ; - } - - case 8021: // WIREFRAME-SHADING - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - // VTK - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); - - QApplication::setOverrideCursor( Qt::waitCursor ); - for(;It.More();It.Next()) { - Handle(SALOME_InteractiveObject) IOS = It.Value(); - myRenderInter->SwitchRepresentation(IOS, false); - } - myRenderInter->Render(); - QApplication::restoreOverrideCursor(); - } - else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - QApplication::setOverrideCursor( Qt::waitCursor ); - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - for(;It.More();It.Next()) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - Standard_Boolean found; - Handle(GEOM_AISShape) Shape = GeomGUI->ConvertIOinGEOMAISShape( IObject, found, true ); - if (!Shape.IsNull()) { - AIS_DisplayMode mode = ( AIS_DisplayMode )Shape->DisplayMode(); - if ( mode == -1 ) - mode = ( AIS_DisplayMode )ic->DisplayMode(); - - QApplication::setOverrideCursor( Qt::waitCursor ); - ic->SetDisplayMode(Shape, mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame, false); - } - QApplication::restoreOverrideCursor(); - } - ic->UpdateCurrentViewer(); - } - QApplication::restoreOverrideCursor(); - break; - } - - case 8031: // COLOR - POPUP VIEWER - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - // VTK - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); - - Handle(SALOME_InteractiveObject) FirstIOS = Sel->firstIObject(); - if(!FirstIOS.IsNull()) { - - QColor initcolor = myRenderInter->GetColor(FirstIOS); - - QColor c = QColorDialog::getColor( initcolor, - QAD_Application::getDesktop() ); - - if ( c.isValid() ) { - QApplication::setOverrideCursor( Qt::waitCursor ); - for(;It.More();It.Next()) { - Handle(SALOME_InteractiveObject) IOS = It.Value(); - myRenderInter->SetColor(IOS,c); - } - } - QApplication::restoreOverrideCursor(); - } - } - else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - Handle(SALOME_InteractiveObject) IO = Sel->firstIObject(); - Standard_Boolean found; - Handle(GEOM_AISShape) Shape = GeomGUI->ConvertIOinGEOMAISShape(IO, found, true); - if ( found ) { - Quantity_Color CSFColor; - Shape->Color( CSFColor ); - - QColor c = QColorDialog::getColor( QColor(CSFColor.Red() * 255.0, - CSFColor.Green()* 255.0, - CSFColor.Blue() * 255.0 ), - QAD_Application::getDesktop() ); - - if ( c.isValid() ) { - CSFColor = Quantity_Color ( c.red()/255., c.green()/255., c.blue()/255., Quantity_TOC_RGB ); - QApplication::setOverrideCursor( Qt::waitCursor ); - - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - for(;It.More();It.Next()) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - Standard_Boolean found; - Handle(GEOM_AISShape) Shape = GeomGUI->ConvertIOinGEOMAISShape(IObject, found, true); - if ( found ) { - Shape->SetColor ( CSFColor ); - Shape->SetShadingColor ( CSFColor ); - } - } - } - } - } - QApplication::restoreOverrideCursor(); - break; - } - - case 8032: // TRANSPARENCY - POPUP VIEWER - { - GeomGUI->EmitSignalDeactivateDialog() ; - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - GeometryGUI_TransparencyDlg *aDlg = new GeometryGUI_TransparencyDlg( parent, "", Sel, ic ) ; - break ; - } - - case 8033: // ISOS - POPUP VIEWER - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - break; - else { - ic->InitCurrent(); - if ( ic->MoreCurrent() ) { - Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); - QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU"); - QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV"); - - if ( !IsoU.isEmpty() ) - ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt()); - else - IsoU = "1"; - if ( !IsoV.isEmpty() ) - ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt()); - else - IsoV = "1"; - - GeometryGUI_NbIsosDlg * NbIsosDlg = - new GeometryGUI_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE ); - - NbIsosDlg->SpinBoxU->setValue(IsoU.toInt()); - NbIsosDlg->SpinBoxV->setValue(IsoV.toInt()); - - if ( NbIsosDlg->exec() ) { - QApplication::setOverrideCursor( Qt::waitCursor ); - for ( ; ic->MoreCurrent (); ic->NextCurrent () ) { - Handle (AIS_Drawer) CurDrawer; - - CurDrawer = ic->Current()->Attributes(); - CurDrawer->UIsoAspect()->SetNumber( NbIsosDlg->SpinBoxU->text().toInt() ); - CurDrawer->VIsoAspect()->SetNumber( NbIsosDlg->SpinBoxV->text().toInt() ); - - ic->SetLocalAttributes(CurObject, CurDrawer); - ic->Redisplay(CurObject); - } - } - } - } - QApplication::restoreOverrideCursor(); - break; - } - - case 9022 : // ERASE - OBJBROSER POPUP - { - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - // VTK - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - Handle(SALOME_InteractiveObject) anIObject; - for(;It.More();It.Next()) { - anIObject = It.Value(); - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - -// Handle(SALOME_InteractiveObject) IObject; - if(myRenderInter->isInViewer(anIObject)) { - myRenderInter->Erase(anIObject); - } else { - SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() ); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if ( !obj->_is_nil() ) { - if ( obj->FindAttribute(anAttr, "AttributeIOR")) { - // this SObject may be GEOM module root SObject - SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj); - bool useSubItems = false; - while (anIter->More() && !useSubItems) { - SALOMEDS::SObject_var subobj = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttr; - if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { - anAttr = aTmpAttr; - obj = subobj; - useSubItems = true; - } else anIter->Next(); - } - - while(useSubItems?anIter->More():!anAttr->_is_nil()) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value()); - TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape); - if (obj->FindAttribute(anAttr, "AttributeName")) { - // searchin for already displayed objects with the same shape - vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); - vtkActorCollection* theAllActors = theRenderer->GetActors(); - theAllActors->InitTraversal(); - vtkActor* actor = (vtkActor*)theAllActors->GetNextActor(); - Handle(SALOME_InteractiveObject) anIObj; - // don't create new study object if it already exists - bool isDisplayed = false; - while(!(actor==NULL)) { - SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor); - if (Gactor!=NULL) { - if (Gactor->hasIO()) { - if (strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) { - isDisplayed = true; - anIObj = Gactor->getIO(); - if (!anIObj.IsNull()) myRenderInter->Erase(anIObj); - } - } - } - actor=(vtkActor*)(theAllActors->GetNextActor()); - } - } - if (useSubItems) { - anIter->Next(); - anAttr=SALOMEDS::GenericAttribute::_nil(); - while (anIter->More() && anAttr->_is_nil()) { - SALOMEDS::SObject_var subobject = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttribute; - if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { - anAttr = aTmpAttribute; - obj = subobject; - } else anIter->Next(); - } - } else anAttr = SALOMEDS::GenericAttribute::_nil(); - } - } - } - } -// SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); -// for(;It.More();It.Next()) { -// Handle(SALOME_InteractiveObject) IOS = It.Value(); -// GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getVTKView()->getRWInteractor()->Erase(IOS);; - } -// SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); -// for(;It.More();It.Next()) { -// Handle(SALOME_InteractiveObject) IOS = It.Value(); -// GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getVTKView()->getRWInteractor()->Erase(IOS);; -// } - } - else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - // OCC - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - Handle(SALOME_InteractiveObject) anIObject; - for(;It.More();It.Next()) { - anIObject = It.Value(); - if ( v3d->isInViewer( anIObject, true ) ) { - Standard_Boolean found; - Handle(GEOM_AISShape) aSh = GeomGUI->ConvertIOinGEOMAISShape( anIObject, found, true ); - if ( found ) { - ic->Erase(aSh); - ic->AddOrRemoveCurrentObject(aSh, true); - } - } else { - SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() ); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if ( !obj->_is_nil() ) { - if ( obj->FindAttribute(anAttr, "AttributeIOR")) { - // this SObject may be GEOM module root SObject - SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj); - bool useSubItems = false; - while (anIter->More() && !useSubItems) { - SALOMEDS::SObject_var subobj = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttr; - if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { - anAttr = aTmpAttr; - obj = subobj; - useSubItems = true; - } else anIter->Next(); - } - - while(useSubItems?anIter->More():!anAttr->_is_nil()) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value()); - TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape); - if (obj->FindAttribute(anAttr, "AttributeName")) { - // searchin for already displayed objects with the same shape - AIS_ListOfInteractive aDisplayed; - ic->DisplayedObjects(aDisplayed); - AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed); - Handle(AIS_Shape) anAISShape; - for(;anIObjects.More();anIObjects.Next()) { - anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value()); - if (!anAISShape.IsNull()) { - if (anAISShape->Shape().IsSame(Shape)) break; - anAISShape.Nullify(); - } - } - if (!anAISShape.IsNull()) { - if (ic->IsDisplayed(anAISShape)) ic->Erase(anAISShape); - } - } - if (useSubItems) { - anIter->Next(); - anAttr=SALOMEDS::GenericAttribute::_nil(); - while (anIter->More() && anAttr->_is_nil()) { - SALOMEDS::SObject_var subobject = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttribute; - if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { - anAttr = aTmpAttribute; - obj = subobject; - } else anIter->Next(); - } - } else anAttr = SALOMEDS::GenericAttribute::_nil(); - } - } - } - } - } -// QAD_Viewer3d* v3d = GeomGUI->myActiveStudy->getActiveStudyFrame()->getViewerOCC(); -// Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); -// myContext->EraseSelected(); - } - - Sel->ClearIObjects(); - break; - } - - case 9023 : // DISPLAY ONLY - OBJBROSER POPUP - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) - GeomGUI->OnVTKDisplayOnly(); - else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) - GeomGUI->OnDisplayOnly(); - break; - } - - case 9024 : // OPEN - OBJBROSER POPUP - { - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - Handle(SALOME_InteractiveObject) anIObject; - for(;It.More();It.Next()) { - anIObject = It.Value(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( anIObject->getEntry() ); - SALOMEDS::AttributePersistentRef_var aPersist; - SALOMEDS::AttributeIOR_var anIOR; - if ( !obj->_is_nil() ) { - // this SObject may be GEOM module root SObject - SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj); - SALOMEDS::GenericAttribute_var anAttr; - bool useSubItems = false; - while (anIter->More() && !useSubItems) { - SALOMEDS::SObject_var subobj = anIter->Value(); - if (subobj->FindAttribute(anAttr, "AttributePersistentRef")) { - useSubItems = true; - obj = subobj; - } - else anIter->Next(); - } - obj->FindAttribute(anAttr, "AttributePersistentRef"); - - while(useSubItems?anIter->More():!anAttr->_is_nil()) { - if (!obj->FindAttribute(anAttr, "AttributeIOR") && - obj->FindAttribute(anAttr, "AttributePersistentRef")) { - // load - Engines::Component_var comp = GeomGUI->myDesktop->getEngine("FactoryServer","GEOM"); - if (!CORBA::is_nil(comp)) { - SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp); - - - SALOMEDS::StudyBuilder_var aStudyBuilder = GeomGUI->myActiveStudy->getStudyDocument()->NewBuilder(); - aStudyBuilder->LoadWith(GeomGUI->myActiveStudy->getStudyDocument()->FindComponent("GEOM"),driver); - - } else { - MESSAGE("Component is null"); - } - } - if (useSubItems) { - anIter->Next(); - obj = anIter->Value(); - } else anAttr = SALOMEDS::GenericAttribute::_nil(); - } - } - } - break; - } - - case 10000 : // SKETCH Segment - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - break; - GeomGUI->OnSketchSegment(); - break; - } - case 10001 : // SKETCH Arc - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - break; - GeomGUI->OnSketchArc(); - break; - } - case 10002 : // SKETCH Set Angle - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - break; - GeomGUI->OnSketchSetAngle(); - break; - } - case 10003 : // SKETCH Set X - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - break; - GeomGUI->OnSketchSetx(); - break; - } - case 10004 : // SKETCH Set Y - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - break; - GeomGUI->OnSketchSety(); - break; - } - case 10006 : // SKETCH Delete - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - break; - GeomGUI->OnSketchDelete(); - break; - } - case 10007 : // SKETCH End - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - break; - GeomGUI->OnSketchEnd(); - break; - } - case 10008 : // SKETCH Close - { - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - break; - GeomGUI->OnSketchClose(); - break; - } - case 10010 : // SKETCH OptionsOnofflengthdimension - { - GeomGUI->OnSketchOptionsOnofflengthdimension(); - break; - } - case 10011 : // SKETCH OptionsOnoffangledimension - { - GeomGUI->OnSketchOptionsOnoffangledimension(); - break; - } - case 10012 : // SKETCH OptionsOnoffradiusdimension - { - GeomGUI->OnSketchOptionsOnoffradiusdimension(); - break; - } - case 10013 : // SKETCH OptionsOnoffxdimension - { - GeomGUI->OnSketchOptionsOnoffxdimension(); - break; - } - case 10014 : // SKETCH OptionsOnoffydimension - { - GeomGUI->OnSketchOptionsOnoffydimension(); - break; - } - - default: - { - parent->putInfo( tr("GEOM_PRP_COMMAND").arg(theCommandID ) ); - break; - } + else { + if(GeomGUI->myState == 2) { + Mb->setItemEnabled(405, false);//SKETCHER + GeomGUI->GetSketcher().Clear(); + GeomGUI->myState = -1; } - - return true ; -} -//======================================================================= -// function : ConvertClickToPoint() -// purpose : Returns the point clicked in 3D view -//======================================================================= -gp_Pnt GeometryGUI::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 : 0nMousePress() -// purpose : [static] manage mouse events -//================================================================================== -bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) -{ - MESSAGE ( "GeometryGUI::OnMousePress") - GeometryGUI::GetOrCreateGeometryGUI(parent); - - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - return false; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort(); - - /* Get the clicked or selected point */ - gp_Pnt thePoint; - - if ( GeomGUI->myState == CURRENT_SKETCH) { - GeomGUI->mySketcher.ValidateEdge(); - if (GeomGUI->mySketcher.GetmyEdgesNumber() == 1 ) { - QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(313,&pp); - pp->setItemEnabled( 313, true); // SKETCH CONTRAINTS + if(theCommandID == 111 || // MENU FILE - IMPORT BREP + theCommandID == 112 || // MENU FILE - IMPORT IGES + theCommandID == 113 || // MENU FILE - IMPORT STEP + theCommandID == 121 || // MENU FILE - EXPORT BREP + theCommandID == 122 || // MENU FILE - EXPORT IGES + theCommandID == 123 || // MENU FILE - EXPORT STEP + theCommandID == 31 || // MENU EDIT - COPY + theCommandID == 33 || // MENU EDIT - DELETE + theCommandID == 411 || // MENU SETTINGS - ADD IN STUDY + theCommandID == 412 || // MENU SETTINGS - SHADING COLOR + theCommandID == 413 || // MENU SETTINGS - ISOS + theCommandID == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES + theCommandID == 5103 || // MENU TOOLS - CHECK GEOMETRY + theCommandID == 5104 || // MENU TOOLS - LOAD SCRIPT + theCommandID == 8032 || // POPUP VIEWER - COLOR + theCommandID == 8033 || // POPUP VIEWER - TRANSPARENCY + theCommandID == 8034 || // POPUP VIEWER - ISOS + theCommandID == 804 || // POPUP VIEWER - ADD IN STUDY + theCommandID == 901 || // OBJECT BROWSER - RENAME + theCommandID == 9024) { // OBJECT BROWSER - OPEN + if(!GeomGUI->LoadLibrary("libGEOMToolsGUI.so")) + return false; + } + else if(theCommandID == 211 || // MENU VIEW - WIREFRAME/SHADING + theCommandID == 212 || // MENU VIEW - DISPLAY ALL + theCommandID == 213 || // MENU VIEW - DISPLAY ONLY + theCommandID == 214 || // MENU VIEW - ERASE ALL + theCommandID == 215 || // MENU VIEW - ERASE ONLY + theCommandID == 8031) { // POPUP VIEWER - WIREFRAME/SHADING + if(!GeomGUI->LoadLibrary("libDisplayGUI.so")) + return false; + } + else if(theCommandID == 4011 || // MENU BASIC - POINT + theCommandID == 4012 || // MENU BASIC - LINE + theCommandID == 4013 || // MENU BASIC - CIRCLE + theCommandID == 4014 || // MENU BASIC - ELLIPSE + theCommandID == 4015 || // MENU BASIC - ARC + theCommandID == 4016 || // MENU BASIC - VECTOR + theCommandID == 4017 || // MENU BASIC - PLANE + theCommandID == 4018) { // MENU BASIC - WPLANE + if(!GeomGUI->LoadLibrary("libBasicGUI.so")) + return false; + } + else if(theCommandID == 4021 || // MENU PRIMITIVE - BOX + theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER + theCommandID == 4023 || // MENU PRIMITIVE - SPHERE + theCommandID == 4024 || // MENU PRIMITIVE - TORUS + theCommandID == 4025) { // MENU PRIMITIVE - CONE + if(!GeomGUI->LoadLibrary("libPrimitiveGUI.so")) + return false; + } + else if(theCommandID == 4031 || // MENU GENERATION - PRISM + theCommandID == 4032 || // MENU GENERATION - REVOLUTION + theCommandID == 4033 || // MENU GENERATION - FILLING + theCommandID == 4034) { // MENU GENERATION - PIPE + if(!GeomGUI->LoadLibrary("libGenerationGUI.so")) + return false; + } + else if(theCommandID == 404 || // SKETCHER + theCommandID == 407) { // MENU ENTITY - EXPLODE + if(!GeomGUI->LoadLibrary("libEntityGUI.so")) + return false; + } + else if(theCommandID == 4081 || // MENU BUILD - EDGE + theCommandID == 4082 || // MENU BUILD - WIRE + theCommandID == 4083 || // MENU BUILD - FACE + theCommandID == 4084 || // MENU BUILD - SHELL + theCommandID == 4085 || // MENU BUILD - SOLID + theCommandID == 4086) { // MENU BUILD - COMPUND + if(!GeomGUI->LoadLibrary("libBuildGUI.so")) + return false; + } + else if(theCommandID == 5011 || // MENU BOOLEAN - FUSE + theCommandID == 5012 || // MENU BOOLEAN - COMMON + theCommandID == 5013 || // MENU BOOLEAN - CUT + theCommandID == 5014) { // MENU BOOLEAN - SECTION + if(!GeomGUI->LoadLibrary("libBooleanGUI.so")) + return false; + } + else if(theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION + theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION + theCommandID == 5023 || // MENU TRANSFORMATION - MIRROR + theCommandID == 5024 || // MENU TRANSFORMATION - SCALE + theCommandID == 5025 || // MENU TRANSFORMATION - MULTI-TRANSLATION + theCommandID == 5026) { // MENU TRANSFORMATION - MULTI-ROTATION + if(!GeomGUI->LoadLibrary("libTransformationGUI.so")) + return false; + } + else if(theCommandID == 503 || // MENU OPERATION - PARTITION + theCommandID == 504 || // MENU OPERATION - ARCHIMEDE + theCommandID == 505 || // MENU OPERATION - FILLET + theCommandID == 506) { // MENU OPERATION - CHAMFER + if(!GeomGUI->LoadLibrary("libOperationGUI.so")) + return false; + } + else if(theCommandID == 601 || // MENU REPAIR - SEWING + theCommandID == 602 || // MENU REPAIR - ORIENTATION + theCommandID == 603 || // MENU REPAIR - SUPPRESS FACES + theCommandID == 604) { // MENU REPAIR - SUPPRESS HOLE + if(!GeomGUI->LoadLibrary("libRepairGUI.so")) + return false; + } + else if(theCommandID == 701 || // MENU MEASURE - PROPERTIES + theCommandID == 702 || // MENU MEASURE - CDG + theCommandID == 703 || // MENU MEASURE - INERTIA + theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX + theCommandID == 7042 || // MENU MEASURE - MIN DISTANCE + theCommandID == 705 || // MENU MEASURE - TOLERANCE + theCommandID == 706 || // MENU MEASURE - WHATIS + theCommandID == 707) { // MENU MEASURE - CHECK + if(!GeomGUI->LoadLibrary("libMeasureGUI.so")) + return false; } - } else if( GeomGUI->myState == POINT_METHOD ) { - - GeomGUI->EraseSimulationShape() ; - GeometryGUI_PointDlg *DialogPt = (GeometryGUI_PointDlg*)(GeomGUI->myActiveDialogBox) ; - - if ( DialogPt->UseLocalContext() ) { - ic->InitSelected(); - if ( pe->state() == Qt::ShiftButton ) - v3d->getAISSelector()->shiftSelect(); /* Append selection */ - else - v3d->getAISSelector()->select(); /* New selection */ - - if ( ic->MoreSelected() ) { - thePoint = BRep_Tool::Pnt( TopoDS::Vertex(ic->SelectedShape()) ); - } - else - thePoint = ConvertClickToPoint(pe->x(), pe->y(), ( (OCCViewer_ViewPort3d*)vp)->getView() ); - } else - thePoint = ConvertClickToPoint(pe->x(), pe->y(), ( (OCCViewer_ViewPort3d*)vp)->getView() ); - - if( DialogPt != 0 ) { - DialogPt->PointIntoCoordinates(thePoint, true) ; /* display point */ - } - else { - // MESSAGE ("On Mouse Press : myActiveDialogBox is null" << endl) ; - GeomGUI->myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - } + return false; } - - return false ; -} - - -//======================================================================= -// function : OnMouseMove() -// purpose : [static] manage mouse events -//======================================================================= -bool GeometryGUI::OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) -{ - GeometryGUI::GetOrCreateGeometryGUI(parent); - - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + + //Load Function OnGUIEvent + OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("OnGUIEvent"); + OGE (*f1) = NULL; + if(osdF != NULL) { + f1 = (bool (*) (int, QAD_Desktop*)) osdF; + (*f1)(theCommandID, parent); + } + else return false; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort(); - - if ( GeomGUI->myState == CURRENT_SKETCH) - GeomGUI->mySketcher.MakeCurrentEdge( pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView() ); - - return true; + return true; } -//================================================================================ -// function : SetDisplayedObjectList() -// purpose : -//================================================================================ -void GeometryGUI::SetDisplayedObjectList() -{ - if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC) - return; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - ListDisplayedObject.Clear(); - - Handle (AIS_InteractiveContext) aContext = v3d->getAISContext(); - aContext->DisplayedObjects( ListDisplayedObject ); -} - - - -//===================================================================================== -// function : OnDisplayAll() -// purpose : -//===================================================================================== -void GeometryGUI::OnDisplayAll(bool onlyPreviousDisplayedObject) -{ - if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC) - return; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); - - myContext->Display(v3d->getTrihedron()); - - if ( !onlyPreviousDisplayedObject ) { - AIS_ListOfInteractive List1; - myContext->ObjectsInCollector(List1); - AIS_ListIteratorOfListOfInteractive ite1(List1); - while (ite1.More()) { - if (ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value()); - if ( aSh->hasIO() ) { - Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); - if ( v3d->isInViewer(GIO, true) ) { - myContext->Display(aSh); - } - } - } - ite1.Next(); - } - } else { - AIS_ListIteratorOfListOfInteractive ite(ListDisplayedObject); - 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 ( v3d->isInViewer(GIO,true) ) { - myContext->Display(aSh); - } - } - } - ite.Next(); - } - } -} - - - - -//===================================================================================== -// function : OnVTKDisplayOnly() -// purpose : -//===================================================================================== -void GeometryGUI::OnVTKDisplayOnly() -{ - - // Erase all not selected actors - - QApplication::setOverrideCursor( Qt::waitCursor ); - - vtkRenderer* aren = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); - vtkActorCollection* theActors = aren->GetActors(); - theActors->InitTraversal(); - vtkActor *ac = theActors->GetNextActor(); - while(!(ac==NULL)) { - if ( ac->IsA("SALOME_Actor") ) { - SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ); - if(!anActor->isHighlighted()) anActor->VisibilityOff(); - } - ac = theActors->GetNextActor(); - } - - // Display selection - SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(GeomGUI->myActiveStudy->getActiveStudyFrame()->entry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIOR; - - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - - for(;It.More();It.Next()) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); - - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - if(myRenderInter->isInViewer(IObject)) { - myRenderInter->Display(IObject); - } - else { - // Create new actor - if ( !obj->_is_nil() ) { - if ( !obj->FindAttribute(anAttr, "AttributeIOR")) - break; - // If selected object contains displayable subobjects, then do nothing - SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj); - SALOMEDS::GenericAttribute_var aTmpAttr; - - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value()); - if (CORBA::is_nil(aShape)) continue; - TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape); - - if (obj->FindAttribute(anAttr, "AttributeName")) { - aName = SALOMEDS::AttributeName::_narrow(anAttr); - // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( GeomGUI->myActiveStudy ); - op->start(); - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, obj); - // commit transaction - op->finish(); - - vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->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(); - while(!(anActor==NULL)) { - GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor ); - GActor->setIO( IObject ); - GActor->setName( IObject->getName() ); - - theRenderer->AddActor(GActor); - vtkRenderWindow *renWin - = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer()->GetRenderWindow(); - renWin->Render(); - anActor = (vtkActor*)theActors->GetNextActor(); - } - } - } - } - } - GeomGUI->myActiveStudy->updateObjBrowser( true ); - QApplication::restoreOverrideCursor(); -} - - - -//===================================================================================== -// function : OnDisplayOnly() -// purpose : -//===================================================================================== -void GeometryGUI::OnDisplayOnly() -{ - if (myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC) - return; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument(); - 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 (!ic->IsSelected( aSh )) { - ic->Erase( aSh, Standard_True, Standard_True ); - } - } - ite.Next(); - } - - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); - - SALOME_ListIteratorOfListIO It1( Sel->StoredIObjects() ); - for(;It1.More();It1.Next()) { - Handle(SALOME_InteractiveObject) IObject = It1.Value(); - - - SALOMEDS::SObject_var fatherSF = - aStudy->FindObjectID(myActiveStudy->getActiveStudyFrame()->entry()); - if ( v3d->isInViewer( IObject, true ) ) { - AIS_ListOfInteractive List1; - ic->ObjectsInCollector(List1); - AIS_ListIteratorOfListOfInteractive ite1(List1); - while (ite1.More()) { - if (ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value()); - if ( aSh->hasIO() ) { - Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); - if ( IObject->isSame( GIO ) ) { - ic->Display(aSh); - ic->AddOrRemoveCurrentObject(aSh, true); - break; - } - } - } - ite1.Next(); - } - } else { - if ( IObject->hasEntry() ) { - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIOR; - if ( !obj->_is_nil() ) { - if (obj->FindAttribute(anAttr, "AttributeIOR")) { - // this SObject may be GEOM module root SObject - - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( anIOR->Value() ); - if (CORBA::is_nil(aShape)) continue; - TopoDS_Shape Shape = ShapeReader.GetShape(myComponentGeom, aShape); - - if (obj->FindAttribute(anAttr, "AttributeName")) { - aName = SALOMEDS::AttributeName::_narrow(anAttr); - // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy ); - op->start(); - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, obj); - // commit transaction - op->finish(); - } - - Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value()); - Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), Fatherior,"GEOM"); - - IO->setEntry(obj->GetID()); - aSh->setIO( IO ); - aSh->setName( aName->Value() ); - ic->Display (aSh); - ic->AddOrRemoveCurrentObject(aSh, true); - } - } - } - } - } -} - - -//=============================================================================== -// function : OnEditDelete() -// purpose : -//=============================================================================== -void GeometryGUI::OnEditDelete() -{ - if ( QAD_MessageBox::warn2 - ( QAD_Application::getDesktop(), - tr ("GEOM_WRN_WARNING"), - tr ("GEOM_REALLY_DELETE"), - tr ("GEOM_BUT_YES"), tr ("GEOM_BUT_NO"), 1, 0, 0) != 1 ) - return; - - int nbSf = myActiveStudy->getStudyFramesCount(); - - Standard_Boolean found; - SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - - SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - for(;It.More();It.Next()) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - if ( IObject->hasEntry() ) { - SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument(); - SALOMEDS::SObject_var SO = aStudy->FindObjectID( IObject->getEntry() ); - - /* Erase child graphical objects */ - SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO); - for (; it->More();it->Next()) { - SALOMEDS::SObject_var CSO= it->Value(); - if (CSO->FindAttribute(anAttr, "AttributeIOR") ) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - /* Delete child(s) shape in Client : */ - const TCollection_AsciiString ASCior(anIOR->Value()) ; - ShapeReader.RemoveShapeFromBuffer( ASCior ) ; - - for ( int i = 0; i < nbSf; i++ ) { - QAD_StudyFrame* sf = myActiveStudy->getStudyFrame(i); - if ( sf->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); - Handle(GEOM_AISShape) Result = GeomGUI->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 = GeomGUI->ConvertIORinGEOMActor( anIOR->Value(), found ); - if ( found ) { - //Renderer->RemoveActor(ac); - if ( ac->hasIO() ) - myRenderInter->Remove( ac->getIO() ); - } - } - } - } - } - - /* Erase main graphical object */ - for ( int i = 0; i < nbSf; i++ ) { - QAD_StudyFrame* sf = myActiveStudy->getStudyFrame(i); - if ( sf->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); - Handle(GEOM_AISShape) Result = GeomGUI->ConvertIOinGEOMAISShape( IObject, found ); - if ( found ) - myContext->Erase( Result, true, false ); - } else if ( sf->getTypeView() == VIEW_VTK ) { - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor(); - myRenderInter->Remove( IObject ); - } - } - - /* Delete main shape in Client : */ - if (SO->FindAttribute(anAttr, "AttributeIOR") ) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - const TCollection_AsciiString ASCIor(anIOR->Value()) ; - ShapeReader.RemoveShapeFromBuffer( ASCIor ) ; - } - - /* Erase objects in Study */ - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); - if ( !obj->_is_nil() ) { - QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy ); - op->start(); - aStudyBuilder->RemoveObject(obj); - op->finish(); - } - - } /* IObject->hasEntry() */ - } /* more/next */ - - /* Clear any previous selection */ - Sel->ClearIObjects() ; - myActiveStudy->updateObjBrowser(); -} - - -//============================================================================== -// function : OnEditCopy() -// purpose : -//============================================================================== -void GeometryGUI::OnEditCopy() -{ - SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); - GEOM::GEOM_Gen::ListOfIOR_var listIOR = new GEOM::GEOM_Gen::ListOfIOR; - - const SALOME_ListIO& List = Sel->StoredIObjects(); - - GeomGUI->ConvertListOfIOInListOfIOR( List, listIOR); - - Sel->ClearIObjects(); - - for (unsigned int ind = 0; ind < listIOR->length();ind++) { - GEOM::GEOM_Shape_var aShapeInit = myComponentGeom->GetIORFromString(listIOR[ind]); - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeCopy(aShapeInit) ; - result->NameType( aShapeInit->NameType() ); - this->Display(result); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - } - - myDesktop->putInfo(tr("GEOM_PRP_READY")); -} - - - -//===================================================================================== +//================================================================================= // function : OnKeyPress() // purpose : [static] -//===================================================================================== -bool GeometryGUI::OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) +//================================================================================= +bool GeometryGUI::OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) { GeometryGUI::GetOrCreateGeometryGUI(parent); - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - - return true ; -} - - - -//===================================================================================== -// function : DisplaySimulationShape() -// purpose : Displays 'this->mySimulationShape' a pure graphical shape from a TopoDS_Shape -//===================================================================================== -void GeometryGUI::DisplaySimulationShape(const TopoDS_Shape& S) -{ - if( S.IsNull() ) - return ; - - //NRI DEBUG : 14/02/2002 - if ( myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) - return ; - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - try { - /* erase any previous */ - ic->Erase( this->mySimulationShape, Standard_True, Standard_False ); - ic->ClearPrs( this->mySimulationShape ); - this->mySimulationShape = new AIS_Shape( TopoDS_Shape() ) ; - this->mySimulationShape->Set( S ) ; - this->mySimulationShape->SetColor(Quantity_NOC_VIOLET) ; - ic->Deactivate( this->mySimulationShape ); - ic->Display( this->mySimulationShape, Standard_False ); - ic->UpdateCurrentViewer(); - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in GeometryGUI::DisplaySimulationShape " ) ; - } - this->mySimulationShape->UnsetColor() ; - return ; -} - - - -//================================================================================== -// function : EraseSimulationShape() -// purpose : Clears the display of 'mySimulationShape' a pure graphical shape -//================================================================================== -void GeometryGUI::EraseSimulationShape() -{ - int count = myActiveStudy->getStudyFramesCount(); - for ( int i = 0; i < count; i++ ) { - if (myActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - ic->Erase( this->mySimulationShape, Standard_True, Standard_False ); - ic->ClearPrs( this->mySimulationShape ); - ic->UpdateCurrentViewer(); - - } else if (myActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_VTK ) { // VTK - } - } - // MESSAGE ( " GeometryGUI::EraseSimulationShape done. " ) -} - - - -//===================================================================================== -// function : Import -// purpose : BRep, Iges, Step -//===================================================================================== -bool GeometryGUI::Import( ) -{ - SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - - GEOM::GEOM_Shape_var aShape; - QString file; - QStringList filtersList ; - - switch ( GeomGUI->myState ) - { - case 111 : // Import BREP - { - filtersList.append( tr("GEOM_MEN_IMPORT_BREP") ); - filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ; - - file = QAD_FileDlg::getFileName(myDesktop, - "", - filtersList, - tr("GEOM_MEN_IMPORT"), - true); - if ( !file.isEmpty() ) { - QApplication::setOverrideCursor( Qt::waitCursor ); - try { - aShape = myComponentGeom->ImportBREP( file.latin1() ); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - } - break; - } - case 112 : // Import IGES - { - filtersList.append( tr("GEOM_MEN_IMPORT_IGES") ) ; - filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ; - - file = QAD_FileDlg::getFileName(myDesktop, - "", - filtersList, - tr("GEOM_MEN_IMPORT"), - true); - if ( !file.isEmpty() ) { - QApplication::setOverrideCursor( Qt::waitCursor ); - try { - aShape = myComponentGeom->ImportIGES( file.latin1() ); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - } - break; - } - case 113 : // Import STEP - { - filtersList.append( tr("GEOM_MEN_IMPORT_STEP") ) ; - filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ; - - file = QAD_FileDlg::getFileName(myDesktop, - "", - filtersList, - tr("GEOM_MEN_IMPORT"), - true); - if ( !file.isEmpty() ) { - QApplication::setOverrideCursor( Qt::waitCursor ); - try { - aShape = myComponentGeom->ImportSTEP( file.latin1() ); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - } - break; - } - } - - if ( !file.isEmpty() ) { - myDesktop->putInfo( tr("GEOM_PRP_LOADING").arg(QAD_Tools::getFileNameFromPath( file )) ); - - SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM"); - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID( myActiveStudy->getActiveStudyFrame()->entry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributePixMap_var aPixmap; - int aLocked = false; - if (father->_is_nil()) { - QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy ); - 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( tr("GEOM_MEN_COMPONENT") ); - 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(); - } -// if (aLocked) return false; - aStudyBuilder->DefineComponentInstance( father, myComponentGeom ); - father->ComponentIOR( Fatherior ); - - QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(this->myNbGeom++); - - if ( Display ( aShape, strdup(nameShape.latin1())) ) { - myActiveStudy->setMessage( tr("GEOM_INF_LOADED").arg(QAD_Tools::getFileNameFromPath( file )) ); - myDesktop->putInfo( tr("GEOM_PRP_READY")); - } - } - QApplication::restoreOverrideCursor(); - return true ; -} - - -//===================================================================================== -// function : Export -// purpose : BRep, Iges, Step -//===================================================================================== -bool GeometryGUI::Export( ) -{ - SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - - GEOM::GEOM_Shape_var aShape; - - static QString filters[] = { tr("GEOM_MEN_IMPORT_BREP"), - tr("GEOM_MEN_IMPORT_IGES"), - tr("GEOM_MEN_IMPORT_STEP") }; - - SALOME_Selection* Sel = SALOME_Selection::Selection( this->myActiveStudy->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - - switch ( GeomGUI->myState ) - { - case 121 : - { - for(;It.More();It.Next()) { - QApplication::restoreOverrideCursor(); - Handle(SALOME_InteractiveObject) IObject = It.Value(); - Standard_Boolean found; - GEOM::GEOM_Shape_var aShape = GeomGUI->ConvertIOinGEOMShape(IObject, found); - // Handle(GEOM_AISShape) Shape = ConvertIOinGEOMAISShape(IObject, found, true); - if ( found ) { - QString file = QAD_FileDlg::getFileName(myDesktop, - QString( IObject->getName() ) + ".brep", - tr("GEOM_MEN_IMPORT_BREP"), - tr("GEOM_MEN_EXPORT"), - false); - if ( !file.isEmpty() && !aShape->_is_nil() ) { - QApplication::setOverrideCursor( Qt::waitCursor ); - // Standard_Boolean result = BRepTools::Write(Shape->Shape(), strdup(file.latin1()) ); - try { - GeomGUI->myComponentGeom->ExportBREP(strdup( file.latin1()), aShape); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - } - } - } - break; - } - case 122 : - { - for(;It.More();It.Next()) { - QApplication::restoreOverrideCursor(); - Handle(SALOME_InteractiveObject) IObject = It.Value(); - Standard_Boolean found; - GEOM::GEOM_Shape_var aShape = GeomGUI->ConvertIOinGEOMShape(IObject, found); - // Handle(GEOM_AISShape) Shape = ConvertIOinGEOMAISShape(IObject, found, true); - if ( found ) { - QString file = QAD_FileDlg::getFileName(myDesktop, - QString( IObject->getName() ) + ".igs", - tr("GEOM_MEN_IMPORT_IGES"), - tr("GEOM_MEN_EXPORT"), - false); - if ( !file.isEmpty() && !aShape->_is_nil() ) { - QApplication::setOverrideCursor( Qt::waitCursor ); - try { - GeomGUI->myComponentGeom->ExportIGES(strdup( file.latin1()), aShape); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -// //VRV: OCC 4.0 migration -// IGESControl_Controller::Init(); -// IGESControl_Writer ICW (Interface_Static::CVal("XSTEP.iges.unit"), -// Interface_Static::IVal("XSTEP.iges.writebrep.mode")); -// //VRV: OCC 4.0 migration - -// ICW.AddShape (Shape->Shape()); -// ICW.ComputeModel(); -// Standard_Boolean result = ICW.Write( strdup(file.latin1()) ); - } - } - } - break; - } - - case 123 : - { -// bool test = false ; -// IFSelect_ReturnStatus status ; -// //VRV: OCC 4.0 migration -// STEPControl_Writer aWriter; -// //VRV: OCC 4.0 migration - QString file; - - for( ; It.More(); It.Next() ) { -// GEOM::GEOM_Shape_var aShape = GeomGUI->ConvertIOinGEOMShape(IObject, found); - QApplication::restoreOverrideCursor(); - Handle(SALOME_InteractiveObject) IObject = It.Value(); - Standard_Boolean found; - GEOM::GEOM_Shape_var aShape = GeomGUI->ConvertIOinGEOMShape(IObject, found); - // Handle(GEOM_AISShape) Shape = ConvertIOinGEOMAISShape(IObject, found, true); - if ( found ) { - file = QAD_FileDlg::getFileName(myDesktop, - QString( IObject->getName() ) + ".stp", - tr("GEOM_MEN_IMPORT_STEP"), - tr("GEOM_MEN_EXPORT"), - false); - if ( !file.isEmpty() && !aShape->_is_nil() ) { - - QApplication::setOverrideCursor( Qt::waitCursor ) ; - try { - GeomGUI->myComponentGeom->ExportSTEP(strdup( file.latin1()), aShape); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -// //VRV: OCC 4.0 migration -// status = aWriter.Transfer( Shape->Shape(), STEPControl_ManifoldSolidBrep ) ; -// //VRV: OCC 4.0 migration -// test = true ; -// if ( status != IFSelect_RetDone ) { -// QApplication::restoreOverrideCursor() ; -// return false ; -// } - } - } - } -// if(test) { -// status = aWriter.Write( strdup(file.latin1()) ) ; -// QApplication::restoreOverrideCursor() ; -// return status ; -// } - break; - } - - } - QApplication::restoreOverrideCursor() ; -} - - -//===================================================================================== -// function : Display() -// purpose : Displays a CORBA shape -//===================================================================================== -bool GeometryGUI::Display( GEOM::GEOM_Shape_ptr aShape, - Standard_CString name) -{ - // MESSAGE ( "GeometryGUI::Display init ") - Handle(GEOM_InteractiveObject) IO; - SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->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 = ShapeReader.GetShape(myComponentGeom, aShape); - - if ( shape.IsNull() ) - return false; - - SALOMEDS::Study_var aStudy = myActiveStudy->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( myActiveStudy ); - 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( tr("GEOM_MEN_COMPONENT") ); - aName->SetValue( QAD_Application::getDesktop()->getComponentUserName( "GEOM" ) ); - anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" ); - myActiveStudy->updateObjBrowser(); - if (aLocked) aStudy->GetProperties()->SetLocked(true); - op->finish(); - } -// if (aLocked) return false; - - aStudyBuilder->DefineComponentInstance( father, myComponentGeom ); - father->ComponentIOR( Fatherior ); - - 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( GeomGUI->myNbGeom++ ) + TCollection_AsciiString("\0"); - } else - nameG += TCollection_AsciiString( aShape->NameType()) + TCollection_AsciiString("_") + - TCollection_AsciiString( GeomGUI->myNbGeom++ ) + TCollection_AsciiString("\0"); - } else - nameG = TCollection_AsciiString(name); - - // VTK - if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->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(), - Fatherior, - "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 ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - Handle(GEOM_AISShape) theResult = new GEOM_AISShape( shape, nameG.ToCString() ); - theResult->SetShadingColor( myShadingColor ); - IO = new GEOM_InteractiveObject(aShape->Name(), - Fatherior, - "GEOM"); - theResult->setIO( IO ); - theResult->setName( nameG.ToCString() ); - - /* Precaution : close any local context to permit the display */ - if ( ic->HasOpenedContext() ) { - ic->CloseAllContexts(); - } - -// if(isInfinite) -// theResult->SetInfiniteState() ; - - ic->Display(theResult); - } - - Sel->AddIObject( IO, false ); - myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Repaint(); - if ( Settings_AddInStudy ) - GeomGUI->AddInStudy( false, IO ); - + else return true; } -//===================================================================================== -// function : AddInStudy() -// purpose : anIOShape or a selected shape -//===================================================================================== -bool GeometryGUI::AddInStudy( bool selection, - const Handle(SALOME_InteractiveObject)& anIO) +//================================================================================= +// function : OnMouseMove() +// purpose : [static] manage mouse events +//================================================================================= +bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) { - SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); - if ( !( !Settings_AddInStudy || selection ) ) { - Sel->ClearIObjects(); + GeometryGUI::GetOrCreateGeometryGUI(parent); + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + if(GeomGUI->myState == 2) { + OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort(); + GeomGUI->GetSketcher().MakeCurrentEdge(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView()); } - SALOMEDS::Study_var aStudy = myActiveStudy->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( myActiveStudy ); - 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( tr("GEOM_MEN_COMPONENT") ); - 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(); - } -// if (aLocked) return false; - - aStudyBuilder->DefineComponentInstance( father, myComponentGeom ); - father->ComponentIOR( Fatherior ); - - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myActiveStudy->getActiveStudyFrame()->entry()); - - Handle(GEOM_AISShape) GAISShape; - GEOM_Actor* GActor; - Handle(GEOM_InteractiveObject) GIO; - bool found = false; - - // VTK - if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - vtkRenderer *Renderer = ((VTKViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->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(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; - } - // OCC - else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->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(); - } - - if ( !found ) - return false; - } - - if ( !Settings_AddInStudy || selection ) { - QString Name = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), anIO->getName() ); - if ( !Name.isEmpty() ) { - // VTK - if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - GActor->setName( strdup(Name.latin1()) ); - } - // OCC - else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - GAISShape->setName( strdup(Name.latin1()) ); - } - } else { - return false; - } - } - - // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( myActiveStudy ); - op->start(); - - SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(father); - - GEOM::GEOM_Shape_var aShape = myComponentGeom->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 ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - GActor->setIO( GIO ); - aName->SetValue(GActor->getName()); - } - // OCC - else if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - GAISShape->setIO( GIO ); - aName->SetValue(GAISShape->getName()); - } - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1,newObj); - - GEOM::GEOM_Gen::ListOfIOR_var listIOR = new GEOM::GEOM_Gen::ListOfIOR; - listIOR = myComponentGeom->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); - } - - op->finish(); - - - if ( !Settings_AddInStudy || selection ) { - myActiveStudy->updateObjBrowser(); - } else { - myActiveStudy->updateObjBrowser(false); - Sel->AddIObject( GIO ); - } - - // MESSAGE ( " highlihght done" ) return true; - } -//===================================================================================== -// function : GetShapeFromIOR() -// purpose : exist also as static method ! -//===================================================================================== -TopoDS_Shape GeometryGUI::GetShapeFromIOR( QString IOR ) +//================================================================================= +// function : 0nMousePress() +// purpose : [static] manage mouse events +//================================================================================= +bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) { - 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 = myComponentGeom->GetIORFromString( IOR ); - if (!aShape->_is_nil()) { - result = ShapeReader.GetShape( myComponentGeom, aShape ); + GeometryGUI::GetOrCreateGeometryGUI(parent); + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + if(GeomGUI->myState == 2) { + GeomGUI->GetSketcher().ValidateEdge(); + if(GeomGUI->GetSketcher().GetmyEdgesNumber() == 1) { + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); + Mb->setItemEnabled(405, true); // SKETCH CONTRAINTS + } } - return result; + else if(GeomGUI->myState == 0) { + if(!GeomGUI->LoadLibrary("libBasicGUI.so")) + return false; + + //Load Function OnMousePress + OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("OnMousePress"); + OMP (*f1) = NULL; + if(osdF != NULL) { + f1 = (bool (*) (QMouseEvent*, QAD_Desktop*, QAD_StudyFrame*)) osdF; + (*f1)(pe, parent, studyFrame); + } + } + + return false; } -//===================================================================================== +//================================================================================= // function : SetSettings() // purpose : [static] -//===================================================================================== -bool GeometryGUI::SetSettings( QAD_Desktop* parent ) +//================================================================================= +bool GeometryGUI::SetSettings(QAD_Desktop* parent) { - /* Create or retrieve an object GeomGUI */ GeometryGUI::GetOrCreateGeometryGUI(parent); - - //DCQ parent->menuBar()->setItemEnabled( 504, false); // CORRECTING - //DCQ parent->menuBar()->setItemEnabled( 6062, false); // RADIUS - //VSR parent->menuBar()->setItemEnabled( 701, false); // AUTOMATIC COPY - parent->menuBar()->setItemEnabled( 313, false); // SKETCH CONTRAINTS - parent->menuBar()->setItemEnabled( 3131, false); // SKETCH SET PLAN - - /* Shading Color */ - QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed"); - QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen"); - QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue"); - if( !SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty() ) - GeomGUI->myShadingColor = Quantity_Color ( SCr.toInt()/255., SCg.toInt()/255., SCb.toInt()/255., - Quantity_TOC_RGB ); + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); + QAD_Study* ActiveStudy = parent->getActiveStudy(); /* Wireframe or Shading */ int DisplayMode = 0; - if ( parent->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)parent->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + bool ViewOCC = false; + if(ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); DisplayMode = ic->DisplayMode(); - } else if ( parent->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)parent->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + ViewOCC = true; + } + else if(ActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)ActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); DisplayMode = myRenderInter->GetDisplayMode(); } - if ( DisplayMode == 1 ) - parent->menuBar()->changeItem(6021, tr("GEOM_MEN_WIREFRAME") ); + if(DisplayMode == 1) + Mb->changeItem(211, tr("GEOM_MEN_WIREFRAME")); else - parent->menuBar()->changeItem(6021, tr("GEOM_MEN_SHADING") ); + Mb->changeItem(211, tr("GEOM_MEN_SHADING")); - /* Copy */ -// QString Copy = QAD_CONFIG->getSetting("Geometry:SettingsCopy"); -// if ( !Copy.isEmpty() ) { -// Settings_Copy = Copy.toInt(); -// QMenuData* pp; -// parent->menuBar()->findItem(701,&pp); -// pp->setItemChecked(701, Settings_Copy); -// } - QMenuData* pp; - if ( parent->menuBar()->findItem(701,&pp) ) - pp->removeItem(701); /* Add in Study */ QString AddInStudy = QAD_CONFIG->getSetting("Geometry:SettingsAddInStudy"); - if ( !AddInStudy.isEmpty() ) - Settings_AddInStudy = AddInStudy.toInt(); + int Settings_AddInStudy; + if(!AddInStudy.isEmpty()) + Settings_AddInStudy = AddInStudy.toInt(); else Settings_AddInStudy = 1; - parent->menuBar()->findItem(702,&pp); - pp->setItemChecked(702, Settings_AddInStudy); + Mb->setItemChecked(411, Settings_AddInStudy); + /* step value */ - QString S = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ); - if( S.isEmpty() ) - QAD_CONFIG->addSetting( "Geometry:SettingsGeomStep", "100" ); - - /* isos */ - QAD_Study* ActiveStudy = parent->getActiveStudy(); - int count = ActiveStudy->getStudyFramesCount(); + QString S = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + if(S.isEmpty()) + QAD_CONFIG->addSetting("Geometry:SettingsGeomStep", "100"); - bool ViewOCC = false; - for ( int i = 0; i < count; i++ ) { - if ( ActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_OCC ) { + + /* isos */ + int count = ActiveStudy->getStudyFramesCount(); + for(int i = 0; i < count; i++) { + if(ActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_OCC) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU"); QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV"); - if ( !IsoU.isEmpty() ) + if(!IsoU.isEmpty()) ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt()); - if ( !IsoV.isEmpty() ) + if(!IsoV.isEmpty()) ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt()); - - ViewOCC = true; } } - QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar(); + Mb->setItemEnabled(404, ViewOCC);//SKETCHER + Mb->setItemEnabled(405, false);//SKETCHER + Mb->setItemEnabled(406, ViewOCC);//SKETCHER - Mb->setItemEnabled( 312, ViewOCC); //Sketch - Mb->setItemEnabled( 309, ViewOCC); //SuppressFace - Mb->setItemEnabled( 314, ViewOCC); //SuppressHole + Mb->setItemEnabled(603, ViewOCC);//SuppressFace + Mb->setItemEnabled(604, ViewOCC);//SuppressHole - Mb->setItemEnabled( 703, ViewOCC);// ShadingColor Settings - Mb->setItemEnabled( 704, ViewOCC);// Isos Settings + Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings + Mb->setItemEnabled(414, ViewOCC);// Isos Settings return true; } -//===================================================================================== +//================================================================================= // function : DefinePopup() // purpose : [static] -//===================================================================================== -void GeometryGUI::DefinePopup( QString & theContext, QString & theParent, QString & theObject ) +//================================================================================= +void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString & theObject) { - /* Create or retrieve an object GeomGUI */ GeometryGUI::GetOrCreateGeometryGUI(QAD_Application::getDesktop()); - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); + QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy(); + SALOME_Selection* Sel = SALOME_Selection::Selection(ActiveStudy->getSelection()); theObject = ""; - if ( Sel->IObjectCount() == 1 ) - { - Handle(SALOME_InteractiveObject) IO = Sel->firstIObject(); - if (IO->hasEntry()) - { - SALOMEDS::SObject_var sobj = GeomGUI->myActiveStudy->getStudyDocument()->FindObjectID(IO->getEntry()); - if (!sobj->_is_nil()) - { - SALOMEDS::SComponent_var scomp = sobj->GetFatherComponent(); - if (strcmp(scomp->GetID(), IO->getEntry()) == 0) - { - // component is selected - theObject = "Component"; - } - } - } - } + theContext = ""; - if ( ( theParent.compare("Viewer")==0 ) ) - { - if ( GeomGUI->myState == CURRENT_SKETCH ) - theContext = "Sketch"; - else - { - if ( Sel->IObjectCount() > 0 ) - theContext = ""; - else - theContext = "NothingSelected"; + + if((theParent.compare("Viewer") == 0)) { + if(GeomGUI->myState == 2) + theContext = "Sketch"; + else if(Sel->IObjectCount() == 0) + theContext = "NothingSelected"; + } + + if(Sel->IObjectCount() == 1) { + Handle(SALOME_InteractiveObject) IO = Sel->firstIObject(); + if(IO->hasEntry()) { + SALOMEDS::SObject_var sobj = ActiveStudy->getStudyDocument()->FindObjectID(IO->getEntry()); + if(!sobj->_is_nil()) { + SALOMEDS::SComponent_var scomp = sobj->GetFatherComponent(); + if(strcmp(scomp->GetID(), IO->getEntry()) == 0) { + // component is selected + theObject = "Component"; } - } - else - theContext = ""; - + } + } + } + + return; } -//===================================================================================== + +//================================================================================= // function : CustomPopup() // purpose : [static] -//===================================================================================== -bool GeometryGUI::CustomPopup( QAD_Desktop* parent, - QPopupMenu* popup, - const QString& theContext, - const QString& theParent, - const QString& theObject ) +//================================================================================= +bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, + const QString& theParent, const QString& theObject) { - /* Create or retrieve an object GeomGUI */ GeometryGUI::GetOrCreateGeometryGUI(parent); - - /* Deactivate any non modal dialog box to get the neutral point */ - GeomGUI->EmitSignalDeactivateDialog() ; - - SALOME_Selection* Sel = SALOME_Selection::Selection( GeomGUI->myActiveStudy->getSelection() ); - int nbSel = Sel->IObjectCount(); - - if ( (nbSel == 0) && ( theContext.compare("Sketch")!=0 ) ) - return false; - - - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC) - { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()-> - getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - if ( theParent.compare("Viewer")==0 ) - { - if ( theContext.compare("Sketch")==0 ) - { - SketchStatus myCS = GeomGUI->mySketcher.GetCurrentStatus(); - popup->setCheckable(TRUE); - if (myCS==SEGMENT) - { - popup->setItemChecked(10000,true); - popup->setItemChecked(10001,false); - } - else if (myCS==ARC_CHORD) - { - popup->setItemChecked(10000,false); - popup->setItemChecked(10001,true); - } - - return true; - } - else - if (theObject.compare("Component") == 0) - { - popup->removeItem(QAD_DisplayOnly_Popup_ID); - return true; - } - else - { - QFont f = QApplication::font(); - f.setBold( TRUE ); - if (nbSel==1) - { - Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); - popup->removeItem(QAD_TopLabel_Popup_ID); - popup->insertItem( new CustomItem ( QString(IObject->getName()), f ), QAD_TopLabel_Popup_ID, 0 ); - if ( IObject->hasEntry() ) - popup->setItemEnabled( 801, false ); - else - popup->setItemEnabled( 801, true ); - - if (IObject->IsKind(STANDARD_TYPE(GEOM_InteractiveObject))) - { - Standard_Boolean found; - Handle(GEOM_AISShape) Result = GeomGUI->ConvertIOinGEOMAISShape(IObject, found, true); - if ( found ) - { - if ( Result->DisplayMode() == 1 ) - popup->changeItem(8021, tr("GEOM_MEN_WIREFRAME") ); - else - popup->changeItem(8021, tr("GEOM_MEN_SHADING") ); - } - } - - if ( !(v3d->isInViewer( IObject ) && v3d->isVisible( IObject )) ) - popup->removeItem(QAD_Erase_Popup_ID); - else - popup->removeItem(QAD_Display_Popup_ID); - - } - else - { - popup->removeItem(QAD_DisplayOnly_Popup_ID); - popup->removeItem(QAD_TopLabel_Popup_ID); - popup->insertItem( new CustomItem ( tr("GEOM_MEN_POPUP_NAME").arg(nbSel), f ), - QAD_TopLabel_Popup_ID, 0 ); - popup->setItemEnabled( 801, false ); - } - } - return true; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + if(theParent.compare("Viewer") == 0) { + if(theContext.compare("Sketch") == 0) { + SketchStatus myCS = GeomGUI->GetSketcher().GetCurrentStatus(); + popup->setCheckable(TRUE); + if(myCS == SEGMENT) { + popup->setItemChecked(4041, true); //Sketch Segment Menu + popup->setItemChecked(4042, false); //Sketch Arc Menu } - else - if ( theParent.compare("ObjectBrowser")==0 ) - { - popup->removeItem(QAD_TopLabel_Popup_ID); - int id = popup->idAt(0); // separator - if (id < 0) popup->removeItem(id); - - // checking for GEOM label in the selected list - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - Handle(SALOME_InteractiveObject) anIObject; - - bool useSubItems = false; - bool needOpen = false; - bool needDisplay = false; - bool needErase = false; - SALOMEDS::GenericAttribute_var aTmpAttr; - for(;It.More();It.Next()) - { - anIObject = It.Value(); - if (!anIObject->hasEntry()) - continue; - - if (v3d->isInViewer(anIObject) && v3d->isVisible(anIObject)) - needErase = true; - else - needDisplay = true; - SALOMEDS::SObject_var obj = - GeomGUI->myActiveStudy->getStudyDocument()->FindObjectID( anIObject->getEntry() ); - if (!obj->_is_nil()) - { - GEOM::GEOM_Shape_var aShape; - if (obj->FindAttribute(aTmpAttr, "AttributeIOR")) { - char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value(); - if (str && strlen(str)) - aShape = GeomGUI->myComponentGeom-> GetIORFromString(str); - } - else - if (obj->FindAttribute(aTmpAttr, "AttributePersistentRef")) - needOpen = true; - if (aShape->_is_nil()) - { - SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy-> - getStudyDocument()->NewChildIterator(obj); - while (anIter->More()) - { - SALOMEDS::SObject_var subobj = anIter->Value(); - if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) - { - useSubItems = true; - needErase = true; - needDisplay = true; - } - else - if (subobj->FindAttribute(aTmpAttr, "AttributePersistentRef")) - { - needOpen = true; - useSubItems = true; - } - anIter->Next(); - } - } - } - } - // remove useless popup items - if (nbSel != 1) popup->removeItem(901); // rename - if (useSubItems) popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only - if (!needOpen) - { - int index = popup->indexOf(9024); - popup->removeItem(9024); // open - popup->removeItemAt(index); // separator under Open - - if (!needDisplay) popup->removeItem(QAD_Display_Popup_ID); - if (!needErase) popup->removeItem(QAD_Erase_Popup_ID); - if (!needDisplay && !needErase) - { - int id = popup->idAt(popup->count()-1); // last item - popup->removeItem(id); // separator - } - } - else - { - popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only - popup->removeItem(QAD_Display_Popup_ID); - popup->removeItem(QAD_Erase_Popup_ID); - if (nbSel!=1) - { - int id = popup->idAt(popup->count()-1); // last item - popup->removeItem(id); // separator - } - } - return true; - } - // MESSAGE ( " CUSTOM POPUP VIEWER OCC done. ") + else if(myCS == ARC_CHORD) { + popup->setItemChecked(4041, false); //Sketch Segment Menu + popup->setItemChecked(4042, true); //Sketch Arc Menu + } + return true; + } } + } + + if(!GeomGUI->LoadLibrary("libGEOMBase.so")) + return false; + + //Load Function BuildPresentation + OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("CustomPopup"); + CP (*f1) = NULL; + if(osdF != NULL) { + f1 = (bool (*) (QAD_Desktop*, QPopupMenu*, const QString&, + const QString&, const QString&)) osdF; + (*f1)(parent, popup, theContext, theParent, theObject); + } else - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) - { - // MESSAGE ( " CUSTOM POPUP VIEWER VTK ") - if ( ( theParent.compare("Viewer")==0 ) ) - { - - popup->setItemEnabled( 8033, false ); - if (theObject.compare("Component") == 0) - { - popup->removeItem(QAD_DisplayOnly_Popup_ID); - return true; - } + return false; - //int id = popup->idAt(0); - QFont f = QApplication::font(); - f.setBold( TRUE ); - - if (nbSel==1) - { - Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject(); - popup->removeItem(QAD_TopLabel_Popup_ID); - popup->insertItem( new CustomItem ( QString(IObject->getName()), f ), QAD_TopLabel_Popup_ID, 0 ); - if ( IObject->hasEntry() ) - { - popup->setItemEnabled( 801, false ); - SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument(); - SALOMEDS::SObject_var SO = aStudy->FindObjectID( IObject->getEntry() ); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if ( !SO->_is_nil() ) - { - if (SO->FindAttribute(anAttr, "AttributeIOR") ) - { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - Standard_Boolean found; - GEOM_Actor* Result = GeomGUI->ConvertIORinGEOMActor(anIOR->Value(), found, true); - if ( found ) - { - if ( Result->getDisplayMode() == 1 ) - popup->changeItem(8021, "Wireframe" ); - else - popup->changeItem(8021, "Shading" ); - - if ( !Result->GetVisibility() ) - popup->removeItem(QAD_Erase_Popup_ID); - else - popup->removeItem(QAD_Display_Popup_ID); - } - else - popup->removeItem(QAD_Erase_Popup_ID); - } - } - } - else - popup->setItemEnabled( 801, true ); - } - else - { - popup->removeItem(QAD_DisplayOnly_Popup_ID); - popup->removeItem(QAD_TopLabel_Popup_ID); - popup->insertItem( new CustomItem ( tr("GEOM_MEN_POPUP_NAME").arg(nbSel), f ), QAD_TopLabel_Popup_ID, 0 ); - popup->setItemEnabled( 801, false ); - } - return true; - } - else - if ( theParent.compare("ObjectBrowser")==0 ) - { - popup->removeItem(QAD_TopLabel_Popup_ID); - int id = popup->idAt(0); // separator - if (id < 0) popup->removeItem(id); - - // checking for GEOM label in the selected list - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); - Handle(SALOME_InteractiveObject) anIObject; - - bool useSubItems = false; - bool needOpen = false; - bool needDisplay = false; - bool needErase = false; - SALOMEDS::GenericAttribute_var aTmpAttr; - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy-> - getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - for(;It.More();It.Next()) - { - anIObject = It.Value(); - if ( !anIObject->hasEntry() ) - continue; - - if (myRenderInter->isInViewer(anIObject) && myRenderInter->isVisible(anIObject)) - needErase = true; - else - needDisplay = true; - - SALOMEDS::SObject_var obj = GeomGUI->myActiveStudy->getStudyDocument() - ->FindObjectID( anIObject->getEntry() ); - if (!obj->_is_nil()) { - GEOM::GEOM_Shape_var aShape; - if (obj->FindAttribute(aTmpAttr, "AttributeIOR")){ - char *str = SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value(); - if (str && strlen(str)) - aShape = GeomGUI->myComponentGeom->GetIORFromString(str); - } - else - if (obj->FindAttribute(aTmpAttr, "AttributePersistentRef")) - needOpen = true; - if (aShape->_is_nil()) - { - SALOMEDS::ChildIterator_var anIter = - GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj); - while (anIter->More()) - { - SALOMEDS::SObject_var subobj = anIter->Value(); - if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) - { - useSubItems = true; - needDisplay = true; - needErase = true; - } - else - if (subobj->FindAttribute(aTmpAttr, "AttributePersistentRef")) - { - needOpen = true; - useSubItems = true; - } - anIter->Next(); - } - } - } - } - // remove useless popup items - if (nbSel != 1) popup->removeItem(901); // rename - if (useSubItems) popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only - if (!needOpen) - { - int index = popup->indexOf(9024); - popup->removeItem(9024); // open - popup->removeItemAt(index); // separator under Open - - if (!needDisplay) popup->removeItem(QAD_Display_Popup_ID); - if (!needErase) popup->removeItem(QAD_Erase_Popup_ID); - if (!needDisplay && !needErase) - { - int id = popup->idAt(popup->count()-1); // last item - popup->removeItem(id); // separator - } - } - else - { - popup->removeItem(QAD_DisplayOnly_Popup_ID); // display only - popup->removeItem(QAD_Display_Popup_ID); - popup->removeItem(QAD_Erase_Popup_ID); - if (nbSel!=1) - { - int id = popup->idAt(popup->count()-1); // last item - popup->removeItem(id); // separator - } - } - return true; - // MESSAGE ( " CUSTOM POPUP VIEWER VTK done.") - } - } else - { // other viewer types not supported. - while (1) - { - int id = popup->idAt(0); - if (id <= QAD_TopLabel_Popup_ID && id != -1) - popup->removeItemAt(0); - else - break; - } - popup->removeItem(QAD_DisplayOnly_Popup_ID); - popup->removeItem(QAD_Display_Popup_ID); - popup->removeItem(QAD_Erase_Popup_ID); - int id = popup->idAt(popup->count()-1); // last item - if (id < 0 && id != -1) popup->removeItem(id); // separator - return false; - } - return false; + return true; } + +//================================================================================= +// function : activeStudyChanged() +// purpose : static +//================================================================================= +void GeometryGUI::activeStudyChanged(QAD_Desktop* parent) +{ + GeometryGUI::GetOrCreateGeometryGUI(parent); + + if(GeomGUI != 0) { + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); + if(GeomGUI->myState == 2) { + Mb->setItemEnabled(405, false);//SKETCHER + GeomGUI->GetSketcher().Clear(); + GeomGUI->myState = -1; + } + + bool ViewOCC = false; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + ViewOCC = true; + + Mb->setItemEnabled(404, ViewOCC);//SKETCHER + Mb->setItemEnabled(406, ViewOCC);//SKETCHER + + Mb->setItemEnabled(603, ViewOCC);//SuppressFace + Mb->setItemEnabled(604, ViewOCC);//SuppressHole + + Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings + Mb->setItemEnabled(414, ViewOCC);// Isos Settings + + GeomGUI->EmitSignalCloseAllDialogs(); + GeomGUI = 0; + } + return; +} + + +//======================================================================= +// function : BuildPresentation() +// purpose : static +//======================================================================= void GeometryGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO) { - /* Create or retrieve an object GeomGUI */ GeometryGUI::GetOrCreateGeometryGUI(QAD_Application::getDesktop()); - - SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - - OCCViewer_Viewer3d* v3d; - Handle(AIS_InteractiveContext) ic; - vtkRenderer* Renderer; - if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - v3d = ((OCCViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - ic = v3d->getAISContext(); - } else if ( GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - Renderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); - } else + if(!GeomGUI->LoadLibrary("libDisplayGUI.so")) return; - if (theIO.IsNull()) - MESSAGE("BuildPresentation(): null SALOME_InteractiveObject passed") - - if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { - // VTK - - SALOMEDS::SObject_var fatherSF = - aStudy->FindObjectID(GeomGUI->myActiveStudy->getActiveStudyFrame()->entry()); - - SALOMEDS::SObject_var obj = aStudy->FindObjectID( theIO->getEntry() ); - - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIOR; - - if(myRenderInter->isInViewer(theIO)) { - myRenderInter->Display(theIO, false); - } - else { - // Create new actor - if ( !obj->_is_nil() ) { - if ( obj->FindAttribute(anAttr, "AttributeIOR")) { - // this SObject may be GEOM module root SObject - - bool useSubItems = false; - SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj); - if (GeomGUI->myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) { - while (anIter->More() && !useSubItems) { - SALOMEDS::SObject_var subobj = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttr; - if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { - if (!GeomGUI->myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) { - anAttr = aTmpAttr; - obj = subobj; - useSubItems = true; - } else anIter->Next(); - } else anIter->Next(); - } - } - - while(useSubItems?anIter->More():!anAttr->_is_nil()) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value()); - TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape); - - if (obj->FindAttribute(anAttr, "AttributeName")) { - aName = SALOMEDS::AttributeName::_narrow(anAttr); - - vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); - vtkActorCollection* theAllActors = theRenderer->GetActors(); - theAllActors->InitTraversal(); - vtkActor* actor = (vtkActor*)theAllActors->GetNextActor(); - Handle(SALOME_InteractiveObject) anIObj; - // don't create new study object if it already exists - bool isDisplayed = false; - while(!(actor==NULL)) { - SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor); - if (Gactor!=NULL) { - if (Gactor->hasIO()) { - if (strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) { - isDisplayed = true; - anIObj = Gactor->getIO(); - if (!anIObj.IsNull()) myRenderInter->Display(anIObj, false); - } - } - } - actor=(vtkActor*)(theAllActors->GetNextActor()); - } - if (!isDisplayed) { - // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( GeomGUI->myActiveStudy ); - op->start(); - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, obj); - // commit transaction - op->finish(); - - vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); - int themode = myRenderInter->GetDisplayMode(); - - vtkActorCollection* theActors = - GEOM_AssemblyBuilder::BuildActors(Shape,0,themode,Standard_True); - theActors->InitTraversal(); - vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); - while(!(anActor==NULL)) { - GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor ); - Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), Fatherior,"GEOM"); - IO->setEntry(obj->GetID()); - GActor->setIO( IO ); - GActor->setName( theIO->getName() ); - - theRenderer->AddActor(GActor); - // renWin->Render(); - anActor = (vtkActor*)theActors->GetNextActor(); - } - } - } - // next item iteration - if (useSubItems) { - anIter->Next(); - anAttr = SALOMEDS::GenericAttribute::_nil(); - while (anIter->More() && anAttr->_is_nil()) { - SALOMEDS::SObject_var subobject = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttribute; - if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { - anAttr = aTmpAttribute; - obj = subobject; - } else anIter->Next(); - } - } else anAttr = SALOMEDS::GenericAttribute::_nil(); - } - } - } - } - // No viewer update should be done here! - //myRenderInter->Render(); - //GeomGUI->myActiveStudy->updateObjBrowser( true ); - } else if (GeomGUI->myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - SALOMEDS::SObject_var fatherSF = - aStudy->FindObjectID( GeomGUI->myActiveStudy->getActiveStudyFrame()->entry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIOR; - - if ( v3d->isInViewer( theIO, true ) ) { - Standard_Boolean found; - Handle(GEOM_AISShape) aSh = GeomGUI->ConvertIOinGEOMAISShape( theIO, found, true ); - if ( found ) { - ic->Display(aSh, false); - ic->AddOrRemoveCurrentObject(aSh, false); - } - - } else { - SALOMEDS::SObject_var obj = aStudy->FindObjectID( theIO->getEntry() ); - if ( !obj->_is_nil() ) { - MESSAGE("BuildPresentation(): SObject not null") - if ( obj->FindAttribute(anAttr, "AttributeIOR")) { - MESSAGE("BuildPresentation(): SObject has IOR") - // this SObject may be GEOM module root SObject - - bool useSubItems = false; - SALOMEDS::ChildIterator_var anIter = GeomGUI->myActiveStudy->getStudyDocument()->NewChildIterator(obj); - if (GeomGUI->myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) { - while (anIter->More() && !useSubItems) { - SALOMEDS::SObject_var subobj = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttr; - if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { - if (!GeomGUI->myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) { - anAttr = aTmpAttr; - obj = subobj; - useSubItems = true; - } else anIter->Next(); - } else anIter->Next(); - } - } - - while(useSubItems?anIter->More():!anAttr->_is_nil()) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Shape_var aShape = GeomGUI->myComponentGeom->GetIORFromString(anIOR->Value()); - TopoDS_Shape Shape = ShapeReader.GetShape(GeomGUI->myComponentGeom,aShape); - if (Shape.IsNull()) - MESSAGE("BuildPresentation(): TopoDS_Shape is null!") - if (obj->FindAttribute(anAttr, "AttributeName")) { - MESSAGE("BuildPresentation(): SObject has Name") - aName = SALOMEDS::AttributeName::_narrow(anAttr); - // searchin for already displayed objects with the same shape - AIS_ListOfInteractive aDisplayed; - ic->DisplayedObjects(aDisplayed); - AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed); - Handle(AIS_Shape) anAISShape; - for(;anIObjects.More();anIObjects.Next()) { - anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value()); - if (!anAISShape.IsNull()) { - if (anAISShape->Shape().IsSame(Shape)) break; - anAISShape.Nullify(); - } - } - if (!anAISShape.IsNull()) { - if (!ic->IsDisplayed(anAISShape)) ic->Display(anAISShape, false); - } else { - if (!useSubItems) { - // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( GeomGUI->myActiveStudy ); - op->start(); - if (fatherSF->_is_nil()) - MESSAGE("BuildPresentation(): fatherSF is nil!") - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, obj); - // commit transaction - op->finish(); - } - Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value()); - aSh->SetShadingColor( GeomGUI->myShadingColor ); - Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), - Fatherior, - "GEOM"); - IO->setEntry(obj->GetID()); - aSh->setIO( IO ); - aSh->setName( aName->Value() ); - ic->Display (aSh, false); - if (!useSubItems) ic->AddOrRemoveCurrentObject(aSh, false); - } - } - // next item iteration - if (useSubItems) { - anIter->Next(); - anAttr=SALOMEDS::GenericAttribute::_nil(); - while (anIter->More() && anAttr->_is_nil()) { - SALOMEDS::SObject_var subobject = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttribute; - if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { - anAttr = aTmpAttribute; - obj = subobject; - } else anIter->Next(); - } - } else - anAttr = SALOMEDS::GenericAttribute::_nil(); - } - } - } - } - // No viewer update should be done here! - //GeomGUI->myActiveStudy->updateObjBrowser( true ); - //ic->UpdateCurrentViewer(); + //Load Function BuildPresentation + OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("BuildPresentation"); + BP (*f1) = NULL; + if(osdF != NULL) { + f1 = (void (*) (const Handle(SALOME_InteractiveObject)&)) osdF; + (*f1)(theIO); } -} - -//======================================================================= -// function : Parameter() -// purpose : return a parameter (float) from a dialog box -// -// avalue1 : is a float or integer used as a default value displayed -// aTitle1 : is the title for aValue1 -// aTitle : is the main title -// bottom : maximum value to be entered -// top : minimum value to be entered -// decimals : number of decimals -//======================================================================= -double GeometryGUI::Parameter( Standard_Boolean& res, - const char* aValue1, - const char* aTitle1, - const char* aTitle, - const double bottom, - const double top, - const int decimals ) -{ - GeometryGUI_aParameterDlg * Dialog = - new GeometryGUI_aParameterDlg(aValue1, - aTitle1, - QAD_Application::getDesktop(), - aTitle, - TRUE, - 0, - bottom, - top, - decimals) ; - int r = Dialog->exec() ; - float X = 0.0 ; - if ( r == QDialog::Accepted ) { - res = Standard_True; - X = Dialog->getValue(); - } else - res = Standard_False; - delete Dialog; - return X; + return; } -//======================================================================= -// function : OnSketchSegment() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchSegment() -{ - this->mySketcher.ChangeMode(SEGMENT); -} - - -//======================================================================= -// function : OnSketchArc() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchArc() -{ - this->mySketcher.ChangeMode(ARC_CHORD); -} - -//======================================================================= -// function : OnSketchSetAngle() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchSetAngle() -{ - Standard_Real anAngle = this->mySketcher.GetSegmentAngle()/PI180; - Sketch::fitInResol(anAngle); - Standard_Boolean res = false ; - QString Value = QString("%1").arg( anAngle ); - anAngle = Parameter(res, Value, tr("GEOM_MEN_ANGLE"), tr("GEOM_MEN_ENTER_ANGLE"), -180.0, +180.0, 6 )*PI180 ; - - if( res ) { - this->mySketcher.SetSegmentAngle(anAngle); - QMenuBar* Mb = this->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(3133,&pp); - pp->setItemChecked(3133,false); - item = Mb->findItem(3134,&pp); - pp->setItemChecked(3134,false); - } - -} - - -//======================================================================= -// function : OnSketchSetx() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchSetx() -{ - Standard_Boolean res = false; - double X = Parameter( res, - "0.", - tr("GEOM_MEN_X"), - tr("GEOM_MEN_SKETCHER_X"), - 2.0 * Precision::Confusion(), - 1E6, - 6 ) ; - if (res) - this->mySketcher.SetXDimension(X); - QMenuBar* Mb = this->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(3133,&pp); - pp->setItemChecked(3133,false); - item = Mb->findItem(3134,&pp); - pp->setItemChecked(3134,false); -} - -//======================================================================= -// function : OnSketchSety() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchSety() -{ - Standard_Boolean res = false; - double Y = Parameter( res, - "0.", - tr("GEOM_MEN_Y"), - tr("GEOM_MEN_SKETCHER_Y"), - 2.0 * Precision::Confusion(), - 1E6, - 6 ) ; - if (res) - this->mySketcher.SetYDimension(Y); - QMenuBar* Mb = this->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(3133,&pp); - pp->setItemChecked(3133,false); - item = Mb->findItem(3134,&pp); - pp->setItemChecked(3134,false); -} - - -//======================================================================= -// function : OnSketchDelete() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchDelete() -{ - if (GeomGUI->mySketcher.GetmyEdgesNumber() == 1 ) { - QMenuBar* Mb = GeomGUI->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(313,&pp); - pp->setItemEnabled( 313, false); // SKETCH CONTRAINTS - GeomGUI->mySketcher.SetTransitionStatus(NOCONSTRAINT); - } - - if (this->mySketcher.Delete()) - GeomGUI->ResetState(); -} - - -//======================================================================= -// function : OnSketchClose() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchClose() -{ - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)this->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); - - TopoDS_Wire W = this->mySketcher.Close(); - if ( !W.IsNull() ) { - // - GEOM::GEOM_Gen::ListOfIOR_var listShapes = new GEOM::GEOM_Gen::ListOfIOR; - listShapes->length(0); - unsigned int i = 0; - - BRepTools_WireExplorer Ex(W); - while ( Ex.More() ) { - TopoDS_Edge E = Ex.Current(); - gp_Pnt pt1 , pt2 ; - - pt1 = BRep_Tool::Pnt(TopExp::FirstVertex(E)); - pt2 = BRep_Tool::Pnt(TopExp::LastVertex(E)); - - gp_Pnt CenterPoint; - Handle(Geom_Curve) Curve; - Handle(Geom_Circle) Circle; - gp_Circ Circ; - Standard_Real First,Last; - - Curve = BRep_Tool::Curve(E,First,Last); - if(Curve->IsKind(STANDARD_TYPE(Geom_Circle))) { - Circle = Handle(Geom_Circle)::DownCast(Curve); // pointer on geom_circ - Circ = Circle->Circ(); // gp_Circ - - Curve->D0( (First + Last) / 2. , CenterPoint ); - - GEOM::PointStruct pI = myComponentGeom->MakePointStruct( pt1.X(), pt1.Y(), pt1.Z() ); - GEOM::PointStruct pC = myComponentGeom->MakePointStruct( CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z() ); - GEOM::PointStruct pE = myComponentGeom->MakePointStruct( pt2.X(), pt2.Y(), pt2.Z() ); - - GEOM::GEOM_Shape_var arc; - - try { - arc = myComponentGeom->MakeArc(pI, pC, pE) ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - listShapes->length(i+1); - listShapes[i] = strdup(arc->Name()); - i++; - } else { - GEOM::PointStruct pI = myComponentGeom->MakePointStruct( pt1.X(), pt1.Y(), pt1.Z() ); - GEOM::PointStruct pE = myComponentGeom->MakePointStruct( pt2.X(), pt2.Y(), pt2.Z() ); - GEOM::GEOM_Shape_var segment; - - try { - segment = myComponentGeom->MakeEdge(pI,pE) ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - listShapes->length(i+1); - listShapes[i] = strdup(segment->Name()); - i++; - } - Ex.Next(); - } - GEOM::GEOM_Shape_var Wire = myComponentGeom->MakeWire(listShapes) ; - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, Wire); - Standard_CString type; - GetShapeTypeString(S,type); - Wire->NameType( type ); - - if ( Display(Wire, "" )) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); - } - } - GeomGUI->ResetState(); - QMenuBar* Mb = this->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(313,&pp); - pp->setItemEnabled( 313, false); // SKETCH CONTRAINTS - GeomGUI->mySketcher.SetTransitionStatus(NOCONSTRAINT); -} - - - -//======================================================================= -// function : OnSketchEnd() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchEnd() -{ - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)this->myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); - - TopoDS_Wire W = this->mySketcher.End(); - if (!W.IsNull()) { - // - GEOM::GEOM_Gen::ListOfIOR_var listShapes = new GEOM::GEOM_Gen::ListOfIOR; - listShapes->length(0); - unsigned int i = 0; - - BRepTools_WireExplorer Ex(W); - while ( Ex.More() ) { - TopoDS_Edge E = TopoDS::Edge( Ex.Current() ); - - gp_Pnt pt1 , pt2 ; - pt1 = BRep_Tool::Pnt(TopExp::FirstVertex(E)); - pt2 = BRep_Tool::Pnt(TopExp::LastVertex(E)); - - gp_Pnt CenterPoint; - Handle(Geom_Curve) Curve; - Handle(Geom_Circle) Circle; - gp_Circ Circ; - Standard_Real First,Last; - - Curve = BRep_Tool::Curve(E,First,Last); - if(Curve->IsKind(STANDARD_TYPE(Geom_Circle))) { - Circle = Handle(Geom_Circle)::DownCast(Curve); // pointer on geom_circ - Circ = Circle->Circ(); // gp_Circ - - Curve->D0( (First + Last) / 2. , CenterPoint ); - - GEOM::PointStruct pI = myComponentGeom->MakePointStruct( pt1.X(), pt1.Y(), pt1.Z() ); - GEOM::PointStruct pC = myComponentGeom->MakePointStruct( CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z() ); - GEOM::PointStruct pE = myComponentGeom->MakePointStruct( pt2.X(), pt2.Y(), pt2.Z() ); - - GEOM::GEOM_Shape_var arc; - - try { - arc = myComponentGeom->MakeArc(pI, pC, pE) ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - listShapes->length(i+1); - listShapes[i] = strdup(arc->Name()); - i++; - } else { - GEOM::PointStruct pI = myComponentGeom->MakePointStruct( pt1.X(), pt1.Y(), pt1.Z() ); - GEOM::PointStruct pE = myComponentGeom->MakePointStruct( pt2.X(), pt2.Y(), pt2.Z() ); - GEOM::GEOM_Shape_var segment; - - try { - segment = myComponentGeom->MakeEdge(pI,pE) ; - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - listShapes->length(i+1); - listShapes[i] = strdup(segment->Name()); - i++; - } - Ex.Next(); - } - - GEOM::GEOM_Shape_var Wire = myComponentGeom->MakeWire(listShapes) ; - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, Wire); - Standard_CString type; - GetShapeTypeString(S,type); - Wire->NameType( type ); - - if ( Display(Wire, "") ) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); - } - } - GeomGUI->ResetState(); - QMenuBar* Mb = this->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(313,&pp); - pp->setItemEnabled( 313, false); // SKETCH CONTRAINTS - GeomGUI->mySketcher.SetTransitionStatus(NOCONSTRAINT); -} - -//======================================================================= -// function : OnSettingsNoconstraint() -// purpose : -//======================================================================= -void GeometryGUI::OnSettingsNoconstraint() -{ - this->mySketcher.SetTransitionStatus(NOCONSTRAINT); -} - -//======================================================================= -// function : OnSettingsPerpendicular() -// purpose : -//======================================================================= -void GeometryGUI::OnSettingsPerpendicular() -{ - this->mySketcher.SetTransitionStatus(PERPENDICULAR); -} - -//======================================================================= -// function : OnSettingsTangent() -// purpose : -//======================================================================= -void GeometryGUI::OnSettingsTangent() -{ - this->mySketcher.SetTransitionStatus(TANGENT); -} - -//======================================================================= -// function : OnSketchOptionsOnoffangledimension() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchOptionsOnoffangledimension() -{ - QMenuBar* Mb = this->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(10011,&pp); - pp->setItemChecked(10011,!pp->isItemChecked(10011)); - this->mySketcher.SetParameterVisibility(ANGLE_PARAMETER,pp->isItemChecked(10011)); -} - -//======================================================================= -// function : OnSketchOptionsOnofflengthdimension() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchOptionsOnofflengthdimension() -{ - QMenuBar* Mb = this->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(10010,&pp); - pp->setItemChecked(10010,!pp->isItemChecked(10010)); - this->mySketcher.SetParameterVisibility(LENGTH_PARAMETER,pp->isItemChecked(10010)); -} - -//======================================================================= -// function : OnSketchOptionsOnoffradiusdimension() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchOptionsOnoffradiusdimension() -{ - QMenuBar* Mb = this->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(10012,&pp); - pp->setItemChecked(10012,!pp->isItemChecked(10012)); - this->mySketcher.SetParameterVisibility(RADIUS_PARAMETER,pp->isItemChecked(10012)); -} - - -//======================================================================= -// function : OnSketchOptionsOnoffxdimension() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchOptionsOnoffxdimension() -{ - QMenuBar* Mb = this->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(10013,&pp); - pp->setItemChecked(10013,!pp->isItemChecked(10013)); - this->mySketcher.SetParameterVisibility(XVALUE_PARAMETER,pp->isItemChecked(10013)); -} - -//======================================================================= -// function : OnSketchOptionsOnoffydimension() -// purpose : -//======================================================================= -void GeometryGUI::OnSketchOptionsOnoffydimension() -{ - QMenuBar* Mb = this->myDesktop->getMainMenuBar(); - QMenuData* pp; - QMenuItem* item = Mb->findItem(10014,&pp); - pp->setItemChecked(10014,!pp->isItemChecked(10014)); - this->mySketcher.SetParameterVisibility(YVALUE_PARAMETER,pp->isItemChecked(10014)); -} - - -//======================================================================= -// function : Archimede() -// purpose : -//======================================================================= -void GeometryGUI::Archimede( const Handle(SALOME_InteractiveObject)& IO, - const double aWeight, - const double aWaterDensity, - const double aMeshingDeflection ) -{ - try { - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIO = - Handle(GEOM_InteractiveObject)::DownCast( IO ); - GEOM::GEOM_Shape_var Shape = GeomGUI->myComponentGeom->GetIORFromString( GIO->getIOR() ); - - GEOM::GEOM_Shape_var Result = GeomGUI->myComponentGeom->Archimede( Shape, aWeight, aWaterDensity, aMeshingDeflection); - Result->NameType(tr("GEOM_PLANE")); - if ( Display(Result, "") ) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); - } - return; - } - if ( IO->hasEntry() ) { - SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->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); - GEOM::GEOM_Shape_var Shape = GeomGUI->myComponentGeom->GetIORFromString( anIOR->Value() ); - GEOM::GEOM_Shape_var Result = GeomGUI->myComponentGeom->Archimede( Shape, aWeight, aWaterDensity, aMeshingDeflection); - Result->NameType(tr("GEOM_PLANE")); - if ( Display(Result, "") ) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); - } - } - } - } - - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } -} - - -//===================================================================================== +//================================================================================= // EXPORTED METHODS -//===================================================================================== +//================================================================================= extern "C" { bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) - { - return GeometryGUI::OnGUIEvent(theCommandID, parent); - } + {return GeometryGUI::OnGUIEvent(theCommandID, parent);} - bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) - { - return GeometryGUI::OnKeyPress (pe, parent, studyFrame); - } + bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) + {return GeometryGUI::OnKeyPress(pe, parent, studyFrame);} - bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) - { - return GeometryGUI::OnMousePress (pe, parent, studyFrame); - } + bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) + {return GeometryGUI::OnMousePress(pe, parent, studyFrame);} - bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) - { - return GeometryGUI::OnMouseMove (pe, parent, studyFrame); - } + bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) + {return GeometryGUI::OnMouseMove(pe, parent, studyFrame);} - bool SetSettings ( QAD_Desktop* parent ) - { - return GeometryGUI::SetSettings( parent ); - } + bool SetSettings(QAD_Desktop* parent) + {return GeometryGUI::SetSettings(parent);} - bool customPopup ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext, - const QString & theParent, const QString & theObject ) - { - return GeometryGUI::CustomPopup( parent, popup, theContext, theParent, theObject ); - } + bool customPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext, + const QString & theParent, const QString & theObject) + {return GeometryGUI::CustomPopup(parent, popup, theContext, theParent, theObject);} - void definePopup ( QString & theContext, QString & theParent, QString & theObject ) - { - GeometryGUI::DefinePopup( theContext, theParent, theObject ); - } + void definePopup(QString & theContext, QString & parent, QString & theObject) + {GeometryGUI::DefinePopup(theContext, parent, theObject);} - bool activeStudyChanged ( QAD_Desktop* parent ) - { - GeometryGUI::activeStudyChanged( parent ); - } + bool activeStudyChanged(QAD_Desktop* parent) + {GeometryGUI::activeStudyChanged(parent);} - void buildPresentation ( const Handle(SALOME_InteractiveObject)& theIO ) - { - GeometryGUI::BuildPresentation(theIO); - } + void buildPresentation(const Handle(SALOME_InteractiveObject)& theIO) + {GeometryGUI::BuildPresentation(theIO);} void supportedViewType(int* buffer, int bufferSize) { - if (!buffer || !bufferSize) return; + if(!buffer || !bufferSize) return; buffer[0] = (int)VIEW_OCC; if (--bufferSize) buffer[1] = (int)VIEW_VTK; } } - -//===================================================================================== -// function : OnFilletGetAll() -// purpose : -//===================================================================================== -bool GeometryGUI::OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Radius, const int SubShapeType, const char* ShapeTopoIOR) -{ - GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; - ListOfID->length(0); - - SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument(); - SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR( ShapeTopoIOR ); - if ( theObj->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); - return false ; - } - - try { - if( Radius <= Precision::Confusion() ) - return false; - - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR ); - GEOM::GEOM_Shape_var result = myComponentGeom->MakeFillet(aShape, Radius, SubShapeType, ListOfID) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return false; - } - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result); - Standard_CString type; - GetShapeTypeString(S,type); - result->NameType( type ); - - if ( Display( result, "" )) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return true; -} - -//===================================================================================== -// function : OnFilletGetSelected() -// purpose : -//===================================================================================== -bool GeometryGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, - const char* ShapeTopoIOR, - const double Radius, - const int SubShapeType, - Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) -{ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - return false; - } - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - if( myUseLocalContext == false ) { - /* No local context opened for fillet method */ - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return false ; - } - - GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; - ic->InitSelected(); - int nbSelected = ic->NbSelected(); - int i = 0; - ic->InitSelected(); - - while(ic->MoreSelected()) { - TopoDS_Shape s = ic->SelectedShape(); - if ( s.ShapeType() == TopAbs_FACE ) { - TopExp_Explorer Exp( s, TopAbs_EDGE ); - TopTools_MapOfShape M ; - while ( Exp.More() ) { - if( M.Add(Exp.Current() )) { /* if a new edge : do not add doublons indices */ - ListOfID->length( i + 1 ); - ListOfID[i] = GetIndex( Exp.Current(), ShapeTopo, (int)TopAbs_EDGE ) ; - i++ ; - } - Exp.Next(); - } - } - else { - ListOfID->length( i + 1 ); - ListOfID[i] = GetIndex( ic->SelectedShape(), ShapeTopo, SubShapeType ); - i++; - } - ic->NextSelected(); - } - - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR ); - GEOM::GEOM_Shape_var aResult ; - try { - aResult = myComponentGeom->MakeFillet( aShape, Radius, 6, ListOfID ); - - /* local context from DialogBox */ - ic->CloseLocalContext(aLocalContextId) ; - myUseLocalContext = false ; - - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, aResult); - Standard_CString type; - GetShapeTypeString(S,type); - aResult->NameType( type ); - - if ( Display( aResult, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - if ( myUseLocalContext ) { - /* local context from DialogBox */ - ic->CloseLocalContext(aLocalContextId) ; - myUseLocalContext = false ; - } - - this->OnDisplayAll(true); - myActiveStudy->updateObjBrowser(); - myDesktop->putInfo (tr("GEOM_PRP_READY")); - - return true ; -} - -//===================================================================================== -// function : OnChamferGetAll() -// purpose : -//===================================================================================== -bool GeometryGUI::OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D1, const double D2, const int SubShapeType, const char* ShapeTopoIOR) -{ - GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; - ListOfID->length(0); - - SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument(); - SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR( ShapeTopoIOR ); - if ( theObj->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); - return false ; - } - - try { - if( D1 <= Precision::Confusion() ) - return false; - if( D2 <= Precision::Confusion() ) - return false; - - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR ); - GEOM::GEOM_Shape_var result = myComponentGeom->MakeChamfer(aShape, D1, D2, SubShapeType, ListOfID) ; - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return false; - } - - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, result); - Standard_CString type; - GetShapeTypeString(S,type); - result->NameType( type ); - - if ( Display( result, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return true; -} - -//===================================================================================== -// function : OnChamferGetSelected() -// purpose : -//===================================================================================== -bool GeometryGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, - const char* ShapeTopoIOR, - const double D1, const double D2, const int SubShapeType, - Standard_Integer& aLocalContextId, - bool& myUseLocalContext) -{ - if ( this->myActiveStudy->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - return false; - } - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myActiveStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - if( myUseLocalContext == false ) { - /* No local context opened for chamfer method */ - myDesktop->putInfo(tr("GEOM_PRP_ABORT")); - return false ; - } - - GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; - ic->InitSelected(); - int nbSelected = ic->NbSelected(); - int i = 0; - ic->InitSelected(); - - while(ic->MoreSelected()) { - TopoDS_Shape s = ic->SelectedShape(); - if ( s.ShapeType() == TopAbs_FACE ) { - TopExp_Explorer Exp( s, TopAbs_EDGE ); - TopTools_MapOfShape M ; - while ( Exp.More() ) { - if( M.Add(Exp.Current() )) { /* if a new edge : do not add doublons indices */ - ListOfID->length( i + 1 ); - ListOfID[i] = GetIndex( Exp.Current(), ShapeTopo, (int)TopAbs_EDGE ) ; - i++ ; - } - Exp.Next(); - } - } - else { - ListOfID->length( i + 1 ); - ListOfID[i] = GetIndex( ic->SelectedShape(), ShapeTopo, SubShapeType ) ; - i++; - } - ic->NextSelected(); - } - - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString( ShapeTopoIOR ); - GEOM::GEOM_Shape_var aResult ; - try { - aResult = myComponentGeom->MakeChamfer( aShape, D1, D2, 6, ListOfID ); - - /* local context from DialogBox */ - ic->CloseLocalContext(aLocalContextId) ; - myUseLocalContext = false ; - - TopoDS_Shape S = ShapeReader.GetShape(myComponentGeom, aResult); - Standard_CString type; - GetShapeTypeString(S,type); - aResult->NameType( type ); - - if ( Display( aResult, "") ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - if ( myUseLocalContext ) { - /* local context from DialogBox */ - ic->CloseLocalContext(aLocalContextId) ; - myUseLocalContext = false ; - } - - this->OnDisplayAll(true); - myActiveStudy->updateObjBrowser(); - myDesktop->putInfo (tr("GEOM_PRP_READY")); - - return true ; -} - -//===================================================================================== -// function : MakeCDGAndDisplay() -// purpose : -//===================================================================================== -void GeometryGUI::MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape) -{ - try { - GEOM::GEOM_Shape_var result = myComponentGeom->MakeCDG( Shape ); - if ( result->_is_nil() ) { - myDesktop->putInfo(tr("GEOM_PRP_ABORT") ); - return ; - } - result->NameType( tr("GEOM_POINT") ); - if ( Display( result ) ) - myDesktop->putInfo(tr("GEOM_PRP_DONE")); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return ; -} - -bool GeometryGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR) { - SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->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; -} diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 756f2d1d4..dd133add0 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -26,39 +26,10 @@ // Module : GEOM // $Header$ -#ifndef GeometryGUI_HeaderFile -#define GeometryGUI_HeaderFile - -// SALOME Includes -#include "QAD_Desktop.h" -#include "SALOME_Selection.h" -#include "SALOME_InteractiveObject.hxx" -#include "GEOM_InteractiveObject.hxx" -#include "GEOM_AISShape.hxx" -#include "GEOM_Actor.h" -#include "GEOM_Sketcher.h" - -// Open CASCADE Includes -#include -#include -#include -#include -#include - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(GEOM_Gen) -#include CORBA_SERVER_HEADER(SALOMEDS) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -//================================================================================= -// -//================================================================================= - enum { - POINT_METHOD, - CURRENT_SKETCH - } ; +#ifndef GEOMETRYGUI_H +#define GEOMETRYGUI_H +#include "GEOMContext.h" //================================================================================= // class : GeometryGUI @@ -68,274 +39,24 @@ class GeometryGUI : public QObject { Q_OBJECT /* for QT compatibility */ -private : - - QAD_Desktop* myDesktop; - QAD_Study* myActiveStudy; - GEOM::GEOM_Gen_var myComponentGeom; - QDialog* myActiveDialogBox; /* Unique active dialog box */ - Handle(AIS_Shape) mySimulationShape; /* AIS shape used only during topo/geom simulations */ - vtkActorCollection* mySimulationActor; /* GEOM Actor used only during topo/geom simulations */ - int myNbGeom ; /* Unique name for a geom entity */ - int myState ; /* Identify a method */ - Sketch mySketcher; - - Quantity_Color myShadingColor; - public : + GeometryGUI(); + ~GeometryGUI(); - GeometryGUI(); - ~GeometryGUI(); + static GEOMContext* GetOrCreateGeometryGUI(QAD_Desktop* desktop); - static GeometryGUI* GetOrCreateGeometryGUI( QAD_Desktop* desktop ); - static GeometryGUI* GetGeometryGUI() ; + /* Managed by IAPP */ + Standard_EXPORT static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + Standard_EXPORT static bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); + Standard_EXPORT static bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); + Standard_EXPORT static bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); + Standard_EXPORT static bool SetSettings(QAD_Desktop* parent); + Standard_EXPORT static void activeStudyChanged(QAD_Desktop* parent); + Standard_EXPORT static void BuildPresentation(const Handle(SALOME_InteractiveObject)&); + Standard_EXPORT static void DefinePopup(QString & theContext, QString & theParent, QString & theObject); + Standard_EXPORT static bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, + const QString& theParent, const QString& theObject); - QAD_Study* GetActiveStudy() ; - QAD_Desktop* GetDesktop() ; - - QDialog* GetActiveDialogBox() ; /* Returns the active DialogBox */ - void SetActiveDialogBox(QDialog* aDlg) ; /* Sets 'myActiveDialogBox' a pointer to the active Dialog Box */ - - void SetState(int aState) ; - void ResetState() ; /* Sets myState = -1 a private field to indicate wich method is active */ - bool DefineDlgPosition(QWidget* aDlg, int& x, int& y) ; - - bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR); - - void OnEditCopy (); - void OnEditDelete (); - void OnVTKDisplayOnly (); - - void OnDisplayOnly (); - void OnDisplayAll ( bool onlyPreviousDisplayedObject = false ); - void SetDisplayedObjectList(); - - bool AddInStudy( bool selection = false, const Handle(SALOME_InteractiveObject)& anIO = 0 ); - bool Display( GEOM::GEOM_Shape_ptr aShape, Standard_CString name = ""); - - /* Import and export topology methods */ - bool Import(); - bool Export(); - - - static int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType) ; - static bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P) ; - static void GetBipointDxDyDz( gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz) ; - - static bool GetShapeTypeString( const TopoDS_Shape& aShape, Standard_CString& aTypeString ) ; - static bool LinearEdgeExtremities( const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2) ; - - static gp_Pnt ConvertClickToPoint( Standard_Real x, Standard_Real y, Handle(V3d_View) aView ) ; - - /* User dialog 1 parameter returned */ - static 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 ) ; - - /* Managed by IAPP */ - Standard_EXPORT static bool OnGUIEvent ( int theCommandID, QAD_Desktop* parent) ; - Standard_EXPORT static bool OnMousePress ( QMouseEvent* pe, QAD_Desktop* parent, - QAD_StudyFrame* studyFrame ); - Standard_EXPORT static bool OnMouseMove ( QMouseEvent* pe, QAD_Desktop* parent, - QAD_StudyFrame* studyFrame ); - Standard_EXPORT static bool OnKeyPress ( QKeyEvent* pe, QAD_Desktop* parent, - QAD_StudyFrame* studyFrame ); - Standard_EXPORT static void activeStudyChanged ( QAD_Desktop* parent ); - Standard_EXPORT static bool SetSettings ( QAD_Desktop* parent ); - Standard_EXPORT static void DefinePopup( QString & theContext, - QString & theParent, - QString & theObject ); - Standard_EXPORT static bool CustomPopup ( QAD_Desktop* parent, - QPopupMenu* popup, - const QString& theContext, - const QString& theParent, - const QString& theObject ); - Standard_EXPORT static void BuildPresentation(const Handle(SALOME_InteractiveObject)&); - - void Archimede( const Handle(SALOME_InteractiveObject)& IO, const double aWeight, - const double aWaterDensity, const double aMeshingDeflection ); - - void MakePointAndDisplay( const double x, const double y, const double z ) ; - void MakeVectorAndDisplay( const gp_Pnt P1, const gp_Pnt P2 ); - void MakeBoxAndDisplay( const gp_Pnt P1, const gp_Pnt P2 ) ; - void MakePlaneAndDisplay( const gp_Pnt P1, const Standard_Real dx, - const Standard_Real dy, const Standard_Real dz, const Standard_Real TrimSize ) ; - void MakeSphereAndDisplay( const gp_Pnt aCenterPoint, const double aRadius) ; - void MakeCircleAndDisplay( const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Radius) ; - void MakeEllipseAndDisplay( const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Major_Radius, const Standard_Real Minor_Radius) ; - void MakeArcAndDisplay( gp_Pnt InitPoint, gp_Pnt CirclePoint, gp_Pnt EndPoint ) ; - void MakeLineAndDisplay( const gp_Pnt InitPoint, const gp_Pnt LastPoint) ; - void MakeCylinderAndDisplay( const gp_Pnt BasePoint, const gp_Dir aDir, - const double Radius, const double aHeight ) ; - void MakeConeAndDisplay( const gp_Pnt BasePoint, const gp_Dir aDir, - const double Radius1, const double Radius2, const double aHeight ) ; - void MakeTorusAndDisplay( const gp_Pnt BasePoint, const gp_Dir aDir, - const double Radius1, const double Radius2 ) ; - void MakeBooleanAndDisplay( GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2, - const short operation ) ; - void MakeRevolutionAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc, - const gp_Dir dir, Standard_Real revolAngle ) ; - void MakePrismAndDisplay( GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2 ) ; - void MakePipeAndDisplay( GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Shape_ptr aBase ) ; - void MakeFillingAndDisplay( GEOM::GEOM_Shape_ptr SectionShape, const short mindeg, const short maxdeg, - const double tol3d, const double tol2d, const short nbiter ) ; - void MakeRotationAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc, const gp_Dir dir, - const Standard_Real angle ) ; - void MakeTranslationAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Vec V) ; - - void MakeMultiTranslation1DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const double Step, const short NbTimes ) ; - void 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 ) ; - void MakeMultiRotation1DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const gp_Pnt Loc, const short NbTimes ) ; - void MakeMultiRotation2DAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, const gp_Pnt Loc, const double Ang, - const short NbTimes1, const double Step, const short NbTimes2 ) ; - void MakeCDGAndDisplay( GEOM::GEOM_Shape_ptr Shape ); - void MakeScaleAndDisplay( GEOM::GEOM_Shape_ptr Shape, const gp_Pnt centralPoint, - const Standard_Real factor) ; - void MakeMirrorAndDisplay( GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2 ) ; - void MakeSewingAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, - const Standard_Real precision ) ; - void MakeCompoundAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) ; - void MakeLinearEdgeAndDisplay( const gp_Pnt P1, const gp_Pnt P2 ) ; - void MakeOrientationChangeAndDisplay( GEOM::GEOM_Shape_ptr Shape ) ; - - void MakePartitionAndDisplay (const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, - const GEOM::GEOM_Gen::ListOfIOR& listToolsIOR, - const GEOM::GEOM_Gen::ListOfIOR& listKeepInsIOR, - const GEOM::GEOM_Gen::ListOfIOR& listRemoveInsIOR, - const GEOM::shape_type limit ) ; - - void MakeWireAndDisplay( GEOM::GEOM_Gen::ListOfIOR& listShapesIOR ) ; - void MakeWorkingPlane( const gp_Pnt P, const gp_Dir D) ; - void MakeFaceAndDisplay( GEOM::GEOM_Shape_ptr aWire, const Standard_Boolean wantPlanar ) ; - - /* Simulation management */ - bool CreateArrowForLinearEdge( const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone ) ; - void DisplaySimulationShape(const TopoDS_Shape& S) ; - void EraseSimulationShape() ; - - /* Selection and objects management */ - - TopoDS_Shape GetShapeFromIOR( QString IOR ); - bool GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds) ; - int GetNameOfSelectedIObjects( SALOME_Selection* Sel, QString& aName ) ; - 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 ) ; - - /* Method opening context for any sub shape selection */ - bool PrepareSubShapeSelection( const int SubShapeType, - Standard_Integer& returnLocalContextId ) ; - - /* Method opening context for sub shape selection on an argument shape */ - bool PrepareSubShapeSelectionArgumentShape( const TopoDS_Shape& aShape, - const int SubShapeType, - Standard_Integer& returnLocalContextId ) ; - - - /* 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 ) ; - - /* Methods for sub shapes explode */ - 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 ) ; - - /* Remove faces in a shape */ - bool OnSuppressFaces( const TopoDS_Shape& ShapeTopo, - const char* ShapeTopoIOR, - const Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) ; - - /* Remove an hole in a topology (ListOfIdEndFace may be an empty list ) */ - bool OnSuppressHole( const char* ShapeTopoIOR, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdFace, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWire, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace ) ; - - /* Remove one or more holes in a face or a shell */ - bool OnSuppressHolesInFaceOrShell( const char* ShapeTopoIOR, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires ) ; - - /* Create a face corresponding to a hole on a shape */ - bool OnFillingHole( const TopoDS_Shape& MainShape, - const char* ShapeTopoIOR, - const Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) ; - - /* Method for Fillet */ - bool OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Radius, const int SubShapeType, const char* ShapeTopoIOR) ; - bool OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, - const char* ShapeTopoIOR, - const double Radius, - const int SubShapeType, - Standard_Integer& aLocalContextId, - bool& myUseLocalContext ); - - /* Methods for Chamfer */ - bool OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D1, const double D2, const int SubShapeType, const char* ShapeTopoIOR) ; - bool OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, - const char* ShapeTopoIOR, - const double D1, const double D2, const int SubShapeType, - Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) ; - - /* Non modal dialog boxes magement */ - void EmitSignalDeactivateDialog() ; - void EmitSignalCloseAllDialogs() ; - - /* Sketcher management */ - void OnSketchSegment(); - void OnSketchArc(); - void OnSketchSetAngle(); - void OnSketchSetx(); - void OnSketchSety(); - - void OnSketchDelete(); - void OnSketchClose(); - void OnSketchEnd(); - - void OnSketchOptionsOnoffangledimension(); - void OnSketchOptionsOnofflengthdimension(); - void OnSketchOptionsOnoffradiusdimension(); - void OnSketchOptionsOnoffxdimension(); - void OnSketchOptionsOnoffydimension(); - - void OnSettingsNoconstraint(); - void OnSettingsPerpendicular(); - void OnSettingsTangent(); - -signals: - void SignalDeactivateActiveDialog() ; - void SignalCloseAllDialogs() ; - void SignalDefaultStepValueChanged( double newVal ) ; }; #endif diff --git a/src/GEOMGUI/GeometryGUI_ArcDlg.cxx b/src/GEOMGUI/GeometryGUI_ArcDlg.cxx deleted file mode 100644 index cd536c58c..000000000 --- a/src/GEOMGUI/GeometryGUI_ArcDlg.cxx +++ /dev/null @@ -1,507 +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 : GeometryGUI_ArcDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_ArcDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Tools.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_ArcDlg() -// purpose : Constructs a GeometryGUI_ArcDlg 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. -//================================================================================= -GeometryGUI_ArcDlg::GeometryGUI_ArcDlg( 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_ARC"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_ArcDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_ARC_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_ArcDlgLayout = new QGridLayout( this ); - GeometryGUI_ArcDlgLayout->setSpacing( 6 ); - GeometryGUI_ArcDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_ARC" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_ArcDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_POINTS" ) ); - 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_POINT_I" ).arg( "1" ) ); - 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 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_POINT_I" ).arg( "2" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_POINT_I" ).arg( "3" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - SelectButtonC1A3 = new QPushButton( GroupC1, "SelectButtonC1A3" ); - SelectButtonC1A3->setText( tr( "" ) ); - SelectButtonC1A3->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A3, 2, 1 ); - LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" ); - GroupC1Layout->addWidget( LineEditC1A3, 2, 2 ); - GeometryGUI_ArcDlgLayout->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, 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 ); - GeometryGUI_ArcDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ - - /* Move widget on the botton right corner of main widget */ - QAD_Tools::alignWidget(this, parent, AlignBottom | AlignRight); - /* Display Dialog */ - this->show() ; -} - - -//================================================================================= -// function : ~GeometryGUI_ArcDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_ArcDlg::~GeometryGUI_ArcDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myOkPoint1 = myOkPoint2 = myOkPoint3 = false ; - mySimulationTopoDs.Nullify() ; - 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); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - mySelection->AddFilter(myVertexFilter) ; - - /* 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( SelectButtonC1A3, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - 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() ) ) ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_ArcDlg::ConstructorsClicked(int constructorId) -{ - /* only a constructor now */ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPoint1 && myOkPoint2 && myOkPoint3 ) { - myGeomGUI->MakeArcAndDisplay( myPoint1, myPoint2, myPoint3 ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_ArcDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* name of future selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myEditCurrentArgument->setText("") ; - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myEditCurrentArgument->setText("") ; - myOkPoint2 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A3 ) { - myEditCurrentArgument->setText("") ; - myOkPoint3 = false ; - } - return ; - } - - // nbSel == 1 ! - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint( S, this->myPoint1 ) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 && myGeomGUI->VertexToPoint( S, this->myPoint2 ) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint2 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A3 && myGeomGUI->VertexToPoint( S, this->myPoint3 ) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint3 = true ; - } - - /* Simulation */ - if( myOkPoint1 && myOkPoint2 && myOkPoint3 ) { - this->MakeArcSimulationAndDisplay() ; - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - mySelection->AddFilter(myVertexFilter) ; - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - } - else if(send == SelectButtonC1A3) { - LineEditC1A3->setFocus() ; - myEditCurrentArgument = LineEditC1A3; - } - SelectionIntoArgument() ; - break; - } - } -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - else if ( send == LineEditC1A3 ) - myEditCurrentArgument = LineEditC1A3 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : MakeArcSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_ArcDlg::MakeArcSimulationAndDisplay() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - try { - if ( myPoint2.IsEqual( myPoint1, Precision::Confusion() ) ) { - myEditCurrentArgument->setText("") ; - return; - } - if ( myPoint2.IsEqual( myPoint3, Precision::Confusion() ) ) { - myEditCurrentArgument->setText("") ; - return; - } - - gp_Vec v1( this->myPoint2, this->myPoint1 ) ; - gp_Vec v2( this->myPoint2, this->myPoint3 ) ; - if( v1.IsParallel(v2, Precision::Angular() ) ) { - myEditCurrentArgument->setText("") ; - return ; - } - - GC_MakeArcOfCircle Arc( this->myPoint1, this->myPoint2, this->myPoint3 ); - if ( Arc.IsDone() ) { - Handle(Geom_TrimmedCurve) curve = Arc.Value() ; - mySimulationTopoDs = BRepBuilderAPI_MakeEdge(curve).Shape() ; - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ; - } - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeArcSimulationAndDisplay" ) ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_ArcDlg.h b/src/GEOMGUI/GeometryGUI_ArcDlg.h deleted file mode 100644 index 40384fee5..000000000 --- a/src/GEOMGUI/GeometryGUI_ArcDlg.h +++ /dev/null @@ -1,125 +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 : GeometryGUI_ArcDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_ARC_H -#define DIALOGBOX_ARC_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_ArcDlg -// purpose : -//================================================================================= -class GeometryGUI_ArcDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_ArcDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_ArcDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - gp_Pnt myPoint1 ; - gp_Pnt myPoint2 ; - gp_Pnt myPoint3; - - bool myOkPoint1 ; - bool myOkPoint2; - bool myOkPoint3; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeArcSimulationAndDisplay() ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A2; - QLabel* TextLabelC1A3; - QPushButton* SelectButtonC1A3; - QLineEdit* LineEditC1A3; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void LineEditReturnPressed() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_ArcDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_ARC_H diff --git a/src/GEOMGUI/GeometryGUI_ArchimedeDlg.cxx b/src/GEOMGUI/GeometryGUI_ArchimedeDlg.cxx deleted file mode 100644 index 61159318f..000000000 --- a/src/GEOMGUI/GeometryGUI_ArchimedeDlg.cxx +++ /dev/null @@ -1,470 +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 : GeometryGUI_ArchimedeDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_ArchimedeDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Tools.h" -#include "utilities.h" - -#include "SALOME_InteractiveObject.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_ArchimedeDlg() -// purpose : Constructs a GeometryGUI_ArchimedeDlg 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. -//================================================================================= -GeometryGUI_ArchimedeDlg::GeometryGUI_ArchimedeDlg( 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_ARCHIMEDE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_ArchimedeDlg" ); - resize( 303, 219 ); - setCaption( tr( "GEOM_ARCHIMEDE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_ArchimedeDlgLayout = new QGridLayout( this ); - GeometryGUI_ArchimedeDlgLayout->setSpacing( 6 ); - GeometryGUI_ArchimedeDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_ARCHIMEDE" ) ); - 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( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_ArchimedeDlgLayout->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_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_1, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - GeometryGUI_ArchimedeDlgLayout->addWidget( GroupButtons, 2, 0 ); - - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A2->setMinimumSize( QSize( 40, 0 ) ); - LineEditC1A2->setMaximumSize( QSize( 32767, 32767 ) ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - - LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" ); - LineEditC1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A3->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A3->setMinimumSize( QSize( 40, 0 ) ); - LineEditC1A3->setMaximumSize( QSize( 32767, 32767 ) ); - GroupC1Layout->addWidget( LineEditC1A3, 2, 2 ); - - LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" ); - LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A4->setMinimumSize( QSize( 40, 0 ) ); - LineEditC1A4->setMaximumSize( QSize( 32767, 32767 ) ); - GroupC1Layout->addWidget( LineEditC1A4, 3, 2 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) ); - 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_WEIGHT" ) ); - 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_WATER_DENSITY" ) ); - 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_MESHING_DEFLECTION" ) ); - TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A4->setFrameShape( QLabel::NoFrame ); - TextLabelC1A4->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 ); - - GeometryGUI_ArchimedeDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ - -/* Move widget on the botton right corner of main widget */ - QAD_Tools::alignWidget(this, parent, AlignBottom | AlignRight); - /* Display Dialog */ - this->show() ; -} - - -//================================================================================= -// function : ~GeometryGUI_ArchimedeDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_ArchimedeDlg::~GeometryGUI_ArchimedeDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::Init( SALOME_Selection* Sel ) -{ - LineEditC1A2->setMaxLength( 10 ); - LineEditC1A3->setMaxLength( 10 ); - LineEditC1A4->setMaxLength( 10 ); - this->myVa = new QDoubleValidator( 0, +999999.999, 3, LineEditC1A2 ) ; - this->myVb = new QDoubleValidator( 0, +999999.999, 3, LineEditC1A3 ) ; - this->myVc = new QDoubleValidator( 0, +999999.999, 3, LineEditC1A4 ) ; - LineEditC1A2->setValidator( myVa ) ; - LineEditC1A3->setValidator( myVb ) ; - LineEditC1A4->setValidator( myVc ) ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - - this->myWeight = 100.0 ; - LineEditC1A2->setText("100.0") ; - this->myWaterDensity = 1.0 ; - LineEditC1A3->setText("1.0") ; - this->myMeshingDeflection = 0.01 ; - LineEditC1A4->setText("0.01") ; - - myOkWeight = myOkWaterDensity = myOkMeshingDeflection = true ; - myOkIO = false ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - /* 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( LineEditC1A2, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; - connect( LineEditC1A3, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; - connect( LineEditC1A4, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_ArchimedeDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - if(myOkIO && myOkWeight && myOkWaterDensity && myOkMeshingDeflection ) { - myGeomGUI->Archimede( myIO, myWeight, myWaterDensity, myMeshingDeflection ); - } - } - break ; - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::ClickOnCancel() -{ - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_ArchimedeDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - myEditCurrentArgument->setText("") ; - myOkIO = false ; - } - else { - myEditCurrentArgument->setText(aString) ; - myIO = mySelection->firstIObject(); - myOkIO = true ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : TextChangedInLineEdit() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::TextChangedInLineEdit(const QString& newText) -{ - QLineEdit* send = (QLineEdit*)sender(); - QString newT = strdup(newText) ; - int i ; - - if(send == LineEditC1A2) { - if( myVa->validate(newT, i) == myVa->Acceptable ) { - this->myWeight = newText.toFloat() ; - myOkWeight = true ; - } - else { - myOkWeight = false ; - } - } - else if(send == LineEditC1A3) { - if( myVb->validate(newT, i) == myVb->Acceptable ) { - this->myWaterDensity = newText.toFloat() ; - myOkWaterDensity = true ; - } - else { - myOkWaterDensity = false ; - } - } - else if(send == LineEditC1A4) { - if( myVc->validate(newT, i) == myVc->Acceptable ) { - this->myMeshingDeflection = newText.toFloat() ; - myOkMeshingDeflection = true ; - } - else { - myOkMeshingDeflection = false ; - } - } - - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_ArchimedeDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - diff --git a/src/GEOMGUI/GeometryGUI_ArchimedeDlg.h b/src/GEOMGUI/GeometryGUI_ArchimedeDlg.h deleted file mode 100644 index f233b43c8..000000000 --- a/src/GEOMGUI/GeometryGUI_ArchimedeDlg.h +++ /dev/null @@ -1,127 +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 : GeometryGUI_ArchimedeDlg.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_ARCHIMEDE_H -#define DIALOGBOX_ARCHIMEDE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_ArchimedeDlg -// purpose : -//================================================================================= -class GeometryGUI_ArchimedeDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_ArchimedeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_ArchimedeDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - Handle(SALOME_InteractiveObject) myIO ; - - Standard_Real myWeight ; - Standard_Real myWaterDensity ; - Standard_Real myMeshingDeflection ; - - bool myOkIO ; - bool myOkWeight ; - bool myOkWaterDensity ; - bool myOkMeshingDeflection ; - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QDoubleValidator *myVa ; /* Double validator for numeric input */ - QDoubleValidator *myVb ; /* Double validator for numeric input */ - QDoubleValidator *myVc ; /* Double validator for numeric input */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QLineEdit* LineEditC1A3; - QLineEdit* LineEditC1A4; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QLabel* TextLabelC1A3; - QLabel* TextLabelC1A4; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void TextChangedInLineEdit(const QString&) ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_ArchimedeDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_ARCHIMEDE_H diff --git a/src/GEOMGUI/GeometryGUI_BndBoxDlg.cxx b/src/GEOMGUI/GeometryGUI_BndBoxDlg.cxx deleted file mode 100644 index 495aa46cc..000000000 --- a/src/GEOMGUI/GeometryGUI_BndBoxDlg.cxx +++ /dev/null @@ -1,487 +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 : GeometryGUI_BndBoxDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_BndBoxDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_BndBoxDlg() -// purpose : Constructs a GeometryGUI_BndBoxDlg 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. -//================================================================================= -GeometryGUI_BndBoxDlg::GeometryGUI_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 ) -{ - 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( "GeometryGUI_BndBoxDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_BNDBOX_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_BndBoxDlgLayout = new QGridLayout( this ); - GeometryGUI_BndBoxDlgLayout->setSpacing( 6 ); - GeometryGUI_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 ); - GeometryGUI_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 ); - - GeometryGUI_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 ); - - GeometryGUI_BndBoxDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_BndBoxDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_BndBoxDlg::~GeometryGUI_BndBoxDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::Init( SALOME_Selection* Sel ) -{ - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_BndBoxDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_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 = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() ) { - myEditCurrentArgument->setText( "" ); - return ; - } - - LineEditC1A1->setText(aString) ; - this->CalculateAndDisplayBndBox(S) ; - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::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 GeometryGUI_BndBoxDlg::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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_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 ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_BndBoxDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : CalculateAndDisplayBndBox() -// purpose : -//================================================================================= -void GeometryGUI_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; - 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 ) ) ; - - mySimulationTopoDs = BRepPrimAPI_MakeBox( gp_Pnt(axmin,aymin,azmin), - gp_Pnt(axmax,aymax,azmax) ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE("Catch intercepted in CalculateAndDisplayBndBox()" << endl ) ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_BndBoxDlg.h b/src/GEOMGUI/GeometryGUI_BndBoxDlg.h deleted file mode 100644 index 546dde539..000000000 --- a/src/GEOMGUI/GeometryGUI_BndBoxDlg.h +++ /dev/null @@ -1,119 +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 : GeometryGUI_BndBoxDlg.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_BNDBOX_H -#define DIALOGBOX_BNDBOX_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : DialogBox_PROPERTIES -// purpose : -//================================================================================= -class GeometryGUI_BndBoxDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_BndBoxDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_BndBoxDlg(); - -private: - - 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 */ - GeometryGUI* myGeomGUI ; /* 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; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_BndBoxDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_BNDBOX_H diff --git a/src/GEOMGUI/GeometryGUI_BoxDlg.cxx b/src/GEOMGUI/GeometryGUI_BoxDlg.cxx deleted file mode 100644 index 659dc19b2..000000000 --- a/src/GEOMGUI/GeometryGUI_BoxDlg.cxx +++ /dev/null @@ -1,639 +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 : GeometryGUI_BoxDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_BoxDlg.h" -#include "GeometryGUI_SpinBox.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_BoxDlg() -// purpose : Constructs a GeometryGUI_BoxDlg 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. -//================================================================================= -GeometryGUI_BoxDlg::GeometryGUI_BoxDlg( 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_BOX_2P"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BOX_DXYZ"))); - - if ( !name ) - setName( "GeometryGUI_BoxDlg" ); - resize( 335, 220 ); - setCaption( tr( "GEOM_BOX_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_BoxDlgLayout = new QGridLayout( this ); - GeometryGUI_BoxDlgLayout->setSpacing( 6 ); - GeometryGUI_BoxDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_BOX" ) ); - 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_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_1, 0, 3 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - 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, 1 ); - GeometryGUI_BoxDlgLayout->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 = 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 ); - GeometryGUI_BoxDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupPoints = new QGroupBox( this, "GroupPoints" ); - GroupPoints->setGeometry( QRect( 10, 10, 280, 90 ) ); - GroupPoints->setTitle( tr( "GEOM_DIAGONAL_POINTS" ) ); - GroupPoints->setFrameShape( QGroupBox::Box ); - GroupPoints->setFrameShadow( QGroupBox::Sunken ); - GroupPoints->setColumnLayout(0, Qt::Vertical ); - GroupPoints->layout()->setSpacing( 0 ); - GroupPoints->layout()->setMargin( 0 ); - GroupPointsLayout = new QGridLayout( GroupPoints->layout() ); - GroupPointsLayout->setAlignment( Qt::AlignTop ); - GroupPointsLayout->setSpacing( 6 ); - GroupPointsLayout->setMargin( 11 ); - SelectButtonPt2 = new QPushButton( GroupPoints, "SelectButtonPt2" ); - SelectButtonPt2->setText( tr( "" ) ); - SelectButtonPt2->setPixmap( image1 ); - GroupPointsLayout->addWidget( SelectButtonPt2, 1, 1 ); - LineEditPt1 = new QLineEdit( GroupPoints, "LineEditPt1" ); - GroupPointsLayout->addWidget( LineEditPt1, 0, 2 ); - LineEditPt2 = new QLineEdit( GroupPoints, "LineEditPt2" ); - GroupPointsLayout->addWidget( LineEditPt2, 1, 2 ); - SelectButtonPt1 = new QPushButton( GroupPoints, "SelectButtonPt1" ); - SelectButtonPt1->setText( tr( "" ) ); - SelectButtonPt1->setPixmap( image1 ); - SelectButtonPt1->setToggleButton( FALSE ); - GroupPointsLayout->addWidget( SelectButtonPt1, 0, 1 ); - TextLabelPt1 = new QLabel( GroupPoints, "TextLabelPt1" ); - TextLabelPt1->setText( tr( "GEOM_POINT_I" ).arg("1") ); - TextLabelPt1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelPt1->setFrameShape( QLabel::NoFrame ); - TextLabelPt1->setFrameShadow( QLabel::Plain ); - GroupPointsLayout->addWidget( TextLabelPt1, 0, 0 ); - TextLabelPt2 = new QLabel( GroupPoints, "TextLabelPt2" ); - TextLabelPt2->setText( tr( "GEOM_POINT_I" ).arg("2") ); - TextLabelPt2->setMinimumSize( QSize( 50, 0 ) ); - GroupPointsLayout->addWidget( TextLabelPt2, 1, 0 ); - GeometryGUI_BoxDlgLayout->addWidget( GroupPoints, 1, 0 ); - - /***************************************************************/ - GroupDimensions = new QGroupBox( this, "GroupDimensions" ); - GroupDimensions->setGeometry( QRect( 11, 75, 310, 80 ) ); - GroupDimensions->setTitle( tr( "GEOM_BOX_OBJ" ) ); - GroupDimensions->setColumnLayout(0, Qt::Vertical ); - GroupDimensions->setMinimumSize( QSize( 0, 90 ) ); - GroupDimensions->layout()->setSpacing( 0 ); - GroupDimensions->layout()->setMargin( 0 ); - GroupDimensionsLayout = new QGridLayout( GroupDimensions->layout() ); - GroupDimensionsLayout->setAlignment( Qt::AlignTop ); - GroupDimensionsLayout->setSpacing( 6 ); - GroupDimensionsLayout->setMargin( 11 ); - - TextLabel_DZ = new QLabel( GroupDimensions, "TextLabel_DZ" ); - TextLabel_DZ->setText( tr( "GEOM_DZ" ) ); - GroupDimensionsLayout->addWidget( TextLabel_DZ, 0, 4 ); - TextLabel_DY = new QLabel( GroupDimensions, "TextLabel_DY" ); - TextLabel_DY->setText( tr( "GEOM_DY" ) ); - GroupDimensionsLayout->addWidget( TextLabel_DY, 0, 2 ); - TextLabel_DX = new QLabel( GroupDimensions, "TextLabel_DX" ); - TextLabel_DX->setText( tr( "GEOM_DX" ) ); - GroupDimensionsLayout->addWidget( TextLabel_DX, 0, 0 ); - - /* Spin boxes construction */ - SpinBox_DX = new GeometryGUI_SpinBox( GroupDimensions, "GeomSpinBox_DX" ) ; - GroupDimensionsLayout->addWidget( SpinBox_DX, 0, 1 ); - SpinBox_DY = new GeometryGUI_SpinBox( GroupDimensions, "GeomSpinBox_DY" ) ; - GroupDimensionsLayout->addWidget( SpinBox_DY, 0, 3 ); - SpinBox_DZ = new GeometryGUI_SpinBox( GroupDimensions, "GeomSpinBox_DZ" ) ; - GroupDimensionsLayout->addWidget( SpinBox_DZ, 0, 5 ); - - QSpacerItem* spacer1 = new QSpacerItem( 20, 24, QSizePolicy::Minimum, QSizePolicy::Fixed ); - GroupDimensionsLayout->addItem( spacer1, 1, 3 ); - - GeometryGUI_BoxDlgLayout->addWidget( GroupDimensions, 1, 0 ); - - /* Initialisations */ - Init(Sel) ; -} - - -//================================================================================= -// function : ~DialogBox_Box() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_BoxDlg::~GeometryGUI_BoxDlg() -{ - // no need to delete child widgets, Qt does it all for us - this->destroy(TRUE, TRUE) ; -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::Init(SALOME_Selection *Sel) -{ - - - /* 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 spin boxes */ - SpinBox_DX->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DX->SetValue( 200.0 ) ; - SpinBox_DY->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DY->SetValue( 200.0 ) ; - SpinBox_DZ->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DZ->SetValue( 200.0 ) ; - - GroupPoints->show(); - GroupDimensions->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditPt1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myPoint2.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkPoint2 = false ; - mySimulationTopoDs.Nullify() ; - - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO previous selection into argument ? - - /* Vertices Filter for all arguments */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - mySelection->AddFilter( myVertexFilter ); /* filter for next selection */ - - /* 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) ), this, SLOT( ConstructorsClicked(int) ) ) ; - connect( SelectButtonPt1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonPt2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_DX, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DY, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DZ, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditPt1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditPt2, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - - this->show() ; /* displays Dialog */ -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_BoxDlg::ConstructorsClicked(int constructorId) -{ - - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupPoints->show(); - GroupDimensions->hide() ; - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditPt1 ; - Constructor1->setChecked( TRUE ); - LineEditPt1->setText("") ; - LineEditPt2->setText("") ; - myOkPoint1 = myOkPoint2 = false ; - - /* filter for next selection */ - mySelection->AddFilter( myVertexFilter ); - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - break; - } - case 1: - { - GroupPoints->hide(); - GroupDimensions->show(); - myConstructorId = constructorId ; - myOkPoint1 = myOkPoint2 = false ; - - disconnect( mySelection, 0, this, 0 ); - - double initValue = 200.0 ; - SpinBox_DX->SetValue( initValue ) ; - SpinBox_DY->SetValue( initValue ) ; - SpinBox_DZ->SetValue( initValue ) ; - - myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ; - myPoint2.SetCoord( initValue, initValue,initValue ) ; - - mySimulationTopoDs = BRepPrimAPI_MakeBox( myPoint1, myPoint2 ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::ClickOnApply() -{ -//NRI+ : 02/12/2202 - BugID 1065 -// if (mySimulationTopoDs.IsNull()) -// return; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - //NRI+ : 02/12/2202 - BugID 1065 mySelection->ClearFilters() ; - if(myOkPoint1 && myOkPoint2) - myGeomGUI->MakeBoxAndDisplay( myPoint1, myPoint2 ) ; - break ; - } - case 1 : - { - /* Recup args and call method */ - double vx = SpinBox_DX->GetValue() ; - double vy = SpinBox_DY->GetValue() ; - double vz = SpinBox_DZ->GetValue() ; - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(vx, vy, vz) ; - myGeomGUI->MakeBoxAndDisplay( myPoint1, myPoint2 ) ; - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed -//================================================================================= -void GeometryGUI_BoxDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = "" ; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditPt1 ) { - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditPt2 ) { - myOkPoint2 = false ; - } - return ; - } - - // nbSel == 1 - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditPt1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - myEditCurrentArgument->setText( aString ) ; - myOkPoint1 = true ; - } - else if ( myEditCurrentArgument == LineEditPt2 && myGeomGUI->VertexToPoint(S, myPoint2) ) { - myEditCurrentArgument->setText( aString ) ; - myOkPoint2 = true ; - } - - if( myOkPoint1 && myOkPoint2 && TestBoxDimensions( myPoint1, myPoint2 ) ) { - mySimulationTopoDs = BRepPrimAPI_MakeBox( myPoint1, myPoint2 ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: // default constructor - { - if(send == SelectButtonPt1) { - LineEditPt1->setFocus() ; - myEditCurrentArgument = LineEditPt1; - } - else if(send == SelectButtonPt2) { - LineEditPt2->setFocus() ; - myEditCurrentArgument = LineEditPt2; - } - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - break; - } - case 1: - { - /* nothing to do here */ - break; - } - } - return ; -} - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::ValueChangedInSpinBox( double newValue ) -{ - if(myConstructorId != 1) - return ; - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QObject* send = (QObject*)sender() ; - double vx, vy, vz ; - - if( send == SpinBox_DX ) { - vx = newValue ; - vy = SpinBox_DY->GetValue() ; - vz = SpinBox_DZ->GetValue() ; - } else if ( send == SpinBox_DY ) { - vx = SpinBox_DX->GetValue() ; - vy = newValue ; - vz = SpinBox_DZ->GetValue() ; - } else if (send == SpinBox_DZ ) { - vx = SpinBox_DX->GetValue() ; - vy = SpinBox_DY->GetValue() ; - vz = newValue ; - } - - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(vx, vy, vz) ; - - if ( TestBoxDimensions( myPoint1, myPoint2 ) ) { - mySimulationTopoDs = BRepPrimAPI_MakeBox( myPoint1, myPoint2 ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditPt1 ) - myEditCurrentArgument = LineEditPt1 ; - else if ( send == LineEditPt2 ) - myEditCurrentArgument = LineEditPt2 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupDimensions->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - GroupPoints->setEnabled(false) ; - - mySelection->ClearFilters() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::ActivateThisDialog() -{ - - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupDimensions->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - GroupPoints->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent [REDEFINED] -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_BoxDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : TestBoxDimensions() -// purpose : -//================================================================================= -bool GeometryGUI_BoxDlg::TestBoxDimensions(gp_Pnt P1, gp_Pnt P2) -{ - if ( ( fabs( P1.X() - P2.X() ) > Precision::Confusion() ) && - ( fabs( P1.Y() - P2.Y() ) > Precision::Confusion() ) && - ( fabs( P1.Z() - P2.Z() ) > Precision::Confusion() ) ) - return true ; - return false ; -} diff --git a/src/GEOMGUI/GeometryGUI_BoxDlg.h b/src/GEOMGUI/GeometryGUI_BoxDlg.h deleted file mode 100644 index 062591582..000000000 --- a/src/GEOMGUI/GeometryGUI_BoxDlg.h +++ /dev/null @@ -1,139 +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 : GeometryGUI_BoxDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_BOX_H -#define DIALOGBOX_BOX_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QLabel; -class QPushButton; -class GeometryGUI_SpinBox; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_BoxDlg -// purpose : -//================================================================================= -class GeometryGUI_BoxDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_BoxDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_BoxDlg(); - -private : - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e ); - void Init(SALOME_Selection* Sel) ; - bool TestBoxDimensions( gp_Pnt P1, gp_Pnt P2 ) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - SALOME_Selection* mySelection ; /* User shape selection */ - gp_Pnt myPoint1 ; /* Points containing the vector */ - gp_Pnt myPoint2 ; - bool myOkPoint1 ; /* true when myPoint is defined */ - bool myOkPoint2 ; - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */ - - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - - QGroupBox* GroupPoints; - QPushButton* SelectButtonPt1; - QPushButton* SelectButtonPt2; - QLineEdit* LineEditPt2; - QLineEdit* LineEditPt1; - QLabel* TextLabelPt1; - QLabel* TextLabelPt2; - - QGroupBox* GroupDimensions ; - QLabel* TextLabel_DX ; - QLabel* TextLabel_DY ; - QLabel* TextLabel_DZ ; - - GeometryGUI_SpinBox* SpinBox_DX ; - GeometryGUI_SpinBox* SpinBox_DY ; - GeometryGUI_SpinBox* SpinBox_DZ ; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - - QGridLayout* GeometryGUI_BoxDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupPointsLayout; - QGridLayout* GroupDimensionsLayout; - -}; - -#endif // DIALOGBOX_BOX_H diff --git a/src/GEOMGUI/GeometryGUI_CenterMassDlg.cxx b/src/GEOMGUI/GeometryGUI_CenterMassDlg.cxx deleted file mode 100644 index 4f5d2ac19..000000000 --- a/src/GEOMGUI/GeometryGUI_CenterMassDlg.cxx +++ /dev/null @@ -1,527 +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 : GeometryGUI_CenterMassDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CenterMassDlg.h" -#include "GeometryGUI.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_CenterMassDlg() -// purpose : Constructs a GeometryGUI_CenterMassDlg 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. -//================================================================================= -GeometryGUI_CenterMassDlg::GeometryGUI_CenterMassDlg( 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_CENTERMASS"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_CenterMassDlg" ); - resize( 398, 219 ); - setCaption( tr( "GEOM_CMASS_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_CenterMassDlgLayout = new QGridLayout( this ); - GeometryGUI_CenterMassDlgLayout->setSpacing( 6 ); - GeometryGUI_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 ); - GeometryGUI_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 ); - GeometryGUI_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 ); - GeometryGUI_CenterMassDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ - -} - - -//================================================================================= -// function : ~GeometryGUI_CenterMassDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_CenterMassDlg::~GeometryGUI_CenterMassDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::Init( SALOME_Selection* Sel ) -{ - 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; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_CenterMassDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - if( myOkCenterMass) { - myGeomGUI->MakeCDGAndDisplay( myGeomShape ) ; - } - return ; -} - - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_CenterMassDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - myEditCurrentArgument->setText("") ; - myOkCenterMass = false ; - Standard_Boolean testResult ; - - LineEdit_X->setText("") ; - LineEdit_Y->setText("") ; - LineEdit_Z->setText("") ; - - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, this->myShape) ) - return ; - - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - if( this->CalculateAndDisplayCenterMass() ) { - myOkCenterMass = true ; - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::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 GeometryGUI_CenterMassDlg::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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - myGeomGUI->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CenterMassDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : CalculateAndDisplayCenterMass() -// purpose : -//================================================================================= -bool GeometryGUI_CenterMassDlg::CalculateAndDisplayCenterMass() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - try { - - QString resString; - GProp_GProps System; - - if ( this->myShape.ShapeType() == TopAbs_VERTEX) { - myGeomGUI->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() ; - } - else if ( this->myShape.ShapeType() == TopAbs_FACE || this->myShape.ShapeType() == TopAbs_SHELL ) { - BRepGProp::SurfaceProperties(this->myShape, System); - this->myCenterMass = System.CentreOfMass() ; - } - else { - BRepGProp::VolumeProperties(this->myShape, System); - this->myCenterMass = System.CentreOfMass() ; - } - - BRepBuilderAPI_MakeVertex V(this->myCenterMass) ; - mySimulationTopoDs = V.Shape() ; - - resString = tr("%1").arg( myCenterMass.X(), 12, 'f', 6 ) ; - LineEdit_X->setText(resString) ; - - resString = tr("%1").arg( myCenterMass.Y(), 12, 'f', 6 ) ; - LineEdit_Y->setText(resString) ; - - resString = tr("%1").arg( myCenterMass.Z(), 12, 'f', 6 ) ; - LineEdit_Z->setText(resString) ; - - - if( !mySimulationTopoDs.IsNull() ) { - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return true ; - } - } - catch(Standard_Failure) { - MESSAGE("Catch intercepted in CalculateAndDisplayCenterMass()" << endl ) ; - } - return false ; -} - - diff --git a/src/GEOMGUI/GeometryGUI_CenterMassDlg.h b/src/GEOMGUI/GeometryGUI_CenterMassDlg.h deleted file mode 100644 index c56720724..000000000 --- a/src/GEOMGUI/GeometryGUI_CenterMassDlg.h +++ /dev/null @@ -1,121 +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 : GeometryGUI_CenterMassDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM - -#ifndef DIALOGBOX_CMASS_H -#define DIALOGBOX_CMASS_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_CenterMassDlg -// purpose : -//================================================================================= -class GeometryGUI_CenterMassDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CenterMassDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_CenterMassDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - bool CalculateAndDisplayCenterMass() ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - - 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 */ - - 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; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void ClickOnOk() ; - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_CenterMassDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_CMASS_H diff --git a/src/GEOMGUI/GeometryGUI_ChamferDlg.cxx b/src/GEOMGUI/GeometryGUI_ChamferDlg.cxx deleted file mode 100644 index c0892f768..000000000 --- a/src/GEOMGUI/GeometryGUI_ChamferDlg.cxx +++ /dev/null @@ -1,934 +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 : GeometryGUI_ChamferDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_ChamferDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "QAD_RightFrame.h" -#include "OCCViewer_Viewer3d.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -//================================================================================= -// class : GeometryGUI_ChamferDlg() -// purpose : Constructs a GeometryGUI_ChamferDlg 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. -//================================================================================= -GeometryGUI_ChamferDlg::GeometryGUI_ChamferDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - 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_CHAMFER_ALL"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CHAMFER_EDGE"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CHAMFER_FACE"))); - - if ( !name ) - setName( "GeometryGUI_ChamferDlg" ); - resize( 365, 220 ); - setCaption( tr( "GEOM_CHAMFER_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_ChamferDlgLayout = new QGridLayout( this ); - GeometryGUI_ChamferDlgLayout->setSpacing( 6 ); - GeometryGUI_ChamferDlgLayout->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 ); - GeometryGUI_ChamferDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_CHAMFER" ) ); - 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 ); - Constructor3 = new QRadioButton( GroupConstructors, "Constructor3" ); - Constructor3->setText( tr( "" ) ); - Constructor3->setPixmap( image3 ); - Constructor3->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor3, 0, 4 ); - QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_4, 0, 5 ); - GeometryGUI_ChamferDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_CHAMFER_ALL" ) ); - 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_D1" ) ); - 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_D2" ) ); - 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" ); -// LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); -// GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - -// LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" ); -// LineEditC1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A3->sizePolicy().hasHeightForWidth() ) ); -// GroupC1Layout->addWidget( LineEditC1A3, 2, 2 ); - - SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A2" ) ; - SpinBox_C1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A2->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A2, 1, 2 ); - - SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_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 ); - GeometryGUI_ChamferDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "GEOM_CHAMFER_EDGES" ) ); - 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_D1" ) ); - 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_D2" ) ); - TextLabelC2A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A3->setFrameShape( QLabel::NoFrame ); - TextLabelC2A3->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A3, 2, 0 ); - - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - GroupC2Layout->addWidget( LineEditC2A1, 0, 2 ); - - // LineEditC2A2 = new QLineEdit( GroupC2, "LineEditC2A2" ); -// LineEditC2A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC2A2->sizePolicy().hasHeightForWidth() ) ); -// GroupC2Layout->addWidget( LineEditC2A2, 1, 2 ); - -// LineEditC2A3 = new QLineEdit( GroupC2, "LineEditC2A3" ); -// LineEditC2A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC2A3->sizePolicy().hasHeightForWidth() ) ); -// GroupC2Layout->addWidget( LineEditC2A3, 2, 2 ); - - SpinBox_C2A2 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A2" ) ; - SpinBox_C2A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A2->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A2, 1, 2 ); - - SpinBox_C2A3 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A3" ) ; - SpinBox_C2A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A3->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A3, 2, 2 ); - - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setText( tr( "" ) ); - SelectButtonC2A1->setPixmap( image1 ); - SelectButtonC2A1->setToggleButton( FALSE ); - SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 ); - GeometryGUI_ChamferDlgLayout->addWidget( GroupC2, 1, 0 ); - - /***************************************************************/ - GroupC3 = new QGroupBox( this, "GroupC3" ); - GroupC3->setTitle( tr( "GEOM_CHAMFER_FACES" ) ); - GroupC3->setMinimumSize( QSize( 0, 0 ) ); - GroupC3->setFrameShape( QGroupBox::Box ); - GroupC3->setFrameShadow( QGroupBox::Sunken ); - GroupC3->setColumnLayout(0, Qt::Vertical ); - GroupC3->layout()->setSpacing( 0 ); - GroupC3->layout()->setMargin( 0 ); - GroupC3Layout = new QGridLayout( GroupC3->layout() ); - GroupC3Layout->setAlignment( Qt::AlignTop ); - GroupC3Layout->setSpacing( 6 ); - GroupC3Layout->setMargin( 11 ); - - TextLabelC3A1 = new QLabel( GroupC3, "TextLabelC3A1" ); - TextLabelC3A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC3A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A1->setFrameShape( QLabel::NoFrame ); - TextLabelC3A1->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A1, 0, 0 ); - - TextLabelC3A2 = new QLabel( GroupC3, "TextLabelC3A2" ); - TextLabelC3A2->setText( tr( "GEOM_D1" ) ); - TextLabelC3A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A2->setFrameShape( QLabel::NoFrame ); - TextLabelC3A2->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A2, 1, 0 ); - - TextLabelC3A3 = new QLabel( GroupC3, "TextLabelC3A3" ); - TextLabelC3A3->setText( tr( "GEOM_D2" ) ); - TextLabelC3A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A3->setFrameShape( QLabel::NoFrame ); - TextLabelC3A3->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A3, 2, 0 ); - - LineEditC3A1 = new QLineEdit( GroupC3, "LineEditC3A1" ); - GroupC3Layout->addWidget( LineEditC3A1, 0, 2 ); - - // LineEditC3A2 = new QLineEdit( GroupC3, "LineEditC3A2" ); -// LineEditC3A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC3A2->sizePolicy().hasHeightForWidth() ) ); -// GroupC3Layout->addWidget( LineEditC3A2, 1, 2 ); - -// LineEditC3A3 = new QLineEdit( GroupC3, "LineEditC3A3" ); -// LineEditC3A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC3A3->sizePolicy().hasHeightForWidth() ) ); -// GroupC3Layout->addWidget( LineEditC3A3, 2, 2 ); - - SpinBox_C3A2 = new GeometryGUI_SpinBox( GroupC3, "GeomSpinBox_C3A2" ) ; - SpinBox_C3A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C3A2->sizePolicy().hasHeightForWidth() ) ); - GroupC3Layout->addWidget( SpinBox_C3A2, 1, 2 ); - - SpinBox_C3A3 = new GeometryGUI_SpinBox( GroupC3, "GeomSpinBox_C3A3" ) ; - SpinBox_C3A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C3A3->sizePolicy().hasHeightForWidth() ) ); - GroupC3Layout->addWidget( SpinBox_C3A3, 2, 2 ); - - SelectButtonC3A1 = new QPushButton( GroupC3, "SelectButtonC3A1" ); - SelectButtonC3A1->setText( tr( "" ) ); - SelectButtonC3A1->setPixmap( image1 ); - SelectButtonC3A1->setToggleButton( FALSE ); - SelectButtonC3A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC3Layout->addWidget( SelectButtonC3A1, 0, 1 ); - GeometryGUI_ChamferDlgLayout->addWidget( GroupC3, 1, 0 ); - - /* Initialisation */ - Init( Sel, ic ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_ChamferDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_ChamferDlg::~GeometryGUI_ChamferDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) -{ - - /* 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 spin boxes */ - SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* myD1 */ - SpinBox_C1A2->SetValue( 50 ) ; - SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* myD2 */ - SpinBox_C1A3->SetValue( 50 ) ; - - SpinBox_C2A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C2A2->SetValue( 50 ) ; - SpinBox_C2A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C2A3->SetValue( 50 ) ; - - SpinBox_C3A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C3A2->SetValue( 50 ) ; - SpinBox_C3A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C3A3->SetValue( 50 ) ; - - GroupC1->show(); - GroupC2->hide() ; - GroupC3->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - - mySelection = Sel ; - myEditCurrentArgument = LineEditC1A1 ; - myShape.Nullify() ; - myD1 = 50.0 ; - myOkD1 = true ; - myD2 = 50.0 ; - myOkD2 = true ; - myIC = ic ; - myUseLocalContext = false ; - myOkShape = false ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - mySimulationTopoDs.Nullify() ; - - /* Filters definition */ - 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( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC3A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C3A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C3A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC3A1, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_ChamferDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myEditCurrentArgument->setText(tr("")) ; - - 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(this->myLocalContextId); - myGeomGUI->OnDisplayAll(true) ; - myUseLocalContext = false ; - } - } - - myOkShape = false ; - myD1 = 50.0 ; - myD2 = 50.0 ; - myOkD1 = true ; - myOkD2 = true ; - myConstructorId = constructorId ; - - switch (constructorId) - { - case 0: /* Chamfer All */ - { - GroupC1->show(); - GroupC2->hide() ; - GroupC3->hide() ; - myEditCurrentArgument = LineEditC1A1 ; - SpinBox_C1A2->SetValue( 50 ) ; - SpinBox_C1A3->SetValue( 50 ) ; - LineEditC1A1->setText(tr("")) ; - myShapeType = -1; - break; - } - - case 1: /* Chamfer edges */ - { - myShapeType = 6; - GroupC1->hide(); - GroupC2->show() ; - GroupC3->hide() ; - myEditCurrentArgument = LineEditC2A1 ; - SpinBox_C2A2->SetValue( 50 ) ; - SpinBox_C2A3->SetValue( 50 ) ; - LineEditC2A1->setText(tr("")) ; - break ; - } - - case 2: /* Chamfer Faces */ - { - myShapeType = 4; - GroupC1->hide(); - GroupC2->hide() ; - GroupC3->show() ; - myEditCurrentArgument = LineEditC3A1 ; - SpinBox_C3A2->SetValue( 50 ) ; - SpinBox_C3A3->SetValue( 50 ) ; - LineEditC3A1->setText(tr("")) ; - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - bool testResult = false ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : /* Chamfer All */ - { - if(myOkD1 && myOkD2) { - if( myOkShape ) { - testResult = myGeomGUI->OnChamferGetAll( myShape, myD1, myD2, myShapeType, myShapeIOR ) ; - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - - case 1 : /* Chamfer Edge */ - { - if(myOkD1 && myOkD2) { - if( myOkShape ) { - testResult = myGeomGUI->OnChamferGetSelected( myShape, myShapeIOR, myD1, myD2, myShapeType, - myLocalContextId, myUseLocalContext ); - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - - case 2 : /* Chamfer Face */ - { - if(myOkD1 && myOkD2) { - if( myOkShape ) { - testResult = myGeomGUI->OnChamferGetSelected( myShape, myShapeIOR, myD1, myD2, myShapeType, - myLocalContextId, myUseLocalContext ) ; - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - } - - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if(this->myUseLocalContext ) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - - reject() ; - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_ChamferDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Reset all arguments and local context when selection as changed */ - this->ResetStateOfDialog() ; - - /* Future name of argument */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel == 1 ) { - - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( !IO->hasEntry() ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ; - return ; - } - - if ( !S.IsNull() && S.ShapeType() <= 2 ) { - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ - myEditCurrentArgument->setText(aString) ; - myShape = S ; - myOkShape = true ; - } - - 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); - myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - myEditCurrentArgument->setText(aString) ; - } - } - } - - MakePreview(); - - } - } else - return; - - if( myOkShape && myShapeType!=-1 && myConstructorId != 0 ) { - /* local context is defined into the method */ - myGeomGUI->PrepareSubShapeSelection( this->myShapeType, this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_EDGE")) ; - } -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC2A1 ) - myEditCurrentArgument = LineEditC2A1 ; - else if ( send == LineEditC3A1 ) - myEditCurrentArgument = LineEditC3A1 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - - switch (myConstructorId) - { - case 0: - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - SelectionIntoArgument() ; - } - break; - } - - case 1: - { - if(send ==SelectButtonC2A1 ) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1; - SelectionIntoArgument() ; - } - break; - } - - case 2: - { - if(send ==SelectButtonC3A1 ) { - LineEditC3A1->setFocus() ; - myEditCurrentArgument = LineEditC3A1; - SelectionIntoArgument() ; - } - break; - } - - } - return ; -} - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::ValueChangedInSpinBox( double newValue ) -{ - QObject* send = (QObject*)sender(); - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - - if( send == SpinBox_C1A2 || send == SpinBox_C2A2 || send == SpinBox_C3A2 ) { /* D1 */ - myD1 = newValue ; - myOkD1 = true ; - MakePreview(); - return ; - } - if( send == SpinBox_C1A3 || send == SpinBox_C2A3 || send == SpinBox_C3A3 ) { /* D2 */ - myD2 = newValue ; - myOkD2 = true ; - MakePreview(); - return ; - } -} - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - this->ResetStateOfDialog() ; - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupC3->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupC2->setEnabled(true) ; - GroupC3->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::enterEvent( QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : ResetStateOfDialog() -// purpose : -//================================================================================= -void GeometryGUI_ChamferDlg::ResetStateOfDialog() -{ - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; - - /* Close its local contact if opened */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if(this->myUseLocalContext) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - return ; -} - -void GeometryGUI_ChamferDlg::MakePreview() -{ - TopoDS_Shape tds ; - try - { - BRepFilletAPI_MakeChamfer MC(myShape); - switch (myConstructorId) - { - case 0: /* Chamfer All */ - { - TopTools_IndexedDataMapOfShapeListOfShape M; - TopExp::MapShapesAndAncestors(myShape,TopAbs_EDGE,TopAbs_FACE,M); - for (int i = 1;i<=M.Extent();i++) - { - TopoDS_Edge E = TopoDS::Edge(M.FindKey(i)); - TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First()); - if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E)) - MC.Add(myD1, myD2,E,F); - } - tds = MC.Shape(); - break; - } -// case 1: /* Chamfer edges */ -// case 2: /* Chamfer Faces */ - } - if (!tds.IsNull()) - { - mySimulationTopoDs = tds; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - - } - catch(Standard_Failure) - { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } -} diff --git a/src/GEOMGUI/GeometryGUI_ChamferDlg.h b/src/GEOMGUI/GeometryGUI_ChamferDlg.h deleted file mode 100644 index 22fe93ffa..000000000 --- a/src/GEOMGUI/GeometryGUI_ChamferDlg.h +++ /dev/null @@ -1,172 +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 : GeometryGUI_ChamferDlg.h -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_CHAMFER_H -#define DIALOGBOX_CHAMFER_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -// Qt Includes -#include -#include -#include - -// Open CASCADE Includes -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QToolButton; -class QLabel; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_ChamferDlg -// purpose : -//================================================================================= -class GeometryGUI_ChamferDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_ChamferDlg( QWidget* parent = 0, - const char* name = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - - ~GeometryGUI_ChamferDlg(); - -private : - - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void ResetStateOfDialog() ; - - /* Interactive and local context management see also : bool myUseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ - - QDoubleValidator *myVa ; /* Double validator for numeric input */ - QDoubleValidator *myVb ; /* Double validator for numeric input */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape myShape ; - bool myOkShape ; - char* myShapeIOR ; - - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - int myShapeType ; - - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - void MakePreview(); - - bool myOkD1 ; - double myD1 ; - bool myOkD2 ; - double myD2 ; - - QButtonGroup* GroupConstructors; - - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QRadioButton* Constructor3; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A1; - GeometryGUI_SpinBox* SpinBox_C1A2 ; - QLabel* TextLabelC1A2; - GeometryGUI_SpinBox* SpinBox_C1A3 ; - QLabel* TextLabelC1A3; - - QGroupBox* GroupC2; - QPushButton* SelectButtonC2A1; - QLineEdit* LineEditC2A1; - QLabel* TextLabelC2A1; - GeometryGUI_SpinBox* SpinBox_C2A2 ; - QLabel* TextLabelC2A2; - GeometryGUI_SpinBox* SpinBox_C2A3; - QLabel* TextLabelC2A3; - - QGroupBox* GroupC3; - QPushButton* SelectButtonC3A1; - QLineEdit* LineEditC3A1; - QLabel* TextLabelC3A1; - GeometryGUI_SpinBox* SpinBox_C3A2 ; - QLabel* TextLabelC3A2; - GeometryGUI_SpinBox* SpinBox_C3A3; - QLabel* TextLabelC3A3; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - - QGridLayout* GeometryGUI_ChamferDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; - QGridLayout* GroupC3Layout; -}; - -#endif // DIALOGBOX_CHAMFER_H - diff --git a/src/GEOMGUI/GeometryGUI_CheckShape.cxx b/src/GEOMGUI/GeometryGUI_CheckShape.cxx deleted file mode 100644 index d0dfc9fea..000000000 --- a/src/GEOMGUI/GeometryGUI_CheckShape.cxx +++ /dev/null @@ -1,402 +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 : GeometryGUI_CheckShape.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CheckShape.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -// Open Cascade Include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_CheckShape() -// purpose : Constructs a GeometryGUI_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. -//================================================================================= -GeometryGUI_CheckShape::GeometryGUI_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 ); - GeometryGUI_CheckShapeLayout = new QGridLayout( this ); - GeometryGUI_CheckShapeLayout->setSpacing( 6 ); - GeometryGUI_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 ); - GeometryGUI_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 ); - - GeometryGUI_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 ); - GeometryGUI_CheckShapeLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_CheckShape() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_CheckShape::~GeometryGUI_CheckShape() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_CheckShape::Init( SALOME_Selection* Sel ) -{ - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_CheckShape::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_CheckShape::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_CheckShape::SelectionIntoArgument() -{ - Text->setText("") ; - myEditCurrentArgument->setText("") ; - - SelectedName = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, SelectedName) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() ) { - myEditCurrentArgument->setText( "" ); - return ; - } - - LineEditC1A1->setText(SelectedName) ; - this->Check(S) ; - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_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 GeometryGUI_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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_CheckShape::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_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 GeometryGUI_CheckShape::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CheckShape::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : Check() -// purpose : -//================================================================================= -void GeometryGUI_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/GEOMGUI/GeometryGUI_CheckShape.h b/src/GEOMGUI/GeometryGUI_CheckShape.h deleted file mode 100644 index ce9b51789..000000000 --- a/src/GEOMGUI/GeometryGUI_CheckShape.h +++ /dev/null @@ -1,110 +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 : GeometryGUI_CheckShape.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_CHECKSHAPE_H -#define DIALOGBOX_CHECKSHAPE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QTextView; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_CheckShape -// purpose : -//================================================================================= -class GeometryGUI_CheckShape : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CheckShape( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_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 */ - GeometryGUI* 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* GeometryGUI_CheckShapeLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_CHECKSHAPE_H diff --git a/src/GEOMGUI/GeometryGUI_CircleDlg.cxx b/src/GEOMGUI/GeometryGUI_CircleDlg.cxx deleted file mode 100644 index ba0c36640..000000000 --- a/src/GEOMGUI/GeometryGUI_CircleDlg.cxx +++ /dev/null @@ -1,504 +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 : GeometryGUI_CircleDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CircleDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_CircleDlg() -// purpose : Constructs a GeometryGUI_CircleDlg 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. -//================================================================================= -GeometryGUI_CircleDlg::GeometryGUI_CircleDlg( 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_CIRCLE_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_CircleDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_CIRCLE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_CircleDlgLayout = new QGridLayout( this ); - GeometryGUI_CircleDlgLayout->setSpacing( 6 ); - GeometryGUI_CircleDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_CIRCLE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_CircleDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - 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_CENTER_POINT" ) ); - 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 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_VECTOR" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_RADIUS" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ; - GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 ); - GeometryGUI_CircleDlgLayout->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 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - GeometryGUI_CircleDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_CircleDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_CircleDlg::~GeometryGUI_CircleDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::Init( SALOME_Selection* Sel ) -{ - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C1A3->SetValue( 100.0 ) ; /* = myRadius */ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myRadius = 100.0 ; - myOkPoint1 = myOkDir = false ; - mySimulationTopoDs.Nullify() ; - 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); - myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom ); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - - mySelection->AddFilter(myVertexFilter) ; /* first filter used */ - - /* 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( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_CircleDlg::ConstructorsClicked(int constructorId) -{ - /* only a constructor now */ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPoint1 && myOkDir) { - myGeomGUI->MakeCircleAndDisplay( myPoint1, myDir, myRadius) ; - } - break ; - } - } - // accept(); - return ; -} - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_CircleDlg::SelectionIntoArgument() -{ - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future name of selection */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - LineEditC1A2->setText("") ; - myOkDir = false ; - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* gp_Pnt : not used */ - if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditC1A1->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir) */) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - LineEditC1A2->setText(aString) ; - myOkDir = true ; - } - - if( myOkPoint1 && myOkDir ) { - MakeCircleSimulationAndDisplay() ; - } - return ; -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::SetEditCurrentArgument() -{ - mySelection->ClearFilters() ; - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->AddFilter(myVertexFilter) ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::ValueChangedInSpinBox( double newValue ) -{ - myRadius = newValue ; - - if (myOkPoint1 && myOkDir) { - MakeCircleSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : MakeCircleSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_CircleDlg::MakeCircleSimulationAndDisplay() -{ - myGeomGUI->EraseSimulationShape() ; - - try { - gp_Ax2 axis( this->myPoint1, this->myDir ) ; - gp_Circ circ( axis, this->myRadius); - BRepBuilderAPI_MakeEdge MakeEdge( circ ); - mySimulationTopoDs = MakeEdge.Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeCircleSimulationAndDisplay" ) ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_CircleDlg.h b/src/GEOMGUI/GeometryGUI_CircleDlg.h deleted file mode 100644 index 8254f30b4..000000000 --- a/src/GEOMGUI/GeometryGUI_CircleDlg.h +++ /dev/null @@ -1,126 +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 : GeometryGUI_CircleDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_CIRCLE_H -#define DIALOGBOX_CIRCLE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_CircleDlg -// purpose : -//================================================================================= -class GeometryGUI_CircleDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CircleDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_CircleDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - gp_Pnt myPoint1 ; - gp_Dir myDir ; - Standard_Real myRadius ; - bool myOkPoint1 ; - bool myOkDir ; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */ - Handle(GEOM_EdgeFilter) myEdgeFilter; - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeCircleSimulationAndDisplay() ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A2; - QLineEdit* LineEditC1A2; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A3; - - GeometryGUI_SpinBox* SpinBox_C1A3; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_CircleDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_CIRCLE_H diff --git a/src/GEOMGUI/GeometryGUI_CommonDlg.cxx b/src/GEOMGUI/GeometryGUI_CommonDlg.cxx deleted file mode 100644 index 17552ed53..000000000 --- a/src/GEOMGUI/GeometryGUI_CommonDlg.cxx +++ /dev/null @@ -1,467 +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 : GeometryGUI_CommonDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CommonDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_CommonDlg() -// purpose : Constructs a GeometryGUI_CommonDlg 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. -//================================================================================= -GeometryGUI_CommonDlg::GeometryGUI_CommonDlg( 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_COMMON"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_CommonDlg" ); - resize( 322, 220 ); - setCaption( tr( "GEOM_COMMON_TITLE" ) ); - setSizeGripEnabled( TRUE ); - - GeometryGUI_CommonDlgLayout = new QGridLayout( this ); - GeometryGUI_CommonDlgLayout->setSpacing( 6 ); - GeometryGUI_CommonDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_COMMON" ) ); - 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 ); - GeometryGUI_CommonDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - 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 ); - GeometryGUI_CommonDlgLayout->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, 3 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_1, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - GeometryGUI_CommonDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_CommonDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_CommonDlg::~GeometryGUI_CommonDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::Init( SALOME_Selection* Sel ) -{ - mySelection = Sel ; - myShape1.Nullify() ; - myShape2.Nullify() ; - myConstructorId = 0 ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_CommonDlg::ConstructorsClicked(int constructorId) -{ - GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupConstructor1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1Shape ; - LineEditC1A2Shape->setText(tr("")) ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 1 ) ; - } - break ; - } - } - - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_CommonDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - QString aString = ""; /* name of future selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myOkShape1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myOkShape2 = false ; - } - break ; - } - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape1 = S ; - LineEditC1A1Shape->setText(aString) ; - myOkShape1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape2 = S ; - LineEditC1A2Shape->setText(aString) ; - myOkShape2 = true ; - } - return ; -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::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 ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Shape ) - myEditCurrentArgument = LineEditC1A1Shape ; - else if ( send == LineEditC1A2Shape ) - myEditCurrentArgument = LineEditC1A2Shape ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_CommonDlg::enterEvent( QEvent * ) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_CommonDlg::ActivateThisDialog() -{ - /* 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() ) ); - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_CommonDlg.h b/src/GEOMGUI/GeometryGUI_CommonDlg.h deleted file mode 100644 index 9e8844482..000000000 --- a/src/GEOMGUI/GeometryGUI_CommonDlg.h +++ /dev/null @@ -1,119 +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 : GeometryGUI_CommonDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_COMMON_H -#define DIALOGBOX_COMMON_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_CommonDlg -// purpose : -//================================================================================= -class GeometryGUI_CommonDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CommonDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_CommonDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape myShape1 ; /* topology used */ - TopoDS_Shape myShape2 ; /* topology used */ - GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */ - GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */ - bool myOkShape1 ; - bool myOkShape2 ; /* to check when arguments are defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1Shape; - QLineEdit* LineEditC1A2Shape; - QPushButton* SelectButtonC1A1Shape; - QPushButton* SelectButtonC1A2Shape; - QLabel* TextLabelC1A2Shape; - QLabel* TextLabelC1A1Shape; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_CommonDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructor1Layout; -}; - -#endif // DIALOGBOX_COMMON_H diff --git a/src/GEOMGUI/GeometryGUI_CompoundDlg.cxx b/src/GEOMGUI/GeometryGUI_CompoundDlg.cxx deleted file mode 100644 index a1a6346af..000000000 --- a/src/GEOMGUI/GeometryGUI_CompoundDlg.cxx +++ /dev/null @@ -1,375 +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 : GeometryGUI_CompoundDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CompoundDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_CompoundDlg() -// purpose : Constructs a GeometryGUI_CompoundDlg 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. -//================================================================================= -GeometryGUI_CompoundDlg::GeometryGUI_CompoundDlg( 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 image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BUILD_COMPOUND"))); - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - if ( !name ) - setName( "GeometryGUI_CompoundDlg" ); - resize( 303, 175 ); - setCaption( tr( "GEOM_COMPOUND_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_CompoundDlgLayout = new QGridLayout( this ); - GeometryGUI_CompoundDlgLayout->setSpacing( 6 ); - GeometryGUI_CompoundDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_COMPOUND" ) ); - 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( image1 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_CompoundDlgLayout->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 ); - GeometryGUI_CompoundDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) ); - 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( image0 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - GeometryGUI_CompoundDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_CompoundDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_CompoundDlg::~GeometryGUI_CompoundDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkListShapes = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - 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( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_CompoundDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - if(myOkListShapes) { - myGeomGUI->MakeCompoundAndDisplay( myListShapes ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_CompoundDlg::SelectionIntoArgument() -{ - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - - myOkListShapes = false; - myEditCurrentArgument->setText("") ; - QString aString = ""; /* name of selection */ - - int nbSel = mySelection->IObjectCount() ; - if ( nbSel == 0 ) - return; - aString = tr( "%1_objects" ).arg( nbSel ); - - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; - myEditCurrentArgument->setText(aString) ; - myOkListShapes = true ; - /* no simulation */ - return ; -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::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 GeometryGUI_CompoundDlg::LineEditReturnPressed() -{ - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::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 ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CompoundDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_CompoundDlg.h b/src/GEOMGUI/GeometryGUI_CompoundDlg.h deleted file mode 100644 index 8bdbbc810..000000000 --- a/src/GEOMGUI/GeometryGUI_CompoundDlg.h +++ /dev/null @@ -1,106 +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 : GeometryGUI_CompoundDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_COMPOUND_H -#define DIALOGBOX_COMPOUND_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_CompoundDlg -// purpose : -//================================================================================= -class GeometryGUI_CompoundDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CompoundDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_CompoundDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - GEOM::GEOM_Gen::ListOfIOR myListShapes ; - bool myOkListShapes ; /* to check when arguments is defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_CompoundDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_COMPOUND_H diff --git a/src/GEOMGUI/GeometryGUI_ConeDlg.cxx b/src/GEOMGUI/GeometryGUI_ConeDlg.cxx deleted file mode 100644 index 030079183..000000000 --- a/src/GEOMGUI/GeometryGUI_ConeDlg.cxx +++ /dev/null @@ -1,788 +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 : GeometryGUI_ConeDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_ConeDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_ConeDlg() -// purpose : Constructs a GeometryGUI_ConeDlg 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. -//================================================================================= -GeometryGUI_ConeDlg::GeometryGUI_ConeDlg( 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_CONE_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CONE_DXYZ"))); - - if ( !name ) - setName( "GeometryGUI_ConeDlg" ); - resize( 303, 309 ); - setCaption( tr( "GEOM_CONE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_ConeDlgLayout = new QGridLayout( this ); - GeometryGUI_ConeDlgLayout->setSpacing( 6 ); - GeometryGUI_ConeDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_CONE" ) ); - 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() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 3 ); - GeometryGUI_ConeDlgLayout->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 ); - GeometryGUI_ConeDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - 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 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_BASE_POINT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - 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_RADIUS_I" ).arg("1") ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A3->setFrameShape( QLabel::NoFrame ); - TextLabelC1A3->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - - SpinBox_C1A3 = new GeometryGUI_SpinBox(GroupC1, "GeomSpinBox_C1A3" ) ; - SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A3 , 2, 2 ); - - TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" ); - TextLabelC1A4->setText( tr( "GEOM_RADIUS_I" ).arg("2") ); - TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A4->setFrameShape( QLabel::NoFrame ); - TextLabelC1A4->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 ); - - SpinBox_C1A4 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A4" ) ; - SpinBox_C1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A4->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A4 , 3, 2 ) ; - - TextLabelC1A5 = new QLabel( GroupC1, "TextLabelC1A5" ); - TextLabelC1A5->setText( tr( "GEOM_HEIGHT" ) ); - TextLabelC1A5->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A5->setFrameShape( QLabel::NoFrame ); - TextLabelC1A5->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A5, 4, 0 ); - - SpinBox_C1A5 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A5" ) ; - SpinBox_C1A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A5->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A5 , 4, 2 ) ; - - GeometryGUI_ConeDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "GEOM_BOX_OBJ" ) ); - 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 ); - TextLabel_Height = new QLabel(GroupC2 , "TextLabel_Height" ); - TextLabel_Height->setText( tr( "GEOM_HEIGHT" ) ); - GroupC2Layout->addWidget( TextLabel_Height, 2, 0 ); - TextLabel_Radius1 = new QLabel( GroupC2, "TextLabel_Radius1" ); - TextLabel_Radius1->setText( tr( "GEOM_RADIUS_I" ).arg("1") ); - GroupC2Layout->addWidget( TextLabel_Radius1, 0, 0 ); - TextLabel_Radius2 = new QLabel( GroupC2, "TextLabel_Radius2" ); - TextLabel_Radius2->setText( tr( "GEOM_RADIUS_I" ).arg("2") ); - GroupC2Layout->addWidget( TextLabel_Radius2, 1, 0 ); - - SpinBox_Radius1 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius1" ) ; - GroupC2Layout->addWidget( SpinBox_Radius1 , 0, 1 ) ; - - SpinBox_Radius2 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius2" ) ; - GroupC2Layout->addWidget( SpinBox_Radius2 , 1, 1 ) ; - - SpinBox_Height = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Height" ) ; - GroupC2Layout->addWidget( SpinBox_Height , 2, 1 ) ; - - QSpacerItem* spacer1 = new QSpacerItem( 20, 60, QSizePolicy::Minimum, QSizePolicy::Fixed ); - GroupC2Layout->addItem( spacer1 ); - - GeometryGUI_ConeDlgLayout->addWidget(GroupC2 , 1, 0 ); - - /***************************************************************/ - - /* Initialisations */ - Init(Sel) ; -} - - -//================================================================================= -// function : ~GeometryGUI_ConeDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_ConeDlg::~GeometryGUI_ConeDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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 spin boxes */ - SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* radius 1 */ - SpinBox_C1A3->SetValue( 100.0 ) ; - SpinBox_C1A4->RangeStepAndValidator( 0.000, 999.999, step, 3 ) ; /* radius 2 */ - SpinBox_C1A4->SetValue( 0.0 ) ; - SpinBox_C1A5->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* algebric height */ - SpinBox_C1A5->SetValue( 300.0 ) ; - - SpinBox_Radius1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* radius 1 */ - SpinBox_Radius1->SetValue( 100.0 ) ; - SpinBox_Radius2->RangeStepAndValidator( 0.000, 999.999, step, 3 ) ; /* radius 2 */ - SpinBox_Radius2->SetValue( 0.0 ) ; - SpinBox_Height->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; /* algebric height */ - SpinBox_Height->SetValue( 300.0 ) ; - - GroupC1->show(); - GroupC2->hide(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myRadius1 = 100.0 ; - myRadius2 = 0.0 ; - myHeight = 300.0 ; - - myOkRadius1 = true ; - myOkRadius2 = true ; - myOkHeight = true ; - myOkPoint1 = false ; - myOkDir = false ; - - mySimulationTopoDs.Nullify() ; - 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); - myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom ); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - /* first filter used */ - mySelection->AddFilter(myVertexFilter) ; - - /* 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( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C1A5, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_Radius1, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_Radius2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_Height, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_ConeDlg::ConstructorsClicked(int constructorId) -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - - switch(myConstructorId) - { - case 0 : - { - GroupC1->hide(); - GroupC2->show(); - myConstructorId = constructorId ; - myOkHeight = myOkRadius1 = myOkRadius2 = myOkPoint1 = myOkDir = true ; - - SpinBox_Radius1->SetValue( 100.0 ) ; /* radius 1 */ - SpinBox_Radius2->SetValue( 0.0 ) ; /* radius 2 */ - SpinBox_Height->SetValue( 300.0 ) ; /* height */ - - disconnect( mySelection, 0, this, 0 ); - - myRadius1 = 100.0 ; - myRadius2 = 0.0 ; - myHeight = 300.0 ; - - myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ; - myDir.SetCoord( 0.0, 0.0, 1.0 ) ; - - if( myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight ) { - gp_Dir aDir = myDir ; - /* allows user to reverse direction of construction with a negative height */ - if( this->myHeight < -Precision::Confusion() ) { - aDir.Reverse() ; - } - MakeConeSimulationAndDisplay() ; - } - break ; - } - case 1 : - { - GroupC2->hide(); - GroupC1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1 ; - myOkHeight = myOkRadius1 = myOkRadius2 = true ; - myOkPoint1 = myOkDir = false ; - - SpinBox_C1A3->SetValue( 100.0 ) ; /* radius 1 */ - SpinBox_C1A4->SetValue( 0.0 ) ; /* radius 2 */ - SpinBox_C1A5->SetValue( 300.0 ) ; /* height */ - - myRadius1 = 100.0 ; - myRadius2 = 0.0 ; - myHeight = 300.0 ; - disconnect( mySelection, 0, this, 0 ); - break ; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) { - gp_Dir aDir = myDir ; - /* allows user to reverse direction of construction with a negative height */ - if( this->myHeight < -Precision::Confusion() ) { - aDir.Reverse() ; - } - myGeomGUI->MakeConeAndDisplay( myPoint1, aDir, myRadius1, myRadius2, fabs(myHeight) ) ; - } - break ; - } - case 1 : - { - if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) { - gp_Dir aDir = myDir ; - /* allows user to reverse direction of construction with a negative height */ - if( this->myHeight < -Precision::Confusion() ) { - aDir.Reverse() ; - } - myGeomGUI->MakeConeAndDisplay( myPoint1, aDir, myRadius1, myRadius2, fabs(myHeight) ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_ConeDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future name of selection */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - LineEditC1A2->setText("") ; - myOkDir = false ; - } - return ; - } - - /* nbSel == 1 ! */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* gp_Pnt : not used */ - if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditC1A1->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir)*/ ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - LineEditC1A2->setText(aString) ; - myOkDir = true ; - } - - if( myConstructorId == 0 && myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) { - MakeConeSimulationAndDisplay() ; - } - return ; -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->AddFilter(myVertexFilter) ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - case 1: - { - break ; - } - } - - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - else - return ; - - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ; - const QString objectUserName = LE->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - LE->setText( objectUserName ) ; - } - return ; -} - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::ValueChangedInSpinBox( double newValue ) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QObject* send = (QObject*)sender(); - - if( send == SpinBox_C1A3 || send == SpinBox_Radius1 ) { /* radius1 */ - myRadius1 = newValue ; - myOkRadius1 = true ; - } else if( send == SpinBox_C1A4 || send == SpinBox_Radius2 ) { /* radius2 */ - myRadius2 = newValue ; - myOkRadius2 = true ; - } - else if( send == SpinBox_C1A5 || send == SpinBox_Height ) { /* algebric height */ - myHeight = newValue ; - myOkHeight = true ; - } - - if ( myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight ) { - MakeConeSimulationAndDisplay() ; - } - - return ; -} - - -//================================================================================= -// function : TextChangedInLineEdit() -// purpose : -//================================================================================= -// void GeometryGUI_ConeDlg::TextChangedInLineEdit(const QString& newText) -// { - -// myGeomGUI->EraseSimulationShape() ; -// mySimulationTopoDs.Nullify() ; -// QLineEdit* send = (QLineEdit*)sender(); -// QString newT = strdup(newText) ; -// int i ; - -// if(send == LineEditC1A3) { /* radius1 */ -// if( myVa->validate(newT, i) == myVa->Acceptable ) { -// myRadius1 = newText.toFloat() ; -// myOkRadius1 = true ; -// } -// else { -// myOkRadius1 = false ; -// } -// } else if(send == LineEditC1A4) { /* radius2 */ -// if( myVb->validate(newT, i) == myVb->Acceptable ) { -// myRadius2 = newText.toFloat() ; -// myOkRadius2 = true ; -// } -// else { -// myOkRadius2 = false ; -// } -// } else if(send == LineEditC1A5) { /* algebric height */ - -// if( myVc->validate(newT, i) == myVc->Acceptable ) { -// myHeight = newText.toFloat() ; -// if( fabs(myHeight) > Precision::Confusion() ) -// myOkHeight = true ; -// else -// myOkHeight = false ; -// } -// }else if(send == LineEdit_Radius1) { /* radius1 */ -// if( myVa->validate(newT, i) == myVa->Acceptable ) { -// myRadius1 = newText.toFloat() ; -// myOkRadius1 = true ; -// } -// else { -// myOkRadius1 = false ; -// } -// } else if(send == LineEdit_Radius2) { /* radius2 */ -// if( myVb->validate(newT, i) == myVb->Acceptable ) { -// myRadius2 = newText.toFloat() ; -// myOkRadius2 = true ; -// } -// else { -// myOkRadius2 = false ; -// } -// } else if(send == LineEdit_Height) { /* algebric height */ - -// if( myVc->validate(newT, i) == myVc->Acceptable ) { -// myHeight = newText.toFloat() ; -// if( fabs(myHeight) > Precision::Confusion() ) -// myOkHeight = true ; -// else -// myOkHeight = false ; -// } -// } -// if (myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) { -// MakeConeSimulationAndDisplay() ; -// } - -// return ; -// } - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::ActivateThisDialog() -{ - /* 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() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : MakeConeSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_ConeDlg::MakeConeSimulationAndDisplay() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - gp_Dir aDir = myDir ; - - try { - /* allows user to reverse direction of construction with a negative height */ - if( this->myHeight < -Precision::Confusion() ) { - aDir.Reverse() ; - } - - gp_Ax2 anAxis(this->myPoint1, aDir) ; - - if( fabs(myRadius1 - myRadius2) <= Precision::Confusion() ) { - mySimulationTopoDs = BRepPrimAPI_MakeCylinder( anAxis, (myRadius1+myRadius2)/2.0, fabs(myHeight) ).Shape() ; - } - else { - if( fabs(myHeight) > Precision::Confusion() ) - mySimulationTopoDs = BRepPrimAPI_MakeCone( anAxis, myRadius1, myRadius2, fabs(myHeight) ).Shape() ; - } - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeConeSimulationAndDisplay" ) ; - } - return ; -} - diff --git a/src/GEOMGUI/GeometryGUI_ConeDlg.h b/src/GEOMGUI/GeometryGUI_ConeDlg.h deleted file mode 100644 index 7811f1b58..000000000 --- a/src/GEOMGUI/GeometryGUI_ConeDlg.h +++ /dev/null @@ -1,152 +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 : GeometryGUI_ConeDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_CONE_H -#define DIALOGBOX_CONE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QSpinBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_ConeDlg -// purpose : -//================================================================================= -class GeometryGUI_ConeDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_ConeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_ConeDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void MakeConeSimulationAndDisplay() ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs ; - - gp_Pnt myPoint1 ; /* Topology used */ - gp_Dir myDir ; - bool myOkPoint1 ; - bool myOkDir ; /* to check when argument is defined */ - - Standard_Real myRadius1 ; - Standard_Real myRadius2 ; - Standard_Real myHeight ; - bool myOkRadius1 ; - bool myOkRadius2 ; - bool myOkHeight ; - QDoubleValidator *myVa ; /* Double validator for numeric input myRadius1 */ - QDoubleValidator *myVb ; /* Double validator for numeric input myRadius2 */ - QDoubleValidator *myVc ; /* Double validator for numeric input myHeight */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QWidget* myEditCurrentArgument; /* Current LineEdit or spin box */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */ - Handle(GEOM_EdgeFilter) myEdgeFilter ; /* Filter selection */ - - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QGroupBox* GroupC1; - QGroupBox* GroupC2; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A2; - QLabel* TextLabelC1A2; - QLabel* TextLabelC1A3; - GeometryGUI_SpinBox* SpinBox_C1A3 ; - QLabel* TextLabelC1A4; - GeometryGUI_SpinBox* SpinBox_C1A4 ; - QLabel* TextLabelC1A5; - GeometryGUI_SpinBox* SpinBox_C1A5 ; - - QLabel* TextLabel_Radius1 ; - QLabel* TextLabel_Radius2 ; - QLabel* TextLabel_Height ; - GeometryGUI_SpinBox* SpinBox_Radius1 ; - GeometryGUI_SpinBox* SpinBox_Radius2 ; - GeometryGUI_SpinBox* SpinBox_Height ; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_ConeDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; -}; - -#endif // DIALOGBOX_CONE_H diff --git a/src/GEOMGUI/GeometryGUI_CutDlg.cxx b/src/GEOMGUI/GeometryGUI_CutDlg.cxx deleted file mode 100644 index 948eed897..000000000 --- a/src/GEOMGUI/GeometryGUI_CutDlg.cxx +++ /dev/null @@ -1,472 +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 : GeometryGUI_CutDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CutDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_CutDlg() -// purpose : Constructs a GeometryGUI_CutDlg 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. -//================================================================================= -GeometryGUI_CutDlg::GeometryGUI_CutDlg( 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_CUT"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_CutDlg" ); - resize( 322, 220 ); - setCaption( tr( "GEOM_CUT_TITLE" ) ); - setSizeGripEnabled( TRUE ); - - GeometryGUI_CutDlgLayout = new QGridLayout( this ); - GeometryGUI_CutDlgLayout->setSpacing( 6 ); - GeometryGUI_CutDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_CUT" ) ); - 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 ); - GeometryGUI_CutDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - 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_TOOL_OBJECT" ) ); - 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_MAIN_OBJECT" ) ); - TextLabelC1A1Shape->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1Shape->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1Shape->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelC1A1Shape, 0, 0 ); - GeometryGUI_CutDlgLayout->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, 3 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_1, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - GeometryGUI_CutDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_CutDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_CutDlg::~GeometryGUI_CutDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_CutDlg::Init( SALOME_Selection* Sel ) -{ - mySelection = Sel ; - myShape1.Nullify() ; - myShape2.Nullify() ; - myConstructorId = 0 ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_CutDlg::ConstructorsClicked(int constructorId) -{ - GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupConstructor1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1Shape ; - LineEditC1A2Shape->setText(tr("")) ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_CutDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_CutDlg::ClickOnApply() -{ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 2 ) ; - } - break ; - } - } - - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_CutDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_CutDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myOkShape1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myOkShape2 = false ; - } - break ; - } - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape1 = S ; - LineEditC1A1Shape->setText(aString) ; - myOkShape1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape2 = S ; - LineEditC1A2Shape->setText(aString) ; - myOkShape2 = true ; - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_CutDlg::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 ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_CutDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Shape ) - myEditCurrentArgument = LineEditC1A1Shape ; - else if ( send == LineEditC1A2Shape ) - myEditCurrentArgument = LineEditC1A2Shape ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_CutDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CutDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_CutDlg::enterEvent( QEvent * ) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_CutDlg::ActivateThisDialog() -{ - /* 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() ) ); - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_CutDlg.h b/src/GEOMGUI/GeometryGUI_CutDlg.h deleted file mode 100644 index 1e7c6ed2e..000000000 --- a/src/GEOMGUI/GeometryGUI_CutDlg.h +++ /dev/null @@ -1,118 +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 : GeometryGUI_CutDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_CUT_H -#define DIALOGBOX_CUT_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_CutDlg -// purpose : -//================================================================================= -class GeometryGUI_CutDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CutDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_CutDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape myShape1 ; /* topology used to fuse */ - TopoDS_Shape myShape2 ; /* topology used to fuse */ - GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */ - GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */ - bool myOkShape1 ; - bool myOkShape2 ; /* to check when arguments are defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1Shape; - QLineEdit* LineEditC1A2Shape; - QPushButton* SelectButtonC1A1Shape; - QPushButton* SelectButtonC1A2Shape; - QLabel* TextLabelC1A2Shape; - QLabel* TextLabelC1A1Shape; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_CutDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructor1Layout; -}; - -#endif // DIALOGBOX_CUT_H diff --git a/src/GEOMGUI/GeometryGUI_CylinderDlg.cxx b/src/GEOMGUI/GeometryGUI_CylinderDlg.cxx deleted file mode 100644 index d96817330..000000000 --- a/src/GEOMGUI/GeometryGUI_CylinderDlg.cxx +++ /dev/null @@ -1,695 +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 : GeometryGUI_CylinderDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_CylinderDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_CylinderDlg() -// purpose : Constructs a GeometryGUI_CylinderDlg 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. -//================================================================================= -GeometryGUI_CylinderDlg::GeometryGUI_CylinderDlg( 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_CYLINDER_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CYLINDER_DXYZ"))); - - if ( !name ) - setName( "GeometryGUI_CylinderDlg" ); - resize( 303, 281 ); - setCaption( tr( "GEOM_CYLINDER_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_CylinderDlgLayout = new QGridLayout( this ); - GeometryGUI_CylinderDlgLayout->setSpacing( 6 ); - GeometryGUI_CylinderDlgLayout->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 ); - GeometryGUI_CylinderDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_CYLINDER" ) ); - 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_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 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() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 3 ); - GeometryGUI_CylinderDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - 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 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_BASE_POINT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setMinimumSize( QSize( 0, 0 ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - 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_RADIUS" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A3->setFrameShape( QLabel::NoFrame ); - TextLabelC1A3->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - - SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ; - GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 ) ; - - TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" ); - TextLabelC1A4->setText( tr( "GEOM_HEIGHT" ) ); - TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A4->setFrameShape( QLabel::NoFrame ); - TextLabelC1A4->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 ); - - SpinBox_C1A4 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A4" ) ; - GroupC1Layout->addWidget( SpinBox_C1A4, 3, 2 ); - - GeometryGUI_CylinderDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "GEOM_BOX_OBJ" ) ); - 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 ); - TextLabel_Height = new QLabel(GroupC2 , "TextLabel_Height" ); - TextLabel_Height->setText( tr( "GEOM_HEIGHT" ) ); - GroupC2Layout->addWidget( TextLabel_Height, 1, 0 ); - TextLabel_Radius = new QLabel( GroupC2, "TextLabel_Radius" ); - TextLabel_Radius->setText( tr( "GEOM_RADIUS" ) ); - GroupC2Layout->addWidget( TextLabel_Radius, 0, 0 ); - - SpinBox_Height = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Height" ) ; - SpinBox_Height->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_Height->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_Height, 1, 1 ) ; - - SpinBox_Radius = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius" ) ; - SpinBox_Radius->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_Radius->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_Radius, 0, 1 ) ; - - QSpacerItem* spacer1 = new QSpacerItem( 20, 62, QSizePolicy::Minimum, QSizePolicy::Fixed ); - GroupC2Layout->addItem( spacer1 ); - - GeometryGUI_CylinderDlgLayout->addWidget(GroupC2 , 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_CylinderDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_CylinderDlg::~GeometryGUI_CylinderDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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 spin boxes & initial values */ - /* First constructor : radius */ - SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - /* First constructor : algebric height */ - SpinBox_C1A4->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - /* Second constructor : radius */ - SpinBox_Radius->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - /* Second constructor : algebric height */ - SpinBox_Height->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - - GroupC1->show(); - GroupC2->hide(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - SpinBox_C1A3->SetValue( 100.0 ) ; - SpinBox_C1A4->SetValue( 300.0 ) ; - SpinBox_Radius->SetValue( 100.0 ) ; - SpinBox_Height->SetValue( 300.0 ) ; - myRadius = 100.0 ; - myHeight = 300.0 ; - - myOkRadius = true ; - myOkHeight = true ; - myOkPoint1 = false ; - myOkDir = false ; - - mySimulationTopoDs.Nullify() ; - 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); - myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom ); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - - /* first filter used */ - mySelection->AddFilter(myVertexFilter) ; - - /* 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( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_Radius, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_Height, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_CylinderDlg::ConstructorsClicked(int constructorId) -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - - switch(myConstructorId) - { - case 0 : - { - GroupC1->hide(); - GroupC2->show(); - myConstructorId = constructorId ; - myOkHeight = myOkRadius = myOkPoint1 = myOkDir = true ; - - SpinBox_Radius->SetValue( 100.0 ) ; - SpinBox_Height->SetValue( 300.0 ) ; - myRadius = 100.0 ; - myHeight = 300.0 ; - - disconnect( mySelection, 0, this, 0 ); - - myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ; - myDir.SetCoord( 0.0, 0.0, 1.0 ) ; - - if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) { - gp_Dir aDir = myDir ; - /* allows user to reverse direction of construction with a negative height */ - if( this->myHeight < -Precision::Confusion() ) { - aDir.Reverse() ; - } - MakeCylinderSimulationAndDisplay() ; - } - break ; - } - case 1 : - { - GroupC2->hide(); - GroupC1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1 ; - myOkHeight = myOkRadius = true ; - myOkPoint1 = myOkDir = false ; - LineEditC1A1->setText( tr("") ); - - SpinBox_C1A3->SetValue( 100.0 ) ; - SpinBox_C1A4->SetValue( 300.0 ) ; - myRadius = 100.0 ; - myHeight = 300.0 ; - disconnect( mySelection, 0, this, 0 ); - break ; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) { - gp_Dir aDir = myDir ; - /* allows user to reverse direction of construction with a negative height */ - if( this->myHeight < -Precision::Confusion() ) { - aDir.Reverse() ; - } - myGeomGUI->MakeCylinderAndDisplay( myPoint1, aDir, myRadius, fabs(myHeight) ) ; - } - break ; - } - case 1 : - { - if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) { - gp_Dir aDir = myDir ; - /* allows user to reverse direction of construction with a negative height */ - if( this->myHeight < -Precision::Confusion() ) { - aDir.Reverse() ; - } - myGeomGUI->MakeCylinderAndDisplay( myPoint1, aDir, myRadius, fabs(myHeight) ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_CylinderDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* name of future selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - LineEditC1A2->setText("") ; - myOkDir = false ; - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* gp_Pnt : not used */ - if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditC1A1->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir)*/ ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - - LineEditC1A2->setText(aString) ; - myOkDir = true ; - } - - if( myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) { - MakeCylinderSimulationAndDisplay() ; - } - return ; -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->AddFilter(myVertexFilter) ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - case 1: - { - break ; - } - } - - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - else - return ; - - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ; - const QString objectUserName = LE->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - LE->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : ValueChangedInSpinBox -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::ValueChangedInSpinBox( double newValue ) -{ - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - QObject* send = (QObject*)sender(); - - if(send == SpinBox_C1A3 ) { /* radius */ - - myRadius = newValue ; - myOkRadius = true ; - if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) { - MakeCylinderSimulationAndDisplay() ; - } - } else if (send == SpinBox_C1A4 ) { /* algebric height */ - - myHeight = newValue ; - myOkHeight = true ; - if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) { - MakeCylinderSimulationAndDisplay() ; - } - } - else if (send == SpinBox_Height) { /* algebric height */ - - myOkHeight = true ; - myHeight = newValue ; - if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) { - MakeCylinderSimulationAndDisplay() ; - } - } - else if (send == SpinBox_Radius) { /* radius */ - myRadius = newValue ; - myOkRadius = true ; - if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight ) { - MakeCylinderSimulationAndDisplay() ; - } - } - return ; -} - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::ActivateThisDialog() -{ - /* 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() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : MakeCylinderSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_CylinderDlg::MakeCylinderSimulationAndDisplay() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - gp_Dir aDir = this->myDir ; - - try { - /* allows user to reverse direction of construction with a negative height */ - if( this->myHeight < -Precision::Confusion() ) { - aDir.Reverse() ; - } - gp_Ax2 anAxis(this->myPoint1, aDir) ; - - mySimulationTopoDs = BRepPrimAPI_MakeCylinder( anAxis, this->myRadius, fabs(myHeight) ).Shape() ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeCylinderSimulationAndDisplay" ) ; - } - return ; -} - diff --git a/src/GEOMGUI/GeometryGUI_CylinderDlg.h b/src/GEOMGUI/GeometryGUI_CylinderDlg.h deleted file mode 100644 index fafab604e..000000000 --- a/src/GEOMGUI/GeometryGUI_CylinderDlg.h +++ /dev/null @@ -1,146 +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 : GeometryGUI_CylinderDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_CYLINDER_H -#define DIALOGBOX_CYLINDER_H - -#include "SALOME_Selection.h" - -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QSpinBox; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_CylinderDlg -// purpose : -//================================================================================= -class GeometryGUI_CylinderDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_CylinderDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_CylinderDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void MakeCylinderSimulationAndDisplay() ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs ; - SALOME_Selection* mySelection ; /* User shape selection */ - - gp_Pnt myPoint1 ; /* topology used */ - gp_Dir myDir ; - - Standard_Real myRadius ; - Standard_Real myHeight ; - bool myOkRadius ; - bool myOkHeight ; - QDoubleValidator *myVa ; /* Double validator for numeric input */ - QDoubleValidator *myVb ; /* Double validator for numeric input */ - - bool myOkPoint1 ; - bool myOkDir ; /* to check when arguments is defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QWidget* myEditCurrentArgument; /* Current LineEdit or spin box */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */ - Handle(GEOM_EdgeFilter) myEdgeFilter ; /* Filter selection */ - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QGroupBox* GroupC1; - QGroupBox* GroupC2; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A2; - QLabel* TextLabelC1A2; - - QLabel* TextLabelC1A3; - GeometryGUI_SpinBox* SpinBox_C1A3 ; - QLabel* TextLabelC1A4 ; - GeometryGUI_SpinBox* SpinBox_C1A4 ; - - QLabel* TextLabel_Radius ; - GeometryGUI_SpinBox* SpinBox_Radius ; - QLabel* TextLabel_Height ; - GeometryGUI_SpinBox* SpinBox_Height ; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_CylinderDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; -}; - -#endif // DIALOGBOX_CYLINDER_H diff --git a/src/GEOMGUI/GeometryGUI_DistanceDlg.cxx b/src/GEOMGUI/GeometryGUI_DistanceDlg.cxx deleted file mode 100644 index cc60a3c14..000000000 --- a/src/GEOMGUI/GeometryGUI_DistanceDlg.cxx +++ /dev/null @@ -1,589 +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 : GeometryGUI_DistanceDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_DistanceDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_RightFrame.h" -#include "utilities.h" - -#include "OCCViewer_Viewer3d.h" -#include "OCCViewer_ViewFrame.h" - -// Open CASCADE Includes -#include -#include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_DistanceDlg() -// purpose : Constructs a GeometryGUI_DistanceDlg 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. -//================================================================================= -GeometryGUI_DistanceDlg::GeometryGUI_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 ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MINDIST"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_DistanceDlg" ); - resize( 322, 220 ); - setCaption( tr( "GEOM_MINDIST_TITLE" ) ); - setSizeGripEnabled( TRUE ); - - GeometryGUI_DistanceDlgLayout = new QGridLayout( this ); - GeometryGUI_DistanceDlgLayout->setSpacing( 6 ); - GeometryGUI_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 ); - GeometryGUI_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 ); - GeometryGUI_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 ); - GeometryGUI_DistanceDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_DistanceDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_DistanceDlg::~GeometryGUI_DistanceDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::Init( SALOME_Selection* Sel ) -{ - mySelection = Sel ; - myShape1.Nullify() ; - myShape2.Nullify() ; - myConstructorId = 0 ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_DistanceDlg::ConstructorsClicked(int constructorId) -{ - EraseDistance(); - myGeomGUI->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupConstructor1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1Shape ; - LineEditC1A2Shape->setText(tr("")) ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::ClickOnApply() -{ - EraseDistance() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - this->MakeDistanceSimulationAndDisplay(myShape1 ,myShape2) ; - } - break ; - } - } - - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::ClickOnCancel() -{ - EraseDistance() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_DistanceDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - LineEdit_Length->setText("") ; - myEditCurrentArgument->setText("") ; /* by default */ - QString aString = ""; /* the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myOkShape1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myOkShape2 = false ; - } - break ; - } - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape1 = S ; - LineEditC1A1Shape->setText(aString) ; - myOkShape1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape2 = S ; - LineEditC1A2Shape->setText(aString) ; - myOkShape2 = true ; - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_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 ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Shape ) - myEditCurrentArgument = LineEditC1A1Shape ; - else if ( send == LineEditC1A2Shape ) - myEditCurrentArgument = LineEditC1A2Shape ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_DistanceDlg::enterEvent( QEvent * ) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::ActivateThisDialog() -{ - /* 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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - - -//================================================================================= -// function : MakeDistanceSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape& S1, const TopoDS_Shape& S2) -{ - LineEdit_Length->setText("") ; - EraseDistance() ; - myGeomGUI->EraseSimulationShape() ; - - 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) { - BRepBuilderAPI_MakeVertex MakeVertex(P1); - mySimulationTopoDs = MakeVertex.Vertex(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - LineEdit_Length->setText("0.0") ; - } else { - BRepBuilderAPI_MakeEdge MakeEdge(P1, P2); - mySimulationTopoDs = MakeEdge.Edge(); - - TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(P1); - 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(); - } - } - } else - myGeomGUI->GetDesktop()->putInfo( tr( "GEOM_PRP_MIN_DIST" ) ); -} - - -//================================================================================= -// function : EraseDistance() -// purpose : -//================================================================================= -void GeometryGUI_DistanceDlg::EraseDistance() -{ - 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(); - - AIS_ListOfInteractive L; - ic->DisplayedObjects(AIS_KOI_Relation,-1,L); - AIS_ListIteratorOfListOfInteractive ite(L); - while (ite.More()) { - ic->Remove( ite.Value() ); - ic->UpdateCurrentViewer(); - ite.Next(); - } - } -} diff --git a/src/GEOMGUI/GeometryGUI_DistanceDlg.h b/src/GEOMGUI/GeometryGUI_DistanceDlg.h deleted file mode 100644 index 742fe38e2..000000000 --- a/src/GEOMGUI/GeometryGUI_DistanceDlg.h +++ /dev/null @@ -1,125 +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 : GeometryGUI_DistanceDlg.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_DISTANCE_H -#define DIALOGBOX_DISTANCE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_DistanceDlg -// purpose : -//================================================================================= -class GeometryGUI_DistanceDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_DistanceDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_DistanceDlg(); - -private: - - 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() ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* 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; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_DistanceDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructor1Layout; -}; - -#endif // DIALOGBOX_DISTANCE_H diff --git a/src/GEOMGUI/GeometryGUI_EdgeDlg.cxx b/src/GEOMGUI/GeometryGUI_EdgeDlg.cxx deleted file mode 100644 index 6d212261f..000000000 --- a/src/GEOMGUI/GeometryGUI_EdgeDlg.cxx +++ /dev/null @@ -1,462 +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 : GeometryGUI_EdgeDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_EdgeDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_EdgeDlg() -// purpose : Constructs a GeometryGUI_EdgeDlg 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. -//================================================================================= -GeometryGUI_EdgeDlg::GeometryGUI_EdgeDlg( 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_BUILD_EDGE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_EdgeDlg" ); - resize( 303, 225 ); - setCaption( tr( "GEOM_EDGE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_EdgeDlgLayout = new QGridLayout( this ); - GeometryGUI_EdgeDlgLayout->setSpacing( 6 ); - GeometryGUI_EdgeDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_EDGE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_EdgeDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_POINTS" ) ); - 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 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_POINT_I" ).arg("1") ); - 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_POINT_I" ).arg("2") ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - GeometryGUI_EdgeDlgLayout->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, 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 ); - GeometryGUI_EdgeDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_EdgeDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_EdgeDlg::~GeometryGUI_EdgeDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - // GroupC2->hide(); - // GroupC3->hide(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myPoint2.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkPoint2 = false ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - mySelection->AddFilter(myVertexFilter) ; /* first filter used */ - - /* 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( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_EdgeDlg::ConstructorsClicked(int constructorId) -{ - switch (constructorId) - { - case 0: - { - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPoint1 && myOkPoint2) - myGeomGUI->MakeLinearEdgeAndDisplay( myPoint1, myPoint2 ) ; - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_EdgeDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* name of future selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myOkPoint2 = false ; - } - return ; - } - - // nbSel == 1 ! - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A2 && myGeomGUI->VertexToPoint(S, myPoint2) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint2 = true ; - } - - if( myOkPoint1 && myOkPoint2 && myPoint1.Distance(myPoint2) > Precision::Confusion() ) { - mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - } - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - // TODO other constructors - // - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_EdgeDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_EdgeDlg.h b/src/GEOMGUI/GeometryGUI_EdgeDlg.h deleted file mode 100644 index facdddc5f..000000000 --- a/src/GEOMGUI/GeometryGUI_EdgeDlg.h +++ /dev/null @@ -1,118 +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 : GeometryGUI_EdgeDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_EDGE_H -#define DIALOGBOX_EDGE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_EdgeDlg -// purpose : -//================================================================================= -class GeometryGUI_EdgeDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_EdgeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_EdgeDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - SALOME_Selection* mySelection ; /* User shape selection */ - gp_Pnt myPoint1 ; /* Points containing the vector */ - gp_Pnt myPoint2 ; - - bool myOkPoint1 ; /* true when myPoint is defined */ - bool myOkPoint2 ; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_EdgeDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_EDGE_H diff --git a/src/GEOMGUI/GeometryGUI_EllipseDlg.cxx b/src/GEOMGUI/GeometryGUI_EllipseDlg.cxx deleted file mode 100755 index c8acdaa42..000000000 --- a/src/GEOMGUI/GeometryGUI_EllipseDlg.cxx +++ /dev/null @@ -1,533 +0,0 @@ -// GEOM GEOMGUI : GUI for Geometry component -// -// Copyright (C) 2003 OPEN CASCADE -// -// 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 : GeometryGUI_EllipseDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#include "GeometryGUI_EllipseDlg.h" - -#include "GeometryGUI.h" -#include "gp_Elips.hxx" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_EllipseDlg() -// purpose : Constructs a GeometryGUI_EllipseDlg 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. -//================================================================================= -GeometryGUI_EllipseDlg::GeometryGUI_EllipseDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, fl ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_ELLIPSE_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_EllipseDlg" ); - resize( 303, 285 ); - setCaption( tr( "GEOM_ELLIPSE_TITLE" ) ); - - GeometryGUI_EllipseDlgLayout = new QGridLayout( this ); - GeometryGUI_EllipseDlgLayout->setSpacing( 6 ); - GeometryGUI_EllipseDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_ELLIPSE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_EllipseDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupButtons->sizePolicy().hasHeightForWidth() ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - buttonApply->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 2 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_2, 0, 1 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - GeometryGUI_EllipseDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 150 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_CENTER" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" ); - TextLabelC1A4->setText( tr( "GEOM_RADIUS_MINOR" ) ); - TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addMultiCellWidget( TextLabelC1A4, 3, 3, 0, 1 ); - - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_RADIUS_MAJOR" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_VECTOR" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - - SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ); - GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 ) ; - SpinBox_C1A4 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A4" ); - GroupC1Layout->addWidget( SpinBox_C1A4, 3, 2 ); - - GeometryGUI_EllipseDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_EllipseDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_EllipseDlg::~GeometryGUI_EllipseDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_EllipseDlg::Init( SALOME_Selection* Sel ) -{ - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_C1A3->RangeStepAndValidator( 0.00001, 999999.99999, step, 5 ) ; - SpinBox_C1A3->SetValue( 200.0 ) ; /* = myMajorRadius */ - myMajorRadius = 200.0 ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_C1A4->RangeStepAndValidator( 0.00001, 999999.99999, step, 5 ) ; - SpinBox_C1A4->SetValue( 100.0 ) ; /* = myMinorRadius */ - myMinorRadius = 100.0 ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myOkPoint = myOkDir = false ; - mySimulationTopoDs.Nullify() ; - 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); - myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom ); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - - mySelection->AddFilter(myVertexFilter) ; /* first filter used */ - - /* signals and slots connections */ - connect( buttonOk, SIGNAL( pressed() ), this, SLOT( ClickOnOk() ) ); - connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( ClickOnCancel() ) ) ; - connect( buttonApply, SIGNAL( pressed() ), this, SLOT( ClickOnApply() ) ); - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (pressed() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC1A2, SIGNAL (pressed() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_EllipseDlg::ConstructorsClicked(int constructorId) -{ - /* only a constructor now */ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_EllipseDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_EllipseDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPoint && myOkDir) { - myGeomGUI->MakeEllipseAndDisplay( myPoint, myDir, myMajorRadius, myMinorRadius ) ; - } - break ; - } - } - return ; -} - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_EllipseDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_EllipseDlg::SelectionIntoArgument() -{ - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future name of selection */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - myOkPoint = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - LineEditC1A2->setText("") ; - myOkDir = false ; - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* gp_Pnt : not used */ - if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint) ) { - LineEditC1A1->setText(aString) ; - myOkPoint = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir) */) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - LineEditC1A2->setText(aString) ; - myOkDir = true ; - } - - if( myOkPoint && myOkDir ) { - this->MakeEllipseSimulationAndDisplay() ; - } - return ; -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_EllipseDlg::SetEditCurrentArgument() -{ - mySelection->ClearFilters() ; - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->AddFilter(myVertexFilter) ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_EllipseDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_EllipseDlg::ValueChangedInSpinBox( double newValue ) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - GeometryGUI_SpinBox* send = (GeometryGUI_SpinBox*)sender(); - if(send == SpinBox_C1A3) - myMajorRadius = newValue ; - else if(send == SpinBox_C1A4) - myMinorRadius = newValue ; - else - return ; - - if (myOkPoint && myOkDir) { - MakeEllipseSimulationAndDisplay() ; - } - - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_EllipseDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_EllipseDlg::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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_EllipseDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_EllipseDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : MakeEllipseSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_EllipseDlg::MakeEllipseSimulationAndDisplay() -{ - myGeomGUI->EraseSimulationShape() ; - - if( myMajorRadius < myMinorRadius ) - return ; - - try { - const gp_Ax2 axis( this->myPoint, this->myDir ) ; - gp_Elips ellipse( axis, this->myMajorRadius, this->myMinorRadius ); - - BRepBuilderAPI_MakeEdge MakeEdge( ellipse ); - mySimulationTopoDs = MakeEdge.Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeEllipseSimulationAndDisplay" ) ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_EllipseDlg.h b/src/GEOMGUI/GeometryGUI_EllipseDlg.h deleted file mode 100755 index 521cec8c4..000000000 --- a/src/GEOMGUI/GeometryGUI_EllipseDlg.h +++ /dev/null @@ -1,133 +0,0 @@ -// GEOM GEOMGUI : GUI for Geometry component -// -// Copyright (C) 2003 OPEN CASCADE -// -// 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 : GeometryGUI_EllipseDlg.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef GEOMETRYGUI_ELLIPSE_H -#define GEOMETRYGUI_ELLIPSE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QSpinBox; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_EllipseDlg -// purpose : -//================================================================================= -class GeometryGUI_EllipseDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_EllipseDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_EllipseDlg(); - -private : - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e ); - void Init(SALOME_Selection* Sel) ; - void MakeEllipseSimulationAndDisplay() ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - SALOME_Selection* mySelection ; /* User shape selection */ - - gp_Pnt myPoint ; /* Central point of ellipse */ - bool myOkPoint ; /* true when myPoint is defined */ - - gp_Dir myDir ; /* to set normal axis of ellipse */ - bool myOkDir ; /* true when myPoint is defined */ - - Standard_Real myMajorRadius ; - Standard_Real myMinorRadius ; - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */ - Handle(GEOM_EdgeFilter) myEdgeFilter; /* filter for selection */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonCancel; - QPushButton* buttonOk; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A4; - QLabel* TextLabelC1A3; - QLabel* TextLabelC1A2; - QPushButton* SelectButtonC1A1; - QPushButton* SelectButtonC1A2; - GeometryGUI_SpinBox* SpinBox_C1A3; - GeometryGUI_SpinBox* SpinBox_C1A4; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox(double newValue) ; - -protected: - QGridLayout* GeometryGUI_EllipseDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // GEOMETRYGUI_ELLIPSE_H diff --git a/src/GEOMGUI/GeometryGUI_FaceDlg.cxx b/src/GEOMGUI/GeometryGUI_FaceDlg.cxx deleted file mode 100644 index 499d5002a..000000000 --- a/src/GEOMGUI/GeometryGUI_FaceDlg.cxx +++ /dev/null @@ -1,420 +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 : GeometryGUI_FaceDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_FaceDlg.h" -#include "GeometryGUI.h" - -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_FaceDlg() -// purpose : Constructs a GeometryGUI_FaceDlg 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. -//================================================================================= -GeometryGUI_FaceDlg::GeometryGUI_FaceDlg( 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_BUILD_FACE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_FaceDlg" ); - resize( 303, 208 ); - setCaption( tr( "GEOM_FACE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_FaceDlgLayout = new QGridLayout( this ); - GeometryGUI_FaceDlgLayout->setSpacing( 6 ); - GeometryGUI_FaceDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_FACE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_FaceDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_FACE_FFW" ) ); - 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_WIRE" ) ); - 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 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" ); - CheckBox1->setText( tr( "GEOM_FACE_OPT" ) ); - CheckBox1->setChecked( TRUE ); - GroupC1Layout->addWidget( CheckBox1, 1, 2); - GeometryGUI_FaceDlgLayout->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, 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 ); - GeometryGUI_FaceDlgLayout->addWidget( GroupButtons, 2, 0 ); - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_FaceDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_FaceDlg::~GeometryGUI_FaceDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - CheckBox1->setChecked( TRUE ); - - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkShape = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - 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); - myWireFilter = new GEOM_ShapeTypeFilter( TopAbs_WIRE, myGeom ); - mySelection->AddFilter(myWireFilter) ; /* first filter used */ - - /* 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( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_FaceDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::ClickOnApply() -{ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkShape) { - myGeomGUI->MakeFaceAndDisplay(this->myGeomShape, this->CheckBox1->isChecked() ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->ResetState() ; - disconnect( mySelection, 0, this, 0 ); - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_FaceDlg::SelectionIntoArgument() -{ - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - - myOkShape = false; - myEditCurrentArgument->setText("") ; - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) - return ; - - // nbSel == 1 ! - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(this->mySelection, this->myShape) ) - return ; - - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - - myEditCurrentArgument->setText(aString) ; - this->myOkShape = true ; - - /* no simulation */ - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->AddFilter(myWireFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - mySelection->ClearFilters() ; - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::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 ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_FaceDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_FaceDlg.h b/src/GEOMGUI/GeometryGUI_FaceDlg.h deleted file mode 100644 index 2b33a5161..000000000 --- a/src/GEOMGUI/GeometryGUI_FaceDlg.h +++ /dev/null @@ -1,113 +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 : GeometryGUI_FaceDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_FACE_H -#define DIALOGBOX_FACE_H - - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_FaceDlg -// purpose : -//================================================================================= -class GeometryGUI_FaceDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_FaceDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_FaceDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape myShape ; /* topology used to fuse */ - GEOM::GEOM_Shape_var myGeomShape ; /* is myShape */ - bool myOkShape ; /* to check when arguments is defined */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - Handle(GEOM_ShapeTypeFilter) myWireFilter; /* Filter selection */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QCheckBox* CheckBox1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_FaceDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_FACE_H diff --git a/src/GEOMGUI/GeometryGUI_FilletDlg.cxx b/src/GEOMGUI/GeometryGUI_FilletDlg.cxx deleted file mode 100644 index f15159b06..000000000 --- a/src/GEOMGUI/GeometryGUI_FilletDlg.cxx +++ /dev/null @@ -1,842 +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 : GeometryGUI_FilletDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_FilletDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" -#include "QAD_RightFrame.h" -#include "OCCViewer_Viewer3d.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - - -//================================================================================= -// class : GeometryGUI_FilletDlg() -// purpose : Constructs a GeometryGUI_FilletDlg 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. -//================================================================================= -GeometryGUI_FilletDlg::GeometryGUI_FilletDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - 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_FILLET_ALL"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_FILLET_EDGE"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_FILLET_FACE"))); - - if ( !name ) - setName( "GeometryGUI_FilletDlg" ); - resize( 365, 220 ); - setCaption( tr( "GEOM_FILLET_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_FilletDlgLayout = new QGridLayout( this ); - GeometryGUI_FilletDlgLayout->setSpacing( 6 ); - GeometryGUI_FilletDlgLayout->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 ); - GeometryGUI_FilletDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_FILLET" ) ); - 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 ); - Constructor3 = new QRadioButton( GroupConstructors, "Constructor3" ); - Constructor3->setText( tr( "" ) ); - Constructor3->setPixmap( image3 ); - Constructor3->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor3, 0, 4 ); - QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_4, 0, 5 ); - GeometryGUI_FilletDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_FILLET_ALL" ) ); - 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_RADIUS" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A2" ) ; - SpinBox_C1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A2->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A2, 1, 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 ); - GeometryGUI_FilletDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "GEOM_FILLET_EDGES" ) ); - 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_RADIUS" ) ); - TextLabelC2A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A2->setFrameShape( QLabel::NoFrame ); - TextLabelC2A2->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 ); - - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - GroupC2Layout->addWidget( LineEditC2A1, 0, 2 ); - - SpinBox_C2A2 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_C2A2" ) ; - SpinBox_C2A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A2->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A2, 1, 2 ); - - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setText( tr( "" ) ); - SelectButtonC2A1->setPixmap( image1 ); - SelectButtonC2A1->setToggleButton( FALSE ); - SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 ); - GeometryGUI_FilletDlgLayout->addWidget( GroupC2, 1, 0 ); - - /***************************************************************/ - GroupC3 = new QGroupBox( this, "GroupC3" ); - GroupC3->setTitle( tr( "GEOM_FILLET_FACES" ) ); - GroupC3->setMinimumSize( QSize( 0, 0 ) ); - GroupC3->setFrameShape( QGroupBox::Box ); - GroupC3->setFrameShadow( QGroupBox::Sunken ); - GroupC3->setColumnLayout(0, Qt::Vertical ); - GroupC3->layout()->setSpacing( 0 ); - GroupC3->layout()->setMargin( 0 ); - GroupC3Layout = new QGridLayout( GroupC3->layout() ); - GroupC3Layout->setAlignment( Qt::AlignTop ); - GroupC3Layout->setSpacing( 6 ); - GroupC3Layout->setMargin( 11 ); - - TextLabelC3A1 = new QLabel( GroupC3, "TextLabelC3A1" ); - TextLabelC3A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC3A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A1->setFrameShape( QLabel::NoFrame ); - TextLabelC3A1->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A1, 0, 0 ); - - TextLabelC3A2 = new QLabel( GroupC3, "TextLabelC3A2" ); - TextLabelC3A2->setText( tr( "GEOM_RADIUS" ) ); - TextLabelC3A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A2->setFrameShape( QLabel::NoFrame ); - TextLabelC3A2->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A2, 1, 0 ); - - LineEditC3A1 = new QLineEdit( GroupC3, "LineEditC3A1" ); - GroupC3Layout->addWidget( LineEditC3A1, 0, 2 ); - - SpinBox_C3A2 = new GeometryGUI_SpinBox( GroupC3, "GeomSpinBox_C3A2" ) ; - SpinBox_C3A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C3A2->sizePolicy().hasHeightForWidth() ) ); - GroupC3Layout->addWidget( SpinBox_C3A2, 1, 2 ); - - SelectButtonC3A1 = new QPushButton( GroupC3, "SelectButtonC3A1" ); - SelectButtonC3A1->setText( tr( "" ) ); - SelectButtonC3A1->setPixmap( image1 ); - SelectButtonC3A1->setToggleButton( FALSE ); - SelectButtonC3A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC3Layout->addWidget( SelectButtonC3A1, 0, 1 ); - GeometryGUI_FilletDlgLayout->addWidget( GroupC3, 1, 0 ); - - /* Initialisation */ - Init( Sel, ic ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_FilletDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_FilletDlg::~GeometryGUI_FilletDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) -{ - - /* 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 spin boxes */ - SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C1A2->SetValue( 50 ) ; - SpinBox_C2A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C2A2->SetValue( 50 ) ; - SpinBox_C3A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C3A2->SetValue( 50 ) ; - - GroupC1->show(); - GroupC2->hide() ; - GroupC3->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - - mySelection = Sel ; - myEditCurrentArgument = LineEditC1A1 ; - myShape.Nullify() ; - myRadius = 50.0 ; - myOkRadius = true ; - myIC = ic ; - myLocalContextId = -1 ; - myUseLocalContext = false ; - myOkShape = false ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - mySimulationTopoDs.Nullify() ; - - /* Filters definition */ - 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( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC3A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C3A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC3A1, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_FilletDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myEditCurrentArgument->setText(tr("")) ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); - if(this->myUseLocalContext) { - myIC->CloseLocalContext(this->myLocalContextId) ; - myGeomGUI->OnDisplayAll(true) ; - this->myUseLocalContext = false ; - } - } - - myOkShape = false ; - myRadius = 50.0 ; - myOkRadius = true ; - myConstructorId = constructorId ; - - // connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - switch (constructorId) - { - case 0: /* Fillet All */ - { - myShapeType = -1; - GroupC1->show(); - GroupC2->hide() ; - GroupC3->hide() ; - myEditCurrentArgument = LineEditC1A1 ; - SpinBox_C1A2->SetValue( 50 ) ;; - LineEditC1A1->setText(tr("")) ; - break; - } - - case 1: /* Fillet edges */ - { - myShapeType = 6; - GroupC1->hide(); - GroupC2->show() ; - GroupC3->hide() ; - myEditCurrentArgument = LineEditC2A1 ; - SpinBox_C2A2->SetValue( 50 ) ;; - LineEditC2A1->setText(tr("")) ; - break ; - } - - case 2: /* Fillet Faces */ - { - myShapeType = 4; - GroupC1->hide(); - GroupC2->hide() ; - GroupC3->show() ; - myEditCurrentArgument = LineEditC3A1 ; - SpinBox_C3A2->SetValue( 50 ) ;; - LineEditC3A1->setText(tr("")) ; - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - bool testResult = false ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : /* Fillet All */ - { - if(myOkRadius) { - if( myOkShape ) { - testResult = myGeomGUI->OnFilletGetAll( myShape, myRadius, myShapeType, myShapeIOR ) ; - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - - case 1 : /* Fillet Edge */ - { - if(myOkRadius) { - if( myOkShape ) { - testResult = myGeomGUI->OnFilletGetSelected( myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext ); - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - - case 2 : /* Fillet Face */ - { - if(myOkRadius) { - if( myOkShape ) { - testResult = myGeomGUI->OnFilletGetSelected( myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext ) ; - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - } - - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); - if(this->myUseLocalContext) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - reject() ; - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC2A1 ) - myEditCurrentArgument = LineEditC2A1 ; - else if ( send == LineEditC3A1 ) - myEditCurrentArgument = LineEditC3A1 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_FilletDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Reset all arguments and local context when selection as changed */ - this->ResetStateOfDialog() ; - - /* Future name of argument */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel == 1 ) { - - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( !IO->hasEntry() ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ; - return ; - } - - if ( !S.IsNull() && S.ShapeType() <= 2 ) { - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ - myEditCurrentArgument->setText(aString) ; - myShape = S ; - myOkShape = true ; - } - - 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); - myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - myEditCurrentArgument->setText(aString) ; - } - } - } - } - - MakePreview(); - - } else - return; - - if( myOkShape && myShapeType!=-1 && myConstructorId != 0 ) { - /* local context is defined into the method */ - myGeomGUI->PrepareSubShapeSelection( this->myShapeType, this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_EDGE")) ; - } -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - - switch (myConstructorId) - { - case 0: - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - SelectionIntoArgument() ; - } - break; - } - - case 1: - { - if(send ==SelectButtonC2A1 ) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1; - SelectionIntoArgument() ; - } - break; - } - - case 2: - { - if(send ==SelectButtonC3A1 ) { - LineEditC3A1->setFocus() ; - myEditCurrentArgument = LineEditC3A1; - SelectionIntoArgument() ; - } - break; - } - } - return ; -} - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::ValueChangedInSpinBox( double newValue ) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myRadius = newValue ; - myOkRadius = true ; - - MakePreview(); -} - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - this->ResetStateOfDialog() ; - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupC3->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupC2->setEnabled(true) ; - GroupC3->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::enterEvent( QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : ResetStateOfDialog() -// purpose : -//================================================================================= -void GeometryGUI_FilletDlg::ResetStateOfDialog() -{ - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; - - /* Close its local contact if opened */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); - if(this->myUseLocalContext) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - return ; -} - - -void GeometryGUI_FilletDlg::MakePreview() -{ - TopoDS_Shape tds ; - try - { - BRepFilletAPI_MakeFillet fill(myShape); - switch (myConstructorId) - { - case 0: /* Fillet All */ - { - TopExp_Explorer Exp ( myShape, TopAbs_EDGE ); - for (Exp; Exp.More(); Exp.Next()) - { - TopoDS_Edge E =TopoDS::Edge(Exp.Current()); - fill.Add(E); - } - for (int i = 1;i<=fill.NbContours();i++) - fill.SetRadius(myRadius,i); - - tds = fill.Shape(); - break; - } -// case 1: /* Fillet edges */ -// case 2: /* Fillet Faces */ - } - if (!tds.IsNull()) - { - mySimulationTopoDs = tds; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - } - catch(Standard_Failure) - { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } -} diff --git a/src/GEOMGUI/GeometryGUI_FilletDlg.h b/src/GEOMGUI/GeometryGUI_FilletDlg.h deleted file mode 100644 index 775bcc9f6..000000000 --- a/src/GEOMGUI/GeometryGUI_FilletDlg.h +++ /dev/null @@ -1,163 +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 : GeometryGUI_FilletDlg.h -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_FILLET_H -#define DIALOGBOX_FILLET_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -// Qt Includes -#include -#include -#include - -// Open CASCADE Includes -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QToolButton; -class QLabel; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_FilletDlg -// purpose : -//================================================================================= -class GeometryGUI_FilletDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_FilletDlg( QWidget* parent = 0, - const char* name = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - - ~GeometryGUI_FilletDlg(); - -private : - - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void ResetStateOfDialog() ; - - /* Interactive and local context management see also : bool myUseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ - - QDoubleValidator *myVa ; /* Double validator for numeric input */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - void MakePreview(); - - TopoDS_Shape myShape ; - bool myOkShape ; - char* myShapeIOR ; - - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - int myShapeType ; - - bool myOkRadius ; - double myRadius ; - - QButtonGroup* GroupConstructors; - - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QRadioButton* Constructor3; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A1; - GeometryGUI_SpinBox* SpinBox_C1A2 ; - QLabel* TextLabelC1A2; - - QGroupBox* GroupC2; - QPushButton* SelectButtonC2A1; - QLineEdit* LineEditC2A1; - QLabel* TextLabelC2A1; - GeometryGUI_SpinBox* SpinBox_C2A2 ; - QLabel* TextLabelC2A2; - - QGroupBox* GroupC3; - QPushButton* SelectButtonC3A1; - QLineEdit* LineEditC3A1; - QLabel* TextLabelC3A1; - GeometryGUI_SpinBox* SpinBox_C3A2 ; - QLabel* TextLabelC3A2; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void LineEditReturnPressed() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - - QGridLayout* GeometryGUI_FilletDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; - QGridLayout* GroupC3Layout; -}; - -#endif // DIALOGBOX_FILLET_H - diff --git a/src/GEOMGUI/GeometryGUI_FillingDlg.cxx b/src/GEOMGUI/GeometryGUI_FillingDlg.cxx deleted file mode 100644 index 1feb85b1f..000000000 --- a/src/GEOMGUI/GeometryGUI_FillingDlg.cxx +++ /dev/null @@ -1,644 +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 : GeometryGUI_FillingDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_FillingDlg.h" - -#include "GeometryGUI.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_FillingDlg() -// purpose : Constructs a GeometryGUI_FillingDlg 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. -//================================================================================= -GeometryGUI_FillingDlg::GeometryGUI_FillingDlg( 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_FILLING"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_FillingDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_FILLING_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_FillingDlgLayout = new QGridLayout( this ); - GeometryGUI_FillingDlgLayout->setSpacing( 6 ); - GeometryGUI_FillingDlgLayout->setMargin( 11 ); - - - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_FILLING" ) ); - 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( 50, 0 ) ); - - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - - GeometryGUI_FillingDlgLayout->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 ); - - GeometryGUI_FillingDlgLayout->addWidget( GroupButtons, 2, 0 ); - -// GroupC1 = new QGroupBox( this, "GroupC1" ); -// GroupC1->setTitle( tr( "GEOM_FILLING_ARG" ) ); -// GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) ); -// GroupC1->setColumnLayout(0, Qt::Vertical ); -// GroupC1->layout()->setSpacing( 0 ); -// GroupC1->layout()->setMargin( 0 ); -// GroupC1Layout = new QGridLayout( GroupC1->layout() ); -// GroupC1Layout->setAlignment( Qt::AlignTop ); -// GroupC1Layout->setSpacing( 6 ); -// GroupC1Layout->setMargin( 11 ); - -// LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); -// LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - -// GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 3, 5 ); - -// TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); -// TextLabelC1A2->setText( tr( "GEOM_FILLING_MIN_DEG" ) ); -// TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); -// TextLabelC1A2->setFrameShape( QLabel::NoFrame ); -// TextLabelC1A2->setFrameShadow( QLabel::Plain ); - -// GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - -// LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); -// LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); -// LineEditC1A2->setMinimumSize( QSize( 40, 0 ) ); - -// GroupC1Layout->addMultiCellWidget( LineEditC1A2, 1, 1, 1, 2 ); - -// TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); -// TextLabelC1A3->setText( tr( "GEOM_FILLING_MAX_DEG" ) ); -// TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); -// TextLabelC1A3->setFrameShape( QLabel::NoFrame ); -// TextLabelC1A3->setFrameShadow( QLabel::Plain ); - -// GroupC1Layout->addWidget( TextLabelC1A3, 1, 4 ); - -// TextLabelC1A5 = new QLabel( GroupC1, "TextLabelC1A5" ); -// TextLabelC1A5->setText( tr( "GEOM_FILLING_TOL_2D" ) ); -// TextLabelC1A5->setMinimumSize( QSize( 50, 0 ) ); -// TextLabelC1A5->setFrameShape( QLabel::NoFrame ); -// TextLabelC1A5->setFrameShadow( QLabel::Plain ); - -// GroupC1Layout->addWidget( TextLabelC1A5, 2, 4 ); - -// LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" ); -// LineEditC1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A3->sizePolicy().hasHeightForWidth() ) ); -// LineEditC1A3->setMinimumSize( QSize( 40, 0 ) ); - -// GroupC1Layout->addWidget( LineEditC1A3, 1, 5 ); - -// LineEditC1A5 = new QLineEdit( GroupC1, "LineEditC1A5" ); -// LineEditC1A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A5->sizePolicy().hasHeightForWidth() ) ); -// LineEditC1A5->setMinimumSize( QSize( 40, 0 ) ); - -// GroupC1Layout->addWidget( LineEditC1A5, 2, 5 ); - -// TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); -// TextLabelC1A1->setText( tr( "GEOM_FILLING_COMPOUND" ) ); -// TextLabelC1A1->setMinimumSize( QSize( 90, 0 ) ); -// TextLabelC1A1->setFrameShape( QLabel::NoFrame ); -// TextLabelC1A1->setFrameShadow( QLabel::Plain ); - -// GroupC1Layout->addMultiCellWidget( TextLabelC1A1, 0, 0, 0, 1 ); - -// SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); -// SelectButtonC1A1->setText( tr( "" ) ); -// SelectButtonC1A1->setPixmap( image1 ); - -// GroupC1Layout->addWidget( SelectButtonC1A1, 0, 2 ); - -// TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" ); -// TextLabelC1A4->setText( tr( "GEOM_FILLING_TOL_3D" ) ); -// TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); -// TextLabelC1A4->setFrameShape( QLabel::NoFrame ); -// TextLabelC1A4->setFrameShadow( QLabel::Plain ); - -// GroupC1Layout->addWidget( TextLabelC1A4, 2, 0 ); - -// TextLabelC1A6 = new QLabel( GroupC1, "TextLabelC1A6" ); -// TextLabelC1A6->setText( tr( "GEOM_FILLING_NB_ITER" ) ); -// TextLabelC1A6->setMinimumSize( QSize( 50, 0 ) ); -// TextLabelC1A6->setFrameShape( QLabel::NoFrame ); -// TextLabelC1A6->setFrameShadow( QLabel::Plain ); - -// GroupC1Layout->addWidget( TextLabelC1A6, 3, 0 ); - -// LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" ); -// LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) ); -// LineEditC1A4->setMinimumSize( QSize( 40, 0 ) ); - -// GroupC1Layout->addMultiCellWidget( LineEditC1A4, 2, 2, 1, 2 ); - -// LineEditC1A6 = new QLineEdit( GroupC1, "LineEditC1A6" ); -// LineEditC1A6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A6->sizePolicy().hasHeightForWidth() ) ); -// LineEditC1A6->setMinimumSize( QSize( 40, 0 ) ); - -// GroupC1Layout->addMultiCellWidget( LineEditC1A6, 3, 3, 1, 2 ); -// QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); -// GroupC1Layout->addItem( spacer_3, 1, 3 ); -// QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); -// GroupC1Layout->addItem( spacer_4, 2, 3 ); -// QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); -// GroupC1Layout->addMultiCell( spacer_5, 3, 3, 3, 5 ); - -// GeometryGUI_FillingDlgLayout->addWidget( GroupC1, 1, 0 ); - - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setTitle( tr( "GEOM_FILLING_ARG" ) ); - GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - - GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 3, 6 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_FILLING_MIN_DEG" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - - TextLabelC1A5 = new QLabel( GroupC1, "TextLabelC1A5" ); - TextLabelC1A5->setText( tr( "GEOM_FILLING_TOL_2D" ) ); - TextLabelC1A5->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A5->setFrameShape( QLabel::NoFrame ); - TextLabelC1A5->setFrameShadow( QLabel::Plain ); - - GroupC1Layout->addWidget( TextLabelC1A5, 2, 5 ); - - LineEditC1A5 = new QLineEdit( GroupC1, "LineEditC1A5" ); - LineEditC1A5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A5->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A5->setMinimumSize( QSize( 40, 0 ) ); - - GroupC1Layout->addWidget( LineEditC1A5, 2, 6 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_FILLING_COMPOUND" ) ); - TextLabelC1A1->setMinimumSize( QSize( 90, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - - GroupC1Layout->addMultiCellWidget( TextLabelC1A1, 0, 0, 0, 1 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) ); - - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 2 ); - - TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" ); - TextLabelC1A4->setText( tr( "GEOM_FILLING_TOL_3D" ) ); - TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A4->setFrameShape( QLabel::NoFrame ); - TextLabelC1A4->setFrameShadow( QLabel::Plain ); - - GroupC1Layout->addWidget( TextLabelC1A4, 2, 0 ); - - TextLabelC1A6 = new QLabel( GroupC1, "TextLabelC1A6" ); - TextLabelC1A6->setText( tr( "GEOM_FILLING_NB_ITER" ) ); - TextLabelC1A6->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A6->setFrameShape( QLabel::NoFrame ); - TextLabelC1A6->setFrameShadow( QLabel::Plain ); - - GroupC1Layout->addWidget( TextLabelC1A6, 3, 0 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupC1Layout->addItem( spacer_3, 1, 3 ); - QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupC1Layout->addMultiCell( spacer_4, 2, 2, 3, 4 ); - QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupC1Layout->addMultiCell( spacer_5, 3, 3, 3, 6 ); - - SpinBox_C1A2 = new QSpinBox( GroupC1, "SpinBox_C1A2" ); - SpinBox_C1A2->setMinValue( 1 ); - SpinBox_C1A2->setMaxValue( 15 ); - SpinBox_C1A2->setWrapping( TRUE ); - - GroupC1Layout->addMultiCellWidget( SpinBox_C1A2, 1, 1, 1, 2 ); - - LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" ); - LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A4->setMinimumSize( QSize( 40, 0 ) ); - - GroupC1Layout->addMultiCellWidget( LineEditC1A4, 2, 2, 1, 2 ); - - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_FILLING_MAX_DEG" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A3->setFrameShape( QLabel::NoFrame ); - TextLabelC1A3->setFrameShadow( QLabel::Plain ); - - GroupC1Layout->addMultiCellWidget( TextLabelC1A3, 1, 1, 4, 5 ); - - SpinBox_C1A3 = new QSpinBox( GroupC1, "SpinBox_C1A3" ); - SpinBox_C1A3->setMinValue( 1 ); - SpinBox_C1A3->setMaxValue( 15 ); - SpinBox_C1A3->setWrapping( TRUE ); - - GroupC1Layout->addWidget( SpinBox_C1A3, 1, 6 ); - - SpinBox_C1A6 = new QSpinBox( GroupC1, "SpinBox_C1A6" ); - SpinBox_C1A6->setMinValue( 1 ); - SpinBox_C1A6->setMaxValue( 30 ); - SpinBox_C1A6->setWrapping( TRUE ); - - GroupC1Layout->addMultiCellWidget( SpinBox_C1A6, 3, 3, 1, 2 ); - - GeometryGUI_FillingDlgLayout->addWidget( GroupC1, 1, 0 ); - - /* Initialisations */ - Init(Sel) ; -} - - -//================================================================================= -// function : ~GeometryGUI_FillingDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_FillingDlg::~GeometryGUI_FillingDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::Init( SALOME_Selection* Sel ) -{ - - LineEditC1A4->setMaxLength( 10 ); /* myTol3D */ - LineEditC1A5->setMaxLength( 10 ); /* myTol2D */ - QDoubleValidator *Vc = new QDoubleValidator( 0.00001, +10000.0, 3, LineEditC1A4 ) ; - QDoubleValidator *Vd = new QDoubleValidator( 0.00001, +10000.0, 3, LineEditC1A5 ) ; - LineEditC1A4->setValidator( Vc) ; - LineEditC1A5->setValidator( Vd) ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - SpinBox_C1A2->setValue(2) ; /* myMinDeg */ - SpinBox_C1A3->setValue(5) ; /* myMaxDeg */ - LineEditC1A4->setText("0.0001") ; /* myTol3D */ - LineEditC1A5->setText("0.0001") ; /* myTol2D */ - SpinBox_C1A6->setValue(5) ; /* myNbIter */ - - this->myMinDeg = 2 ; - this->myMaxDeg = 5 ; - this->myTol3D = 0.0001 ; - this->myTol2D = 0.0001 ; - this->myNbIter = 5 ; - - myOkSectionShape = false ; - mySectionShape.Nullify() ; - 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); - myCompoundFilter = new GEOM_ShapeTypeFilter( TopAbs_COMPOUND, myGeom ); - /* first filter used */ - mySelection->AddFilter(myCompoundFilter) ; - - /* 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( LineEditC1A1, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - /* Displays Dialog */ - this->show() ; - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_FillingDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - this->myMinDeg = SpinBox_C1A2->value() ; - this->myMaxDeg = SpinBox_C1A3->value() ; - this->myTol3D = LineEditC1A4->text().toDouble(); - this->myTol2D = LineEditC1A5->text().toDouble(); - this->myNbIter = SpinBox_C1A6->value() ; - if(myOkSectionShape) { - myGeomGUI->MakeFillingAndDisplay( myGeomShape, myMinDeg, myMaxDeg, myTol3D, myTol2D, myNbIter) ; - } - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_FillingDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myOkSectionShape = false ; - } - return ; - } - - // nbSel == 1 - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 && S.ShapeType() == TopAbs_COMPOUND ) { - myEditCurrentArgument->setText(aString) ; - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myOkSectionShape = true ; - } - /* no simulation */ - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->AddFilter(myCompoundFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::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 ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_FillingDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_FillingDlg.h b/src/GEOMGUI/GeometryGUI_FillingDlg.h deleted file mode 100644 index b41726884..000000000 --- a/src/GEOMGUI/GeometryGUI_FillingDlg.h +++ /dev/null @@ -1,127 +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 : GeometryGUI_FillingDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_FILLING_H -#define DIALOGBOX_FILLING_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QSpinBox; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_FillingDlg -// purpose : -//================================================================================= -class GeometryGUI_FillingDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_FillingDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_FillingDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - GEOM::GEOM_Shape_var myGeomShape ; /* is mySectionShape */ - TopoDS_Shape mySectionShape ; - Standard_Integer myMinDeg ; - Standard_Integer myMaxDeg ; - Standard_Real myTol3D ; - Standard_Real myTol2D ; - Standard_Integer myNbIter ; - - bool myOkSectionShape ; /* to check when arguments is defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - Handle(GEOM_ShapeTypeFilter) myCompoundFilter ; /* Filter selection */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A2; - QLabel* TextLabelC1A3; - QLabel* TextLabelC1A5; - - QLineEdit* LineEditC1A5; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A4; - QLabel* TextLabelC1A6; - QLineEdit* LineEditC1A4; - - QSpinBox* SpinBox_C1A2; - QSpinBox* SpinBox_C1A3; - QSpinBox* SpinBox_C1A6; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_FillingDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_FILLING_H diff --git a/src/GEOMGUI/GeometryGUI_FuseDlg.cxx b/src/GEOMGUI/GeometryGUI_FuseDlg.cxx deleted file mode 100644 index e42d61c7e..000000000 --- a/src/GEOMGUI/GeometryGUI_FuseDlg.cxx +++ /dev/null @@ -1,477 +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 : GeometryGUI_FuseDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_FuseDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_FuseDlg() -// purpose : Constructs a GeometryGUI_FuseDlg 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. -//================================================================================= -GeometryGUI_FuseDlg::GeometryGUI_FuseDlg( 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_FUSE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_FuseDlg" ); - resize( 322, 220 ); - setCaption( tr( "GEOM_FUSE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - - GeometryGUI_FuseDlgLayout = new QGridLayout( this ); - GeometryGUI_FuseDlgLayout->setSpacing( 6 ); - GeometryGUI_FuseDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_FUSE" ) ); - 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 ); - GeometryGUI_FuseDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - 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 ); - GeometryGUI_FuseDlgLayout->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, 3 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_1, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - GeometryGUI_FuseDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_FuseDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_FuseDlg::~GeometryGUI_FuseDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::Init( SALOME_Selection* Sel ) -{ - mySelection = Sel ; - myShape1.Nullify() ; - myShape2.Nullify() ; - myConstructorId = 0 ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - 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( LineEditC1A1Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2Shape, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SelectButtonC1A1Shape, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC1A2Shape, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_FuseDlg::ConstructorsClicked(int constructorId) -{ - GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupConstructor1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1Shape ; - LineEditC1A2Shape->setText(tr("")) ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - myGeomGUI->MakeBooleanAndDisplay(myGeomShape1 ,myGeomShape2, 3 ) ; - } - break ; - } - } - - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_FuseDlg::SelectionIntoArgument() -{ - - myEditCurrentArgument->setText("") ; /* by default */ - QString aString = ""; /* the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myOkShape1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myOkShape2 = false ; - } - break ; - } - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape1 = S ; - LineEditC1A1Shape->setText(aString) ; - myOkShape1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape2 = S ; - LineEditC1A2Shape->setText(aString) ; - myOkShape2 = true ; - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::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 ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Shape ) - myEditCurrentArgument = LineEditC1A1Shape ; - else if ( send == LineEditC1A2Shape ) - myEditCurrentArgument = LineEditC1A2Shape ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_FuseDlg::enterEvent( QEvent * ) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_FuseDlg::ActivateThisDialog() -{ - /* 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() ) ); - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_FuseDlg.h b/src/GEOMGUI/GeometryGUI_FuseDlg.h deleted file mode 100644 index 67a2911b1..000000000 --- a/src/GEOMGUI/GeometryGUI_FuseDlg.h +++ /dev/null @@ -1,119 +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 : GeometryGUI_FuseDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_FUSE_H -#define DIALOGBOX_FUSE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_FuseDlg -// purpose : -//================================================================================= -class GeometryGUI_FuseDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_FuseDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_FuseDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape myShape1 ; /* topology used to fuse */ - TopoDS_Shape myShape2 ; /* topology used to fuse */ - GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */ - GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */ - bool myOkShape1 ; - bool myOkShape2 ; /* to check when arguments are defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1Shape; - QLineEdit* LineEditC1A2Shape; - QPushButton* SelectButtonC1A1Shape; - QPushButton* SelectButtonC1A2Shape; - QLabel* TextLabelC1A2Shape; - QLabel* TextLabelC1A1Shape; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_FuseDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructor1Layout; -}; - -#endif // DIALOGBOX_FUSE_H diff --git a/src/GEOMGUI/GeometryGUI_InertiaDlg.cxx b/src/GEOMGUI/GeometryGUI_InertiaDlg.cxx deleted file mode 100644 index 99a6c46c6..000000000 --- a/src/GEOMGUI/GeometryGUI_InertiaDlg.cxx +++ /dev/null @@ -1,566 +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 : GeometryGUI_InertiaDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM - -using namespace std; -#include "GeometryGUI_InertiaDlg.h" - -#include "GeometryGUI.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_InertiaDlg() -// purpose : Constructs a GeometryGUI_InertiaDlg 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. -//================================================================================= -GeometryGUI_InertiaDlg::GeometryGUI_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 ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_INERTIA"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_InertiaDlg" ); - resize( 356, 303 ); - setCaption( tr( "GEOM_INERTIA_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_InertiaDlgLayout = new QGridLayout( this ); - GeometryGUI_InertiaDlgLayout->setSpacing( 6 ); - GeometryGUI_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 ); - GeometryGUI_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 ); - GeometryGUI_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 ); - - GeometryGUI_InertiaDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_InertiaDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_InertiaDlg::~GeometryGUI_InertiaDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::Init( SALOME_Selection* Sel ) -{ - - 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; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_InertiaDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_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 = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) || S.IsNull() ) - return ; - - LineEditC1A1->setText(aString) ; - this->CalculateAndDisplayInertia(S) ; - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::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 GeometryGUI_InertiaDlg::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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_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 ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_InertiaDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : CalculateAndDisplayInertia() -// purpose : -//================================================================================= -void GeometryGUI_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 ; - - try { - - QString resString; - GProp_GProps System; - - 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 ) { - BRepGProp::SurfaceProperties(S, System); - } - else { - BRepGProp::VolumeProperties(S, System); - } - - gp_Mat I = System.MatrixOfInertia() ; - GProp_PrincipalProps Pr = System.PrincipalProperties(); - Standard_Real Ix,Iy,Iz; - 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) ; - - /* 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) ; - - } - catch(Standard_Failure) { - MESSAGE("Catch intercepted in CalculateAndDisplayInertia()" << endl ) ; - } - return ; -} - - diff --git a/src/GEOMGUI/GeometryGUI_InertiaDlg.h b/src/GEOMGUI/GeometryGUI_InertiaDlg.h deleted file mode 100644 index c64f81700..000000000 --- a/src/GEOMGUI/GeometryGUI_InertiaDlg.h +++ /dev/null @@ -1,124 +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 : GeometryGUI_InertiaDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_INERTIA_H -#define DIALOGBOX_INERTIA_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_InertiaDlg -// purpose : -//================================================================================= -class GeometryGUI_InertiaDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_InertiaDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_InertiaDlg(); - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void CalculateAndDisplayInertia(const TopoDS_Shape& S) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* 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; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_InertiaDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_INERTIA_H diff --git a/src/GEOMGUI/GeometryGUI_LineDlg.cxx b/src/GEOMGUI/GeometryGUI_LineDlg.cxx deleted file mode 100644 index c943a303d..000000000 --- a/src/GEOMGUI/GeometryGUI_LineDlg.cxx +++ /dev/null @@ -1,518 +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 : GeometryGUI_LineDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_LineDlg.h" - -#include "GeometryGUI.h" - -#include - -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_LineDlg() -// purpose : Constructs a GeometryGUI_LineDlg 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. -//================================================================================= -GeometryGUI_LineDlg::GeometryGUI_LineDlg( 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_LINE_2P"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_LINE_PV"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_LINE_EDGE"))); - - if ( !name ) - setName( "GeometryGUI_LineDlg" ); - resize( 303, 225 ); - setCaption( tr( "GEOM_LINE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_LineDlgLayout = new QGridLayout( this ); - GeometryGUI_LineDlgLayout->setSpacing( 6 ); - GeometryGUI_LineDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_LINE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 5 ); - GeometryGUI_LineDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_POINTS" ) ); - 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 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_POINT_I" ).arg("1") ); - 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_POINT_I" ).arg("2") ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - GeometryGUI_LineDlgLayout->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, 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 ); - GeometryGUI_LineDlgLayout->addWidget( GroupButtons, 2, 0 ); - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_LineDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_LineDlg::~GeometryGUI_LineDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - // GroupC2->hide(); - // GroupC3->hide(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myPoint2.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkPoint2 = false ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom ); - mySelection->AddFilter(myVertexFilter) ; /* first filter used */ - - /* 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( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_LineDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupC1->show(); - // - // - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1 ; - Constructor1->setChecked( TRUE ); - LineEditC1A1->setText(tr("")) ; - LineEditC1A2->setText(tr("")) ; - myOkPoint1 = myOkPoint2 = false ; - /* filter for next selections */ - mySelection->ClearFilters() ; - mySelection->AddFilter( myVertexFilter ); - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - break; - } - case 1: - { - break; - } - case 2: - { - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPoint1 && myOkPoint2) - myGeomGUI->MakeLineAndDisplay( myPoint1, myPoint2 ) ; - break ; - } - case 1 : - { - break ; - } - case 2 : - { - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender() ; - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_LineDlg::SelectionIntoArgument() -{ - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myEditCurrentArgument->setText("") ; - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myEditCurrentArgument->setText("") ; - myOkPoint2 = false ; - } - return ; - } - - // nbSel == 1 ! - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* Constructor 1 treatment */ - if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A2 && myGeomGUI->VertexToPoint(S, myPoint2) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint2 = true ; - } - - if( myOkPoint1 && myOkPoint2 && myPoint1.Distance(myPoint2) > Precision::Confusion() ) { - mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape(); - /* Try to add an arrow at simulation shape */ - bool notNeedToTest = this->AddArrowToSimulation(mySimulationTopoDs) ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - } - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_LineDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - -//================================================================================= -// function : AddArrowToSimulation() -// purpose : An arrow (cone topology) is added to 'modifiedShape' -// : to simulate a vector or an 'oriented line' display. The result is in 'modifiedShape'. -// : If an arrow can't be added returns false and 'modifiedShape' isn't modified ! -//================================================================================= -bool GeometryGUI_LineDlg::AddArrowToSimulation( TopoDS_Shape& modifiedShape ) -{ - TopoDS_Shape arrow ; - /* Try to add a cone simulation shape to show direction of a linear edge */ - if( myGeomGUI->CreateArrowForLinearEdge( modifiedShape, arrow ) ) { - TopoDS_Compound Comp ; - BRep_Builder B; - B.MakeCompound (Comp); - B.Add( Comp, modifiedShape ) ; - B.Add( Comp, arrow ) ; - modifiedShape = Comp ; - return true ; - } - return false ; -} - diff --git a/src/GEOMGUI/GeometryGUI_LineDlg.h b/src/GEOMGUI/GeometryGUI_LineDlg.h deleted file mode 100644 index 830ccdc28..000000000 --- a/src/GEOMGUI/GeometryGUI_LineDlg.h +++ /dev/null @@ -1,125 +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 : GeometryGUI_LineDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_LINE_H -#define DIALOGBOX_LINE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_LineDlg -// purpose : -//================================================================================= -class GeometryGUI_LineDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_LineDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_LineDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - SALOME_Selection* mySelection ; /* User shape selection */ - gp_Pnt myPoint1 ; /* Points containing the vector */ - gp_Pnt myPoint2 ; - - bool myOkPoint1 ; /* Are true when myPoint is defined */ - bool myOkPoint2 ; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */ - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - - bool AddArrowToSimulation( TopoDS_Shape& modifiedShape ) ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QRadioButton* Constructor3; - - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A2; - QLineEdit* LineEditC1A2; - QPushButton* SelectButtonC1A1; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_LineDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_LINE_H diff --git a/src/GEOMGUI/GeometryGUI_MaxToleranceDlg.cxx b/src/GEOMGUI/GeometryGUI_MaxToleranceDlg.cxx deleted file mode 100644 index 5b60d9df3..000000000 --- a/src/GEOMGUI/GeometryGUI_MaxToleranceDlg.cxx +++ /dev/null @@ -1,547 +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 : GeometryGUI_MaxToleranceDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_MaxToleranceDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -// Open CASCADE Includes -#include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_MaxToleranceDlg() -// purpose : Constructs a GeometryGUI_MaxToleranceDlg 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. -//================================================================================= -GeometryGUI_MaxToleranceDlg::GeometryGUI_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 ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_TOLERANCE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_MaxToleranceDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_TOLERANCE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_MaxToleranceDlgLayout = new QGridLayout( this ); - GeometryGUI_MaxToleranceDlgLayout->setSpacing( 6 ); - GeometryGUI_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 ); - GeometryGUI_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 ); - - GeometryGUI_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 ); - GeometryGUI_MaxToleranceDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_MaxToleranceDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_MaxToleranceDlg::~GeometryGUI_MaxToleranceDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::Init( SALOME_Selection* Sel ) -{ - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_MaxToleranceDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_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 = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() ) { - myEditCurrentArgument->setText( "" ); - return ; - } - - LineEditC1A1->setText(aString) ; - this->CalculateMaxTolerance(S) ; - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::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 GeometryGUI_MaxToleranceDlg::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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_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 ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_MaxToleranceDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : CalculateMaxTolerance() -// purpose : -//================================================================================= -void GeometryGUI_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( "" ) ; - } - } - catch(Standard_Failure) - { - MESSAGE("Catch intercepted in CalculateMaxTolerance()" << endl ) ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_MaxToleranceDlg.h b/src/GEOMGUI/GeometryGUI_MaxToleranceDlg.h deleted file mode 100644 index 7da3e4111..000000000 --- a/src/GEOMGUI/GeometryGUI_MaxToleranceDlg.h +++ /dev/null @@ -1,119 +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 : GeometryGUI_MaxToleranceDlg.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_MAXTOLERANCE_H -#define DIALOGBOX_MAXTOLERANCE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : DialogBox_PROPERTIES -// purpose : -//================================================================================= -class GeometryGUI_MaxToleranceDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_MaxToleranceDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_MaxToleranceDlg(); - -private: - - 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 */ - GeometryGUI* 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; - - 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; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_MaxToleranceDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_MAXTOLERANCE_H diff --git a/src/GEOMGUI/GeometryGUI_MirrorDlg.cxx b/src/GEOMGUI/GeometryGUI_MirrorDlg.cxx deleted file mode 100644 index ccfc924c3..000000000 --- a/src/GEOMGUI/GeometryGUI_MirrorDlg.cxx +++ /dev/null @@ -1,525 +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 : GeometryGUI_MirrorDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_MirrorDlg.h" - -#include "GeometryGUI.h" - -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - - -//================================================================================= -// class : GeometryGUI_MirrorDlg() -// purpose : Constructs a GeometryGUI_MirrorDlg 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. -//================================================================================= -GeometryGUI_MirrorDlg::GeometryGUI_MirrorDlg( 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_MIRROR"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_MirrorDlg" ); - resize( 303, 225 ); - setCaption( tr( "GEOM_MIRROR_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_MirrorDlgLayout = new QGridLayout( this ); - GeometryGUI_MirrorDlgLayout->setSpacing( 6 ); - GeometryGUI_MirrorDlgLayout->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_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 ); - - GeometryGUI_MirrorDlgLayout->addWidget( GroupButtons, 2, 0 ); - - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_MIRROR" ) ); - 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_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 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() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - GeometryGUI_MirrorDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - 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 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_PLANE_MIRROR" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - GeometryGUI_MirrorDlgLayout->addWidget( GroupC1, 1, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_MirrorDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_MirrorDlg::~GeometryGUI_MirrorDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::Init( SALOME_Selection* Sel ) -{ - mySelection = Sel ; - myShape1.Nullify() ; - myShape2.Nullify() ; - mySimulationTopoDs.Nullify() ; - myConstructorId = 0 ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - GroupC1->show(); - - myEditCurrentArgument = LineEditC1A1 ; - 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); - /* Filter definition */ - - myFaceFilter = new GEOM_FaceFilter( StdSelect_Plane, myGeom ); - - // 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( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_MirrorDlg::ConstructorsClicked(int constructorId) -{ - GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupC1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1 ; - LineEditC1A2->setText(tr("")) ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::ClickOnApply() -{ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - myGeomGUI->MakeMirrorAndDisplay(myGeomShape1 ,myGeomShape2 ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_MirrorDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myOkShape1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myOkShape2 = false ; - } - break ; - } - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape1 = S ; - LineEditC1A1->setText(aString) ; - myOkShape1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape2 = S ; - LineEditC1A2->setText(aString) ; - myOkShape2 = true ; - } - - if(myOkShape1 && myOkShape2) { - MakeMirrorSimulationAndDisplay( myShape1, myShape2 ) ; - } - - return ; -} - - - -//================================================================================= -// function : MakeMirrorSimulationAndDisplay() -// purpose : S1 is a shape and S2 a mirror. -//================================================================================= -void GeometryGUI_MirrorDlg::MakeMirrorSimulationAndDisplay( const TopoDS_Shape& S1, const TopoDS_Shape& S2 ) -{ - this->mySimulationTopoDs.Nullify() ; - - try { - Handle(Geom_Surface) surf = BRep_Tool::Surface(TopoDS::Face(S2)) ; - Handle(Geom_Plane) myPlane = Handle(Geom_Plane)::DownCast(surf) ; - const gp_Ax3 pos = myPlane->Position() ; - const gp_Pnt loc = pos.Location() ; /* location of the plane */ - const gp_Dir dir = pos.Direction() ; /* Main direction of the plane (Z axis) */ - - /* plane used for mirroring */ - gp_Ax2 pln(loc, dir) ; - gp_Trsf theTransformation ; - theTransformation.SetMirror(pln) ; - BRepBuilderAPI_Transform myBRepTransformation( S1, theTransformation, Standard_False ) ; - - this->mySimulationTopoDs = myBRepTransformation.Shape() ; - if( this->mySimulationTopoDs.IsNull() ) - return ; - else - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeMirrorSimulationAndDisplay" ) ; - return ; - } - return ; -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - - switch (myConstructorId) - { - case 0: - { - if( send == SelectButtonC1A1 ) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1 ; - mySelection->ClearFilters() ; - SelectionIntoArgument() ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myFaceFilter) ; - SelectionIntoArgument() ; - } - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_MirrorDlg::enterEvent( QEvent * ) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_MirrorDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate any active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_MirrorDlg.h b/src/GEOMGUI/GeometryGUI_MirrorDlg.h deleted file mode 100644 index adc4d7d33..000000000 --- a/src/GEOMGUI/GeometryGUI_MirrorDlg.h +++ /dev/null @@ -1,118 +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 : GeometryGUI_MirrorDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_MIRROR_H -#define DIALOGBOX_MIRROR_H - -#include "SALOME_Selection.h" -#include "GEOM_FaceFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_MirrorDlg -// purpose : -//================================================================================= -class GeometryGUI_MirrorDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_MirrorDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_MirrorDlg(); - -private : - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); /* Mouse enter the QWidget */ - void Init( SALOME_Selection* Sel ) ; - void MakeMirrorSimulationAndDisplay( const TopoDS_Shape& S1, const TopoDS_Shape& S2 ) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape myShape1 ; /* topology used */ - TopoDS_Shape myShape2 ; /* topology used */ - GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */ - GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - bool myOkShape1 ; - bool myOkShape2 ; /* to check when arguments are defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - Handle(GEOM_FaceFilter) myFaceFilter; /* To filter selections */ - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QPushButton* SelectButtonC1A1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - -private slots : - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_MirrorDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_MIRROR_H diff --git a/src/GEOMGUI/GeometryGUI_MultiRotationDlg.cxx b/src/GEOMGUI/GeometryGUI_MultiRotationDlg.cxx deleted file mode 100644 index 537f06022..000000000 --- a/src/GEOMGUI/GeometryGUI_MultiRotationDlg.cxx +++ /dev/null @@ -1,986 +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 : GeometryGUI_MultiTranslationDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_MultiRotationDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_MultiRotationDlg() -// purpose : Constructs a GeometryGUI_MultiRotationDlg 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. -//================================================================================= -GeometryGUI_MultiRotationDlg::GeometryGUI_MultiRotationDlg( 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_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( "GeometryGUI_MultiTranlationDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_MULTIROTATION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_MultiRotationDlgLayout = new QGridLayout( this ); - GeometryGUI_MultiRotationDlgLayout->setSpacing( 6 ); - GeometryGUI_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 ); - - GeometryGUI_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 ); - GeometryGUI_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 ); - - GeometryGUI_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 GeometryGUI_SpinBox */ - SpinBox_C2A3 = new GeometryGUI_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 GeometryGUI_SpinBox */ - SpinBox_C2A5 = new GeometryGUI_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 ); - - GeometryGUI_MultiRotationDlgLayout->addWidget( GroupC2, 1, 0 ); - - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - -//================================================================================= -// function : ~GeometryGUI_MultiRotationDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_MultiRotationDlg::~GeometryGUI_MultiRotationDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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 ; - myNbTimes1 = 2; - myNbTimes2 = 2; - - GroupC1->show(); - GroupC2->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - myOkBase = myOkDir = 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 ); - - /* 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() ) ) ; - - /* GeometryGUI_SpinBox */ - connect( SpinBox_C2A3, SIGNAL ( valueChanged( double) ), this, SLOT( valueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A5, SIGNAL ( valueChanged( double) ), this, SLOT( valueChangedInSpinBox( double) ) ) ; - - /* 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - -//================================================================================= -// function : ReverseAngle() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_MultiRotationDlg::ReverseAngle(int state) -{ - myAng = -myAng ; - SpinBox_C2A3->SetValue( myAng ) ; - if( myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) -{ - myEditCurrentArgument->setText(tr("")) ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myAng = 45.0 ; - myStep = 50.0 ; - myNbTimes1 = 2; - myNbTimes2 = 2; - - myOkBase = myOkDir = false ; - myConstructorId = constructorId ; - - switch (constructorId) - { - case 0: /* Rotate simple */ - { - GroupC1->show(); - GroupC2->hide() ; - myEditCurrentArgument = LineEditC1A1 ; - SpinBox_C1A3->setValue( 2 ) ; - LineEditC1A1->setText(tr("")) ; - LineEditC1A2->setText(tr("")) ; - 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 ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkBase && myOkDir) { - myGeomGUI->MakeMultiRotation1DAndDisplay( myGeomShape, myDir, myLoc, myNbTimes1 ) ; - } - break ; - } - case 1 : - { - if(myOkBase && myOkDir) { - myGeomGUI->MakeMultiRotation2DAndDisplay( myGeomShape, myDir, myLoc, myAng, myNbTimes1, myStep, myNbTimes2 ) ; - } - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::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 - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_MultiRotationDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Name of future selection */ - QString aString = ""; - int nbSel = myGeomGUI->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( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->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 { - myGeomGUI->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 ; - } - - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC2A1 ) { - myGeomShape = myGeomGUI->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 { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_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 ; -} - -//================================================================================= -// function : ValueChangedInt() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::ValueChangedInt( int newIntValue ) -{ - QSpinBox* send = (QSpinBox*)sender(); - - if( send == SpinBox_C1A3 ) { - myNbTimes1 = newIntValue ; - } - else if(send == SpinBox_C2A4 ) { - myNbTimes1 = newIntValue ; - } - else if(send == SpinBox_C2A6 ) { - myNbTimes2 = newIntValue ; - } - - switch (myConstructorId) - { - case 0 : - { - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : (specifig for GeometryGUI_SpinBox) -//================================================================================= -void GeometryGUI_MultiRotationDlg::ValueChangedInSpinBox( double newValue ) -{ - GeometryGUI_SpinBox* send = (GeometryGUI_SpinBox*)sender(); - - if( send == SpinBox_C2A3 ) { - myAng = newValue ; - } - else if( send == SpinBox_C2A5 ) { - myStep = newValue ; - } - - switch (myConstructorId) - { - case 0 : - { - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if (myOkBase && myOkDir ) { - MakeMultiRotationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::ActivateThisDialog() -{ - /* 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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ - return ; -} - - -//================================================================================= -// function : MakeMultiRotationSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay() -{ - myGeomGUI->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 ; - TopoDS_Compound compound; - BRep_Builder B; - - B.MakeCompound( compound ); - - if ( myBase.ShapeType() == TopAbs_VERTEX) { - myGeomGUI->VertexToPoint( myBase, myPoint ); - } - else if ( myBase.ShapeType() == TopAbs_EDGE || myBase.ShapeType() == TopAbs_WIRE ) { - BRepGProp::LinearProperties(myBase, System); - myPoint = System.CentreOfMass() ; - } - else if ( myBase.ShapeType() == TopAbs_FACE || myBase.ShapeType() == TopAbs_SHELL ) { - BRepGProp::SurfaceProperties(myBase, System); - myPoint = System.CentreOfMass() ; - } - else { - BRepGProp::VolumeProperties(myBase, System); - myPoint = System.CentreOfMass() ; - } - - TopoDS_Shape S = BRepBuilderAPI_MakeVertex(myPoint).Shape(); - - try { - switch (myConstructorId) - { - case 0 : - { - 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() ); - } - mySimulationTopoDs = compound; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - break; - } - case 1 : - { - 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() ) ) - return; - 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() ); - } - } - mySimulationTopoDs = compound ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - break; - } - } - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeMultitranslationSimulationAndDisplay" ) ; - return ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_MultiRotationDlg.h b/src/GEOMGUI/GeometryGUI_MultiRotationDlg.h deleted file mode 100644 index 13f6804ad..000000000 --- a/src/GEOMGUI/GeometryGUI_MultiRotationDlg.h +++ /dev/null @@ -1,162 +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 : GeometryGUI_MultiRotationDlg.h -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_MULTIROTATION_H -#define DIALOGBOX_MULTIROTATION_H - - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#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 GeometryGUI; - -//================================================================================= -// class : GeometryGUI_MultiRotationDlg -// purpose : -//================================================================================= -class GeometryGUI_MultiRotationDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_MultiRotationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_MultiRotationDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* 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() ; - - 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; - GeometryGUI_SpinBox* SpinBox_C2A3 ; /* double : angle */ - QSpinBox* SpinBox_C2A4; /* int : Nb times 1 */ - GeometryGUI_SpinBox* SpinBox_C2A5 ; /* double : step value */ - QSpinBox* SpinBox_C2A6; /* int : Nb times 2 */ - - QCheckBox* CheckBoxReverse; - -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 GeometryGUI_SpinBox */ - void ValueChangedInt( int newIntValue ) ; /* for QT spin box ! not const ! */ - -protected: - QGridLayout* GeometryGUI_MultiRotationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; -}; - -#endif // DIALOGBOX_MULTIROTATION_H diff --git a/src/GEOMGUI/GeometryGUI_MultiTranslationDlg.cxx b/src/GEOMGUI/GeometryGUI_MultiTranslationDlg.cxx deleted file mode 100644 index 31d544d8a..000000000 --- a/src/GEOMGUI/GeometryGUI_MultiTranslationDlg.cxx +++ /dev/null @@ -1,1063 +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 : GeometryGUI_MultiTranslationDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_MultiTranslationDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_MultiTranslationDlg() -// purpose : Constructs a GeometryGUI_MultiTranslationDlg 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. -//================================================================================= -GeometryGUI_MultiTranslationDlg::GeometryGUI_MultiTranslationDlg( 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_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( "GeometryGUI_MultiTranlationDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_MULTITRANSLATION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_MultiTranslationDlgLayout = new QGridLayout( this ); - GeometryGUI_MultiTranslationDlgLayout->setSpacing( 6 ); - GeometryGUI_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 ); - - GeometryGUI_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 ); - GeometryGUI_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 GeometryGUI_SpinBox */ - SpinBox_C1A3 = new GeometryGUI_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 ); - - GeometryGUI_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 GeometryGUI_SpinBox */ - SpinBox_C2A4 = new GeometryGUI_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 GeometryGUI_SpinBox */ - SpinBox_C2A6 = new GeometryGUI_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 ); - - GeometryGUI_MultiTranslationDlgLayout->addWidget( GroupC2, 1, 0 ); - - /***************************************************************/ - - - Init(Sel) ; /* Initialisations */ -} - -//================================================================================= -// function : ~GeometryGUI_MultiTranslationDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_MultiTranslationDlg::~GeometryGUI_MultiTranslationDlg() -{ - // no need to delete child widgets, Qt does it all for us - this->destroy(TRUE, TRUE) ; -} - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - 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 ); - - /* 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() ) ) ; - - /* GeometryGUI_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( 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - -//================================================================================= -// function : ReverseAngle1() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ReverseAngle1(int state) -{ - myStep1 = -myStep1 ; - SpinBox_C1A3->SetValue( myStep1 ) ; - SpinBox_C2A4->SetValue( myStep1 ) ; - if( myOkBase && myOkDir1 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : ReverseAngle2() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ReverseAngle2(int state) -{ - myStep2 = -myStep2 ; - SpinBox_C2A6->SetValue( myStep2 ) ; - if( myOkBase && myOkDir1 && myOkDir2 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId) -{ - myEditCurrentArgument->setText(tr("")) ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myStep1 = 50.0 ; - myStep2 = 50.0 ; - myNbTimes1 = 2; - myNbTimes2 = 2; - - myOkBase = myOkDir1 = myOkDir2 = false ; - myConstructorId = constructorId ; - - 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("")) ; - 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 ; - } - - } - - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkBase && myOkDir1 ) { - myGeomGUI->MakeMultiTranslation1DAndDisplay( myGeomShape, myDir1, myStep1, myNbTimes1 ) ; - } - break ; - } - case 1 : - { - if(myOkBase && myOkDir1 && myOkDir2 ) { - myGeomGUI->MakeMultiTranslation2DAndDisplay( myGeomShape, myDir1, myStep1, myNbTimes1, myDir2, myStep2, myNbTimes2 ) ; - } - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_MultiTranslationDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future name of selection */ - QString aString = ""; - int nbSel = myGeomGUI->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("") ; - myOkDir1 = false ; - } - return ; - } - - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir1 = curv.Line().Direction(); - myEditCurrentArgument->setText(aString) ; - myOkDir1 = true ; - } - - if (myOkBase && myOkDir1 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - 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( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC2A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - else if ( myEditCurrentArgument == LineEditC2A2 ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir1 = curv.Line().Direction(); - myEditCurrentArgument->setText(aString) ; - myOkDir1 = true ; - } - else if ( myEditCurrentArgument == LineEditC2A3 ) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir2 = curv.Line().Direction(); - myEditCurrentArgument->setText(aString) ; - myOkDir2 = true ; - } - - if (myOkBase && myOkDir1 && myOkDir2 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_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 ; -} - - -//================================================================================= -// function : ValueChangedInt() -// purpose : (General QT SpinBox) -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ValueChangedInt( int newIntValue ) -{ - 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 ; - } - - switch (myConstructorId) - { - case 0 : - { - if (myOkBase && myOkDir1 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if (myOkBase && myOkDir1 && myOkDir2 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : (specifig for GeometryGUI_SpinBox) -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ValueChangedInSpinBox( double newValue ) -{ - GeometryGUI_SpinBox* send = (GeometryGUI_SpinBox*)sender(); - - /* First constructor */ - if( send == SpinBox_C1A3 ) { - myStep1 = newValue ; - } - /* Second constructor */ - else if( send == SpinBox_C2A4 ) { - myStep1 = newValue ; - } - else if( send == SpinBox_C2A6 ) { - myStep2 = newValue ; - } - - switch (myConstructorId) - { - case 0 : - { - if (myOkBase && myOkDir1 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - case 1 : - { - if (myOkBase && myOkDir1 && myOkDir2 ) { - MakeMultiTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::ActivateThisDialog() -{ - /* 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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ - return ; -} - - -//================================================================================= -// function : MakeMultiTranslationSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_MultiTranslationDlg::MakeMultiTranslationSimulationAndDisplay() -{ - myGeomGUI->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 ; - TopoDS_Compound compound; - BRep_Builder B; - - B.MakeCompound( compound ); - TopoDS_Shape S ; - - try { - - BRepGProp::LinearProperties(myBase, System); - myPoint = System.CentreOfMass() ; - S = BRepBuilderAPI_MakeVertex(myPoint).Shape(); - - switch (myConstructorId) - { - case 0 : - { - 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 ) ; - - theTransformation.SetTranslation(myVec) ; - BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False) ; - B.Add( compound, myBRepTransformation.Shape() ); - } - mySimulationTopoDs = compound; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - break; - } - case 1 : - { - gp_Vec Vec1(myDir1) ; - Vec1.Normalize(); - 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 ) ; - - theTransformation.SetTranslation(myVec) ; - BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False) ; - B.Add( compound, myBRepTransformation.Shape() ); - } - } - mySimulationTopoDs = compound ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - break; - } - } - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeMultitranslationSimulationAndDisplay" ) ; - return ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_MultiTranslationDlg.h b/src/GEOMGUI/GeometryGUI_MultiTranslationDlg.h deleted file mode 100644 index d0b366dc9..000000000 --- a/src/GEOMGUI/GeometryGUI_MultiTranslationDlg.h +++ /dev/null @@ -1,169 +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 : GeometryGUI_MultiTranslationDlg.h -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_MULTITRANSLATION_H -#define DIALOGBOX_MULTITRANSLATION_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#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 GeometryGUI; - -//================================================================================= -// class : GeometryGUI_MultiTranslationDlg -// purpose : -//================================================================================= -class GeometryGUI_MultiTranslationDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_MultiTranslationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_MultiTranslationDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* 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() ; - - 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; - GeometryGUI_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; - GeometryGUI_SpinBox* SpinBox_C2A4 ; - QSpinBox* SpinBox_C2A5; - GeometryGUI_SpinBox* SpinBox_C2A6 ; - QSpinBox* SpinBox_C2A7 ; - - QCheckBox* CheckBoxReverse0; - QCheckBox* CheckBoxReverse1; - QCheckBox* CheckBoxReverse2; - -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 GeometryGUI_SpinBox */ - void ValueChangedInt( int newIntValue ) ; /* for QT spin box ! not const ! */ - -protected: - QGridLayout* GeometryGUI_MultiTranslationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; -}; - -#endif // DIALOGBOX_MULTITRANSLATION_H diff --git a/src/GEOMGUI/GeometryGUI_OrientationDlg.cxx b/src/GEOMGUI/GeometryGUI_OrientationDlg.cxx deleted file mode 100644 index 1970e6e97..000000000 --- a/src/GEOMGUI/GeometryGUI_OrientationDlg.cxx +++ /dev/null @@ -1,608 +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 : GeometryGUI_OrientationDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_OrientationDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_OrientationDlg() -// purpose : Constructs a GeometryGUI_OrientationDlg 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. -//================================================================================= -GeometryGUI_OrientationDlg::GeometryGUI_OrientationDlg( 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_ORIENTATION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - if ( !name ) - setName( "GeometryGUI_OrientationDlg" ); - resize( 303, 242 ); - setCaption( tr( "GEOM_ORIENTATION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_OrientationDlgLayout = new QGridLayout( this ); - GeometryGUI_OrientationDlgLayout->setSpacing( 6 ); - GeometryGUI_OrientationDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_ORIENTATION" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_OrientationDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - GeometryGUI_OrientationDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - /* Spin box construction */ - SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A2" ) ; - GroupC1Layout->addWidget( SpinBox_C1A2, 1, 2 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_VECTOR_LENGTH" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - CheckBoxReverse = new QCheckBox( GroupC1, "CheckBoxReverse" ); - CheckBoxReverse->setText( tr( "GEOM_ORIENTATION_OPT" ) ); - GroupC1Layout->addMultiCellWidget( CheckBoxReverse, 2, 2, 0, 2 ); - GeometryGUI_OrientationDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ - -} - -//================================================================================= -// function : ~GeometryGUI_OrientationDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_OrientationDlg::~GeometryGUI_OrientationDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::Init( SALOME_Selection* Sel ) -{ - - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C1A2->SetValue( 25.0 ) ; /* = myLength */ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - CheckBoxReverse->setChecked( FALSE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - myLength = 25.0 ; - myOkShape = false ; - myOkLength = true; - mySimulationTopoDs.Nullify() ; - myShape.Nullify() ; - 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( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( CheckBoxReverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseOrientation(int) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_OrientationDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::ClickOnApply() -{ - /* Leave simulation display in this method ! */ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if(myOkShape && CheckBoxReverse->isChecked() && myOkLength == true ) { - myGeomGUI->MakeOrientationChangeAndDisplay( myGeomShape ) ; - CheckBoxReverse->setChecked( FALSE ); - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else - return ; - - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - const QString objectUserName = myEditCurrentArgument->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_OrientationDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - this->mySimulationTopoDs.Nullify() ; - - /* Name of future selection */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - this->myOkShape = false ; - } - return ; - } - - /* nbSel == 1 ! */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* Constructor */ - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - LineEditC1A1->setText(aString) ; - myShape = S ; - myOkShape = true ; - } - - if( myOkShape && myOkLength ) { - MakeOrientationSimulationAndDisplay( this->myShape, this->myLength ) ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1 ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::ValueChangedInSpinBox( double newValue ) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QObject* send = (QObject*)sender() ; - if( send == SpinBox_C1A2 ) { - this->myLength = newValue ; - myOkLength = true ; - } - - if ( myConstructorId == 0 && myOkShape && myOkLength == true ) { - MakeOrientationSimulationAndDisplay( this->myShape, this->myLength ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - GroupC1->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - GroupC1->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_OrientationDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - - -//=========================================================================================== -// function : ReverseOrientation() -// purpose : -//=========================================================================================== -void GeometryGUI_OrientationDlg::ReverseOrientation(int state) -{ - if( this->myOkShape && myOkLength == true ) { - MakeOrientationSimulationAndDisplay( this->myShape, this-> myLength ) ; - } - return ; -} - - -//=========================================================================================== -// function : MakeOrientationSimulationAndDisplay() -// purpose : Create 'aCompound1' and 'aCompound2' each contains edges oriented -// : respectively FORWARD and REVERSE for all faces of 'aTopoDS' -// : These edges represent normal vectors on faces of 'aTopoDS' -// : For a unique edge an arrow is displayed to show its orientation. -//=========================================================================================== -void GeometryGUI_OrientationDlg::MakeOrientationSimulationAndDisplay(const TopoDS_Shape& aTopoDS, Standard_Real length ) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - TopoDS_Compound aCompound1, aCompound2 ; - TopoDS_Compound NullComp ; - BRep_Builder aBuilder1, aBuilder2; - aCompound1 = aCompound2 = NullComp ; - aBuilder1.MakeCompound(aCompound1) ; - aBuilder2.MakeCompound(aCompound2) ; - - if( aTopoDS.IsNull() ) - return ; - - /* Case of an edge */ - if( aTopoDS.ShapeType() == TopAbs_EDGE ) { - /* Try to display a cone simulation shape to show direction of edge */ - TopoDS_Shape tmpShape = aTopoDS ; - if( this->CheckBoxReverse->isChecked() ) { - if( aTopoDS.Orientation() == TopAbs_FORWARD) - tmpShape.Orientation(TopAbs_REVERSED) ; - else - tmpShape.Orientation(TopAbs_FORWARD) ; - } - if( myGeomGUI->CreateArrowForLinearEdge( tmpShape, mySimulationTopoDs ) ) { - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; - } - - - gp_Pnt P1, P2 ; - gp_Vec V, V1, V2 ; - TopExp_Explorer ex( aTopoDS, TopAbs_FACE ); - int test = 0 ; - while (ex.More()) { - - const TopoDS_Face& F = TopoDS::Face(ex.Current()); - /* find the center of the minmax */ - BRepAdaptor_Surface SF(F); - Standard_Real u, v, x; - - u = SF.FirstUParameter(); - x = SF.LastUParameter(); - if ( Precision::IsInfinite(u) ) { - if( Precision::IsInfinite(x) ) u = 0.0 ; else u = x ; - } - else if ( !Precision::IsInfinite(x) ) - u = (u+x) / 2.0 ; - - v = SF.FirstVParameter(); - x = SF.LastVParameter(); - if ( Precision::IsInfinite(v) ) { - if ( Precision::IsInfinite(x) ) v = 0.0 ; else v = x ; - } - else if ( !Precision::IsInfinite(x) ) - v = (v+x) / 2.0 ; - - SF.D1( u, v, P1, V1, V2 ); - V = V1.Crossed(V2); - x = V.Magnitude(); - if ( x > 1.e-10 ) - V.Multiply( length/x ); - else { - V.SetCoord( length/2.0, 0.0, 0.0 ) ; - MESSAGE ("Null normal in Orientation " << endl ) ; - } - - P2 = P1; - /* test orientation of each face and displays forward (aCompound1) */ - if( F.Orientation() == TopAbs_FORWARD ) - P2.Translate(V); - else - P2.Translate(-V) ; - BRepBuilderAPI_MakeEdge anEdge(P1, P2) ; - aBuilder1.Add( aCompound1, anEdge ) ; - - P2 = P1; - /* test orientation of each face and displays forward (aCompound2) */ - if( F.Orientation() == TopAbs_FORWARD ) - P2.Translate(-V); - else - P2.Translate(V) ; - anEdge = BRepBuilderAPI_MakeEdge(P1, P2) ; - aBuilder2.Add( aCompound2, anEdge ) ; - - ex.Next(); - test++ ; - } - - /* display simulation compounds */ - if( test > 0 && this->CheckBoxReverse->isChecked() ) { - mySimulationTopoDs = aCompound1 ; - } - else if ( test > 0 && !CheckBoxReverse->isChecked() ) { - mySimulationTopoDs = aCompound2 ; - } - if(!mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ; - - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_OrientationDlg.h b/src/GEOMGUI/GeometryGUI_OrientationDlg.h deleted file mode 100644 index 81b439e1a..000000000 --- a/src/GEOMGUI/GeometryGUI_OrientationDlg.h +++ /dev/null @@ -1,124 +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 : GeometryGUI_OrientationDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_ORIENTATION_H -#define DIALOGBOX_ORIENTATION_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : DialogBox_ORIENTATION -// purpose : -//================================================================================= -class GeometryGUI_OrientationDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_OrientationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_OrientationDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - SALOME_Selection* mySelection ; /* User shape selection */ - GEOM::GEOM_Shape_var myGeomShape ; /* is myShape */ - TopoDS_Shape myShape ; /* topology used */ - Standard_Real myLength ; /* to simulate normal vector */ - bool myOkShape ; - bool myOkLength ; - QDoubleValidator *myVa ; /* Double validator for numeric input */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeOrientationSimulationAndDisplay( const TopoDS_Shape& aTopoDS, Standard_Real length ) ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - GeometryGUI_SpinBox* SpinBox_C1A2 ; - - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QCheckBox* CheckBoxReverse; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ReverseOrientation(int state) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - - QGridLayout* GeometryGUI_OrientationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_ORIENTATION_H diff --git a/src/GEOMGUI/GeometryGUI_PartitionDlg.cxx b/src/GEOMGUI/GeometryGUI_PartitionDlg.cxx deleted file mode 100644 index 92f753c90..000000000 --- a/src/GEOMGUI/GeometryGUI_PartitionDlg.cxx +++ /dev/null @@ -1,530 +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 : GeometryGUI_PartitionDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_PartitionDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MIN_EDIT_SIZE 150 - -//================================================================================= -// class : GeometryGUI_PartitionDlg() -// purpose : Constructs a GeometryGUI_PartitionDlg 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. -//================================================================================= -GeometryGUI_PartitionDlg::GeometryGUI_PartitionDlg( 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_PARTITION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); -// QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GeometryGUI",tr("ICON_DLG_PARTITION_KEEP_FACES"))); - - if ( !name ) - setName( "GeometryGUI_PartitionDlg" ); - setCaption( tr( "GEOM_PARTITION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - QGridLayout* GeometryGUI_PartitionDlgLayout = new QGridLayout( this ); - GeometryGUI_PartitionDlgLayout->setSpacing( 6 ); - GeometryGUI_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 ); - - GeometryGUI_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 ); - - GeometryGUI_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 ); - - GeometryGUI_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 ); - - GeometryGUI_PartitionDlgLayout->addWidget( GroupButtons, 3, 0 ); - - /***************************************************************/ - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_PartitionDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_PartitionDlg::~GeometryGUI_PartitionDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::Init( SALOME_Selection* Sel ) -{ - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myOkListShapes = myOkListTools = myOkKeepShape = myOkRemoveShape = false ; - - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - /* 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" ) ); - - /* 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); - - /* 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - ComboTextChanged(); - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_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; - } - myGeomGUI->MakePartitionAndDisplay (myListShapes, - myListTools, - myListKeepInside, - myListRemoveInside, - limit); - - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : -//================================================================================= -// void GeometryGUI_PartitionDlg::ConstructorsClicked(int constructorId) -// { -// } - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_PartitionDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->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 ; - } - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; - myEditCurrentArgument->setText(aString) ; - myOkListShapes = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListTools) ; - myEditCurrentArgument->setText(aString) ; - myOkListTools = true ; - } - else if ( myEditCurrentArgument == LineEditC2A1 ) { - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListRemoveInside) ; - myEditCurrentArgument->setText(aString) ; - myOkKeepShape = true ; - } - else if ( myEditCurrentArgument == LineEditC2A2 ) { - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListKeepInside) ; - myEditCurrentArgument->setText(aString) ; - myOkRemoveShape = true ; - } - /* no simulation */ - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - - if (send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1 ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2 ; - } - else if(send == SelectButtonC2A1) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1 ; - } - else if(send == SelectButtonC2A2) { - LineEditC2A2->setFocus() ; - myEditCurrentArgument = LineEditC2A2 ; - } - SelectionIntoArgument() ; - - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_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 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= - -void GeometryGUI_PartitionDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_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 ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_PartitionDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - -//======================================================================= -//function : ComboTextChanged -//purpose : -//======================================================================= - -void GeometryGUI_PartitionDlg::ComboTextChanged() -{ - - myLimit = ComboBox1->currentItem(); - GroupC2->setEnabled( ComboBox1->currentItem() < 3 ); - - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_PartitionDlg.h b/src/GEOMGUI/GeometryGUI_PartitionDlg.h deleted file mode 100644 index 72725819b..000000000 --- a/src/GEOMGUI/GeometryGUI_PartitionDlg.h +++ /dev/null @@ -1,127 +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 : GeometryGUI_PartitionDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_PARTITION_H -#define DIALOGBOX_PARTITION_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QComboBox; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_PartitionDlg -// purpose : -//================================================================================= -class GeometryGUI_PartitionDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_PartitionDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_PartitionDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* Mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - 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; - - /* Arguments group */ - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A2; - QLabel* TextLabelC1A2; - QPushButton* SelectButtonC1A2; - - /* limit */ - QComboBox* ComboBox1; - QLabel* TextLabelComboBox1; - - /* Keep Inside and Remove Inside feilds */ - QGroupBox* GroupC2; - QLineEdit* LineEditC2A1; - QLabel* TextLabelC2A1; - QPushButton* SelectButtonC2A1; - QLineEdit* LineEditC2A2; - QLabel* TextLabelC2A2; - QPushButton* SelectButtonC2A2; - -private slots: - - //void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ComboTextChanged() ; -}; - -#endif // DIALOGBOX_PARTITION_H diff --git a/src/GEOMGUI/GeometryGUI_PipeDlg.cxx b/src/GEOMGUI/GeometryGUI_PipeDlg.cxx deleted file mode 100644 index 7746c5985..000000000 --- a/src/GEOMGUI/GeometryGUI_PipeDlg.cxx +++ /dev/null @@ -1,522 +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 : GeometryGUI_PipeDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_PipeDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#if OCC_VERSION_MAJOR >= 5 -#include -#else -#include -#endif - - -//================================================================================= -// class : GeometryGUI_PipeDlg() -// purpose : Constructs a GeometryGUI_PipeDlg 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. -//================================================================================= -GeometryGUI_PipeDlg::GeometryGUI_PipeDlg( 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_PIPE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_PipeDlg" ); - resize( 303, 225 ); - setCaption( tr( "GEOM_PIPE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_PipeDlgLayout = new QGridLayout( this ); - GeometryGUI_PipeDlgLayout->setSpacing( 6 ); - GeometryGUI_PipeDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_PIPE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_PipeDlgLayout->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 ); - GeometryGUI_PipeDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_BASE_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_PATH_OBJECT" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - GeometryGUI_PipeDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_PipeDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_PipeDlg::~GeometryGUI_PipeDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::Init( SALOME_Selection* Sel ) -{ - mySelection = Sel ; - myShape1.Nullify() ; - myShape2.Nullify() ; - myConstructorId = 0 ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - GroupC1->show(); - myConstructorId = 0 ; - myEditCurrentArgument = LineEditC1A1 ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - mySimulationTopoDs.Nullify() ; - - 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( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_PipeDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - //GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - - -//================================================================================= -// function : ClickOnAply() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - myGeomGUI->MakePipeAndDisplay(myGeomShape2 ,myGeomShape1) ; - } - break ; - } - } - // accept(); - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_PipeDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myEditCurrentArgument->setText("") ; - QString aString = ""; /* name of future selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myOkShape1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myOkShape2 = false ; - } - break ; - } - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 && - S.ShapeType() != TopAbs_COMPSOLID && - S.ShapeType() != TopAbs_COMPOUND && - S.ShapeType() != TopAbs_SOLID && - S.ShapeType() != TopAbs_SHAPE ) { - myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape1 = S ; - LineEditC1A1->setText(aString) ; - myOkShape1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 && ( S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE) ) { - myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape2 = S ; - LineEditC1A2->setText(aString) ; - myOkShape2 = true ; - } - - if (myOkShape1 && myOkShape2 && !myShape1.IsNull() && !myShape2.IsNull()) - { - //Make preview - TopoDS_Shape tds ; - TopoDS_Wire aWire ; - - if( myShape2.ShapeType() == TopAbs_WIRE ) - aWire = TopoDS::Wire(myShape2) ; - else - if ( myShape2.ShapeType() == TopAbs_EDGE ) - { - TopoDS_Edge aEdge = TopoDS::Edge(myShape2) ; - aWire = BRepBuilderAPI_MakeWire(aEdge); - - } - - try - { - tds = BRepOffsetAPI_MakePipe(aWire,myShape1 ) ; -#if OCC_VERSION_MAJOR >= 5 - if ( BRepAlgo::IsValid(tds) ) -#else - if ( BRepAlgoAPI::IsValid(tds) ) -#endif - { - //Draw Pipe - mySimulationTopoDs = tds; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - } - catch(Standard_Failure) - { - } - } -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if( send == SelectButtonC1A1 ) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1 ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_PipeDlg::enterEvent( QEvent * ) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_PipeDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate any active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_PipeDlg.h b/src/GEOMGUI/GeometryGUI_PipeDlg.h deleted file mode 100644 index bbae793a9..000000000 --- a/src/GEOMGUI/GeometryGUI_PipeDlg.h +++ /dev/null @@ -1,119 +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 : GeometryGUI_PipeDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_PIPE_H -#define DIALOGBOX_PIPE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_PipeDlg -// purpose : -//================================================================================= -class GeometryGUI_PipeDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_PipeDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_PipeDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape myShape1 ; /* topology used */ - TopoDS_Shape myShape2 ; /* topology used */ - GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */ - GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */ - bool myOkShape1 ; - bool myOkShape2 ; /* to check when arguments are defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - // Handle(GEOM_ShapeTypeFilter) myEdgFilter ; /* Filter selection */ - // Handle(GEOM_ShapeTypeFilter) myWireFilter ; /* Filter selection */ - - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A2; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_PipeDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_PIPE_H diff --git a/src/GEOMGUI/GeometryGUI_PlaneDlg.cxx b/src/GEOMGUI/GeometryGUI_PlaneDlg.cxx deleted file mode 100644 index 4132cbc03..000000000 --- a/src/GEOMGUI/GeometryGUI_PlaneDlg.cxx +++ /dev/null @@ -1,879 +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 : GeometryGUI_PlaneDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_PlaneDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_PlaneDlg() -// purpose : Constructs a GeometryGUI_PlaneDlg 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. -//================================================================================= -GeometryGUI_PlaneDlg::GeometryGUI_PlaneDlg( 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_PLANE_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_PLANE_DXYZ"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_PLANE_FACE"))); - - if ( !name ) - setName( "GeometryGUI_PlaneDlg" ); - resize( 365, 220 ); - setCaption( tr( "GEOM_PLANE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_PlaneDlgLayout = new QGridLayout( this ); - GeometryGUI_PlaneDlgLayout->setSpacing( 6 ); - GeometryGUI_PlaneDlgLayout->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_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 ); - GeometryGUI_PlaneDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_PLANE" ) ); - 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 ); - Constructor3 = new QRadioButton( GroupConstructors, "Constructor3" ); - Constructor3->setText( tr( "" ) ); - Constructor3->setPixmap( image3 ); - Constructor3->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor3, 0, 4 ); - QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_4, 0, 5 ); - GeometryGUI_PlaneDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupPointDirection = new QGroupBox( this, "GroupPointDirection" ); - GroupPointDirection->setTitle( tr( "GEOM_PLANE_PV" ) ); - GroupPointDirection->setColumnLayout(0, Qt::Vertical ); - GroupPointDirection->layout()->setSpacing( 0 ); - GroupPointDirection->layout()->setMargin( 0 ); - GroupPointDirectionLayout = new QGridLayout( GroupPointDirection->layout() ); - GroupPointDirectionLayout->setAlignment( Qt::AlignTop ); - GroupPointDirectionLayout->setSpacing( 6 ); - GroupPointDirectionLayout->setMargin( 11 ); - LineEditDirection = new QLineEdit( GroupPointDirection, "LineEditDirection" ); - LineEditDirection->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditDirection->sizePolicy().hasHeightForWidth() ) ); - GroupPointDirectionLayout->addWidget( LineEditDirection, 1, 2 ); - LineEditPt1 = new QLineEdit( GroupPointDirection, "LineEditPt1" ); - LineEditPt1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditPt1->sizePolicy().hasHeightForWidth() ) ); - GroupPointDirectionLayout->addWidget( LineEditPt1, 0, 2 ); - SelectButtonPt1 = new QPushButton( GroupPointDirection, "SelectButtonPt1" ); - SelectButtonPt1->setText( tr( "" ) ); - SelectButtonPt1->setPixmap( image1 ); - GroupPointDirectionLayout->addWidget( SelectButtonPt1, 0, 1 ); - SelectButtonDirection = new QPushButton( GroupPointDirection, "SelectButtonDirection" ); - SelectButtonDirection->setText( tr( "" ) ); - SelectButtonDirection->setPixmap( image1 ); - GroupPointDirectionLayout->addWidget( SelectButtonDirection, 1, 1 ); - TextLabelDirection = new QLabel( GroupPointDirection, "TextLabelDirection" ); - TextLabelDirection->setText( tr( "GEOM_VECTOR" ) ); - TextLabelDirection->setMinimumSize( QSize( 50, 0 ) ); - TextLabelDirection->setFrameShape( QLabel::NoFrame ); - TextLabelDirection->setFrameShadow( QLabel::Plain ); - GroupPointDirectionLayout->addWidget( TextLabelDirection, 1, 0 ); - TextLabelPt1 = new QLabel( GroupPointDirection, "TextLabelPt1" ); - TextLabelPt1->setText( tr( "GEOM_POINT" ) ); - TextLabelPt1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelPt1->setFrameShape( QLabel::NoFrame ); - TextLabelPt1->setFrameShadow( QLabel::Plain ); - GroupPointDirectionLayout->addWidget( TextLabelPt1, 0, 0 ); - - SpinBox_C1Size = new GeometryGUI_SpinBox( GroupPointDirection, "SpinBox_C1Size" ); - GroupPointDirectionLayout->addWidget( SpinBox_C1Size, 2, 2 ); - TextLabelC1Size = new QLabel( GroupPointDirection, "TextLabelC1Size" ); - TextLabelC1Size->setText( tr( "GEOM_PLANE_SIZE" ) ); - TextLabelC1Size->setMinimumSize( QSize( 60, 0 ) ); - GroupPointDirectionLayout->addWidget( TextLabelC1Size, 2, 0 ); - - GeometryGUI_PlaneDlgLayout->addWidget( GroupPointDirection, 1, 0 ); - - /***************************************************************/ - GroupPointPlusCoordinates = new QGroupBox( this, "GroupPointPlusCoordinates" ); - GroupPointPlusCoordinates->setTitle( tr( "GEOM_PLANE_PVC" ) ); - GroupPointPlusCoordinates->setColumnLayout(0, Qt::Vertical ); - GroupPointPlusCoordinates->layout()->setSpacing( 0 ); - GroupPointPlusCoordinates->layout()->setMargin( 0 ); - GroupPointPlusCoordinatesLayout = new QGridLayout( GroupPointPlusCoordinates->layout() ); - GroupPointPlusCoordinatesLayout->setAlignment( Qt::AlignTop ); - GroupPointPlusCoordinatesLayout->setSpacing( 6 ); - GroupPointPlusCoordinatesLayout->setMargin( 11 ); - - LineEditPt2 = new QLineEdit( GroupPointPlusCoordinates, "LineEditPt2" ); - LineEditPt2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditPt2->sizePolicy().hasHeightForWidth() ) ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( LineEditPt2, 0, 0, 5, 8 ); - - SelectButtonPt2 = new QPushButton( GroupPointPlusCoordinates, "SelectButtonPt2" ); - SelectButtonPt2->setText( tr( "" ) ); - SelectButtonPt2->setPixmap( image1 ); - SelectButtonPt2->setMaximumSize( QSize( 28, 32767 ) ); - GroupPointPlusCoordinatesLayout->addWidget( SelectButtonPt2, 0, 4 ); - - TextLabelPt2 = new QLabel( GroupPointPlusCoordinates, "TextLabelPt2" ); - TextLabelPt2->setText( tr( "GEOM_POINT" ) ); - TextLabelPt2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelPt2->setFrameShape( QLabel::NoFrame ); - TextLabelPt2->setFrameShadow( QLabel::Plain ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( TextLabelPt2, 0, 0, 0, 3 ); - - SpinBox_DX = new GeometryGUI_SpinBox( GroupPointPlusCoordinates, "SpinBox_DX" ); - SpinBox_DX->setMinimumSize( QSize( 50, 0 ) ); - SpinBox_DX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DX->sizePolicy().hasHeightForWidth() ) ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( SpinBox_DX, 1, 1, 3, 4 ); - - SpinBox_DY = new GeometryGUI_SpinBox( GroupPointPlusCoordinates, "SpinBox_DY" ); - SpinBox_DY->setMinimumSize( QSize( 50, 0 ) ); - SpinBox_DY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DY->sizePolicy().hasHeightForWidth() ) ); - GroupPointPlusCoordinatesLayout->addWidget( SpinBox_DY, 1, 6 ); - - SpinBox_DZ = new GeometryGUI_SpinBox( GroupPointPlusCoordinates, "SpinBox_DZ" ); - SpinBox_DZ->setMinimumSize( QSize( 50, 0 ) ); - SpinBox_DZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DZ->sizePolicy().hasHeightForWidth() ) ); - GroupPointPlusCoordinatesLayout->addWidget( SpinBox_DZ, 1, 8 ); - - TextLabel_DX = new QLabel( GroupPointPlusCoordinates, "TextLabel_DX" ); - TextLabel_DX->setText( tr( "GEOM_DX" ) ); - GroupPointPlusCoordinatesLayout->addWidget( TextLabel_DX, 1, 2 ); - - TextLabel_DY = new QLabel( GroupPointPlusCoordinates, "TextLabel_DY" ); - TextLabel_DY->setText( tr( "GEOM_DY" ) ); - GroupPointPlusCoordinatesLayout->addWidget( TextLabel_DY, 1, 5 ); - - TextLabel_DZ = new QLabel( GroupPointPlusCoordinates, "TextLabel_DZ" ); - TextLabel_DZ->setText( tr( "GEOM_DZ" ) ); - GroupPointPlusCoordinatesLayout->addWidget( TextLabel_DZ, 1, 7 ); - - TextLabelCoordinates = new QLabel( GroupPointPlusCoordinates, "TextLabelCoordinates" ); - TextLabelCoordinates->setText( tr( "GEOM_COOR" ) ); - TextLabelCoordinates->setMinimumSize( QSize( 50, 0 ) ); - TextLabelCoordinates->setFrameShape( QLabel::NoFrame ); - TextLabelCoordinates->setFrameShadow( QLabel::Plain ); - GroupPointPlusCoordinatesLayout->addWidget( TextLabelCoordinates, 1, 0 ); - - TextLabelC2Size = new QLabel( GroupPointPlusCoordinates, "TextLabelC2Size" ); - TextLabelC2Size->setText( tr( "GEOM_PLANE_SIZE" ) ); - TextLabelC2Size->setMinimumSize( QSize( 60, 0 ) ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( TextLabelC2Size, 2, 2, 0, 1 ); - - SpinBox_C2Size = new GeometryGUI_SpinBox( GroupPointPlusCoordinates, "SpinBox_C2Size" ); - GroupPointPlusCoordinatesLayout->addMultiCellWidget( SpinBox_C2Size, 2, 2, 5, 8 ); - - QSpacerItem* spacer_c = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupPointPlusCoordinatesLayout->addMultiCell( spacer_c, 2, 2, 2, 4 ); - QSpacerItem* spacer_d = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupPointPlusCoordinatesLayout->addItem( spacer_d, 1, 1 ); - - GeometryGUI_PlaneDlgLayout->addWidget( GroupPointPlusCoordinates, 1, 0 ); - - /***************************************************************/ - - GroupFace = new QGroupBox( this, "GroupFace" ); - GroupFace->setTitle( tr( "GEOM_FACE" ) ); - GroupFace->setColumnLayout(0, Qt::Vertical ); - GroupFace->layout()->setSpacing( 0 ); - GroupFace->layout()->setMargin( 0 ); - GroupFaceLayout = new QGridLayout( GroupFace->layout() ); - GroupFaceLayout->setAlignment( Qt::AlignTop ); - GroupFaceLayout->setSpacing( 6 ); - GroupFaceLayout->setMargin( 11 ); - - TextLabelFace = new QLabel( GroupFace, "TextLabelFace" ); - TextLabelFace->setFrameShadow( QLabel::Plain ); - TextLabelFace->setFrameShape( QLabel::NoFrame ); - TextLabelFace->setText( tr( "GEOM_SELECTION" ) ); - TextLabelFace->setMinimumSize( QSize( 50, 0 ) ); - GroupFaceLayout->addMultiCellWidget( TextLabelFace, 0, 0, 0, 1 ); - - SelectButtonFace = new QPushButton( GroupFace, "SelectButtonFace" ); - SelectButtonFace->setText( tr( "" ) ); - SelectButtonFace->setPixmap( image1 ); - SelectButtonFace->setMaximumSize( QSize( 28, 32767 ) ); - GroupFaceLayout->addWidget( SelectButtonFace, 0, 2 ); - - LineEditFace = new QLineEdit( GroupFace, "LineEditFace" ); - LineEditFace->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditFace->sizePolicy().hasHeightForWidth() ) ); - GroupFaceLayout->addWidget( LineEditFace, 0, 3 ); - - TextLabelC3Size = new QLabel( GroupFace, "TextLabelC3Size" ); - TextLabelC3Size->setText( tr( "GEOM_PLANE_SIZE" ) ); - TextLabelC3Size->setMinimumSize( QSize( 60, 0 ) ); - GroupFaceLayout->addWidget( TextLabelC3Size, 1, 0 ); - - SpinBox_C3Size = new GeometryGUI_SpinBox( GroupFace, "SpinBox_C3Size" ); - SpinBox_C3Size->setCaption( tr( "" ) ); - GroupFaceLayout->addWidget( SpinBox_C3Size, 1, 3 ); - - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupFaceLayout->addMultiCell( spacer, 1, 1, 1, 2 ); - QSpacerItem* spacer_e = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); - GroupFaceLayout->addItem( spacer_e, 2, 3 ); - GeometryGUI_PlaneDlgLayout->addWidget( GroupFace, 1, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_PlaneDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_PlaneDlg::~GeometryGUI_PlaneDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::Init( SALOME_Selection* Sel ) -{ - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_DX->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DX->SetValue( 1.0 ) ; - SpinBox_DY->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DY->SetValue( 1.0 ) ; - SpinBox_DZ->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DZ->SetValue( 1.0 ) ; - - this->myTrimSize = 2000.0 ; - SpinBox_C1Size->RangeStepAndValidator( +0.001, 10000000.0, step, 5 ) ; - SpinBox_C1Size->SetValue( myTrimSize ) ; - SpinBox_C2Size->RangeStepAndValidator( +0.001, 10000000.0, step, 5 ) ; - SpinBox_C2Size->SetValue( myTrimSize ) ; - SpinBox_C3Size->RangeStepAndValidator( +0.001, 10000000.0, step, 5 ) ; - SpinBox_C3Size->SetValue( myTrimSize ) ; - - GroupPointDirection->show(); - GroupPointPlusCoordinates->hide() ; - GroupFace->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - - mySelection = Sel ; - myEditCurrentArgument = LineEditPt1 ; - mySimulationTopoDs.Nullify() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkDirection = myOkCoordinates = myOkPlanarFace = false ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO previous selection into argument ? - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom ); - myFaceFilter = new GEOM_FaceFilter( StdSelect_Plane, myGeom ); - /* Filter for the next selection */ - mySelection->AddFilter( myVertexFilter ) ; - - /* 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( LineEditPt1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditDirection, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( LineEditPt2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditFace, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SelectButtonPt1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonPt2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonFace, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonDirection, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_DX, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DY, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DZ, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( SpinBox_C1Size, SIGNAL ( ValueChangedSignal( const double) ), this, SLOT( ValueChangedInSpinBox( const double) ) ) ; - connect( SpinBox_C2Size, SIGNAL ( ValueChangedSignal( const double) ), this, SLOT( ValueChangedInSpinBox( const double) ) ) ; - connect( SpinBox_C3Size, SIGNAL ( ValueChangedSignal( const double) ), this, SLOT( ValueChangedInSpinBox( const double) ) ) ; - - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_PlaneDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - myOkPoint1 = myOkDirection = myOkCoordinates = myOkPlanarFace = false ; - mySelection->ClearFilters() ; - myConstructorId = constructorId ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - switch (constructorId) - { - case 0: /* plane from a point and a direction (vector, edge...) */ - { - GroupPointDirection->show(); - GroupPointPlusCoordinates->hide() ; - GroupFace->hide() ; - myEditCurrentArgument = LineEditPt1 ; - LineEditPt1->setText(tr("")) ; - LineEditDirection->setText(tr("")) ; - - /* for the first argument */ - mySelection->AddFilter(myVertexFilter) ; - break; - } - - case 1: /* plane from a point and vector coordinates */ - { - GroupPointDirection->hide() ; - GroupPointPlusCoordinates->show() ; - GroupFace->hide() ; - myEditCurrentArgument = LineEditPt2 ; - LineEditPt2->setText(tr("")) ; - SpinBox_DX->SetValue( 1.0 ) ; - SpinBox_DY->SetValue( 1.0 ) ; - SpinBox_DZ->SetValue( 1.0 ) ; - myOkCoordinates = true ; - - /* for the first argument */ - mySelection->AddFilter(myVertexFilter) ; - break ; - } - - case 2: /* plane from a planar face selection */ - { - GroupPointDirection->hide() ; - GroupPointPlusCoordinates->hide() ; - GroupFace->show() ; - myEditCurrentArgument = LineEditFace ; - LineEditFace->setText(tr("")) ; - - /* for the first argument */ - mySelection->AddFilter(myFaceFilter) ; - break ; - } - - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : /* args are myPoint1 and myDx, myDy, myDz from a vector(edge) */ - { - if(myOkPoint1 && myOkDirection) { - myGeomGUI->MakePlaneAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize ) ; - } - break ; - } - - case 1 : /* args are myPoint1 and myDx, myDy, myDz from a Spin Box */ - { - if(myOkPoint1) { - myGeomGUI->MakePlaneAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize ) ; - } - break ; - } - - case 2 : /* arg is a planar face selection */ - { - if(myOkPlanarFace) { - myGeomGUI->MakePlaneAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize) ; - } - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_PlaneDlg::SelectionIntoArgument() -{ - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future name of argument */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditPt1 ) { - LineEditPt1->setText("") ; - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditDirection ) { - LineEditDirection->setText("") ; - myOkDirection = false ; - } - break ; - } - case 1: - { - if ( myEditCurrentArgument == LineEditPt2 ) { - LineEditPt2->setText("") ; - myOkPoint1 = false ; - } - break ; - } - - case 2: - { - if ( myEditCurrentArgument == LineEditFace ) { - LineEditFace->setText("") ; - if ( aString.compare("") == 0 ) - myOkPlanarFace = false ; - else - myOkPlanarFace = true ; - } - break ; - } - - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - - /* FIRST CONSTRUCTOR */ - if ( myEditCurrentArgument == LineEditPt1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditPt1->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myEditCurrentArgument == LineEditDirection ) { - /* We verify if the selection is a linear edge */ - gp_Pnt Pfirst, Plast ; - if( myGeomGUI->LinearEdgeExtremities(S, Pfirst, Plast ) ) { - myGeomGUI->GetBipointDxDyDz( Pfirst, Plast, myDx, myDy, myDz) ; - LineEditDirection->setText(aString) ; - myOkDirection = true ; - this->myTrimSize = SpinBox_C1Size->GetValue() ; - } - } - - /* SECOND CONSTRUCTOR */ - else if ( myEditCurrentArgument == LineEditPt2 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditPt2->setText(aString) ; - /* Get arguments */ - myDx = SpinBox_DX->GetValue() ; - myDy = SpinBox_DY->GetValue() ; - myDz = SpinBox_DZ->GetValue() ; - this->myTrimSize = SpinBox_C2Size->GetValue() ; - myOkPoint1 = true ; - myOkCoordinates = true ; - } - - /* THIRD CONSTRUCTOR */ - else if ( myEditCurrentArgument == LineEditFace) { - if( myOkPlanarFace ) { - LineEditFace->setText(aString) ; - BRepAdaptor_Surface surf(TopoDS::Face(S)); - gp_Pln Plane = surf.Plane(); - - gp_Pnt myPoint1 = Plane.Location(); - gp_Ax1 ax = Plane.Axis(); - myDx = (ax.Direction()).X() ; - myDy = (ax.Direction()).Y() ; - myDz = (ax.Direction()).Z() ; - this->myTrimSize = SpinBox_C3Size->GetValue() ; - } - } - - /* Call method simulation */ - if( ( myOkPoint1 && myOkDirection) || ( myOkPoint1 && myOkCoordinates ) || myOkPlanarFace ) { - if ( myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion()*Precision::Confusion() ) { - MakePlaneSimulationAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize ) ; - } - } - return ; -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - - switch (myConstructorId) - { - case 0: - { - if(send == SelectButtonPt1) { - LineEditPt1->setFocus() ; - myEditCurrentArgument = LineEditPt1; - mySelection->AddFilter(myVertexFilter) ; - } - else if(send == SelectButtonDirection) { - LineEditDirection->setFocus() ; - myEditCurrentArgument = LineEditDirection; - /* Edge filter here */ - mySelection->AddFilter(myEdgeFilter) ; - SelectionIntoArgument() ; - } - break; - } - - case 1: - { - if(send == SelectButtonPt2) { - LineEditPt2->setFocus() ; - myEditCurrentArgument = LineEditPt2; - /* Vertex filter here */ - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - } - break; - } - - case 2: - { - if(send == SelectButtonFace) { - LineEditFace->setFocus() ; - myEditCurrentArgument = LineEditFace; - /* Face filter here */ - mySelection->AddFilter(myFaceFilter) ; - SelectionIntoArgument() ; - } - break; - } - - } - return ; -} - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::ValueChangedInSpinBox( double newValue ) -{ - QObject* send = (QObject*)sender() ; - - if( send == SpinBox_DX ) { - myDx = newValue ; - myDy = SpinBox_DY->GetValue() ; - myDz = SpinBox_DZ->GetValue() ; - } else if( send == SpinBox_DY ) { - myDx = SpinBox_DX->GetValue() ; - myDy = newValue ; - myDz = SpinBox_DZ->GetValue() ; - } else if( send == SpinBox_DZ ) { - myDx = SpinBox_DX->GetValue() ; - myDy = SpinBox_DY->GetValue() ; - myDz = newValue ; - } else if( send == SpinBox_C1Size || send == SpinBox_C2Size || send == SpinBox_C3Size ) { - myTrimSize = newValue ; - } else - return ; - - if ( myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion() * Precision::Confusion() ) { - MakePlaneSimulationAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize ) ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditPt1 ) - myEditCurrentArgument = LineEditPt1 ; - else if ( send == LineEditDirection ) - myEditCurrentArgument = LineEditDirection ; - else if ( send == LineEditPt2 ) - myEditCurrentArgument = LineEditPt2 ; - else if ( send == LineEditFace ) - myEditCurrentArgument = LineEditFace ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupPointDirection->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - GroupFace->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupPointDirection->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - GroupFace->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::enterEvent( QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; -} - - - -//================================================================================= -// function : MakePlaneSimulationAndDisplay(() -// purpose : -//================================================================================= -void GeometryGUI_PlaneDlg::MakePlaneSimulationAndDisplay( const gp_Pnt& P1, - const Standard_Real dx, - const Standard_Real dy, - const Standard_Real dz, - const Standard_Real trimsize ) -{ - try { - gp_Dir aDirection( dx, dy, dz ) ; - /* We make a trimmed plane */ - gp_Pln gplane(P1, aDirection) ; - mySimulationTopoDs = BRepBuilderAPI_MakeFace(gplane, -trimsize, +trimsize, -trimsize, +trimsize) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakePlaneSimulation" << endl ) ; - return ; - } - - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_PlaneDlg.h b/src/GEOMGUI/GeometryGUI_PlaneDlg.h deleted file mode 100644 index fb5c0f6ee..000000000 --- a/src/GEOMGUI/GeometryGUI_PlaneDlg.h +++ /dev/null @@ -1,179 +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 : GeometryGUI_PlaneDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_PLANE_H -#define DIALOGBOX_PLANE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_FaceFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QToolButton; -class QLabel; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_PlaneDlg -// purpose : -//================================================================================= -class GeometryGUI_PlaneDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_PlaneDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_PlaneDlg(); - -private : - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - SALOME_Selection* mySelection ; /* User shape selection */ - gp_Pnt myPoint1 ; /* Point on the plane */ - - Standard_Real myDx ; - Standard_Real myDy ; - Standard_Real myDz ; - Standard_Real myTrimSize ; - - bool myOkPoint1 ; /* true when argument is defined */ - bool myOkDirection ; - bool myOkCoordinates ; - bool myOkPlanarFace ; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filters selection */ - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */ - Handle(GEOM_FaceFilter) myFaceFilter; /* Filters selection */ - - // Constructors - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QRadioButton* Constructor3; - - // Constructor with a point + direction (vector) - QGroupBox* GroupPointDirection; - - QLabel* TextLabelPt1; - QPushButton* SelectButtonPt1; - QLineEdit* LineEditPt1; - - QLabel* TextLabelDirection; - QPushButton* SelectButtonDirection; - QLineEdit* LineEditDirection; - - QLabel* TextLabelC1Size; - GeometryGUI_SpinBox* SpinBox_C1Size ; - - // Constructor with a point + dx, dy, dz coordinates - QGroupBox* GroupPointPlusCoordinates; - - QLabel* TextLabelPt2; - QPushButton* SelectButtonPt2; - QLineEdit* LineEditPt2; - - QLabel* TextLabelCoordinates; - QLabel* TextLabel_DX; - QLabel* TextLabel_DY; - QLabel* TextLabel_DZ; - GeometryGUI_SpinBox* SpinBox_DX ; - GeometryGUI_SpinBox* SpinBox_DY ; - GeometryGUI_SpinBox* SpinBox_DZ ; - - QLabel* TextLabelC2Size; - GeometryGUI_SpinBox* SpinBox_C2Size ; - - // Constructor with a face - QGroupBox* GroupFace; - - QLabel* TextLabelFace; - QPushButton* SelectButtonFace; - QLineEdit* LineEditFace; - - QLabel* TextLabelC3Size; - GeometryGUI_SpinBox* SpinBox_C3Size ; - - // BUTTONS - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void MakePlaneSimulationAndDisplay( const gp_Pnt& P, - const Standard_Real dx, - const Standard_Real dy, - const Standard_Real dz, - const Standard_Real trimSize ) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - - QGridLayout* GeometryGUI_PlaneDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupPointDirectionLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupPointPlusCoordinatesLayout; - QGridLayout* GroupFaceLayout; - QHBoxLayout* Layout2 ; -}; - -#endif // DIALOGBOX_PLANE_H diff --git a/src/GEOMGUI/GeometryGUI_PointDlg.cxx b/src/GEOMGUI/GeometryGUI_PointDlg.cxx deleted file mode 100644 index 017a00043..000000000 --- a/src/GEOMGUI/GeometryGUI_PointDlg.cxx +++ /dev/null @@ -1,794 +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 : GeometryGUI_PointDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_PointDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_RightFrame.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" -#include "QAD_Tools.h" -#include "OCCViewer_Viewer3d.h" -#include "utilities.h" - -#include -#include -#if OCC_VERSION_MAJOR >= 5 -#include -#else -#include -#endif -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_PointDlg() -// purpose : Constructs a GeometryGUI_PointDlg 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. -//================================================================================= -GeometryGUI_PointDlg::GeometryGUI_PointDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - const Handle (AIS_InteractiveContext)& ic, - 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_POINT"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_POINT_EDGE"))); - - if ( !name ) - setName( "GeometryGUI_PointDlg" ); - resize( 303, 185 ); - setCaption( tr( "GEOM_POINT_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_PointDlgLayout = new QGridLayout( this ); - GeometryGUI_PointDlgLayout->setSpacing( 6 ); - GeometryGUI_PointDlgLayout->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_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 ); - GeometryGUI_PointDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "Constructors" ) ); - 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( FALSE ); - 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 ); - - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setChecked( TRUE ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 3 ); - - GeometryGUI_PointDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - - /***************************************************************/ - GroupCoordinates = new QGroupBox( this, "GroupCoordinates" ); - GroupCoordinates->setTitle( tr( "GEOM_COORDINATES" ) ); - GroupCoordinates->setColumnLayout(0, Qt::Vertical ); - GroupCoordinates->layout()->setSpacing( 0 ); - GroupCoordinates->layout()->setMargin( 0 ); - GroupCoordinatesLayout = new QGridLayout( GroupCoordinates->layout() ); - GroupCoordinatesLayout->setAlignment( Qt::AlignTop ); - GroupCoordinatesLayout->setSpacing( 6 ); - GroupCoordinatesLayout->setMargin( 11 ); - - TextLabel_X = new QLabel( GroupCoordinates, "TextLabel_X" ); - TextLabel_X->setText( tr( "GEOM_X" ) ); - GroupCoordinatesLayout->addWidget( TextLabel_X, 0, 0 ); - TextLabel_Y = new QLabel( GroupCoordinates, "TextLabel_Y" ); - TextLabel_Y->setText( tr( "GEOM_Y" ) ); - GroupCoordinatesLayout->addWidget( TextLabel_Y, 0, 2 ); - TextLabel_Z = new QLabel( GroupCoordinates, "TextLabel_Z" ); - TextLabel_Z->setText( tr( "GEOM_Z" ) ); - GroupCoordinatesLayout->addWidget( TextLabel_Z, 0, 4 ); - - /* Spin boxes construction */ - SpinBox_X = new GeometryGUI_SpinBox( GroupCoordinates, "GeomSpinBox_X" ) ; - GroupCoordinatesLayout->addWidget( SpinBox_X, 0, 1 ); - SpinBox_Y = new GeometryGUI_SpinBox( GroupCoordinates, "GeomSpinBox_Y" ) ; - GroupCoordinatesLayout->addWidget( SpinBox_Y, 0, 3 ); - SpinBox_Z = new GeometryGUI_SpinBox( GroupCoordinates, "GeomSpinBox_Z" ) ; - GroupCoordinatesLayout->addWidget( SpinBox_Z, 0, 5 ); - GeometryGUI_PointDlgLayout->addWidget( GroupCoordinates, 1, 0 ); - - /***************************************************************/ - GroupWithEdge = new QGroupBox( this, "GroupWithEdge" ); - GroupWithEdge->setTitle( tr( "GEOM_PARAM_POINT" ) ); - GroupWithEdge->setFrameShape( QGroupBox::Box ); - GroupWithEdge->setFrameShadow( QGroupBox::Sunken ); - GroupWithEdge->setColumnLayout(0, Qt::Vertical ); - GroupWithEdge->layout()->setSpacing( 0 ); - GroupWithEdge->layout()->setMargin( 0 ); - GroupWithEdgeLayout = new QGridLayout( GroupWithEdge->layout() ); - GroupWithEdgeLayout->setAlignment( Qt::AlignTop ); - GroupWithEdgeLayout->setSpacing( 6 ); - GroupWithEdgeLayout->setMargin( 11 ); - - LineEdit_Edge = new QLineEdit( GroupWithEdge, "LineEdit_Edge" ); - GroupWithEdgeLayout->addWidget( LineEdit_Edge, 0, 2 ); - - SelectButton_Edge = new QPushButton( GroupWithEdge, "SelectButton_Edge" ); - SelectButton_Edge->setText( tr( "" ) ); - SelectButton_Edge->setPixmap( image1 ); - SelectButton_Edge->setToggleButton( FALSE ); - GroupWithEdgeLayout->addWidget( SelectButton_Edge, 0, 1 ); - - /* Spin box */ - SpinBox_Parameter = new GeometryGUI_SpinBox( GroupWithEdge, "SpinBox_Parameter" ); - GroupWithEdgeLayout->addWidget( SpinBox_Parameter, 1, 2 ); - - TextLabel_Edge = new QLabel( GroupWithEdge, "TextLabel_Edge" ); - TextLabel_Edge->setText( tr( "GEOM_EDGE" ) ); - TextLabel_Edge->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Edge->setFrameShape( QLabel::NoFrame ); - TextLabel_Edge->setFrameShadow( QLabel::Plain ); - GroupWithEdgeLayout->addWidget( TextLabel_Edge, 0, 0 ); - - TextLabel_Parameter = new QLabel( GroupWithEdge, "TextLabel_Parameter" ); - TextLabel_Parameter->setText( tr( "GEOM_PARAMETER" ) ); - TextLabel_Parameter->setMinimumSize( QSize( 50, 0 ) ); - TextLabel_Parameter->setFrameShape( QLabel::NoFrame ); - TextLabel_Parameter->setFrameShadow( QLabel::Plain ); - GroupWithEdgeLayout->addWidget( TextLabel_Parameter, 1, 0 ); - - GeometryGUI_PointDlgLayout->addWidget( GroupWithEdge, 1, 0 ); - /***************************************************************/ - - /* Initialisation and display */ - Init(Sel, ic) ; - - /* Move widget on the botton right corner of main widget */ - QAD_Tools::alignWidget(this, parent, AlignBottom | AlignRight); - /* Display Dialog */ - this->show() ; -} - - -//======================================================================= -// function : ~GeometryGUI_PointDlg() -// purpose : Destructor -//======================================================================= -GeometryGUI_PointDlg::~GeometryGUI_PointDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_PointDlg::Init(SALOME_Selection* Sel, const Handle(AIS_InteractiveContext)& ic) -{ - - /* 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 spin boxes */ - SpinBox_X->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_X->SetValue( 0.0 ) ; - SpinBox_Y->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_Y->SetValue( 0.0 ) ; - SpinBox_Z->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_Z->SetValue( 0.0 ) ; - - /* spin box for parameter on edge */ - double specificStep = 0.1 ; - SpinBox_Parameter->RangeStepAndValidator( -999999.99999, 999999.99999, specificStep, 5 ) ; - SpinBox_Parameter->SetValue( 0.50 ) ; - myParameter = 0.50 ; - - GroupCoordinates->show(); - GroupWithEdge->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - - /* filter for the second constructor */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom ); - - bool displayPoint = false ; - mySelection = Sel ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - myGeomGUI->SetState(POINT_METHOD) ; - - mySelection = Sel; - myOkEdge = false ; - - /* manages local context selection */ - myIC = ic ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - myLocalContextId = myIC->OpenLocalContext(); - myGeomGUI->SetDisplayedObjectList(); - /* sub shapes selection */ - myLocalContextMode = TopAbs_VERTEX ; - myIC->ActivateStandardMode(myLocalContextMode) ; - myUseLocalContext = true ; - } else { - myUseLocalContext = false ; - } - - - myPoint.SetCoord( 0.0, 0.0, 0.0 ) ; - TopoDS_Shape S; - - if( myGeomGUI->GetTopoFromSelection(mySelection, S) ) { - - /* Filter a possibly previous selection and try to put it into coordinates */ - if( myGeomGUI->VertexToPoint( S, myPoint) ) - displayPoint = false ; - else - displayPoint = true ; - } - else { - displayPoint = true ; - } - - mySimulationTopoDs.Nullify() ; - PointIntoCoordinates(myPoint, displayPoint) ; - - /* 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( SelectButton_Edge, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( GroupConstructors, SIGNAL(clicked(int) ), this, SLOT( ConstructorsClicked(int) ) ) ; - - connect( SpinBox_X, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double ) ) ) ; - connect( SpinBox_Y, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double ) ) ) ; - connect( SpinBox_Z, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double ) ) ) ; - - connect( SpinBox_Parameter, SIGNAL ( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) ) ; - connect( LineEdit_Edge, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ),this, SLOT( DeactivateActiveDialog() ) ) ; - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - // connect( mySelection, SIGNAL ( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ) ; done in constructor clicked ! - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays this Dialog */ -} - - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_PointDlg::ValueChangedInSpinBox( double newValue ) -{ - GeometryGUI_SpinBox* send = (GeometryGUI_SpinBox*)sender() ; - double vx, vy, vz ; - if( send == SpinBox_X ) { - vx = newValue ; - vy = SpinBox_Y->GetValue() ; - vz = SpinBox_Z->GetValue() ; - } else if ( send == SpinBox_Y ) { - vx = SpinBox_X->GetValue() ; - vy = newValue ; - vz = SpinBox_Z->GetValue() ; - } else if (send == SpinBox_Z ) { - vx = SpinBox_X->GetValue() ; - vy = SpinBox_Y->GetValue() ; - vz = newValue ; - } else if (send == SpinBox_Parameter ) { - myParameter = newValue ; - } else - return ; - - - switch (myConstructorId) { - case 0: // default constructor - { - myPoint.SetCoord(vx, vy, vz) ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs = BRepBuilderAPI_MakeVertex (myPoint).Shape() ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - break ; - } - case 1: - { - this->SelectionIntoArgument() ; - break ; - } - } - - return ; -} - - - -//======================================================================= -// funcion : PointIntoCoordinates() -// purpose : Sets user point coordinates into this dialog Spin boxes -// : and displays it or not according to 'bool displayPoint' -//======================================================================= -void GeometryGUI_PointDlg::PointIntoCoordinates(gp_Pnt P, bool displayPoint) -{ - switch (myConstructorId) { - case 0 : { - SpinBox_X->SetValue( P.X() ) ; - SpinBox_Y->SetValue( P.Y() ) ; - SpinBox_Z->SetValue( P.Z() ) ; - this->myPoint.SetCoord( P.X(), P.Y(), P.Z() ) ; - if( displayPoint ) { - mySimulationTopoDs = BRepBuilderAPI_MakeVertex(P).Shape() ; - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ; - } - break ; - } - case 1 : - { - // TODO - break ; - } - } - - return ; -} - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_PointDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - myConstructorId = constructorId ; - switch (constructorId) - { - case 0: - { - if ( myUseLocalContext == false && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - myLocalContextId = myIC->OpenLocalContext(); - myGeomGUI->SetDisplayedObjectList(); - /* sub shapes selection */ - myLocalContextMode = TopAbs_VERTEX ; - myIC->ActivateStandardMode(myLocalContextMode) ; - myUseLocalContext = true ; - } - mySelection->ClearFilters() ; - GroupCoordinates->show(); - GroupWithEdge->hide() ; - /* Display point simulation */ - PointIntoCoordinates( this->myPoint, true ) ; - disconnect( mySelection, 0, this, 0 ); - break; - } - case 1: - { - if ( myUseLocalContext == true && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - myIC->CloseLocalContext(myLocalContextId) ; - myUseLocalContext = false ; - } - LineEdit_Edge->setText("") ; - mySelection->AddFilter( myEdgeFilter ); - GroupCoordinates->hide(); - GroupWithEdge->show() ; - myOkEdge = false ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - break; - } - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_PointDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEdit_Edge ) { - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - const QString objectUserName = send->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - LineEdit_Edge->setText( objectUserName ) ; - } - } - return ; -} - - - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_PointDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//======================================================================= -// function : ClickOnApply() -// purpose : -//======================================================================= -void GeometryGUI_PointDlg::ClickOnApply() -{ - - myGeomGUI->EraseSimulationShape() ; - - /* Close local context */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - myIC->CloseLocalContext(myLocalContextId) ; - myUseLocalContext = false ; - } - - switch (myConstructorId) { - - case 0 : - { - /* Recup args and call method */ - double x = SpinBox_X->GetValue() ; - double y = SpinBox_Y->GetValue() ; - double z = SpinBox_Z->GetValue() ; - - myGeomGUI->MakePointAndDisplay(x,y,z) ; /* WARNING : no display if a local context is opened */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - /* no display if a local context is opened */ - myLocalContextId = myIC->OpenLocalContext(); - myGeomGUI->SetDisplayedObjectList(); - /* sub shapes selection */ - myLocalContextMode = TopAbs_VERTEX ; - myIC->ActivateStandardMode(myLocalContextMode); - myUseLocalContext = true ; - } - break ; - } - case 1 : - { - if( myOkEdge == true ) { - /* this constructor method has no idl interface : we use same than constructor 0 */ - myGeomGUI->MakePointAndDisplay( myPoint.X(), myPoint.Y(), myPoint.Z() ) ; - } - break ; - } - } - - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed (for constructors not using local context) -//================================================================================= -void GeometryGUI_PointDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - LineEdit_Edge->setText("") ; - QString aString = "" ; /* future name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - this->myOkEdge = false ; - return ; - } - - // nbSel == 1 - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - switch (myConstructorId) - { - case 0: - break ; - case 1: - { - LineEdit_Edge->setText(aString) ; - if( S.ShapeType() == TopAbs_EDGE ) { - if( CalculateVertexOnCurve( TopoDS::Edge(S), myParameter, mySimulationTopoDs) ) { - if ( myGeomGUI->VertexToPoint( mySimulationTopoDs, myPoint ) ) { - this->myOkEdge = true ; - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ; - } - } - } - break ; - } - } - return ; -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_PointDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: // default constructor - break; - case 1: - { - if(send == SelectButton_Edge) { - LineEdit_Edge->setFocus() ; - SelectionIntoArgument() ; - } - break; - } - } - return ; -} - - -//======================================================================= -// function : UseLocalContext() -// purpose : Return true when this method has opened a local context -// : Used from GeometryGUI -//======================================================================= -bool GeometryGUI_PointDlg::UseLocalContext() -{ - return this->myUseLocalContext ; -} - - -//======================================================================= -// function : closeEvent() -// purpose : -//======================================================================= -void GeometryGUI_PointDlg::closeEvent(QCloseEvent* e) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//======================================================================= -// function : ClickOnCancel() -// purpose : -//======================================================================= -void GeometryGUI_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 ; - } - } - mySelection->ClearFilters() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->EraseSimulationShape() ; - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : to reactivate this dialog box when mouse enter onto the window -//================================================================================= -void GeometryGUI_PointDlg::enterEvent( QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : public slot to deactivate if active -//================================================================================= -void GeometryGUI_PointDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - mySelection->ClearFilters() ; - GroupConstructors->setEnabled(false) ; - GroupCoordinates->setEnabled(false) ; - GroupWithEdge->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - myGeomGUI->EraseSimulationShape() ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - if ( myConstructorId == 0 && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - myIC->CloseLocalContext(myLocalContextId) ; - myUseLocalContext = false ; - } - } - - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_PointDlg::ActivateThisDialog( ) -{ - - if ( !GroupConstructors->isEnabled() ) { /* if not active */ - - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupCoordinates->setEnabled(true) ; - GroupWithEdge->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - - myGeomGUI->SetState(POINT_METHOD) ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - if ( myConstructorId == 0 ) { - - mySelection->ClearFilters() ; - if( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - myLocalContextId = myIC->OpenLocalContext(); - myGeomGUI->SetDisplayedObjectList(); - /* sub shapes selection */ - myLocalContextMode = TopAbs_VERTEX ; - myIC->ActivateStandardMode(myLocalContextMode); - myUseLocalContext = true ; - } - } - - if ( myConstructorId == 1 ) - mySelection->AddFilter( myEdgeFilter ); - - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - } - return ; -} - - -//================================================================================= -// function : CalculateVertexOnCurve() -// purpose : Calculate a Vertex on the curve given by 'anEdge'. -// : The position of resultVertex is given by aParameter. -// : For a linear edge, aParameter=0.0 gives the first vertex of edge -// : aParameter=1.0 gives the last vertex of edge -// : aParameter=0.5 gives the vertex on the middle of edge -// : It is possible to get vertices out of edge using values > 1.0 or < 0.0 -//================================================================================= -bool GeometryGUI_PointDlg::CalculateVertexOnCurve(const TopoDS_Edge& anEdge, const Standard_Real aParameter, TopoDS_Shape& resultVertex) -{ -#if OCC_VERSION_MAJOR >= 5 - if( anEdge.IsNull() || !BRepAlgo::IsValid(anEdge) ) -#else - if( anEdge.IsNull() || !BRepAlgoAPI::IsValid(anEdge) ) -#endif - return false ; - - Standard_Real first, last ; - Handle(Geom_Curve) curv = BRep_Tool::Curve(anEdge, first, last); - if( !curv->IsCN(0) ) - return false ; - - Standard_Real param; - if( anEdge.Orientation() == TopAbs_FORWARD ) { - param = first + (last-first) * aParameter ; - } - else { - param = last + (first-last) * aParameter ; - } - gp_Pnt paramPoint ; - curv->D0( param, paramPoint ) ; - resultVertex = BRepBuilderAPI_MakeVertex(paramPoint); - return true ; -} - diff --git a/src/GEOMGUI/GeometryGUI_PointDlg.h b/src/GEOMGUI/GeometryGUI_PointDlg.h deleted file mode 100644 index 2de8161ee..000000000 --- a/src/GEOMGUI/GeometryGUI_PointDlg.h +++ /dev/null @@ -1,153 +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 : GeometryGUI_PointDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_POINT_H -#define DIALOGBOX_POINT_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLabel; -class QSpinBox; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_PointDlg -// purpose : -//================================================================================= -class GeometryGUI_PointDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_PointDlg( QWidget* parent = 0, const char* name = 0, - SALOME_Selection* Sel = 0, - const Handle(AIS_InteractiveContext)& ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - - ~GeometryGUI_PointDlg(); - -private : - - SALOME_Selection* mySelection ; /* Current selection */ - TopoDS_Shape mySimulationTopoDs; /* Shape used to display a simulation */ - gp_Pnt myPoint ; /* Is 'mySimulationTopoDs' */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - - /* Interactive and local context management see also : bool UseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context from IAPP */ - Standard_Integer myLocalContextId ; /* identify a local context for this method */ - TopAbs_ShapeEnum myLocalContextMode ; /* identify a selection mode into local context */ - bool myUseLocalContext ; /* true when method as opened a local context */ - - int myConstructorId ; /* Current constructor id = radio button id */ - double myParameter ; /* Parameter used to create a vertex on edge (point on curve) */ - bool myOkEdge ; /* true when an edge is selected by user */ - - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* filter for selection */ - - void Init(SALOME_Selection* Sel, const Handle(AIS_InteractiveContext)& ic) ; /* Initialize dialog */ - void enterEvent(QEvent* e); - void closeEvent(QCloseEvent* e) ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - - QGroupBox* GroupCoordinates; - QLabel* TextLabel_X; - QLabel* TextLabel_Y; - QLabel* TextLabel_Z; - - GeometryGUI_SpinBox* SpinBox_X ; - GeometryGUI_SpinBox* SpinBox_Y ; - GeometryGUI_SpinBox* SpinBox_Z ; - - QGroupBox* GroupWithEdge; - QLabel* TextLabel_Edge; - QPushButton* SelectButton_Edge; - QLineEdit* LineEdit_Edge; - QLabel* TextLabel_Parameter; - GeometryGUI_SpinBox* SpinBox_Parameter; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - bool CalculateVertexOnCurve(const TopoDS_Edge& anEdge, const Standard_Real aParameter, TopoDS_Shape& resultVertex) ; - -public: - void PointIntoCoordinates(gp_Pnt P, bool displayPoint) ; - bool UseLocalContext() ; /* return true if method has opened a local context */ - -protected: - QGridLayout* GeometryGUI_PointDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupCoordinatesLayout; - QGridLayout* GroupWithEdgeLayout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_POINT_H diff --git a/src/GEOMGUI/GeometryGUI_PrismDlg.cxx b/src/GEOMGUI/GeometryGUI_PrismDlg.cxx deleted file mode 100644 index 21ce8eba7..000000000 --- a/src/GEOMGUI/GeometryGUI_PrismDlg.cxx +++ /dev/null @@ -1,608 +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 : GeometryGUI_PrismDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_PrismDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_PrismDlg() -// purpose : Constructs a GeometryGUI_PrismDlg 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. -//================================================================================= -GeometryGUI_PrismDlg::GeometryGUI_PrismDlg( 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_PRISM"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_PrismDlg" ); - resize( 303, 225 ); - setCaption( tr( "GEOM_PRISM_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_PrismDlgLayout = new QGridLayout( this ); - GeometryGUI_PrismDlgLayout->setSpacing( 6 ); - GeometryGUI_PrismDlgLayout->setMargin( 11 ); - - /**************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_PRISM" ) ); - 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() ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 2 ); - GeometryGUI_PrismDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /**************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_PRISM_BSV" ) ); - 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 ); - LineEditC1A2Line = new QLineEdit( GroupConstructor1, "LineEditC1A2Line" ); - LineEditC1A2Line->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2Line->sizePolicy().hasHeightForWidth() ) ); - GroupConstructor1Layout->addMultiCellWidget( LineEditC1A2Line, 1, 1, 2, 3 ); - LineEditC1A1Base = new QLineEdit( GroupConstructor1, "LineEditC1A1Base" ); - LineEditC1A1Base->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Base->sizePolicy().hasHeightForWidth() ) ); - GroupConstructor1Layout->addMultiCellWidget( LineEditC1A1Base, 0, 0, 2, 3 ); - SelectButtonC1A1Base = new QPushButton( GroupConstructor1, "SelectButtonC1A1Base" ); - SelectButtonC1A1Base->setText( tr( "" ) ); - SelectButtonC1A1Base->setPixmap( image1 ); - GroupConstructor1Layout->addWidget( SelectButtonC1A1Base, 0, 1 ); - SelectButtonC1A2Line = new QPushButton( GroupConstructor1, "SelectButtonC1A2Line" ); - SelectButtonC1A2Line->setText( tr( "" ) ); - SelectButtonC1A2Line->setPixmap( image1 ); - GroupConstructor1Layout->addWidget( SelectButtonC1A2Line, 1, 1 ); - TextLabelBase = new QLabel( GroupConstructor1, "TextLabelBase" ); - TextLabelBase->setText( tr( "GEOM_BASE" ) ); - TextLabelBase->setMinimumSize( QSize( 50, 0 ) ); - TextLabelBase->setFrameShape( QLabel::NoFrame ); - TextLabelBase->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelBase, 0, 0 ); - TextLabelVector = new QLabel( GroupConstructor1, "TextLabelVector" ); - TextLabelVector->setText( tr( "GEOM_VECTOR" ) ); - TextLabelVector->setMinimumSize( QSize( 50, 0 ) ); - TextLabelVector->setFrameShape( QLabel::NoFrame ); - TextLabelVector->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelVector, 1, 0 ); - - SpinBox_C1A3Height = new GeometryGUI_SpinBox( GroupConstructor1, "GeomSpinBox_C1A3Height" ) ; - SpinBox_C1A3Height->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_C1A3Height->sizePolicy().hasHeightForWidth() ) ); - GroupConstructor1Layout->addWidget( SpinBox_C1A3Height, 2, 3 ); - - CheckBoxC3A1Reverse = new QCheckBox( GroupConstructor1, "CheckBoxC3A1Reverse" ); - CheckBoxC3A1Reverse->setText( tr( "GEOM_REVERSE" ) ); - GroupConstructor1Layout->addMultiCellWidget( CheckBoxC3A1Reverse, 2, 2, 0, 1 ); - TextLabelHeight = new QLabel( GroupConstructor1, "TextLabelHeight" ); - TextLabelHeight->setText( tr( "GEOM_HEIGHT" ) ); - TextLabelHeight->setMinimumSize( QSize( 50, 0 ) ); - TextLabelHeight->setFrameShape( QLabel::NoFrame ); - TextLabelHeight->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelHeight, 2, 2 ); - GeometryGUI_PrismDlgLayout->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, 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 ); - GeometryGUI_PrismDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_PrismDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_PrismDlg::~GeometryGUI_PrismDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::Init( SALOME_Selection* Sel ) -{ - - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_C1A3Height->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C1A3Height->SetValue( 100.0 ) ; /* = myHeight */ - - myHeight = 100.000 ; - mySelection = Sel ; - mySimulationTopoDs.Nullify() ; - myBaseTopo.Nullify() ; - myConstructorId = 0 ; - myDx = myDy = myDz = 0.0 ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - GroupConstructor1->show(); - myConstructorId = 0 ; - myEditCurrentArgument = LineEditC1A1Base ; - Constructor1->setChecked( TRUE ); - myOkBase = myOkLine = false ; - - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - /* Retrieves geom component */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - /* Filters definition */ - myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom ); - - - // TODO first selection into selection ? - - /* 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) ), this, SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1Base, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC1A2Line, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( LineEditC1A1Base, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2Line, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( CheckBoxC3A1Reverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseVector(int) ) ) ; - - connect( SpinBox_C1A3Height, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_PrismDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: /* base shape + an edge used as a vector */ - { - GroupConstructor1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1Base ; - LineEditC1A2Line->setText(tr("")) ; - - SpinBox_C1A3Height->SetValue(100) ; - myHeight = 100.0 ; - - Constructor1->setChecked( TRUE ); - myOkBase = myOkLine = false ; - SelectionIntoArgument() ; - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::ClickOnApply() -{ - gp_Pnt P1, P2 ; - - if( !myOkBase || !myOkLine ) - return ; - - try { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - gp_Vec Vec(myDx, myDy, myDz ); - Vec.Normalize() ; - Vec *= myHeight ; - P1.SetCoord( 0.0, 0.0, 0.0 ) ; - P2.SetCoord( Vec.X(), Vec.Y(), Vec.Z() ) ; - switch(myConstructorId) - { - case 0 : - { - if( myOkBase && myOkLine ) { - myGeomGUI->MakePrismAndDisplay( myGeomShape, P1, P2 ) ; - } - break ; - } - } - } - catch(Standard_Failure) { - MESSAGE("Exception intercepted in GeometryGUI_PrismDlg" << endl ) ; - return ; - } - - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_PrismDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future the name of selection */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1Base ) { - LineEditC1A1Base->setText("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2Line ) { - LineEditC1A2Line->setText("") ; - myOkLine = false ; - } - break ; - } - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - gp_Pnt aPoint1, aPoint2 ; - - if ( myEditCurrentArgument == LineEditC1A1Base ) { - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - Standard_Boolean testResult ; - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult) - return ; - if ( S.ShapeType() <= 2 ) - return; - - LineEditC1A1Base->setText(aString) ; - myBaseTopo = S ; - myOkBase = true ; - } - - else if ( myEditCurrentArgument == LineEditC1A2Line && myGeomGUI->LinearEdgeExtremities(S, aPoint1, aPoint2) ) { - myGeomGUI->GetBipointDxDyDz( aPoint1, aPoint2, myDx, myDy, myDz ) ; - myEditCurrentArgument->setText(aString) ; - myOkLine = true ; - } - - if( myOkBase && myOkLine ) { - MakePrismSimulationAndDisplay( myBaseTopo ) ; - } - return ; -} - - - -//================================================================================= -// function : MakePrismSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::MakePrismSimulationAndDisplay( const TopoDS_Shape& S ) -{ - try { - gp_Vec Vec(myDx, myDy, myDz ); - Vec.Normalize() ; - Vec *= myHeight ; - mySimulationTopoDs = BRepPrimAPI_MakePrism(S, Vec, Standard_False).Shape() ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakePrismSimulationAndDisplay" << endl ) ; - return ; - } - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if( send == SelectButtonC1A1Base ) { - LineEditC1A1Base->setFocus() ; - myEditCurrentArgument = LineEditC1A1Base ; - } - else if(send == SelectButtonC1A2Line) { - LineEditC1A2Line->setFocus() ; - myEditCurrentArgument = LineEditC1A2Line; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::ValueChangedInSpinBox( double newValue ) -{ - QObject* send = (QObject*)sender(); - - if( send == SpinBox_C1A3Height ) { - myHeight = newValue ; - if( myOkBase && myOkLine ) { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - MakePrismSimulationAndDisplay( myBaseTopo ) ; - } - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Base ) - myEditCurrentArgument = LineEditC1A1Base ; - else if ( send == LineEditC1A2Line ) - myEditCurrentArgument = LineEditC1A2Line ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_PrismDlg::enterEvent( QEvent * ) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_PrismDlg::ActivateThisDialog() -{ - /* 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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : ReverseVector() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_PrismDlg::ReverseVector(int state) -{ - myDx = -myDx ; - myDy = -myDy ; - myDz = -myDz ; - if(myOkBase && myOkLine) { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - MakePrismSimulationAndDisplay( myBaseTopo ) ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_PrismDlg.h b/src/GEOMGUI/GeometryGUI_PrismDlg.h deleted file mode 100644 index 8425fc152..000000000 --- a/src/GEOMGUI/GeometryGUI_PrismDlg.h +++ /dev/null @@ -1,129 +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 : GeometryGUI_PrismDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_PRISM_H -#define DIALOGBOX_PRISM_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_PrismDlg -// purpose : -//================================================================================= -class GeometryGUI_PrismDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_PrismDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_PrismDlg(); - -private : - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void MakePrismSimulationAndDisplay( const TopoDS_Shape& S) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - SALOME_Selection* mySelection ; /* User shape selection */ - Standard_Real myDx ; - Standard_Real myDy ; - Standard_Real myDz ; - Standard_Real myHeight ; /* Height used for prism (extrusion) */ - TopoDS_Shape myBaseTopo ; /* topology used as base of prism */ - GEOM::GEOM_Shape_var myGeomShape ; /* that is myBaseTopo */ - bool myOkBase ; - bool myOkLine ; /* to check when arguments myDx, myDy, myDz are defined */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupConstructor1; - - QLineEdit* LineEditC1A1Base; - QLineEdit* LineEditC1A2Line; - QPushButton* SelectButtonC1A1Base; - QPushButton* SelectButtonC1A2Line; - QLabel* TextLabelBase; - QLabel* TextLabelVector; - GeometryGUI_SpinBox* SpinBox_C1A3Height; - QCheckBox* CheckBoxC3A1Reverse; - QLabel* TextLabelHeight; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ReverseVector(int state) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_PrismDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_PRISM_H diff --git a/src/GEOMGUI/GeometryGUI_PropertiesDlg.cxx b/src/GEOMGUI/GeometryGUI_PropertiesDlg.cxx deleted file mode 100644 index ba6c71b3e..000000000 --- a/src/GEOMGUI/GeometryGUI_PropertiesDlg.cxx +++ /dev/null @@ -1,467 +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 : GeometryGUI_PropertiesDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_PropertiesDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - - -//================================================================================= -// class : GeometryGUI_PropertiesDlg() -// purpose : Constructs a GeometryGUI_PropertiesDlg 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. -//================================================================================= -GeometryGUI_PropertiesDlg::GeometryGUI_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 ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BASICPROPERTIES"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_PropertiesDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_PROPERTIES_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_PropertiesDlgLayout = new QGridLayout( this ); - GeometryGUI_PropertiesDlgLayout->setSpacing( 6 ); - GeometryGUI_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 ); - GeometryGUI_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 ); - GeometryGUI_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 ); - - GeometryGUI_PropertiesDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_PropertiesDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_PropertiesDlg::~GeometryGUI_PropertiesDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::Init( SALOME_Selection* Sel ) -{ - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_PropertiesDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_PropertiesDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - LineEdit_Length->setText("") ; - LineEdit_Surface->setText("") ; - LineEdit_Volume->setText("") ; - myEditCurrentArgument->setText("") ; - - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() || S.ShapeType() == TopAbs_VERTEX ) { - myEditCurrentArgument->setText( "" ); - return ; - } - - LineEditC1A1->setText(aString) ; - - /* Try to display of a cone simulation shape to show direction of a linear edge only in OCC viewer */ - if( myGeomGUI->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) { - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - this->CalculateAndDisplayProperties(S) ; - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::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 GeometryGUI_PropertiesDlg::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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - myGeomGUI->EraseSimulationShape() ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : CalculateAndDisplayProperties() -// purpose : -//================================================================================= -void GeometryGUI_PropertiesDlg::CalculateAndDisplayProperties(const TopoDS_Shape& S) -{ - LineEdit_Length->setText("") ; - LineEdit_Surface->setText("") ; - LineEdit_Volume->setText("") ; - if( S.IsNull() ) - return ; - - Standard_Real result; - GProp_GProps LProps; - GProp_GProps 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) ; - } - - 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) ; - } - } - catch(Standard_Failure) - { - MESSAGE("Catch intercepted in CalculateAndDisplayProperties()" << endl ) ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_PropertiesDlg.h b/src/GEOMGUI/GeometryGUI_PropertiesDlg.h deleted file mode 100644 index 2251e2882..000000000 --- a/src/GEOMGUI/GeometryGUI_PropertiesDlg.h +++ /dev/null @@ -1,116 +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 : GeometryGUI_PropertiesDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM - -#ifndef DIALOGBOX_PROPERTIES_H -#define DIALOGBOX_PROPERTIES_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_PropertiesDlg -// purpose : -//================================================================================= -class GeometryGUI_PropertiesDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_PropertiesDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_PropertiesDlg(); - -private: - - 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 */ - GeometryGUI* myGeomGUI ; /* 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; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_PropertiesDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_PROPERTIES_H diff --git a/src/GEOMGUI/GeometryGUI_RevolDlg.cxx b/src/GEOMGUI/GeometryGUI_RevolDlg.cxx deleted file mode 100644 index 1cbea9437..000000000 --- a/src/GEOMGUI/GeometryGUI_RevolDlg.cxx +++ /dev/null @@ -1,560 +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 : GeometryGUI_RevolDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_RevolDlg.h" - -#include - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_RevolDlg() -// purpose : Constructs a GeometryGUI_RevolDlg 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. -//================================================================================= -GeometryGUI_RevolDlg::GeometryGUI_RevolDlg( 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_REVOL"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_RevolDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_REVOLUTION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_RevolDlgLayout = new QGridLayout( this ); - GeometryGUI_RevolDlgLayout->setSpacing( 6 ); - GeometryGUI_RevolDlgLayout->setMargin( 11 ); - - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_REVOLUTION" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_RevolDlgLayout->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 ); - GeometryGUI_RevolDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - 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_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 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, - SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 3 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_AXIS" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - SelectButtonC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, - SelectButtonC1A2->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addMultiCellWidget( LineEditC1A2, 1, 1, 2, 3 ); - - CheckBoxReverse = new QCheckBox( GroupC1, "CheckBoxReverse" ); - CheckBoxReverse->setText( tr( "GEOM_REVERSE" ) ); - GroupC1Layout->addMultiCellWidget( CheckBoxReverse, 2, 2, 0, 1 ); - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_ANGLE" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 2 ); - SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ; - GroupC1Layout->addWidget( SpinBox_C1A3, 2, 3 ); - - GeometryGUI_RevolDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_RevolDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_RevolDlg::~GeometryGUI_RevolDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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 spin boxes */ - SpinBox_C1A3->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_C1A3->SetValue( 45.0 ) ; /* = myAngle */ - myAngle = 45.0 ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - myOkBase = false ; - myOkAxis = false ; - - mySimulationTopoDs.Nullify() ; - myBase.Nullify() ; - 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); - myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom ); - - /* 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( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( CheckBoxReverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle(int) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - -//================================================================================= -// function : ReverseAngle() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_RevolDlg::ReverseAngle(int state) -{ - myAngle = -myAngle ; - SpinBox_C1A3->SetValue( myAngle ) ; - - if(myOkBase && myOkAxis) { - MakeRevolutionSimulationAndDisplay(myBase) ; - } else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_RevolDlg::ConstructorsClicked(int constructorId) -{ - /* only a constructor now */ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if(myOkBase && myOkAxis) { - myGeomGUI->MakeRevolutionAndDisplay( myGeomShape, myLoc, myDir, myAngle*PI180 ) ; - } - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_RevolDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - LineEditC1A2->setText("") ; - myOkAxis = false ; - } - return ; - } - - /* nbSel == 1 ! */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - - /* test if appropriate shape for revol */ - TopAbs_ShapeEnum aType = S.ShapeType() ; - if(aType != TopAbs_VERTEX && aType != TopAbs_EDGE && aType != TopAbs_WIRE && aType != TopAbs_FACE && aType != TopAbs_SHELL && aType != TopAbs_COMPOUND ) - return ; - - LineEditC1A1->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, myLoc, myDir) */) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - myLoc = curv.Line().Location(); - LineEditC1A2->setText(aString) ; - myOkAxis = true ; - } - - if( myOkBase && myOkAxis ) { - MakeRevolutionSimulationAndDisplay( myBase) ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->ClearFilters() ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::ValueChangedInSpinBox( double newValue ) -{ - myAngle = newValue ; - if ( myOkBase && myOkAxis ) { - MakeRevolutionSimulationAndDisplay(myBase) ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : MakeRevolutionSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_RevolDlg::MakeRevolutionSimulationAndDisplay( const TopoDS_Shape& S) -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - if( S.IsNull() ) - return ; - - TopAbs_ShapeEnum aType = S.ShapeType() ; - if(aType != TopAbs_VERTEX && aType != TopAbs_EDGE && aType != TopAbs_WIRE && aType != TopAbs_FACE && aType != TopAbs_SHELL && aType !=TopAbs_COMPOUND ) - return ; - - try { - gp_Ax1 AX( this->myLoc, this->myDir); - mySimulationTopoDs = BRepPrimAPI_MakeRevol(S, AX, this->myAngle*PI180 ); - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeRevolutionSimulationAndDisplay" ) ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_RevolDlg.h b/src/GEOMGUI/GeometryGUI_RevolDlg.h deleted file mode 100644 index 5d4096c45..000000000 --- a/src/GEOMGUI/GeometryGUI_RevolDlg.h +++ /dev/null @@ -1,133 +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 : GeometryGUI_RevolDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_REVOLUTION_H -#define DIALOGBOX_REVOLUTION_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_RevolDlg -// purpose : -//================================================================================= -class GeometryGUI_RevolDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_RevolDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_RevolDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - TopoDS_Shape myBase ; - GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */ - - gp_Pnt myLoc ; - gp_Dir myDir ; - - Standard_Real myAngle ; - - bool myOkBase ; - bool myOkAxis ; - 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 MakeRevolutionSimulationAndDisplay( const TopoDS_Shape& S) ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - GeometryGUI_SpinBox* SpinBox_C1A3 ; /* for angle */ - QLabel* TextLabelC1A3; - QCheckBox* CheckBoxReverse; - -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 state) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_RevolDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_REVOLUTION_H diff --git a/src/GEOMGUI/GeometryGUI_RotationDlg.cxx b/src/GEOMGUI/GeometryGUI_RotationDlg.cxx deleted file mode 100644 index 84e63dc42..000000000 --- a/src/GEOMGUI/GeometryGUI_RotationDlg.cxx +++ /dev/null @@ -1,548 +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 : GeometryGUI_RotationDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_RotationDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_RotationDlg() -// purpose : Constructs a GeometryGUI_RotationDlg 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. -//================================================================================= -GeometryGUI_RotationDlg::GeometryGUI_RotationDlg( 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_ROTATION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_RotationDlg" ); - resize( 303, 251 ); - setCaption( tr( "GEOM_ROTATION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_RotationDlgLayout = new QGridLayout( this ); - GeometryGUI_RotationDlgLayout->setSpacing( 6 ); - GeometryGUI_RotationDlgLayout->setMargin( 11 ); - - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_ROTATION" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_RotationDlgLayout->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 ); - GeometryGUI_RotationDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - 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 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - SelectButtonC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, - SelectButtonC1A2->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 3 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addMultiCellWidget( LineEditC1A2, 1, 1, 2, 3 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, - SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_AXIS" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - - SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ; - GroupC1Layout->addWidget( SpinBox_C1A3, 2, 3 ); - - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_ANGLE" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 2 ); - CheckBoxReverse = new QCheckBox( GroupC1, "CheckBoxReverse" ); - CheckBoxReverse->setText( tr( "GEOM_REVERSE" ) ); - GroupC1Layout->addMultiCellWidget( CheckBoxReverse, 2, 2, 0, 1 ); - GeometryGUI_RotationDlgLayout->addWidget( GroupC1, 1, 0 ); - - Init(Sel) ; /* Initialisations */ -} - -//================================================================================= -// function : ~GeometryGUI_RotationDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_RotationDlg::~GeometryGUI_RotationDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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 spin boxes */ - SpinBox_C1A3->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_C1A3->SetValue( 45.0 ) ; /* = myAngle */ - myAngle = 45.0 ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myOkBase = myOkAxis = 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 ); - - /* 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( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - -//================================================================================= -// function : ReverseAngle() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_RotationDlg::ReverseAngle(int state) -{ - myAngle = -myAngle ; - SpinBox_C1A3->SetValue( myAngle ) ; - if( myOkBase && myOkAxis ) { - MakeRotationSimulationAndDisplay( myBase ) ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_RotationDlg::ConstructorsClicked(int constructorId) -{ - /* only a constructor now */ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if(myOkBase && myOkAxis) { - myGeomGUI->MakeRotationAndDisplay( myGeomShape, myLoc, myDir, myAngle*PI180) ; - } - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_RotationDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* name of future selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - myOkBase = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - LineEditC1A2->setText("") ; - myOkAxis = false ; - } - return ; - } - - /* nbSel == 1 ! */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - LineEditC1A1->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, myLoc, myDir) */) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - myLoc = curv.Line().Location(); - LineEditC1A2->setText(aString) ; - myOkAxis = true ; - } - - if( myOkBase && myOkAxis ) { - MakeRotationSimulationAndDisplay( myBase) ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->ClearFilters() ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::ValueChangedInSpinBox( double newValue ) -{ - myAngle = newValue ; - if (myOkBase && myOkAxis) { - MakeRotationSimulationAndDisplay(myBase) ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : MakeRotationSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_RotationDlg::MakeRotationSimulationAndDisplay( const TopoDS_Shape& S) -{ - myGeomGUI->EraseSimulationShape() ; - - if( S.IsNull() ) - return ; - - try { - gp_Ax1 AX( this->myLoc, this->myDir ) ; - gp_Trsf theTransformation ; - theTransformation.SetRotation(AX, this->myAngle*PI180 ) ; - BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False) ; - this->mySimulationTopoDs = myBRepTransformation.Shape() ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeRotationSimulationAndDisplay" ) ; - return ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_RotationDlg.h b/src/GEOMGUI/GeometryGUI_RotationDlg.h deleted file mode 100644 index 36d6e3985..000000000 --- a/src/GEOMGUI/GeometryGUI_RotationDlg.h +++ /dev/null @@ -1,132 +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 : GeometryGUI_RotationDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_ROTATION_H -#define DIALOGBOX_ROTATION_H - - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_RotationDlg -// purpose : -//================================================================================= -class GeometryGUI_RotationDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_RotationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_RotationDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - TopoDS_Shape myBase ; - GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */ - - gp_Pnt myLoc ; - gp_Dir myDir ; - Standard_Real myAngle ; - - bool myOkBase ; - bool myOkAxis ; - 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 MakeRotationSimulationAndDisplay( const TopoDS_Shape& S) ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - GeometryGUI_SpinBox* SpinBox_C1A3 ; /* for angle */ - QLabel* TextLabelC1A3; - QCheckBox* CheckBoxReverse; - -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 state) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_RotationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_ROTATION_H diff --git a/src/GEOMGUI/GeometryGUI_ScaleDlg.cxx b/src/GEOMGUI/GeometryGUI_ScaleDlg.cxx deleted file mode 100644 index b91517b8a..000000000 --- a/src/GEOMGUI/GeometryGUI_ScaleDlg.cxx +++ /dev/null @@ -1,535 +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 : GeometryGUI_ScaleDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_ScaleDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_ScaleDlg() -// purpose : Constructs a GeometryGUI_ScaleDlg 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. -//================================================================================= -GeometryGUI_ScaleDlg::GeometryGUI_ScaleDlg( 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_SCALE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_ScaleDlg" ); - resize( 303, 253 ); - setCaption( tr( "GEOM_SCALE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_ScaleDlgLayout = new QGridLayout( this ); - GeometryGUI_ScaleDlgLayout->setSpacing( 6 ); - GeometryGUI_ScaleDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SCALE" ) ); - 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() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - GeometryGUI_ScaleDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - 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 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_CENTRAL_POINT" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" ); - GroupC1Layout->addWidget( LineEditC1A3, 2, 2 ); - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_SCALE_FACTOR" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - GeometryGUI_ScaleDlgLayout->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, 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 ); - GeometryGUI_ScaleDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - -//================================================================================= -// function : ~GeometryGUI_ScaleDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_ScaleDlg::~GeometryGUI_ScaleDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::Init( SALOME_Selection* Sel ) -{ - - LineEditC1A3->setMaxLength( 10 ); - QDoubleValidator *Va = new QDoubleValidator( -999999, +999999, 3, LineEditC1A3 ) ; - LineEditC1A3->setValidator( Va ) ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkBaseTopo = false ; - myFactor = 2.0 ; - LineEditC1A3->setText("2.0") ; - mySimulationTopoDs.Nullify() ; - myBaseTopo.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - mySelection->AddFilter(myVertexFilter) ; /* first filter used */ - - /* 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( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( LineEditC1A3, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_ScaleDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupC1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1 ; - Constructor1->setChecked( TRUE ); - LineEditC1A1->setText(tr("")) ; - LineEditC1A2->setText(tr("")) ; - myOkPoint1 = myOkBaseTopo = false ; - myFactor = 2.0 ; - /* filter for next selections */ - mySelection->ClearFilters() ; - mySelection->AddFilter( myVertexFilter ); - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - - switch(myConstructorId) - { - case 0 : - { - if( myOkBaseTopo && myOkPoint1 ) - myGeomGUI->MakeScaleAndDisplay(myGeomShape, myPoint1, myFactor ) ; - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2 ) - myEditCurrentArgument = LineEditC1A2 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : TextChangedInLineEdit() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::TextChangedInLineEdit(const QString& newText) -{ - QLineEdit* send = (QLineEdit*)sender(); - if(send == LineEditC1A3) { - myGeomGUI->EraseSimulationShape() ; - myFactor = newText.toFloat(); - if( fabs(myFactor) > 0.00001 && myOkBaseTopo && myOkPoint1 ) - MakeScaleSimulationAndDisplay(myBaseTopo) ; - } - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_ScaleDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myEditCurrentArgument->setText("") ; - myOkBaseTopo = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - myEditCurrentArgument->setText("") ; - myOkPoint1 = false ; - } - return ; - } - - // nbSel == 1 - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* Constructor */ - if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myEditCurrentArgument->setText(aString) ; - myBaseTopo = S ; - myOkBaseTopo = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - myEditCurrentArgument->setText(aString) ; - myOkPoint1 = true ; - } - - if( myOkBaseTopo && myOkPoint1 ) { - MakeScaleSimulationAndDisplay( myBaseTopo ) ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->ClearFilters() ; - SelectionIntoArgument() ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : MakeScaleSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_ScaleDlg::MakeScaleSimulationAndDisplay( const TopoDS_Shape& S ) -{ - this->mySimulationTopoDs.Nullify() ; - - try { - gp_Trsf theTransformation ; - theTransformation.SetScale( myPoint1, myFactor) ; - BRepBuilderAPI_Transform myBRepTransformation( S, theTransformation, Standard_False) ; - mySimulationTopoDs = myBRepTransformation.Shape() ; - if( mySimulationTopoDs.IsNull() ) - return ; - else - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeScaleSimulationAndDisplay" ) ; - return ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_ScaleDlg.h b/src/GEOMGUI/GeometryGUI_ScaleDlg.h deleted file mode 100644 index e261ed585..000000000 --- a/src/GEOMGUI/GeometryGUI_ScaleDlg.h +++ /dev/null @@ -1,121 +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 : GeometryGUI_ScaleDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_SCALE_H -#define DIALOGBOX_SCALE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_ScaleDlg -// purpose : -//================================================================================= -class GeometryGUI_ScaleDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_ScaleDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_ScaleDlg(); - -private : - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e ); - void Init(SALOME_Selection* Sel) ; - void MakeScaleSimulationAndDisplay( const TopoDS_Shape& S ) ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ - SALOME_Selection* mySelection ; /* User shape selection */ - gp_Pnt myPoint1 ; /* Points containing the vector */ - TopoDS_Shape myBaseTopo ; - GEOM::GEOM_Shape_var myGeomShape ; /* is myBaseTopo */ - Standard_Real myFactor ; - bool myOkPoint1 ; /* true when myPoint1 is defined */ - bool myOkBaseTopo ; /* true when myBaseTopo is defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QPushButton* SelectButtonC1A1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QLineEdit* LineEditC1A3; - QLabel* TextLabelC1A3; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots : - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void TextChangedInLineEdit(const QString& newText) ; - -protected: - QGridLayout* GeometryGUI_ScaleDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_SCALE_H diff --git a/src/GEOMGUI/GeometryGUI_SectionDlg.cxx b/src/GEOMGUI/GeometryGUI_SectionDlg.cxx deleted file mode 100644 index 4fea1aa15..000000000 --- a/src/GEOMGUI/GeometryGUI_SectionDlg.cxx +++ /dev/null @@ -1,471 +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 : GeometryGUI_SectionDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_SectionDlg.h" - -#include "GeometryGUI.h" - -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_SectionDlg() -// purpose : Constructs a GeometryGUI_SectionDlg 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. -//================================================================================= -GeometryGUI_SectionDlg::GeometryGUI_SectionDlg( 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_SECTION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_SectionDlg" ); - resize( 303, 224 ); - setCaption( tr( "GEOM_SECTION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_SectionDlgLayout = new QGridLayout( this ); - GeometryGUI_SectionDlgLayout->setSpacing( 6 ); - GeometryGUI_SectionDlgLayout->setMargin( 11 ); - - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SECTION" ) ); - 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 ); - GeometryGUI_SectionDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - 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 ); - GeometryGUI_SectionDlgLayout->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, 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 ); - GeometryGUI_SectionDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisation */ - Init( Sel ) ; -} - - -//================================================================================= -// function : ~GeometryGUI_SectionDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_SectionDlg::~GeometryGUI_SectionDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::Init( SALOME_Selection* Sel ) -{ - mySelection = Sel ; - myShape1.Nullify() ; - myShape2.Nullify() ; - myConstructorId = 0 ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - 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) ),this, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_SectionDlg::ConstructorsClicked(int constructorId) -{ - GeometryGUI::GetGeometryGUI()->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupConstructor1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1Shape ; - LineEditC1A2Shape->setText(tr("")) ; - Constructor1->setChecked( TRUE ); - myOkShape1 = myOkShape2 = false ; - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::ClickOnApply() -{ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkShape1 && myOkShape2) { - myGeomGUI->MakeBooleanAndDisplay(myGeomShape1, myGeomShape2, 4 ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void GeometryGUI_SectionDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myOkShape1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myOkShape2 = false ; - } - break ; - } - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape1 = S ; - LineEditC1A1Shape->setText(aString) ; - myOkShape1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - myShape2 = S ; - LineEditC1A2Shape->setText(aString) ; - myOkShape2 = true ; - } - - return ; -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::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 ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1Shape ) - myEditCurrentArgument = LineEditC1A1Shape ; - else if ( send == LineEditC1A2Shape ) - myEditCurrentArgument = LineEditC1A2Shape ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - } - return ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void GeometryGUI_SectionDlg::enterEvent( QEvent * ) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_SectionDlg::ActivateThisDialog() -{ - /* 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() ) ); - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_SectionDlg.h b/src/GEOMGUI/GeometryGUI_SectionDlg.h deleted file mode 100644 index 5ac5b2a8f..000000000 --- a/src/GEOMGUI/GeometryGUI_SectionDlg.h +++ /dev/null @@ -1,116 +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 : GeometryGUI_SectionDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header: - -#ifndef DIALOGBOX_SECTION_H -#define DIALOGBOX_SECTION_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_SectionDlg -// purpose : -//================================================================================= -class GeometryGUI_SectionDlg : public QDialog{ - Q_OBJECT - -public: - GeometryGUI_SectionDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_SectionDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - TopoDS_Shape myShape1 ; /* topology used to fuse */ - TopoDS_Shape myShape2 ; /* topology used to fuse */ - GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */ - GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */ - bool myOkShape1 ; - bool myOkShape2 ; /* to check when arguments are defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A2Shape; - QLineEdit* LineEditC1A1Shape; - QPushButton* SelectButtonC1A1Shape; - QPushButton* SelectButtonC1A2Shape; - QLabel* TextLabelC1A2Shape; - QLabel* TextLabelC1A1Shape; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - - -protected: - QGridLayout* GeometryGUI_SectionDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_SECTION_H diff --git a/src/GEOMGUI/GeometryGUI_SewingDlg.cxx b/src/GEOMGUI/GeometryGUI_SewingDlg.cxx deleted file mode 100644 index d74ba155d..000000000 --- a/src/GEOMGUI/GeometryGUI_SewingDlg.cxx +++ /dev/null @@ -1,393 +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 : GeometryGUI_SewingDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_SewingDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_SewingDlg() -// purpose : Constructs a GeometryGUI_SewingDlg 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. -//================================================================================= -GeometryGUI_SewingDlg::GeometryGUI_SewingDlg( 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_SEWING"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_SewingDlg" ); - resize( 303, 219 ); - setCaption( tr( "GEOM_SEWING_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_SewingDlgLayout = new QGridLayout( this ); - GeometryGUI_SewingDlgLayout->setSpacing( 6 ); - GeometryGUI_SewingDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SEWING" ) ); - 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( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_SewingDlgLayout->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 ); - GeometryGUI_SewingDlgLayout->addWidget( GroupButtons, 2, 0 ); - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A2->setMinimumSize( QSize( 40, 0 ) ); - LineEditC1A2->setMaximumSize( QSize( 32767, 32767 ) ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) ); - 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_PRECISION" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - GeometryGUI_SewingDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_SewingDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_SewingDlg::~GeometryGUI_SewingDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::Init( SALOME_Selection* Sel ) -{ - LineEditC1A1->setMaxLength( 10 ); - QDoubleValidator *Va = new QDoubleValidator( -0.000001, +10000.0, 3, LineEditC1A1 ) ; - LineEditC1A1->setValidator( Va ) ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkListShapes = false ; - this->myPrecision = 0.00001 ; - LineEditC1A2->setText("0.00001") ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - 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( 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( LineEditC1A2, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_SewingDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - if(myOkListShapes) { - myGeomGUI->MakeSewingAndDisplay( myListShapes, myPrecision ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::ClickOnCancel() -{ - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_SewingDlg::SelectionIntoArgument() -{ - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - - myOkListShapes = false; - myEditCurrentArgument->setText("") ; - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel < 2 ) { - return ; - } - - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; - myEditCurrentArgument->setText(aString) ; - myOkListShapes = true ; - /* no simulation */ - return ; -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::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 GeometryGUI_SewingDlg::LineEditReturnPressed() -{ - this->myPrecision = LineEditC1A2->text().toFloat(); - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_SewingDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - diff --git a/src/GEOMGUI/GeometryGUI_SewingDlg.h b/src/GEOMGUI/GeometryGUI_SewingDlg.h deleted file mode 100644 index 8e2545bd6..000000000 --- a/src/GEOMGUI/GeometryGUI_SewingDlg.h +++ /dev/null @@ -1,111 +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 : GeometryGUI_SewingDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_SEWING_H -#define DIALOGBOX_SEWING_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_SewingDlg -// purpose : -//================================================================================= -class GeometryGUI_SewingDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_SewingDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_SewingDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - GEOM::GEOM_Gen::ListOfIOR myListShapes ; - Standard_Real myPrecision ; - bool myOkListShapes ; /* to check when arguments is defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_SewingDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_SEWING_H diff --git a/src/GEOMGUI/GeometryGUI_ShellDlg.cxx b/src/GEOMGUI/GeometryGUI_ShellDlg.cxx deleted file mode 100644 index a7492b479..000000000 --- a/src/GEOMGUI/GeometryGUI_ShellDlg.cxx +++ /dev/null @@ -1,375 +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 : GeometryGUI_ShellDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_ShellDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_ShellDlg() -// purpose : Constructs a GeometryGUI_ShellDlg 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. -//================================================================================= -GeometryGUI_ShellDlg::GeometryGUI_ShellDlg( QWidget* parent, const char* name, SALOME_Selection* Sel = 0, 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_SHELL"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - if ( !name ) - setName( "GeometryGUI_ShellDlg" ); - resize( 303, 190 ); - setCaption( tr( "GEOM_SHELL_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_ShellDlgLayout = new QGridLayout( this ); - GeometryGUI_ShellDlgLayout->setSpacing( 6 ); - GeometryGUI_ShellDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SHELL" ) ); - 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 ); - GeometryGUI_ShellDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_SHELL_LIST" ) ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_FACES" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - GeometryGUI_ShellDlgLayout->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, 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 ); - GeometryGUI_ShellDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_ShellDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_ShellDlg::~GeometryGUI_ShellDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkListShapes = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - 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( 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( 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_ShellDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - if(myOkListShapes) { - // myGeomGUI->MakeShellAndDisplay( myListShapes ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_ShellDlg::SelectionIntoArgument() -{ - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - myEditCurrentArgument->setText("") ; - myOkListShapes = false; - - QString aString = ""; /* name of future selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel < 1 ) { - return ; - } - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; - - myEditCurrentArgument->setText(aString) ; - myOkListShapes = true ; - /* no simulation */ - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::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 GeometryGUI_ShellDlg::LineEditReturnPressed() -{ - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::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 ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_ShellDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - diff --git a/src/GEOMGUI/GeometryGUI_ShellDlg.h b/src/GEOMGUI/GeometryGUI_ShellDlg.h deleted file mode 100644 index 0e3fc1940..000000000 --- a/src/GEOMGUI/GeometryGUI_ShellDlg.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 : GeometryGUI_ShellDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_SHELL_H -#define DIALOGBOX_SHELL_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_ShellDlg -// purpose : -//================================================================================= -class GeometryGUI_ShellDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_ShellDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_ShellDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - GEOM::GEOM_Gen::ListOfIOR myListShapes ; - bool myOkListShapes ; /* to check when argument is defined */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_ShellDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QHBoxLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_SHELL_H diff --git a/src/GEOMGUI/GeometryGUI_SphereDlg.cxx b/src/GEOMGUI/GeometryGUI_SphereDlg.cxx deleted file mode 100644 index a78e1f7fc..000000000 --- a/src/GEOMGUI/GeometryGUI_SphereDlg.cxx +++ /dev/null @@ -1,560 +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 : GeometryGUI_SphereDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_SphereDlg.h" -#include "GeometryGUI_SpinBox.h" - -#include "GeometryGUI.h" - -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_SphereDlg() -// purpose : Constructs a GeometryGUI_SphereDlg 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. -//================================================================================= -GeometryGUI_SphereDlg::GeometryGUI_SphereDlg( 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_SPHERE_P"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SPHERE_DXYZ"))); - - if ( !name ) - setName( "GeometryGUI_SphereDlg" ); - resize( 303, 219 ); - setCaption( tr( "GEOM_SPHERE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_SphereDlgLayout = new QGridLayout( this ); - GeometryGUI_SphereDlgLayout->setSpacing( 6 ); - GeometryGUI_SphereDlgLayout->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_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 ); - GeometryGUI_SphereDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SPHERE" ) ); - 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_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 3 ); - 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( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - GroupConstructors->insert( Constructor2, 1 ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - Constructor2->setPixmap( image2 ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - GeometryGUI_SphereDlgLayout->addWidget( GroupConstructors, 0, 0 ); - GroupConstructor1 = new QGroupBox( this, "GroupConstructor1" ); - GroupConstructor1->setTitle( tr( "GEOM_SPHERE_CR" ) ); - 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_CENTER" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A2 = new QLabel( GroupConstructor1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_RADIUS" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupConstructor1Layout->addWidget( TextLabelC1A2, 1, 0 ); - - SpinBox_C1A2 = new GeometryGUI_SpinBox( GroupConstructor1, "GeomSpinBox_C1A2" ) ; - GroupConstructor1Layout->addWidget( SpinBox_C1A2, 1, 2 ); - - GeometryGUI_SphereDlgLayout->addWidget( GroupConstructor1, 1, 0 ); - - /***************************************************************/ - GroupConstructor2 = new QGroupBox( this, "GroupConstructor2" ); - GroupConstructor2->setTitle( tr( "GEOM_SPHERE_RO" ) ); - GroupConstructor2->setColumnLayout(0, Qt::Vertical ); - GroupConstructor2->layout()->setSpacing( 0 ); - GroupConstructor2->layout()->setMargin( 0 ); - GroupConstructor2Layout = new QGridLayout( GroupConstructor2->layout() ); - GroupConstructor2Layout->setAlignment( Qt::AlignTop ); - GroupConstructor2Layout->setSpacing( 6 ); - GroupConstructor2Layout->setMargin( 11 ); - - SpinBox_C2A1 = new GeometryGUI_SpinBox( GroupConstructor2, "GeomSpinBox_C2A1" ) ; - GroupConstructor2Layout->addWidget( SpinBox_C2A1, 0, 1 ); - - TextLabelC2A1 = new QLabel( GroupConstructor2, "TextLabelC2A1" ); - TextLabelC2A1->setText( tr( "GEOM_RADIUS" ) ); - TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A1->setFrameShape( QLabel::NoFrame ); - TextLabelC2A1->setFrameShadow( QLabel::Plain ); - GroupConstructor2Layout->addWidget( TextLabelC2A1, 0, 0 ); - QSpacerItem* spacer_5 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); - GroupConstructor2Layout->addItem( spacer_5, 1, 1 ); - GeometryGUI_SphereDlgLayout->addWidget( GroupConstructor2, 1, 0 ); - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_SphereDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_SphereDlg::~GeometryGUI_SphereDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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 spin boxes */ - SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C1A2->SetValue( 100.0 ) ; - SpinBox_C2A1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C2A1->SetValue( 100.0 ) ; - - GroupConstructor1->show(); - GroupConstructor2->hide(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - - myRadius = 100.0 ; - myOkRadius = true ; - myOkPoint1 = false ; - - mySimulationTopoDs.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - mySelection->AddFilter(myVertexFilter) ; /* first filter used */ - - /* 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( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A1, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_SphereDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - - switch (constructorId) - { - case 0: - { - GroupConstructor1->show(); - GroupConstructor2->hide(); - myConstructorId = constructorId ; - myEditCurrentArgument = SpinBox_C1A2 ; - LineEditC1A1->setText(tr("")) ; - SpinBox_C1A2->SetValue( 100.0 ) ; - myRadius = 100.0 ; - myOkRadius = true ; - myOkPoint1 = false ; - /* filter for next selections */ - mySelection->ClearFilters() ; - mySelection->AddFilter( myVertexFilter ); - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - break; - } - case 1: - { - GroupConstructor1->hide(); - GroupConstructor2->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = SpinBox_C2A1 ;; - SpinBox_C2A1->SetValue( 100.0 ) ; - myRadius = 100.0 ; - myOkRadius = true ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); /* at origin */ - myOkPoint1 = false ; - mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - /* no filters here */ - mySelection->ClearFilters() ; - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if( myOkPoint1 && myOkRadius ) { - myGeomGUI->MakeSphereAndDisplay( myPoint1, myRadius ) ; - } - break ; - } - case 1 : - { - if( myOkRadius ) - myGeomGUI->MakeSphereAndDisplay( myPoint1, myRadius ) ; - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_SphereDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future name of selection */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - myOkPoint1 = false ; - } - return ; - } - - /* nbSel == 1 ! */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* Constructor 1 treatment */ - if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditC1A1->setText(aString) ; - myOkPoint1 = true ; - } - - if( ( myOkPoint1 || myConstructorId == 1 ) && myOkRadius ) { - mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::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. */ - QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ; - const QString objectUserName = LE->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - LE->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::ValueChangedInSpinBox( double newValue ) -{ - myRadius = newValue ; - myOkRadius = true ; - - if ( ( myOkPoint1 || myConstructorId == 1 ) && myOkRadius ) { - mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - - return ; -} - - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - } - break; - } - case 1: - { - /* no selection button here */ - break; - } - - } - return ; -} - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - GroupConstructor2->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate other active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupConstructor1->setEnabled(true) ; - GroupConstructor2->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_SphereDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - - diff --git a/src/GEOMGUI/GeometryGUI_SphereDlg.h b/src/GEOMGUI/GeometryGUI_SphereDlg.h deleted file mode 100644 index cd5027971..000000000 --- a/src/GEOMGUI/GeometryGUI_SphereDlg.h +++ /dev/null @@ -1,131 +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 : GeometryGUI_SphereDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_SPHERE_H -#define DIALOGBOX_SPHERE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QSpinBox; -class QPushButton; -class GeometryGUI_SpinBox; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_SphereDlg -// purpose : -//================================================================================= -class GeometryGUI_SphereDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_SphereDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_SphereDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - SALOME_Selection* mySelection ; /* User shape selection */ - gp_Pnt myPoint1 ; /* Points containing the vector */ - - Standard_Real myRadius ; - bool myOkRadius ; - QDoubleValidator *myVa ; /* Double validator for numeric input myRadius in LineEditC1A2 */ - QDoubleValidator *myVb ; /* Double validator for numeric input myRadius in LineEditC2A1 */ - - bool myOkPoint1 ; /* Are true when myPoint is defined */ - QWidget* myEditCurrentArgument; /* Current LineEdit or SpinBox */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QGroupBox* GroupConstructor1; - QLineEdit* LineEditC1A1; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - // QLineEdit* LineEditC1A2; - QGroupBox* GroupConstructor2; - // QLineEdit* LineEditC2A1; - GeometryGUI_SpinBox* SpinBox_C1A2 ; - GeometryGUI_SpinBox* SpinBox_C2A1 ; - QLabel* TextLabelC2A1; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void LineEditReturnPressed() ; - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_SphereDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupConstructor2Layout; -}; - -#endif // DIALOGBOX_SPHERE_H diff --git a/src/GEOMGUI/GeometryGUI_SubShapeDlg.cxx b/src/GEOMGUI/GeometryGUI_SubShapeDlg.cxx deleted file mode 100644 index 945ff3c76..000000000 --- a/src/GEOMGUI/GeometryGUI_SubShapeDlg.cxx +++ /dev/null @@ -1,745 +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 : GeometryGUI_SubShapeDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_SubShapeDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_RightFrame.h" -#include "OCCViewer_Viewer3d.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include - -//================================================================================= -// class : GeometryGUI_SubShapeDlg() -// purpose : Constructs a GeometryGUI_SubShapeDlg 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. -//================================================================================= -GeometryGUI_SubShapeDlg::GeometryGUI_SubShapeDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - 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_SUBSHAPE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_SUBSHAPE" ); - resize( 303, 239 ); - setCaption( tr( "GEOM_SUBSHAPE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_SubShapeDlgLayout = new QGridLayout( this ); - GeometryGUI_SubShapeDlgLayout->setSpacing( 6 ); - GeometryGUI_SubShapeDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SUB_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)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_SubShapeDlgLayout->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 ); - GeometryGUI_SubShapeDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - 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 ); - TextLabelComboBox1 = new QLabel( GroupC1, "TextLabelComboBox1" ); - TextLabelComboBox1->setText( tr( "GEOM_SUBSHAPE_TYPE" ) ); - GroupC1Layout->addMultiCellWidget( TextLabelComboBox1, 1, 1, 0, 1 ); - ComboBox1 = new QComboBox( FALSE, GroupC1, "ComboBox1" ); - ComboBox1->setMaxCount( 100 ); - GroupC1Layout->addMultiCellWidget( ComboBox1, 1, 1, 2, 3 ); - CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" ); - CheckBox1->setText( tr( "GEOM_SUBSHAPE_SELECT" ) ); - CheckBox1->setChecked( FALSE ); - GroupC1Layout->addMultiCellWidget( CheckBox1, 2, 2, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 3 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - GeometryGUI_SubShapeDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - /* Initialisations */ - Init(Sel, ic) ; -} - - -//================================================================================= -// function : ~GeometryGUI_SubShapeDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_SubShapeDlg::~GeometryGUI_SubShapeDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myShape.Nullify() ; - - myIC = ic ; - myUseLocalContext = false ; - myLocalContextId = -1; - myAbort = false ; - myOkShape = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - /* type for sub shape selection */ - ComboBox1->insertItem("Compound"); - ComboBox1->insertItem("Compsolid"); - ComboBox1->insertItem("Solid"); - ComboBox1->insertItem("Shell"); - ComboBox1->insertItem("Face"); - ComboBox1->insertItem("Wire"); - ComboBox1->insertItem("Edge"); - ComboBox1->insertItem("Vertex"); - ComboBox1->insertItem("Shape"); - - myWithShape = true; - myShapeType = ComboBox1->currentItem(); - - /* Select sub shapes mode not checked */ - CheckBox1->setChecked( FALSE ); - myOkSelectSubMode = CheckBox1->isChecked(); - - // 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) ), this, SLOT( ConstructorsClicked(int) ) ); - - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( CheckBox1, SIGNAL (stateChanged(int) ), this, SLOT( AllOrNotAll() ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); - - connect( ComboBox1, SIGNAL( activated(int) ), this, SLOT( ComboTextChanged() ) ); - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* display Dialog */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_SubShapeDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::ClickOnOk() -{ - this->ClickOnApply() ; - - /* User has aborted or not operation of explode all with many sub shapes */ - if( this->myAbort == false ) - this->ClickOnCancel() ; - else - this->myAbort = false ; - - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::ClickOnApply() -{ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - bool testResult = false ; - - this->myAbort = false ; /* Not aborted by default */ - - switch(myConstructorId) - { - case 0 : - { - /* Explode all sub shapes */ - if( myOkShape && !myOkSelectSubMode ) { - - /* More than 30 subshapes : ask confirmation */ - unsigned int nb = NumberOfSubShapes( myShape, myShapeType ) ; - if( nb > 30 ) { - const QString caption = tr("GEOM_CONFIRM") ; - const QString text = tr("GEOM_CONFIRM_INFO").arg(nb) ; - const QString button0 = tr("GEOM_BUT_EXPLODE") ; - const QString button1 = tr("GEOM_BUT_CANCEL") ; - - if( QMessageBox::warning( this, caption, text, button0, button1 ) == 0 ) - testResult = myGeomGUI->OnSubShapeGetAll( myShape, myShapeIOR, myShapeType ) ; - else - this->myAbort = true ; /* aborted */ - } - else { - testResult = myGeomGUI->OnSubShapeGetAll( myShape, myShapeIOR, myShapeType ) ; - } - } - /* explode only selected sub shapes */ - else if( myOkShape && myOkSelectSubMode ) { - testResult = myGeomGUI->OnSubShapeGetSelected( myShape, myShapeIOR, myShapeType, myLocalContextId, myUseLocalContext ) ; - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - this->myAbort = true; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::ClickOnCancel() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - - 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) ; - myGeomGUI->OnDisplayAll(true) ; - this->myUseLocalContext = false ; - } - } - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -// : used only by SelectButtonC1A1 (LineEditC1A1) -//================================================================================= -void GeometryGUI_SubShapeDlg::SelectionIntoArgument() -{ - - /* Reset all arguments and local context when selection as changed */ - this->ResetStateOfDialog() ; - - QString aString = ""; /* future name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - - if ( nbSel != 1 ) { - LineEditC1A1->setText("") ; - myOkShape = false; - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( !IO->hasEntry() ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ; - return ; - } - - if ( !S.IsNull() && S.ShapeType() != TopAbs_VERTEX ) - { - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) - { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ - LineEditC1A1->setText(aString) ; - myShape = S ; - myOkShape = true ; - } - else - { - 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); - myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - LineEditC1A1->setText(aString) ; - } - } - } - - int SelectedShapeType = ComboBox1->currentItem(); - int count = ComboBox1->count(); - if ( myWithShape ) count = count - 1; - - int i = 0; - while ( i <= myShape.ShapeType() ) { - ComboBox1->removeItem(0); - i++; - } - - if (myShape.ShapeType()==TopAbs_COMPOUND) - { - if (myWithShape == false) { - ComboBox1->insertItem("Shape"); - myWithShape = true; - } - } - else - { - if (myWithShape == true) { - ComboBox1->removeItem( ComboBox1->count() -1 ); - myWithShape = false; - } - } - - int count1 = ComboBox1->count(); - if ( myWithShape ) count1 = count1 - 1; - - if ( SelectedShapeType > myShape.ShapeType() ) { - if ( SelectedShapeType == 8 ) { - if ( myShape.ShapeType() != TopAbs_COMPOUND ) { - ComboBox1->setCurrentItem(0); - myShapeType = 8 - count1; - } - } else { - ComboBox1->setCurrentItem( count1 - count + SelectedShapeType ); - myShapeType = 8 - count1 + ComboBox1->currentItem(); - } - } else { - ComboBox1->setCurrentItem(0); - myShapeType = 8 - count1; - } - } -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::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 GeometryGUI_SubShapeDlg::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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::DeactivateActiveDialog() -{ - /* Check if active */ - if ( GroupConstructors->isEnabled() ) { - - this->ResetStateOfDialog() ; - - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate other active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : AllOrNotAll() -// purpose : Allow user selection of all or only selected sub shapes -// : Called when 'CheckBox1' state change -//================================================================================= -void GeometryGUI_SubShapeDlg::AllOrNotAll() -{ - - /* No sub shape selection if main shape not selected */ - if( !this->myOkShape ) { - ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ; - return ; - } - - if (myShapeType ==TopAbs_SHAPE && myShape.ShapeType()==TopAbs_COMPOUND) - { - /* Select sub shapes mode not checked */ - myOkSelectSubMode = false ; - CheckBox1->setChecked( FALSE ); - //no meaning to allow user selection for type = shape - //TODO - add another message - //myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ; - return ; - } - - myOkSelectSubMode = CheckBox1->isChecked() ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; - return; - } - - if( myOkShape && myOkSelectSubMode ) { - /* local context is defined into the method */ - myGeomGUI->PrepareSubShapeSelection( this->myShapeType, this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")) ; - } - return ; -} - - -//================================================================================= -// function : ResetStateOfDialog() -// purpose : Completely reset the state of method including local context -//================================================================================= -void GeometryGUI_SubShapeDlg::ResetStateOfDialog() -{ - /* To leave current selection if explode all as been aborted by user */ - if( this->myAbort == true ) { - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; - } - else { - ; /* nothing to do : keep selection argument */ - } - - int SelectedShapeType = ComboBox1->currentItem(); - int count = ComboBox1->count(); - if ( myWithShape ) count = count - 1; - /* type for sub shape selection */ - ComboBox1->clear(); - ComboBox1->insertItem("Compound"); - ComboBox1->insertItem("Compsolid"); - ComboBox1->insertItem("Solid"); - ComboBox1->insertItem("Shell"); - ComboBox1->insertItem("Face"); - ComboBox1->insertItem("Wire"); - ComboBox1->insertItem("Edge"); - ComboBox1->insertItem("Vertex"); - ComboBox1->insertItem("Shape"); - this->myWithShape=true; - ComboBox1->setCurrentItem( 8 - count + SelectedShapeType ); - - - /* unpress buttons : due to abort box*/ - this->buttonApply->setDown(FALSE) ; - this->buttonOk->setDown(FALSE) ; - - /* Select sub shapes mode not checked */ - this->myOkSelectSubMode = false ; - this->CheckBox1->setChecked( FALSE ); - - /* Close its local contact if opened */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - return ; -} - - - -//================================================================================= -// function : ComboTextChanged() -// purpose : -//================================================================================= -void GeometryGUI_SubShapeDlg::ComboTextChanged() -{ - if ( myOkShape ) - this->myShapeType = ComboBox1->currentItem() + myShape.ShapeType() + 1; - else - this->myShapeType = ComboBox1->currentItem(); - - /* Select sub shapes mode not checked */ - CheckBox1->setChecked( FALSE ); - myOkSelectSubMode = FALSE ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - return ; -} - - -//================================================================================= -// function : NumberOfSubShapes() -// purpose : -//================================================================================= -unsigned int GeometryGUI_SubShapeDlg::NumberOfSubShapes( const TopoDS_Shape& S, const int shapeType ) -{ - if( S.IsNull() ) - return 0 ; - - unsigned int index = 0 ; - TopExp_Explorer Exp( S, TopAbs_ShapeEnum(shapeType) ); - TopTools_MapOfShape M; - while ( Exp.More() ) { - if ( M.Add(Exp.Current()) ) - index++; - Exp.Next(); - } - M.Clear() ; - return index ; -} - - diff --git a/src/GEOMGUI/GeometryGUI_SubShapeDlg.h b/src/GEOMGUI/GeometryGUI_SubShapeDlg.h deleted file mode 100644 index 7435721de..000000000 --- a/src/GEOMGUI/GeometryGUI_SubShapeDlg.h +++ /dev/null @@ -1,139 +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 : GeometryGUI_SubShapeDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_SUBSHAPE_H -#define DIALOGBOX_SUBSHAPE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QComboBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_SubShapeDlg -// purpose : -//================================================================================= -class GeometryGUI_SubShapeDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_SubShapeDlg( QWidget* parent = 0, - const char* name = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - - ~GeometryGUI_SubShapeDlg(); - -private : - - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void ResetStateOfDialog() ; - - unsigned int NumberOfSubShapes( const TopoDS_Shape& S, const int shapeType ) ; - - - /* Interactive and local context management see also : bool myUseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape myShape ; - char* myShapeIOR ; - bool myOkShape ; - int myShapeType ; /* define a type of topology mode of sub selection */ - - bool myWithShape ; /* check if Shape item exists */ - - bool myOkSelectSubMode ; /* true = sub mode selection activated */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - bool myAbort ; /* Indicate if sub Shape All has been aborted by user */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelComboBox1; - QComboBox* ComboBox1; - - QCheckBox* CheckBox1; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void LineEditReturnPressed() ; - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void AllOrNotAll() ; - void ComboTextChanged() ; - -protected: - QGridLayout* GeometryGUI_SubShapeDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_SUBSHAPE_H diff --git a/src/GEOMGUI/GeometryGUI_SuppressFacesDlg.cxx b/src/GEOMGUI/GeometryGUI_SuppressFacesDlg.cxx deleted file mode 100644 index bdd7bfa90..000000000 --- a/src/GEOMGUI/GeometryGUI_SuppressFacesDlg.cxx +++ /dev/null @@ -1,523 +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 : GeometryGUI_SuppressFacesDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_SuppressFacesDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_SuppressFacesDlg() -// purpose : Constructs a GeometryGUI_SuppressFacesDlg 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. -//================================================================================= -GeometryGUI_SuppressFacesDlg::GeometryGUI_SuppressFacesDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - 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_SUPRESS_FACE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_SuppressFacesDlg" ); - resize( 322, 203 ); - setCaption( tr( "GEOM_SUPRESSFACE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_SuppressFacesDlgLayout = new QGridLayout( this ); - GeometryGUI_SuppressFacesDlgLayout->setSpacing( 6 ); - GeometryGUI_SuppressFacesDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SUPRESSFACE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_SuppressFacesDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - Layout2 = new QHBoxLayout; - Layout2->setSpacing( 6 ); - Layout2->setMargin( 0 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - Layout2->addWidget( TextLabelC1A1 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - Layout2->addWidget( SelectButtonC1A1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setAlignment( int( QLineEdit::AlignLeft ) ); - Layout2->addWidget( LineEditC1A1 ); - GroupC1Layout->addLayout( Layout2, 0, 0 ); - CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" ); - CheckBox1->setText( tr( "GEOM_SUPRESSFACE_SELECT" ) ); - CheckBox1->setChecked( FALSE ); - GroupC1Layout->addWidget( CheckBox1, 1, 0 ); - GeometryGUI_SuppressFacesDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupButtons->sizePolicy().hasHeightForWidth() ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - // - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_2, 0, 2 ); - buttonClose = new QPushButton( GroupButtons, "buttonClose" ); - buttonClose->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonClose->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonClose, 0, 3 ); - GeometryGUI_SuppressFacesDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /* Initialisations */ - Init(Sel, ic) ; - -} - - -//================================================================================= -// function : ~GeometryGUI_SuppressFacesDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_SuppressFacesDlg::~GeometryGUI_SuppressFacesDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myShape.Nullify() ; - - myIC = ic ; - myUseLocalContext = false ; - myOkShape = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - /* Select sub shapes mode not checked */ - CheckBox1->setChecked( FALSE ); - myOkSelectSubMode = 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( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( buttonClose, SIGNAL( clicked() ), this, SLOT( ClickOnClose() ) ); - connect( GroupConstructors, SIGNAL( clicked(int) ), this, SLOT( ConstructorsClicked(int) )); - - connect( SelectButtonC1A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() )); - connect( CheckBox1, SIGNAL( stateChanged(int) ), this, SLOT( ActivateUserSelection() )); - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() )); - connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnClose() )); - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* display Dialog */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - -//================================================================================= -// function : ClickOnOk() -// purpose : Same than click on apply but close this dialog. -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ClickOnOk() -{ - this->ClickOnApply() ; - accept(); - - return ; -} - - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ClickOnApply() -{ - bool testResult = false ; - switch(myConstructorId) - { - case 0 : - { - if( myOkShape && myOkSelectSubMode ) { - testResult = myGeomGUI->OnSuppressFaces( myShape, myShapeIOR, myLocalContextId, myUseLocalContext ) ; - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset arguments to allow a new selection */ - this->ResetStateOfDialog() ; - break ; - } - } - return ; -} - - - -//================================================================================= -// function : ClickOnClose() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ClickOnClose() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - - if(myUseLocalContext) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -// : used only by SelectButtonC1A1 (LineEditC1A1) -//================================================================================= -void GeometryGUI_SuppressFacesDlg::SelectionIntoArgument() -{ - - /* Reset argument and local context when selection as changed */ - this->ResetStateOfDialog() ; - - QString aString = ""; /* name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) - return ; - - /* nbSel == 1 */ - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( !IO->hasEntry() ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ; - return ; - } - - /* Test the exact type of topology to suppress faces into */ - if ( !S.IsNull() && ( S.ShapeType() == TopAbs_SOLID || S.ShapeType() == TopAbs_SHELL || S.ShapeType() == TopAbs_COMPOUND ) ) { - - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ - LineEditC1A1->setText(aString) ; - myShape = S ; - myOkShape = true ; - return; - } - - if ( IO->hasEntry() ) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() ); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if ( !obj->_is_nil() ) { - if (obj->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - LineEditC1A1->setText(aString) ; - return; - } - } - } - - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::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 GeometryGUI_SuppressFacesDlg::LineEditReturnPressed() -{ - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - this->ResetStateOfDialog() ; - - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate other active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : Mouse enter onto the dialog to activate it -//================================================================================= -void GeometryGUI_SuppressFacesDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_SuppressFacesDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnClose() ; - return ; -} - - -//================================================================================= -// function : ActivateUserSelection() -// purpose : Activate selection of faces when CheckBox1->isChecked()... -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ActivateUserSelection() -{ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - if( !this->myOkShape ) { - this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ; - return ; - } - - this->myOkSelectSubMode = CheckBox1->isChecked() ; - - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - - if( myOkShape && myOkSelectSubMode ) { - /* local context is defined into the method : 4 = FACES sub selection */ - myGeomGUI->PrepareSubShapeSelection( int(TopAbs_FACE), this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")) ; - } - } else { - CheckBox1->setChecked( false ); - } - - return ; -} - - - -//================================================================================= -// function : ResetStateOfDialog() -// purpose : Completely reset the state of method including local context -//================================================================================= -void GeometryGUI_SuppressFacesDlg::ResetStateOfDialog() -{ - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; - - /* Select sub shapes mode not checked */ - this->myOkSelectSubMode = false ; - this->CheckBox1->setChecked( FALSE ); - - /* Close its local contact if opened */ - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_SuppressFacesDlg.h b/src/GEOMGUI/GeometryGUI_SuppressFacesDlg.h deleted file mode 100644 index 6e332c6e7..000000000 --- a/src/GEOMGUI/GeometryGUI_SuppressFacesDlg.h +++ /dev/null @@ -1,130 +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 : GeometryGUI_SuppressFacesDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_SUPPRESSFACES_H -#define DIALOGBOX_SUPPRESSFACES_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_SuppressFacesDlg -// purpose : -//================================================================================= -class GeometryGUI_SuppressFacesDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_SuppressFacesDlg( QWidget* parent = 0, - const char* name = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - - ~GeometryGUI_SuppressFacesDlg(); - -private : - - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void ResetStateOfDialog() ; - - /* Interactive and local context management see also : bool myUseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape myShape ; - char* myShapeIOR ; - bool myOkShape ; - - bool myOkSelectSubMode ; /* true = sub mode selection activated */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonApply; - QPushButton* buttonClose; - - QCheckBox* CheckBox1; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnApply() ; - void ClickOnClose(); - - void LineEditReturnPressed() ; - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ActivateUserSelection() ; - -protected: - QGridLayout* GeometryGUI_SuppressFacesDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QHBoxLayout* Layout2; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_SUPPRESSFACES_H diff --git a/src/GEOMGUI/GeometryGUI_SuppressHoleDlg.cxx b/src/GEOMGUI/GeometryGUI_SuppressHoleDlg.cxx deleted file mode 100644 index 3078160c9..000000000 --- a/src/GEOMGUI/GeometryGUI_SuppressHoleDlg.cxx +++ /dev/null @@ -1,969 +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 : GeometryGUI_SuppressHoleDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_SuppressHoleDlg.h" -#include "GeometryGUI.h" - -#include "TopExp_Explorer.hxx" - -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_RightFrame.h" -#include "OCCViewer_Viewer3d.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_SuppressHoleDlg() -// purpose : Constructs a GeometryGUI_SuppressHoleDlg 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. -//================================================================================= -GeometryGUI_SuppressHoleDlg::GeometryGUI_SuppressHoleDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - 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_SUPRESS_HOLE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SUPRESS_HOLE_FACE_SHELL"))); - - if ( !name ) - setName( "GeometryGUI_SuppressHoleDlg" ); - resize( 303, 204 ); - setCaption( tr( "GEOM_SUPPRESSHOLE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_SuppressHoleLayout = new QGridLayout( this ); - GeometryGUI_SuppressHoleLayout->setSpacing( 6 ); - GeometryGUI_SuppressHoleLayout->setMargin( 11 ); - - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setChecked( TRUE ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_4, 0, 3 ); - GeometryGUI_SuppressHoleLayout->addWidget( GroupConstructors, 0, 0 ); - - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupButtons->sizePolicy().hasHeightForWidth() ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QHBoxLayout( 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 ); - buttonOk->setAccel( 276824143 ); - GroupButtonsLayout->addWidget( buttonOk ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_2 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - buttonApply->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply ); - buttonClose = new QPushButton( GroupButtons, "buttonClose" ); - buttonClose->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonClose->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonClose ); - GeometryGUI_SuppressHoleLayout->addWidget( GroupButtons, 2, 0 ); - - /* First constructor */ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - - Layout2 = new QHBoxLayout; - Layout2->setSpacing( 6 ); - Layout2->setMargin( 0 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - Layout2->addWidget( TextLabelC1A1 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - Layout2->addWidget( SelectButtonC1A1 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setAlignment( int( QLineEdit::AlignLeft ) ); - Layout2->addWidget( LineEditC1A1 ); - - GroupC1Layout->addLayout( Layout2, 0, 0 ); - - CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" ); - CheckBox1->setText( tr( "GEOM_SUPPRESSHOLE_SELECTFACE" ) ); - CheckBox1->setChecked( FALSE ); - GroupC1Layout->addWidget( CheckBox1, 1, 0 ); - - CheckBox2 = new QCheckBox( GroupC1, "CheckBox2" ); - CheckBox2->setText( tr( "GEOM_SUPPRESSHOLE_SELECTWIRE" ) ); - CheckBox2->setChecked( FALSE ); - GroupC1Layout->addWidget( CheckBox2, 2, 0 ); - - CheckBox3 = new QCheckBox( GroupC1, "CheckBox3" ); - CheckBox3->setText( tr( "GEOM_SUPPRESSHOLE_SELECTFACE_END" ) ); - CheckBox3->setChecked( FALSE ); - GroupC1Layout->addWidget( CheckBox3, 3, 0 ); - GeometryGUI_SuppressHoleLayout->addWidget( GroupC1, 1, 0 ); - - /* Second constructor */ - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "" ) ); - 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 ); - - Layout3 = new QHBoxLayout; - Layout3->setSpacing( 6 ); - Layout3->setMargin( 0 ); - - TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" ); - TextLabelC2A1->setText( tr( "GEOM_SUPPRESSHOLE_FACE_SHELL" ) ); - TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A1->setFrameShape( QLabel::NoFrame ); - TextLabelC2A1->setFrameShadow( QLabel::Plain ); - Layout3->addWidget( TextLabelC2A1 ); - - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setText( tr( "" ) ); - SelectButtonC2A1->setPixmap( image1 ); - SelectButtonC2A1->setToggleButton( FALSE ); - SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) ); - Layout3->addWidget( SelectButtonC2A1 ); - - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - LineEditC2A1->setAlignment( int( QLineEdit::AlignLeft ) ); - Layout3->addWidget( LineEditC2A1 ); - - GroupC2Layout->addLayout( Layout3, 0, 0 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); - GroupC2Layout->addItem( spacer_3, 2, 0 ); - - CheckBoxC2_1 = new QCheckBox( GroupC2, "CheckBoxC2_1" ); - CheckBoxC2_1->setText( tr( "GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE" ) ); - CheckBoxC2_1->setChecked( FALSE ); - - GroupC2Layout->addWidget( CheckBoxC2_1, 1, 0 ); - GeometryGUI_SuppressHoleLayout->addWidget( GroupC2, 1, 0 ); - - - /* Initialisations */ - Init(Sel, ic) ; -} - - -//================================================================================= -// function : ~GeometryGUI_SuppressHoleDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_SuppressHoleDlg::~GeometryGUI_SuppressHoleDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) -{ - GroupC1->show(); - GroupC2->hide(); - - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myShape.Nullify() ; - - myIC = ic ; - myUseLocalContext = false ; - myOkShape = false ; - myOkSelectFace = false ; - - myListOfIdFace = new GEOM::GEOM_Shape::ListOfSubShapeID; - myListOfIdWire = new GEOM::GEOM_Shape::ListOfSubShapeID; - myListOfIdEndFace = new GEOM::GEOM_Shape::ListOfSubShapeID; - - myListOfIdFace->length(0) ; - myListOfIdWire->length(0) ; - myListOfIdEndFace->length(0) ; - - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - /* Select sub modes not checked */ - CheckBox1->setChecked( FALSE ); /* sub mode GEOM::FACE */ - CheckBox2->setChecked( FALSE ); /* sub mode GEOM::WIRE */ - CheckBox3->setChecked( FALSE ); /* sub mode END GEOM::FACE */ - - CheckBoxC2_1->setChecked( FALSE ); /* sub mode GEOM::WIRE(S) */ - - // 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( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( buttonClose, SIGNAL( clicked() ), this, SLOT( ClickOnClose() ) ); - connect( GroupConstructors, SIGNAL( clicked(int) ), this, SLOT( ConstructorsClicked(int) )); - - connect( SelectButtonC1A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() )); - connect( SelectButtonC2A1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() )); - - connect( CheckBox1, SIGNAL( stateChanged(int) ), this, SLOT( ActivateUserFaceSelection() )); - connect( CheckBox2, SIGNAL( stateChanged(int) ), this, SLOT( ActivateUserWireSelection() )); - connect( CheckBox3, SIGNAL( stateChanged(int) ), this, SLOT( ActivateUserEndFaceSelection() )); - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - /* for the second constructor */ - connect( CheckBoxC2_1, SIGNAL( stateChanged(int) ), this, SLOT( ActivateUserWiresOnFaceShellSelection() )); - - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() )); - connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnClose() )); - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* display Dialog */ - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ConstructorsClicked(int constructorId) -{ - switch (constructorId) - { - case 0: - { - GroupC1->show(); - GroupC2->hide(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1 ; - LineEditC1A1->setText(tr("")) ; - myOkShape = false ; - myOkSelectFace = false ; - this->ResetPartial() ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - break; - } - case 1: - { - GroupC1->hide(); - GroupC2->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC2A1 ; - LineEditC2A1->setText(tr("")) ; - myOkShape = false ; - this->ResetPartial() ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - this->ResetPartial() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnOk() -// purpose : Same than click on apply but close this dialog. -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ClickOnOk() -{ - this->ClickOnApply() ; - accept(); - - return ; -} - - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ClickOnApply() -{ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - bool testResult = false ; - - if( !myOkShape ) - return ; - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if( !myOkSelectFace ) - return ; - - if( CheckBox2->isChecked() ) { - - if( !CheckBox3->isChecked() ) { - - /* Call method to get sub shape selection of GEOM::WIRE */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; - - myGeomGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ - if( !aTest || myListOfIdWire->length() != 1 ) { - CheckBox2->setChecked(FALSE) ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; - } - else { - myListOfIdEndFace->length(0) ; /* no end face */ - QApplication::setOverrideCursor( Qt::waitCursor ); - testResult = myGeomGUI->OnSuppressHole( myShapeIOR, myListOfIdFace, myListOfIdWire, myListOfIdEndFace ) ; - QApplication::restoreOverrideCursor(); - } - } - else { /* CheckBox3->isChecked() */ - - /* Call method to get sub shape selection of END GEOM::FACE */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdEndFace, myLocalContextId, myUseLocalContext) ; - - myGeomGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ - if( !aTest || myListOfIdEndFace->length() != 1 ) { - CheckBox3->setChecked(FALSE) ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; - } - else { - QApplication::setOverrideCursor( Qt::waitCursor ); - testResult = myGeomGUI->OnSuppressHole( myShapeIOR, myListOfIdFace, myListOfIdWire, myListOfIdEndFace ) ; - QApplication::restoreOverrideCursor(); - } - } - } - break ; - } - - case 1: /* second constructor */ - { - 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 = myGeomGUI->GetIndexSubShapeSelected(myShape, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; - - myGeomGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ - - if( !aTest || myListOfIdWire->length() < 1 ) { - CheckBoxC2_1->setChecked(FALSE) ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; - } - else { - QApplication::setOverrideCursor( Qt::waitCursor ); - testResult = myGeomGUI->OnSuppressHolesInFaceOrShell( myShapeIOR, myListOfIdWire ) ; - QApplication::restoreOverrideCursor(); - } - } - break ; - } - } - - - if( !testResult ) - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; - else - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_DONE") ) ; - - /* Reset arguments to allow a new selection */ - this->ResetStateOfDialog() ; - return ; -} - - - -//================================================================================= -// function : ClickOnClose() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ClickOnClose() -{ - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); - if(myUseLocalContext) { - myIC->CloseLocalContext(myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -// : used only by SelectButtonC1A1 and SelectButtonC2A1 -//================================================================================= -void GeometryGUI_SuppressHoleDlg::SelectionIntoArgument() -{ - - /* Reset argument and local context when selection as changed */ - this->ResetStateOfDialog() ; - - QString aString = ""; /* Name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) - return ; - - /* nbSel == 1 */ - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( S.IsNull() || S.ShapeType() == TopAbs_VERTEX || S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE ) { - return ; - } - - /* Test the exact type of topology to suppress faces into. */ - /* For the second constructor a face or shell selection is needed */ - if ( myConstructorId == 0 || ( myConstructorId == 1 && ( S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL ) ) ) { - - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); - - /* The Geom IOR string of selection */ - myShapeIOR = GIObject->getIOR(); - myEditCurrentArgument->setText(aString) ; - myShape = S ; - myOkShape = true ; - return; - } - - if ( IO->hasEntry() ) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() ); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if ( !obj->_is_nil() ) { - if (obj->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - myEditCurrentArgument->setText(aString) ; - return; - } - } - } - - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - SelectionIntoArgument() ; - } - break; - } - case 1: - { - if(send == SelectButtonC2A1) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1; - SelectionIntoArgument() ; - } - break; - } - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC2A1) - myEditCurrentArgument = LineEditC2A1; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - this->ResetStateOfDialog() ; - - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - myGeomGUI->OnDisplayAll(true) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate other 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 ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : Mouse enter onto the dialog to activate it -//================================================================================= -void GeometryGUI_SuppressHoleDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_SuppressHoleDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnClose() ; - return ; -} - - -//================================================================================= -// function : ActivateUserFaceSelection() -// purpose : Called when CheckBox1 state has changed. (Face selection is ckecked) -// : Be careful user must first select a face then a wire ! -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ActivateUserFaceSelection() -{ - if( !this->myOkShape ) { - this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_MAIN_OBJECT") ) ; - return ; - } - - /* Test the viewer type VTK */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; - this->ResetStateOfDialog() ; - return; - } - - if( CheckBox1->isChecked() ) { - - /* local context is opened into the method : Prepare GEOM::FACE sub selection */ - myGeomGUI->PrepareSubShapeSelection( int(TopAbs_FACE), this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE") ) ; - } - else { - this->ResetPartial() ; - } - - return ; -} - - -//================================================================================= -// function : ActivateUserWireSelection() -// purpose : Called when CheckBox2 state has changed. (Wire selection is ckecked) -// : Be careful user must first select a face then a wire ! -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ActivateUserWireSelection() -{ - - if( !this->myOkShape ) { - this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_MAIN_OBJECT") ) ; - return ; - } - - /* Test the type of viewer VTK */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; - this->ResetStateOfDialog() ; - return; - } - - if( CheckBox1->isChecked() ) { - - /* Get sub shape selection GEOM::FACE : local context is closed */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdFace, myLocalContextId, myUseLocalContext) ; - - myGeomGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ - if( !aTest || myListOfIdFace->length() != 1 ) { - CheckBox1->setChecked(FALSE) ; - myOkSelectFace = false ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; - } - else { - myOkSelectFace = true ; - } - } - else { - this->ResetPartial() ; - return ; - } - - - if( CheckBox2->isChecked() ) { - - /* Get the face selection */ - this->myFace = FaceFromList(myShape, myListOfIdFace) ; - /* Local context is opened into the method : Prepare GEOM::WIRE sub selection into a face */ - myGeomGUI->PrepareSubShapeSelectionArgumentShape( this->myFace, int(TopAbs_WIRE), this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTWIRE") ) ; - } - else { - this->ResetPartial() ; - } - - return ; -} - - - -//================================================================================= -// function : ActivateUserlEndFaceSelection() -// purpose : Called when CheckBox3 state has changed. ( Optional End Face selection ) -// : Be careful user must first select a face then a wire then this optional end face ! -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ActivateUserEndFaceSelection() -{ - - if( !this->myOkShape ) { - this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_MAIN_OBJECT") ) ; - return ; - } - - /* Test the type of viewer VTK */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; - this->ResetStateOfDialog() ; - return; - } - - - if( CheckBox2->isChecked() ) { - /* Call method to get sub shape selection for the GEOM::WIRE into myFace : local context is closed */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(this->myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; - - myGeomGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ - - if( !aTest || myListOfIdWire->length() != 1 ) { - CheckBox2->setChecked(FALSE) ; - CheckBox3->setChecked(FALSE) ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_ABORT") ) ; - return ; - } - } - else { - this->ResetPartial() ; - return ; - } - - - if( CheckBox3->isChecked() ) { - /* Local context is opened into the method : prepare GEOM::FACE(end) into myShape sub selection */ - myGeomGUI->PrepareSubShapeSelectionArgumentShape( this->myShape, int(TopAbs_FACE), this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE_END") ) ; - } - else { - this->ResetPartial() ; - } - - return ; -} - - - -//================================================================================= -// function : ActivateUserWiresOnFaceShellSelection() -// purpose : Called when CheckBoxC2_1 state has changed. -// : Only for second constructor ! -// : Prepare selection for wire(s) on main object that is a face or a shell -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ActivateUserWiresOnFaceShellSelection() -{ - - if( !this->myOkShape ) { - this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_MAIN_OBJECT") ) ; - return ; - } - - /* Test the type of viewer VTK */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ; - this->ResetStateOfDialog() ; - return; - } - - if( CheckBoxC2_1->isChecked() ) { - /* Local context is opened to prepare GEOM::WIRE(S) selection into 'myShape' that is a (main) face */ - myGeomGUI->PrepareSubShapeSelectionArgumentShape( this->myShape, int(TopAbs_WIRE), this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE") ) ; - } - else { - this->ResetPartial() ; - } - return ; -} - - - -//================================================================================= -// function : FaceFromList() -// purpose : Return the face (selected by user) that is a sub shape of 'aShape' -// : and which unique index is in 'ListOfSub'. -// : This allows opening a local context with this face loaded. -// : See : myGeomGUI->PrepareSubShapeSelectionArgumentShape(...) -//================================================================================= -TopoDS_Shape GeometryGUI_SuppressHoleDlg::FaceFromList( const TopoDS_Shape& aShape, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfSub ) -{ - TopoDS_Shape tds ; - tds.Nullify() ; - if( ListOfSub.length() != 1 || aShape.IsNull() ) - return tds ; - - int i = ListOfSub[0] ; - TopExp_Explorer exp ; - int j = 1 ; - for( exp.Init(aShape, TopAbs_FACE); exp.More(); exp.Next() ) { - if(j == i) - return exp.Current() ; - j++ ; - } - return tds ; -} - - - - -//================================================================================= -// function : ResetStateOfDialog() -// purpose : Completely reset the state of method including local context -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ResetStateOfDialog() -{ - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; - - /* Partial reset and more ...*/ - this->ResetPartial() ; - - return ; -} - - -//================================================================================= -// function : ResetPartial() -// purpose : Partially reset to keep only main selection -//================================================================================= -void GeometryGUI_SuppressHoleDlg::ResetPartial() -{ - /* Select sub shape modes not checked */ - this->myOkSelectFace = false ; - this->CheckBox1->setChecked( FALSE ); - this->CheckBox2->setChecked( FALSE ); - this->CheckBox3->setChecked( FALSE ); - this->CheckBoxC2_1->setChecked( FALSE ); - - myListOfIdFace->length(0) ; - myListOfIdWire->length(0) ; - myListOfIdEndFace->length(0) ; - - /* Close its local contact if opened */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); - if( this->myUseLocalContext ) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - myGeomGUI->OnDisplayAll(true) ; - } - } - - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_SuppressHoleDlg.h b/src/GEOMGUI/GeometryGUI_SuppressHoleDlg.h deleted file mode 100644 index 3e6e8554a..000000000 --- a/src/GEOMGUI/GeometryGUI_SuppressHoleDlg.h +++ /dev/null @@ -1,162 +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 : GeometryGUI_SuppressHoleDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef GEOMETRYGUI_SUPPRESSHOLE_H -#define GEOMETRYGUI_SUPPRESSHOLE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QCheckBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - -//================================================================================= -// class : GeometryGUI_SuppressHoleDlg -// purpose : -//================================================================================= -class GeometryGUI_SuppressHoleDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_SuppressHoleDlg( QWidget* parent = 0, - const char* name = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - - ~GeometryGUI_SuppressHoleDlg(); - -private : - - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* Mouse enter the QWidget (to reactivate it) */ - - void ResetStateOfDialog() ; - void ResetPartial() ; - - /* Return the face selected by user from the main shape and index in a ListOfSub */ - TopoDS_Shape FaceFromList( const TopoDS_Shape& aShape, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfSub ) ; - - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape myShape ; /* Main shape selected */ - TopoDS_Shape myFace ; /* Face selected */ - - char* myShapeIOR ; - bool myOkShape ; - - bool myOkSelectFace ; /* true = sub mode GEOM::FACE selection done */ - bool myOkSelectWire ; /* true = sub mode GEOM::WIRE selection done (first wire) */ - - GEOM::GEOM_Shape::ListOfSubShapeID_var myListOfIdFace ; /* After selection contains index of face into myShape */ - GEOM::GEOM_Shape::ListOfSubShapeID_var myListOfIdWire ; /* After selection contains index of wire into myFace */ - GEOM::GEOM_Shape::ListOfSubShapeID_var myListOfIdEndFace ; /* After selection contains index of end face into myShape */ - - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonApply; - QPushButton* buttonClose; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QCheckBox* CheckBox1; - QCheckBox* CheckBox2; - QCheckBox* CheckBox3; - - /* Second constructor */ - QRadioButton* Constructor2; - QGroupBox* GroupC2; - QLabel* TextLabelC2A1; - QPushButton* SelectButtonC2A1; - QLineEdit* LineEditC2A1; - QCheckBox* CheckBoxC2_1; - - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnApply() ; - void ClickOnClose(); - - void LineEditReturnPressed() ; - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ActivateUserFaceSelection() ; - void ActivateUserWireSelection() ; - void ActivateUserEndFaceSelection() ; - - /* For the second constructor */ - void ActivateUserWiresOnFaceShellSelection() ; - - -protected: - - QGridLayout* GeometryGUI_SuppressHoleLayout; - QGridLayout* GroupConstructorsLayout; - QHBoxLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; - QHBoxLayout* Layout2; - - QGridLayout* GroupC2Layout; - QHBoxLayout* Layout3; -}; - -#endif // GEOMETRYGUI_SUPPRESSHOLE_H diff --git a/src/GEOMGUI/GeometryGUI_TorusDlg.cxx b/src/GEOMGUI/GeometryGUI_TorusDlg.cxx deleted file mode 100644 index 1936e1e0a..000000000 --- a/src/GEOMGUI/GeometryGUI_TorusDlg.cxx +++ /dev/null @@ -1,670 +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 : GeometryGUI_TorusDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_TorusDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - - -//================================================================================= -// class : GeometryGUI_TorusDlg() -// purpose : Constructs a GeometryGUI_TorusDlg 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. -//================================================================================= -GeometryGUI_TorusDlg::GeometryGUI_TorusDlg( 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_TORUS_PV"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_TORUS_DXYZ"))); - - if ( !name ) - setName( "GeometryGUI_TorusDlg" ); - resize( 303, 219 ); - setCaption( tr( "GEOM_TORUS_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_TorusDlgLayout = new QGridLayout( this ); - GeometryGUI_TorusDlgLayout->setSpacing( 6 ); - GeometryGUI_TorusDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_TORUS" ) ); - 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() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 2 ); - GeometryGUI_TorusDlgLayout->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 ); - GeometryGUI_TorusDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - 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 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_BASE_POINT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); - SelectButtonC1A2->setText( tr( "" ) ); - SelectButtonC1A2->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - 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_RADIUS_I" ).arg("1") ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A3->setFrameShape( QLabel::NoFrame ); - TextLabelC1A3->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - - SpinBox_C1A3 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ; - SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 ); - - TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" ); - TextLabelC1A4->setText( tr( "GEOM_RADIUS_I" ).arg("2") ); - TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A4->setFrameShape( QLabel::NoFrame ); - TextLabelC1A4->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 ); - - SpinBox_C1A4 = new GeometryGUI_SpinBox( GroupC1, "GeomSpinBox_C1A4" ) ; - SpinBox_C1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A4->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A4, 3, 2 ); - - GeometryGUI_TorusDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "GEOM_BOX_OBJ" ) ); - 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 ); - TextLabel_Radius1 = new QLabel( GroupC2, "TextLabel_Radius1" ); - TextLabel_Radius1->setText( tr( "GEOM_RADIUS_I" ).arg("1") ); - GroupC2Layout->addWidget( TextLabel_Radius1, 0, 0 ); - TextLabel_Radius2 = new QLabel( GroupC2, "TextLabel_Radius2" ); - TextLabel_Radius2->setText( tr( "GEOM_RADIUS_I" ).arg("2") ); - GroupC2Layout->addWidget( TextLabel_Radius2, 1, 0 ); - - SpinBox_Radius1 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius1" ) ; - GroupC2Layout->addWidget( SpinBox_Radius1, 0, 1 ); - - SpinBox_Radius2 = new GeometryGUI_SpinBox( GroupC2, "GeomSpinBox_Radius2" ) ; - GroupC2Layout->addWidget( SpinBox_Radius2, 1, 1 ); - - QSpacerItem* spacer1 = new QSpacerItem( 20, 62, QSizePolicy::Minimum, QSizePolicy::Fixed ); - GroupC2Layout->addItem( spacer1 ); - GeometryGUI_TorusDlgLayout->addWidget(GroupC2 , 1, 0 ); - - /***************************************************************/ - - /* Initialisations */ - Init(Sel) ; -} - - -//================================================================================= -// function : ~GeometryGUI_TorusDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_TorusDlg::~GeometryGUI_TorusDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::Init( SALOME_Selection* Sel ) -{ - - /* 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 spin boxes */ - SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C1A4->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_Radius1->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_Radius2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - - GroupC1->show(); - GroupC2->hide(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - SpinBox_C1A3->SetValue( 300.0 ) ; - SpinBox_C1A4->SetValue( 100.0 ) ; - SpinBox_Radius1->SetValue( 300.0 ) ; - SpinBox_Radius2->SetValue( 100.0 ) ; - myRadius1 = 300.0 ; - myRadius2 = 100.0 ; - - myOkRadius1 = true ; - myOkRadius2 = true ; - myOkPoint1 = false ; - myOkDir = false ; - - mySimulationTopoDs.Nullify() ; - 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); - myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom ); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - /* first filter used */ - mySelection->AddFilter(myVertexFilter) ; - - /* 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( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C1A4, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_Radius1, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_Radius2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC1A2, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_TorusDlg::ConstructorsClicked(int constructorId) -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - - switch(myConstructorId) - { - case 0 : - { - GroupC1->hide(); - GroupC2->show(); - myConstructorId = constructorId ; - myOkRadius1 = myOkPoint1 = myOkRadius2 = myOkDir = true ; - - SpinBox_C1A3->SetValue( 300.0 ) ; /* radius 1 */ - SpinBox_C1A4->SetValue( 100.0 ) ; /* radius 2 */ - myRadius1 = 300.0 ; - myRadius2 = 100.0 ; - - disconnect( mySelection, 0, this, 0 ); - - myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ; - myDir.SetCoord( 0.0, 0.0, 1.0 ) ; - - if( myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) { - gp_Dir aDir = myDir ; - - MakeTorusSimulationAndDisplay() ; - } - break ; - } - case 1 : - { - GroupC2->hide(); - GroupC1->show(); - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditC1A1 ; - myOkRadius1 = myOkRadius2 = true ; - myOkPoint1 = myOkDir = false ; - - SpinBox_Radius1->SetValue( 300.0 ) ; - SpinBox_Radius2->SetValue( 100.0 ) ; - myRadius1 = 300.0 ; - myRadius2 = 100.0 ; - - LineEditC1A1->setText( tr("") ); - disconnect( mySelection, 0, this, 0 ); - break ; - } - } - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::ClickOnApply() -{ - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) { - myGeomGUI->MakeTorusAndDisplay( myPoint1, myDir, myRadius1, myRadius2 ) ; - } - break ; - } - case 1 : - { - if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) { - myGeomGUI->MakeTorusAndDisplay( myPoint1, myDir, myRadius1, myRadius2 ) ; - } - break ; - } - } - // accept(); - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_TorusDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QString aString = ""; /* Name of future selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditC1A2 ) { - LineEditC1A2->setText("") ; - myOkDir = false ; - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* gp_Pnt : not used */ - if ( myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditC1A1->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, notUsed, myDir) */) { - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - myDir = curv.Line().Direction(); - LineEditC1A2->setText(aString) ; - myOkDir = true ; - } - - if( myConstructorId == 0 && myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) { - MakeTorusSimulationAndDisplay() ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - mySelection->ClearFilters() ; - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - mySelection->AddFilter(myVertexFilter) ; - } - else if(send == SelectButtonC1A2) { - LineEditC1A2->setFocus() ; - myEditCurrentArgument = LineEditC1A2; - mySelection->AddFilter(myEdgeFilter) ; - } - SelectionIntoArgument() ; - break; - } - case 1: - { - break ; - } - } - - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC1A2) - myEditCurrentArgument = LineEditC1A2; - else - return ; - - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ; - const QString objectUserName = LE->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - LE->setText( objectUserName ) ; - } - - return ; -} - - -//================================================================================= -// function : ValueChangedInSpinBox -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::ValueChangedInSpinBox( double newValue ) -{ - QObject* send = (QObject*)sender(); - - if(send == SpinBox_C1A3 ) { - myRadius1 = newValue ; - myOkRadius1 = true ; - } - else if(send == SpinBox_C1A4 ) { - myRadius2 = newValue ; - myOkRadius2 = true ; - } - else if(send == SpinBox_Radius1 ) { - myRadius1 = newValue ; - myOkRadius1 = true ; - } - else if(send == SpinBox_Radius2 ) { - myRadius2 = newValue ; - myOkRadius2 = true ; - } - - if (myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) { - MakeTorusSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::ActivateThisDialog() -{ - /* 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() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : MakeTorusSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_TorusDlg::MakeTorusSimulationAndDisplay() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - try { - gp_Ax2 anAxis(this->myPoint1, this->myDir) ; - mySimulationTopoDs = BRepPrimAPI_MakeTorus( anAxis, this->myRadius1, this->myRadius2 ).Shape() ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - catch(Standard_Failure) { - MESSAGE( "Exception catched in MakeTorusSimulationAndDisplay" ) ; - } - return ; -} - diff --git a/src/GEOMGUI/GeometryGUI_TorusDlg.h b/src/GEOMGUI/GeometryGUI_TorusDlg.h deleted file mode 100644 index bae34d8ee..000000000 --- a/src/GEOMGUI/GeometryGUI_TorusDlg.h +++ /dev/null @@ -1,148 +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 : GeometryGUI_TorusDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_TORUS_H -#define DIALOGBOX_TORUS_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GEOM_EdgeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include -#include - -#include -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QSpinBox ; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_TorusDlg -// purpose : -//================================================================================= -class GeometryGUI_TorusDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_TorusDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_TorusDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void MakeTorusSimulationAndDisplay() ; - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs ; - SALOME_Selection* mySelection ; /* User shape selection */ - - gp_Pnt myPoint1 ; /* Topology used */ - gp_Dir myDir ; - bool myOkPoint1 ; - bool myOkDir ; /* to check when arguments is defined */ - - Standard_Real myRadius1 ; - Standard_Real myRadius2 ; - bool myOkRadius1 ; - bool myOkRadius2 ; - QDoubleValidator *myVa ; /* Double validator for numeric input myRadius1 */ - QDoubleValidator *myVb ; /* Double validator for numeric input myRadius2 */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QWidget* myEditCurrentArgument; /* Current LineEdit or spin box */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter ; /* Filter selection */ - Handle(GEOM_EdgeFilter) myEdgeFilter ; /* Filter selection */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QGroupBox* GroupC1; - QGroupBox* GroupC2; - QPushButton* SelectButtonC1A1; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - - GeometryGUI_SpinBox* SpinBox_C1A3 ; - GeometryGUI_SpinBox* SpinBox_C1A4 ; - - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QLabel* TextLabelC1A3; - QLabel* TextLabelC1A4; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - - QLabel* TextLabel_Radius1 ; - QLabel* TextLabel_Radius2 ; - GeometryGUI_SpinBox* SpinBox_Radius1 ; - GeometryGUI_SpinBox* SpinBox_Radius2 ; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_TorusDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; -}; - -#endif // DIALOGBOX_TORUS_H diff --git a/src/GEOMGUI/GeometryGUI_TranslationDlg.cxx b/src/GEOMGUI/GeometryGUI_TranslationDlg.cxx deleted file mode 100644 index 9363938cb..000000000 --- a/src/GEOMGUI/GeometryGUI_TranslationDlg.cxx +++ /dev/null @@ -1,563 +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 : GeometryGUI_TranslationDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_TranslationDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Config.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -//================================================================================= -// class : GeometryGUI_TranslationDlg() -// purpose : Constructs a GeometryGUI_TranslationDlg 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. -//================================================================================= -GeometryGUI_TranslationDlg::GeometryGUI_TranslationDlg( 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_TRANSLATION"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_TranslationDlg" ); - resize( 303, 219 ); - setCaption( tr( "GEOM_TRANSLATION_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_TranslationDlgLayout = new QGridLayout( this ); - GeometryGUI_TranslationDlgLayout->setSpacing( 6 ); - GeometryGUI_TranslationDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_TRANSLATION" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_TranslationDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_TRANSLATION" ) ) ; - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) ); - 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 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - Layout1 = new QHBoxLayout; - Layout1->setSpacing( 6 ); - Layout1->setMargin( 0 ); - - TextLabel_DX = new QLabel( GroupC1, "TextLabel_DX" ); - TextLabel_DX->setText( tr( "GEOM_DX" ) ); - Layout1->addWidget( TextLabel_DX ); - - SpinBox_DX = new GeometryGUI_SpinBox( GroupC1, "SpinBox_DX" ); - SpinBox_DX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DX->sizePolicy().hasHeightForWidth() ) ); - Layout1->addWidget( SpinBox_DX ); - - TextLabel_DY = new QLabel( GroupC1, "TextLabel_DY" ); - TextLabel_DY->setText( tr( "GEOM_DY" ) ); - Layout1->addWidget( TextLabel_DY ); - - SpinBox_DY = new GeometryGUI_SpinBox( GroupC1, "SpinBox_DY" ); - SpinBox_DY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DY->sizePolicy().hasHeightForWidth() ) ); - Layout1->addWidget( SpinBox_DY ); - - TextLabel_DZ = new QLabel( GroupC1, "TextLabel_DZ" ); - TextLabel_DZ->setText( tr( "GEOM_DZ" ) ); - Layout1->addWidget( TextLabel_DZ ); - - SpinBox_DZ = new GeometryGUI_SpinBox( GroupC1, "SpinBox_DZ" ); - SpinBox_DZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DZ->sizePolicy().hasHeightForWidth() ) ); - Layout1->addWidget( SpinBox_DZ ); - - GroupC1Layout->addMultiCellLayout( Layout1, 1, 1, 0, 2 ); - - GeometryGUI_TranslationDlgLayout->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, 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 ); - GeometryGUI_TranslationDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - - -//================================================================================= -// function : ~GeometryGUI_TranslationDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_TranslationDlg::~GeometryGUI_TranslationDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::Init( SALOME_Selection* Sel ) -{ - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_DX->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DX->SetValue( 100.0 ) ; - SpinBox_DY->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DY->SetValue( 100.0 ) ; - SpinBox_DZ->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DZ->SetValue( 100.0 ) ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myOkBase = false ; - - this->myVec.SetCoord( 100.0, 100.0, 100.0 ) ; - mySimulationTopoDs.Nullify() ; - myBase.Nullify() ; - 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); - // myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom ); - - /* 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( SpinBox_DX, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DY, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DZ, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditC1A1, 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_TranslationDlg::ConstructorsClicked(int constructorId) -{ - // myGeomGUI->EraseSimulationShape() ; - switch (constructorId) - { - case 0: - { - break; - } - case 1: - { - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - mySimulationTopoDs.Nullify() ; - switch(myConstructorId) - { - case 0 : - { - if(myOkBase) { - myGeomGUI->MakeTranslationAndDisplay( myGeomShape, myVec ) ; - } - break ; - } - case 1 : - { - break ; - } - } - - // accept(); - return ; -} - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_TranslationDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future name of selection */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditC1A1 ) { - LineEditC1A1->setText("") ; - myOkBase = false ; - } - return ; - } - - /* nbSel == 1 ! */ - TopoDS_Shape S; - Standard_Boolean testResult ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; - if( !testResult ) - return ; - LineEditC1A1->setText(aString) ; - myBase = S ; - myOkBase = true ; - } - - if( myOkBase ) { - MakeTranslationSimulationAndDisplay() ; - } - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1 ; - SelectionIntoArgument() ; - } - break; - } - case 1: - { - break; - } - } - return ; -} - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::ValueChangedInSpinBox( double newValue ) -{ - - QObject* send = (QObject*)sender() ; - Standard_Real Dx, Dy, Dz ; - - if( send == SpinBox_DX ) { - Dx = newValue ; - Dy = SpinBox_DY->GetValue() ; - Dz = SpinBox_DZ->GetValue() ; - } else if( send == SpinBox_DY ) { - Dx = SpinBox_DX->GetValue() ; - Dy = newValue ; - Dz = SpinBox_DZ->GetValue() ; - } else if( send == SpinBox_DZ ) { - Dx = SpinBox_DX->GetValue() ; - Dy = SpinBox_DY->GetValue() ; - Dz = newValue ; - } - - this->myVec.SetCoord(Dx, Dy, Dz) ; - if ( myOkBase ) { - MakeTranslationSimulationAndDisplay() ; - } - else { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } - return ; -} - - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : MakeTranslationSimulationAndDisplay() -// purpose : -//================================================================================= -void GeometryGUI_TranslationDlg::MakeTranslationSimulationAndDisplay() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - gp_Trsf theTransformation ; - theTransformation.SetTranslation(this->myVec) ; - - BRepBuilderAPI_Transform myBRepTransformation(this->myBase, theTransformation, Standard_False) ; - mySimulationTopoDs = myBRepTransformation.Shape() ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_TranslationDlg.h b/src/GEOMGUI/GeometryGUI_TranslationDlg.h deleted file mode 100644 index 617bc4802..000000000 --- a/src/GEOMGUI/GeometryGUI_TranslationDlg.h +++ /dev/null @@ -1,127 +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 : GeometryGUI_TranslationDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_TRANSLATION_H -#define DIALOGBOX_TRANSLATION_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_TranslationDlg -// purpose : -//================================================================================= -class GeometryGUI_TranslationDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_TranslationDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_TranslationDlg(); - -private : - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* 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 */ - bool myOkBase ; - gp_Vec myVec ; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filter selection */ - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; - void MakeTranslationSimulationAndDisplay() ; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupC1; - QLabel* TextLabel_DX; - QLabel* TextLabel_DY; - QLabel* TextLabel_DZ; - - GeometryGUI_SpinBox* SpinBox_DX ; - GeometryGUI_SpinBox* SpinBox_DY ; - GeometryGUI_SpinBox* SpinBox_DZ ; - - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* GeometryGUI_TranslationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupButtonsLayout; - - QHBoxLayout* Layout1 ; -}; - -#endif // DIALOGBOX_TRANSLATION_H diff --git a/src/GEOMGUI/GeometryGUI_VectorDlg.cxx b/src/GEOMGUI/GeometryGUI_VectorDlg.cxx deleted file mode 100644 index 7be8439a4..000000000 --- a/src/GEOMGUI/GeometryGUI_VectorDlg.cxx +++ /dev/null @@ -1,708 +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 : GeometryGUI_VectorDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_VectorDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "QAD_Config.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - - -//================================================================================= -// class : GeometryGUI_VectorDlg() -// purpose : Constructs a GeometryGUI_VectorDlg 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. -//================================================================================= -GeometryGUI_VectorDlg::GeometryGUI_VectorDlg( 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_VECTOR_2P"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_VECTOR_DXYZ"))); - - if ( !name ) - setName( "GeometryGUI_VectorDlg" ); - resize( 303, 221 ); - setCaption( tr( "GEOM_VECTOR_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_VectorDlgLayout = new QGridLayout( this ); - GeometryGUI_VectorDlgLayout->setSpacing( 6 ); - GeometryGUI_VectorDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupPoints = new QGroupBox( this, "GroupPoints" ); - GroupPoints->setGeometry( QRect( 10, 10, 280, 90 ) ); - GroupPoints->setTitle( tr( "GEOM_POINTS" ) ); - GroupPoints->setFrameShape( QGroupBox::Box ); - GroupPoints->setFrameShadow( QGroupBox::Sunken ); - GroupPoints->setColumnLayout(0, Qt::Vertical ); - GroupPoints->layout()->setSpacing( 0 ); - GroupPoints->layout()->setMargin( 0 ); - GroupPointsLayout = new QGridLayout( GroupPoints->layout() ); - GroupPointsLayout->setAlignment( Qt::AlignTop ); - GroupPointsLayout->setSpacing( 6 ); - GroupPointsLayout->setMargin( 11 ); - SelectButtonPt2 = new QPushButton( GroupPoints, "SelectButtonPt2" ); - SelectButtonPt2->setText( tr( "" ) ); - SelectButtonPt2->setPixmap( image1 ); - GroupPointsLayout->addWidget( SelectButtonPt2, 1, 1 ); - LineEditPt1 = new QLineEdit( GroupPoints, "LineEditPt1" ); - GroupPointsLayout->addWidget( LineEditPt1, 0, 2 ); - LineEditPt2 = new QLineEdit( GroupPoints, "LineEditPt2" ); - GroupPointsLayout->addWidget( LineEditPt2, 1, 2 ); - SelectButtonPt1 = new QPushButton( GroupPoints, "SelectButtonPt1" ); - SelectButtonPt1->setText( tr( "" ) ); - SelectButtonPt1->setPixmap( image1 ); - SelectButtonPt1->setToggleButton( FALSE ); - GroupPointsLayout->addWidget( SelectButtonPt1, 0, 1 ); - TextLabelPt1 = new QLabel( GroupPoints, "TextLabelPt1" ); - TextLabelPt1->setText( tr( "GEOM_POINT_I" ).arg("1") ); - TextLabelPt1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelPt1->setFrameShape( QLabel::NoFrame ); - TextLabelPt1->setFrameShadow( QLabel::Plain ); - GroupPointsLayout->addWidget( TextLabelPt1, 0, 0 ); - TextLabelPt2 = new QLabel( GroupPoints, "TextLabelPt2" ); - TextLabelPt2->setText( tr( "GEOM_POINT_I" ).arg("2") ); - TextLabelPt2->setMinimumSize( QSize( 50, 0 ) ); - GroupPointsLayout->addWidget( TextLabelPt2, 1, 0 ); - GeometryGUI_VectorDlgLayout->addWidget( GroupPoints, 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, 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 ); - GeometryGUI_VectorDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_VECTOR" ) ); - 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->setChecked( TRUE ); - Constructor1->setPixmap( image0 ); - 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, 3 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); - GeometryGUI_VectorDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupCoordinates = new QGroupBox( this, "GroupCoordinates" ); - GroupCoordinates->setGeometry( QRect( 10, 70, 280, 80 ) ); - GroupCoordinates->setTitle( tr( "GEOM_COORDINATES" ) ); - GroupCoordinates->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupCoordinates->sizePolicy().hasHeightForWidth() ) ); - GroupCoordinates->setColumnLayout(0, Qt::Vertical ); - GroupCoordinates->layout()->setSpacing( 0 ); - GroupCoordinates->layout()->setMargin( 0 ); - GroupCoordinatesLayout = new QGridLayout( GroupCoordinates->layout() ); - GroupCoordinatesLayout->setAlignment( Qt::AlignTop ); - GroupCoordinatesLayout->setSpacing( 6 ); - GroupCoordinatesLayout->setMargin( 11 ); - - TextLabel_DZ = new QLabel( GroupCoordinates, "TextLabel_DZ" ); - TextLabel_DZ->setText( tr( "GEOM_DZ" ) ); - GroupCoordinatesLayout->addWidget( TextLabel_DZ, 0, 4 ); - TextLabel_DY = new QLabel( GroupCoordinates, "TextLabel_DY" ); - TextLabel_DY->setText( tr( "GEOM_DY" ) ); - GroupCoordinatesLayout->addWidget( TextLabel_DY, 0, 2 ); - TextLabel_DX = new QLabel( GroupCoordinates, "TextLabel_DX" ); - TextLabel_DX->setText( tr( "GEOM_DX" ) ); - GroupCoordinatesLayout->addWidget( TextLabel_DX, 0, 0 ); - - /* Spin boxes construction */ - SpinBox_DX = new GeometryGUI_SpinBox( GroupCoordinates, "GeomSpinBox_DX" ) ; - GroupCoordinatesLayout->addWidget( SpinBox_DX, 0, 1 ); - SpinBox_DY = new GeometryGUI_SpinBox( GroupCoordinates, "GeomSpinBox_DY" ) ; - GroupCoordinatesLayout->addWidget( SpinBox_DY, 0, 3 ); - SpinBox_DZ = new GeometryGUI_SpinBox( GroupCoordinates, "GeomSpinBox_DZ" ) ; - GroupCoordinatesLayout->addWidget( SpinBox_DZ, 0, 5 ); - - QSpacerItem* spacer2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); - GroupCoordinatesLayout->addItem( spacer2, 1, 3 ); - - /* QCheckBox to reverse vector */ - CheckBoxReverseVector = new QCheckBox( GroupCoordinates, "CheckBoxReverseVector" ); - CheckBoxReverseVector->setText( tr( "GEOM_REVERSE_VECTOR" ) ); - GroupCoordinatesLayout->addMultiCellWidget( CheckBoxReverseVector, 1, 1, 1, 5 ); - /* same position than GroupPoints */ - GeometryGUI_VectorDlgLayout->addWidget( GroupCoordinates, 1, 0 ); - - Init(Sel) ; /* Initialisations */ - -} - - -//================================================================================= -// function : ~GeometryGUI_VectorDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_VectorDlg::~GeometryGUI_VectorDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::Init( SALOME_Selection* Sel ) -{ - - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - - /* min, max, step and decimals for spin boxes */ - SpinBox_DX->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DX->SetValue( 0.0 ) ; - SpinBox_DY->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DY->SetValue( 0.0 ) ; - SpinBox_DZ->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ; - SpinBox_DZ->SetValue( 200.0 ) ; - - GroupPoints->show(); - GroupCoordinates->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - CheckBoxReverseVector->setChecked( FALSE ); - - myEditCurrentArgument = LineEditPt1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ); - myPoint2.SetCoord( 0.0, 0.0, 0.0 ); - myOkPoint1 = myOkPoint2 = false ; - mySimulationTopoDs.Nullify() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection in argument ? - - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom ); - myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom ); - mySelection->AddFilter(myVertexFilter) ; /* first filter used */ - - /* 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( SelectButtonPt1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonPt2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_DX, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DY, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_DZ, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditPt1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditPt2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( CheckBoxReverseVector, SIGNAL (stateChanged(int) ), this, SLOT( ReverseVector(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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - -//================================================================================= -// function : ReverseVector() -// purpose : 'state' not used here -//================================================================================= -void GeometryGUI_VectorDlg::ReverseVector(int state) -{ - if( myConstructorId == 1 ) { - - myDx = -myDx ; - myDy = -myDy ; - myDz = -myDz ; - - SpinBox_DX->SetValue( myDx ) ; - SpinBox_DY->SetValue( myDy ) ; - SpinBox_DZ->SetValue( myDz ) ; - - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(myDx, myDy, myDz) ; - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - /* In the appropriate constructor */ - if( myPoint1.Distance(myPoint2) > Precision::Confusion() ) { - mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape(); - /* Add arrow in simulation */ - bool noNeedToTest = AddArrowToSimulation(mySimulationTopoDs) ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - } - return ; -} - - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_VectorDlg::ConstructorsClicked(int constructorId) -{ - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - - switch (constructorId) - { - case 0: - { - GroupPoints->show(); - GroupCoordinates->hide() ; - myConstructorId = constructorId ; - myEditCurrentArgument = LineEditPt1 ; - Constructor1->setChecked( TRUE ); - LineEditPt1->setText(tr("")) ; - LineEditPt2->setText(tr("")) ; - myOkPoint1 = myOkPoint2 = false ; - - /* filter for next selections */ - mySelection->AddFilter( myVertexFilter ); - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - break; - } - case 1: - { - GroupPoints->hide(); - GroupCoordinates->show(); - myConstructorId = constructorId ; - CheckBoxReverseVector->setChecked( FALSE ); - myOkPoint1 = myOkPoint2 = false ; - - myEditCurrentArgument = SpinBox_DX ; - myPoint1.SetCoord( 0.0, 0.0, 0.0 ) ; - myDx = 0.0 ; - myDy = 0.0 ; - myDz = 200.0 ; - - myPoint2.SetCoord( myDx, myDy, myDz ) ; - SpinBox_DX->SetValue( myDx ) ; - SpinBox_DY->SetValue( myDy ) ; - SpinBox_DZ->SetValue( myDz ) ; - - /* filter for next selections */ - mySelection->AddFilter( myEdgeFilter ); - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - - if( myPoint1.Distance(myPoint2) > Precision::Confusion() ) { - mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape(); - /* Add arrow in simulation */ - bool noNeedToTest = AddArrowToSimulation(mySimulationTopoDs) ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - break; - } - } - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::ClickOnApply() -{ - myGeomGUI->EraseSimulationShape() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - mySimulationTopoDs.Nullify() ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPoint1 && myOkPoint2) - myGeomGUI->MakeVectorAndDisplay( myPoint1, myPoint2 ) ; - break ; - } - case 1 : - { - /* Recup args and call method */ - myDx = SpinBox_DX->GetValue() ; - myDy = SpinBox_DY->GetValue() ; - myDz = SpinBox_DZ->GetValue() ; - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(myDx, myDy, myDz) ; - myGeomGUI->MakeVectorAndDisplay( myPoint1, myPoint2 ) ; - break ; - } - } - - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_VectorDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Future name of shape */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - if ( myEditCurrentArgument == LineEditPt1 ) { - LineEditPt1->setText("") ; - myOkPoint1 = false ; - } - else if ( myEditCurrentArgument == LineEditPt2 ) { - LineEditPt2->setText("") ; - myOkPoint2 = false ; - } - return ; - } - - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - /* Constructors treatment */ - if ( myConstructorId == 0 && myEditCurrentArgument == LineEditPt1 && myGeomGUI->VertexToPoint(S, myPoint1) ) { - LineEditPt1->setText(aString) ; - myOkPoint1 = true ; - } - else if ( myConstructorId == 0 && myEditCurrentArgument == LineEditPt2 && myGeomGUI->VertexToPoint(S, myPoint2) ) { - LineEditPt2->setText(aString) ; - myOkPoint2 = true ; - } - else if( myConstructorId == 1) { - gp_Pnt P1, P2 ; - /* linear edge selection verified */ - if( myGeomGUI->LinearEdgeExtremities(S, P1, P2) ) { - - myGeomGUI->GetBipointDxDyDz( P1, P2, myDx, myDy, myDz ) ; - SpinBox_DX->SetValue( myDx ) ; - SpinBox_DY->SetValue( myDy ) ; - SpinBox_DZ->SetValue( myDz ) ; - - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(myDx, myDy, myDz) ; - } - } - - Standard_Real d = myPoint1.Distance(myPoint2) ; - - if( ( myConstructorId == 0 && myOkPoint1 && myOkPoint2 && d > Precision::Confusion() ) || - ( myConstructorId == 1 && d > Precision::Confusion() ) ) { - mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape(); - /* Add arrow in simulation */ - bool noNeedToTest = AddArrowToSimulation( mySimulationTopoDs ) ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonPt1) { - LineEditPt1->setFocus() ; - myEditCurrentArgument = LineEditPt1; - } - else if(send == SelectButtonPt2) { - LineEditPt2->setFocus() ; - myEditCurrentArgument = LineEditPt2; - } - mySelection->AddFilter(myVertexFilter) ; - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::ValueChangedInSpinBox( double newValue ) -{ - if(myConstructorId != 1) - return ; - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - QObject* send = (QObject*)sender() ; - if (send == SpinBox_DX) { - myDx = newValue ; - } else if( send == SpinBox_DY ) { - myDy = newValue ; - } else if( send == SpinBox_DZ ) { - myDz = newValue ; - } - - myPoint1.SetCoord(0.0, 0.0, 0.0) ; - myPoint2.SetCoord(myDx, myDy, myDz) ; - - if ( myConstructorId == 1 && myPoint1.Distance(myPoint2) > Precision::Confusion() ) { // mySimulationTopoDs - mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape(); - /* Create simulation vector with an arrow */ - this->AddArrowToSimulation(mySimulationTopoDs ) ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditPt1 ) - myEditCurrentArgument = LineEditPt1 ; - else if ( send == LineEditPt2 ) - myEditCurrentArgument = LineEditPt2 ; - else - return ; - - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - QLineEdit* LE = (QLineEdit*)myEditCurrentArgument ; - const QString objectUserName = LE->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - LE->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - - GroupConstructors->setEnabled(false) ; - GroupCoordinates->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - GroupPoints->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; - mySelection->ClearFilters() ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupCoordinates->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - GroupPoints->setEnabled(true) ; - - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; -} - - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_VectorDlg::closeEvent( QCloseEvent* e ) -{ - this->ClickOnCancel() ; /* same than click on cancel button */ -} - - -//================================================================================= -// function : AddArrowToSimulation() -// purpose : An arrow (cone topology) is added to 'modifiedShape' -// : to simulate a vector or an 'oriented line' display. The result is in 'modifiedShape'. -// : If an arrow can't be added returns false and 'modifiedShape' isn't modified ! -//================================================================================= -bool GeometryGUI_VectorDlg::AddArrowToSimulation( TopoDS_Shape& modifiedShape ) -{ - TopoDS_Shape arrow ; - /* Try to add a cone simulation shape to show direction of a linear edge */ - if( myGeomGUI->CreateArrowForLinearEdge( modifiedShape, arrow ) ) { - TopoDS_Compound Comp ; - BRep_Builder B; - B.MakeCompound (Comp); - B.Add( Comp, modifiedShape ) ; - B.Add( Comp, arrow ) ; - modifiedShape = Comp ; - return true ; - } - return false ; -} diff --git a/src/GEOMGUI/GeometryGUI_VectorDlg.h b/src/GEOMGUI/GeometryGUI_VectorDlg.h deleted file mode 100644 index 03582f257..000000000 --- a/src/GEOMGUI/GeometryGUI_VectorDlg.h +++ /dev/null @@ -1,150 +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 : GeometryGUI_VectorDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_VECTOR_H -#define DIALOGBOX_VECTOR_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" -#include "GeometryGUI_SpinBox.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QCheckBox; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QToolButton; -class QLabel; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_VectorDlg -// purpose : -//================================================================================= -class GeometryGUI_VectorDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_VectorDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_VectorDlg(); - - bool AddArrowToSimulation( TopoDS_Shape& modifiedShape ) ; - -private : - - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void Init( SALOME_Selection* Sel ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ - SALOME_Selection* mySelection ; /* User shape selection */ - gp_Pnt myPoint1 ; /* Points containing the vector */ - gp_Pnt myPoint2 ; - double myDx ; - double myDy ; - double myDz ; - bool myOkPoint1 ; /* Are true when myPoint is defined */ - bool myOkPoint2 ; - QWidget* myEditCurrentArgument; /* Current LineEdit or Spin box */ - int myConstructorId ; /* Current constructor id = radio button id */ - Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */ - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filter selection */ - - QGroupBox* GroupPoints; - QPushButton* SelectButtonPt1; - QPushButton* SelectButtonPt2; - QLabel* TextLabelPt1; - QLabel* TextLabelPt2; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor2; - QRadioButton* Constructor1; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - - QLineEdit* LineEditPt1; - QLineEdit* LineEditPt2; - - QGroupBox* GroupCoordinates; - - GeometryGUI_SpinBox* SpinBox_DX ; - GeometryGUI_SpinBox* SpinBox_DY ; - GeometryGUI_SpinBox* SpinBox_DZ ; - QLabel* TextLabel_DZ; - QLabel* TextLabel_DX; - QLabel* TextLabel_DY; - - QCheckBox* CheckBoxReverseVector; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ReverseVector(int state) ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - - QGridLayout* GeometryGUI_VectorDlgLayout; - QGridLayout* GroupPointsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupCoordinatesLayout; - -}; - -#endif // DIALOGBOX_VECTOR_H diff --git a/src/GEOMGUI/GeometryGUI_WhatisDlg.cxx b/src/GEOMGUI/GeometryGUI_WhatisDlg.cxx deleted file mode 100644 index 97c2e81e3..000000000 --- a/src/GEOMGUI/GeometryGUI_WhatisDlg.cxx +++ /dev/null @@ -1,449 +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 : GeometryGUI_WhatisDlg.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_WhatisDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.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 : GeometryGUI_WhatisDlg() -// purpose : Constructs a GeometryGUI_WhatisDlg 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. -//================================================================================= -GeometryGUI_WhatisDlg::GeometryGUI_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 ) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_WHATIS"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_WhatisDlg" ); - resize( 303, 275 ); - setCaption( tr( "GEOM_WHATIS_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_WhatisDlgLayout = new QGridLayout( this ); - GeometryGUI_WhatisDlgLayout->setSpacing( 6 ); - GeometryGUI_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 ); - GeometryGUI_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 ); - - GeometryGUI_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 ); - - GeometryGUI_WhatisDlgLayout->addWidget( GroupButtons, 2, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - - -//================================================================================= -// function : ~GeometryGUI_WhatisDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_WhatisDlg::~GeometryGUI_WhatisDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::Init( SALOME_Selection* Sel ) -{ - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_WhatisDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::ClickOnCancel() -{ - myGeomGUI->EraseSimulationShape() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_WhatisDlg::SelectionIntoArgument() -{ - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - Text->setText("") ; - myEditCurrentArgument->setText("") ; - - SelectedName = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, SelectedName) ; - if ( nbSel != 1 ) { - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( S.IsNull() ) { - myEditCurrentArgument->setText( "" ); - return ; - } - - /* Try to display of a cone simulation shape to show direction of a linear edge only in OCC viewer */ - if( myGeomGUI->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) { - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - LineEditC1A1->setText(SelectedName) ; - this->CalculateWhatis(S) ; - - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::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 GeometryGUI_WhatisDlg::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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupConstructor1->setEnabled(false) ; - myGeomGUI->EraseSimulationShape() ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_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() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : CalculateWhatis() -// purpose : -//================================================================================= -void GeometryGUI_WhatisDlg::CalculateWhatis(const TopoDS_Shape& S) -{ - - if( S.IsNull() ) - return ; - - TCollection_AsciiString Astr; - 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() ]++; - - TopTools_MapOfShape aMapOfShape; - aMapOfShape.Add( S ); - TopTools_ListOfShape aListOfShape; - aListOfShape.Append( S ); - - TopTools_ListIteratorOfListOfShape itL(aListOfShape); - for (; itL.More(); itL.Next()) - { - TopoDS_Iterator it(itL.Value()); - for (; it.More(); it.Next()) - { - TopoDS_Shape s = it.Value(); - 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() ); - } - catch(Standard_Failure) { - MESSAGE("Catch intercepted in CalculateWhatis()" << endl ) ; - } - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_WhatisDlg.h b/src/GEOMGUI/GeometryGUI_WhatisDlg.h deleted file mode 100644 index 02a4e9f4a..000000000 --- a/src/GEOMGUI/GeometryGUI_WhatisDlg.h +++ /dev/null @@ -1,111 +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 : GeometryGUI_WhatisDlg.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_WHATIS_H -#define DIALOGBOX_WHATIS_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QTextView; -class GeometryGUI; - -//================================================================================= -// class : DialogBox_PROPERTIES -// purpose : -//================================================================================= -class GeometryGUI_WhatisDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_WhatisDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_WhatisDlg(); - -private: - - 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 */ - GeometryGUI* myGeomGUI ; /* 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; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnCancel(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_WhatisDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupConstructor1Layout; - QGridLayout* GroupButtonsLayout; -}; - -#endif // DIALOGBOX_WHATIS_H diff --git a/src/GEOMGUI/GeometryGUI_WireDlg.cxx b/src/GEOMGUI/GeometryGUI_WireDlg.cxx deleted file mode 100644 index add86fe1a..000000000 --- a/src/GEOMGUI/GeometryGUI_WireDlg.cxx +++ /dev/null @@ -1,375 +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 : GeometryGUI_WireDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_WireDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -//================================================================================= -// class : GeometryGUI_WireDlg() -// purpose : Constructs a GeometryGUI_WireDlg 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. -//================================================================================= -GeometryGUI_WireDlg::GeometryGUI_WireDlg( 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_BUILD_WIRE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_WireDlg" ); - resize( 303, 185 ); - setCaption( tr( "GEOM_WIRE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_WireDlgLayout = new QGridLayout( this ); - GeometryGUI_WireDlgLayout->setSpacing( 6 ); - GeometryGUI_WireDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_WIRE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_WireDlgLayout->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 ); - GeometryGUI_WireDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_WIRE_CONNECT" ) ); - 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_OBJECTS" ) ); - 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 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - GeometryGUI_WireDlgLayout->addWidget( GroupC1, 1, 0 ); - - Init(Sel) ; /* Initialisations */ -} - -//================================================================================= -// function : ~GeometryGUI_WireDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_WireDlg::~GeometryGUI_WireDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkListShapes = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - 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( 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( 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_WireDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::ClickOnApply() -{ - switch(myConstructorId) - { - case 0 : - { - if(myOkListShapes) { - myGeomGUI->MakeWireAndDisplay( myListShapes ) ; - } - break ; - } - } - // accept(); - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::ClickOnCancel() -{ - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_WireDlg::SelectionIntoArgument() -{ - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - - myEditCurrentArgument->setText("") ; - myOkListShapes = false; - QString aString = ""; /* Future name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if(nbSel < 1) - return ; - - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; - myEditCurrentArgument->setText(aString) ; - myOkListShapes = true ; - /* no simulation */ - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::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 GeometryGUI_WireDlg::LineEditReturnPressed() -{ - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_WireDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} - - diff --git a/src/GEOMGUI/GeometryGUI_WireDlg.h b/src/GEOMGUI/GeometryGUI_WireDlg.h deleted file mode 100644 index 5346ccaca..000000000 --- a/src/GEOMGUI/GeometryGUI_WireDlg.h +++ /dev/null @@ -1,106 +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 : GeometryGUI_WireDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -#ifndef DIALOGBOX_WIRE_H -#define DIALOGBOX_WIRE_H - -#include "SALOME_Selection.h" -#include "GEOM_ShapeTypeFilter.hxx" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_WireDlg -// purpose : -//================================================================================= -class GeometryGUI_WireDlg : public QDialog -{ - Q_OBJECT - -public: - GeometryGUI_WireDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_WireDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - GEOM::GEOM_Gen::ListOfIOR myListShapes ; - bool myOkListShapes ; /* to check when arguments is defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_WireDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_WIRE_H diff --git a/src/GEOMGUI/GeometryGUI_WorkingPlaneDlg.cxx b/src/GEOMGUI/GeometryGUI_WorkingPlaneDlg.cxx deleted file mode 100644 index 536347dd8..000000000 --- a/src/GEOMGUI/GeometryGUI_WorkingPlaneDlg.cxx +++ /dev/null @@ -1,423 +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 : GeometryGUI_WorkingPlaneDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM - -using namespace std; -#include "GeometryGUI_WorkingPlaneDlg.h" - -#include "GeometryGUI.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "utilities.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================================= -// class : GeometryGUI_WorkingPlaneDlg() -// purpose : Constructs a GeometryGUI_WorkingPlaneDlg 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. -//================================================================================= -GeometryGUI_WorkingPlaneDlg::GeometryGUI_WorkingPlaneDlg( 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_WPLANE_FACE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "GeometryGUI_WorkingPlaneDlg" ); - resize( 303, 185 ); - setCaption( tr( "GEOM_WPLANE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_WorkingPlaneDlgLayout = new QGridLayout( this ); - GeometryGUI_WorkingPlaneDlgLayout->setSpacing( 6 ); - GeometryGUI_WorkingPlaneDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_WPLANE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - GeometryGUI_WorkingPlaneDlgLayout->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 ); - GeometryGUI_WorkingPlaneDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_WPLANE_FACE" ) ); - 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_SELECTION" ) ); - 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 ); - SelectButtonC1A1->setToggleButton( FALSE ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - GeometryGUI_WorkingPlaneDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - - Init(Sel) ; /* Initialisations */ -} - -//================================================================================= -// function : ~GeometryGUI_WorkingPlaneDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -GeometryGUI_WorkingPlaneDlg::~GeometryGUI_WorkingPlaneDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::Init( SALOME_Selection* Sel ) -{ - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkPlane = false ; - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO : previous selection into argument ? - - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); - /* Filter definition */ - myFaceFilter = new GEOM_FaceFilter( StdSelect_Plane, myGeom ); - mySelection->AddFilter( myFaceFilter ); /* filter for next selection */ - - /* 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( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - 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 ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - - return ; -} - - -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId) -{ - return ; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::ClickOnApply() -{ - mySelection->ClearFilters() ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; - switch(myConstructorId) - { - case 0 : - { - if(myOkPlane) { - myGeomGUI->MakeWorkingPlane( this->myLoc, this->myDir ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::ClickOnCancel() -{ - mySelection->ClearFilters() ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - reject() ; - return ; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::SelectionIntoArgument() -{ - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - - myEditCurrentArgument->setText("") ; - QString aString = ""; /* future the name of selection */ - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - switch (myConstructorId) - { - case 0: - { - if ( myEditCurrentArgument == LineEditC1A1 ) { - myOkPlane = false ; - } - break ; - } - } - return ; - } - - /* nbSel == 1 */ - TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if ( myEditCurrentArgument == LineEditC1A1 ) { - BRepAdaptor_Surface surf(TopoDS::Face(S)); - gp_Pln Plane = surf.Plane(); - myLoc = Plane.Location(); - myDir = Plane.Axis().Direction(); - - LineEditC1A1->setText(aString) ; - myOkPlane = true ; - } - - /* no simulation */ - return ; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - mySelection->AddFilter(myFaceFilter) ; - SelectionIntoArgument() ; - break; - } - } - return ; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - 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( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - mySelection->ClearFilters() ; - disconnect( mySelection, 0, this, 0 ); - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - } - return ; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - return ; -} - - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::enterEvent(QEvent* e) -{ - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; -} - - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void GeometryGUI_WorkingPlaneDlg::closeEvent( QCloseEvent* e ) -{ - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} diff --git a/src/GEOMGUI/GeometryGUI_WorkingPlaneDlg.h b/src/GEOMGUI/GeometryGUI_WorkingPlaneDlg.h deleted file mode 100644 index 2f54705a8..000000000 --- a/src/GEOMGUI/GeometryGUI_WorkingPlaneDlg.h +++ /dev/null @@ -1,113 +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 : GeometryGUI_WorkingPlaneDlg.h -// Author : Lucien PIGNOLONI -// Module : GEOM - -#ifndef DIALOGBOX_WORKINGPLANE_H -#define DIALOGBOX_WORKINGPLANE_H - -#include "SALOME_Selection.h" -#include "GEOM_FaceFilter.hxx" - -#include -#include -#include -#include - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class GeometryGUI; - - -//================================================================================= -// class : GeometryGUI_WorkingPlaneDlg -// purpose : -//================================================================================= -class GeometryGUI_WorkingPlaneDlg : public QDialog -{ - Q_OBJECT -public: - GeometryGUI_WorkingPlaneDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_WorkingPlaneDlg(); - -private: - - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - Handle(GEOM_FaceFilter) myFaceFilter; /* filter for selection */ - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - gp_Pnt myLoc; - gp_Dir myDir; - bool myOkPlane ; /* to check when arguments are defined */ - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - -private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* GeometryGUI_WorkingPlaneDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; -}; - -#endif // DIALOGBOX_WORKINGPLANE_H diff --git a/src/GEOMGUI/GeometryGUI_aParameterDlg.cxx b/src/GEOMGUI/GeometryGUI_aParameterDlg.cxx deleted file mode 100644 index ef9f50514..000000000 --- a/src/GEOMGUI/GeometryGUI_aParameterDlg.cxx +++ /dev/null @@ -1,166 +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 : GeometryGUI_aParameterDlg.cxx -// Author : Lucien PIGNOLONI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GeometryGUI_aParameterDlg.h" -#include "GeometryGUI.h" -#include "QAD_SpinBoxDbl.h" -#include "QAD_Tools.h" - -#include - -#include -#include -#include -#include -#include -#include - -//====================================================================================== -// function : GeometryGUI_aParameterDlg() -// purpose : Constructs a GeometryGUI_aParametertDlg which is a child of 'parent', with the -// name 'name' and widget flags set to 'f' -// -// avalue1 : is a float or integer used as default value in edit line -// aTitle1 : is the prompt for aValue1 -// aTitle : is the title for the user in dialog box -// -// bottom : the minimal value to be entered -// top : the maximum value to be entered -// decimals : number of decimals to be entered -// -// The dialog will by default be modeless, unless you set 'modal' to -// TRUE to construct a modal dialog. -// -//====================================================================================== -GeometryGUI_aParameterDlg::GeometryGUI_aParameterDlg( const char *aValue1, - const char *aTitle1, - QWidget* parent, - const char* name, - bool modal, - WFlags fl, - const double bottom, - const double top, - const int decimals ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - if ( !name ) - setName( "MyParameterDialog" ); - resize( 288, 81 ); - setCaption( name ); /* appears on the title bar */ - setSizeGripEnabled( TRUE ); - - QGridLayout* topLayout = new QGridLayout( this ); - topLayout->setSpacing( 6 ); - topLayout->setMargin( 11 ); - - QGroupBox* mainGrp = new QGroupBox( this, "mainGrp" ); - mainGrp->setColumnLayout(0, Qt::Vertical ); - mainGrp->layout()->setSpacing( 0 ); - mainGrp->layout()->setMargin( 0 ); - QGridLayout* mainGrpLayout = new QGridLayout( mainGrp->layout() ); - mainGrpLayout->setAlignment( Qt::AlignTop ); - mainGrpLayout ->setSpacing( 6 ); - mainGrpLayout->setMargin( 11 ); - topLayout->addWidget( mainGrp, 0, 0 ); - - /* aTitle1 : text prompt on left of edit line */ - QLabel* TextLabel1 = new QLabel( mainGrp, "TextLabel1" ); - TextLabel1->setText( tr( aTitle1 ) ); - mainGrpLayout->addWidget( TextLabel1, 0, 0 ); - - mySpinBox = new QAD_SpinBoxDbl( mainGrp, "mySpinBox" ); - mySpinBox->setPrecision( 12); - mySpinBox->setRange( bottom, top ); - (( QDoubleValidator* )(mySpinBox->validator()))->setRange(bottom, top, decimals); - mySpinBox->setValue(QString(aValue1).toDouble()); - mainGrpLayout->addWidget( mySpinBox, 0, 1 ); - - QGroupBox* btnGrp = new QGroupBox( this, "btnGrp" ); - btnGrp->setColumnLayout(0, Qt::Vertical ); - btnGrp->layout()->setSpacing( 0 ); - btnGrp->layout()->setMargin( 0 ); - QGridLayout* btnGrpLayout = new QGridLayout( btnGrp->layout() ); - btnGrpLayout->setAlignment( Qt::AlignTop ); - btnGrpLayout->setSpacing( 6 ); - btnGrpLayout->setMargin( 11 ); - topLayout->addWidget( btnGrp, 1, 0 ); - - /* Ok button */ - myButtonOk = new QPushButton( btnGrp, "buttonOk" ); - myButtonOk->setText( tr("GEOM_BUT_OK") ); - myButtonOk->setAutoDefault( TRUE ); - myButtonOk->setDefault( TRUE ); - btnGrpLayout->addWidget( myButtonOk, 0, 0 ); - - btnGrpLayout->addItem( new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1 ); - - /* Cancel button */ - myButtonCancel = new QPushButton( btnGrp, "buttonCancel" ); - myButtonCancel->setText( tr("GEOM_BUT_CANCEL") ); - myButtonCancel->setAutoDefault( TRUE ); - btnGrpLayout->addWidget( myButtonCancel, 0, 2 ); - - /* signals and slots connections */ - connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); - - /* Retrieve GeomGUI */ - myGeomGUI = GeometryGUI::GetGeometryGUI() ; - - /* Move widget on the botton right corner of main widget */ - QAD_Tools::centerWidget(this, parent); -} - - -//====================================================================================== -// function : ~GeometryGUI_aParameterDlg() destructor -// purpose : Destroys the object and frees any allocated resources -//====================================================================================== -GeometryGUI_aParameterDlg::~GeometryGUI_aParameterDlg() -{ // no need to delete child widgets, Qt does it all for us -} - -//====================================================================================== -// function : GeometryGUI_aParameterDlg::setValue -// purpose : sets value -//====================================================================================== -void GeometryGUI_aParameterDlg::setValue( double val ) -{ - mySpinBox->setValue( val ); -} - -//====================================================================================== -// function : GeometryGUI_aParameterDlg::getValue -// purpose : gets value -//====================================================================================== -double GeometryGUI_aParameterDlg::getValue() -{ - return mySpinBox->value(); -} - diff --git a/src/GEOMGUI/Makefile.in b/src/GEOMGUI/Makefile.in index 568b62a57..9576c2d35 100644 --- a/src/GEOMGUI/Makefile.in +++ b/src/GEOMGUI/Makefile.in @@ -38,140 +38,25 @@ VPATH=.:@srcdir@:@top_srcdir@/idl EXPORT_HEADERS= GeometryGUI_Swig.hxx \ GeometryGUI_Swig.i -# ressources files : -PO_FILES = \ - GEOM_icons.po \ - GEOM_msg_en.po \ - GEOM_msg_fr.po - # Libraries targets LIB = libGEOMGUI.la LIB_SRC = GeometryGUI.cxx \ - GeometryGUI_SpinBox.cxx \ - GeometryGUI_TransparencyDlg.cxx \ - GeometryGUI_NbIsosDlg.cxx \ - GeometryGUI_BoxDlg.cxx \ - GeometryGUI_ArchimedeDlg.cxx \ - GeometryGUI_PointDlg.cxx \ - GeometryGUI_VectorDlg.cxx \ - GeometryGUI_PlaneDlg.cxx \ - GeometryGUI_PrismDlg.cxx \ - GeometryGUI_FuseDlg.cxx \ - GeometryGUI_SectionDlg.cxx \ - GeometryGUI_CommonDlg.cxx \ - GeometryGUI_CutDlg.cxx \ - GeometryGUI_LineDlg.cxx \ - GeometryGUI_ScaleDlg.cxx \ - GeometryGUI_MirrorDlg.cxx \ - GeometryGUI_SphereDlg.cxx \ - GeometryGUI_CircleDlg.cxx \ - GeometryGUI_RevolDlg.cxx \ - GeometryGUI_RotationDlg.cxx \ - GeometryGUI_TranslationDlg.cxx \ - GeometryGUI_ArcDlg.cxx \ - GeometryGUI_PipeDlg.cxx \ - GeometryGUI_CylinderDlg.cxx \ - GeometryGUI_ConeDlg.cxx \ - GeometryGUI_TorusDlg.cxx \ - GeometryGUI_FillingDlg.cxx \ - GeometryGUI_SewingDlg.cxx \ - GeometryGUI_CompoundDlg.cxx \ - GeometryGUI_EdgeDlg.cxx \ - GeometryGUI_OrientationDlg.cxx \ - GeometryGUI_PartitionDlg.cxx \ - GeometryGUI_SubShapeDlg.cxx \ - GeometryGUI_aParameterDlg.cxx \ - GeometryGUI_WireDlg.cxx \ - GeometryGUI_WorkingPlaneDlg.cxx \ - GeometryGUI_PropertiesDlg.cxx \ - GeometryGUI_InertiaDlg.cxx \ - GeometryGUI_CenterMassDlg.cxx \ - GeometryGUI_FaceDlg.cxx \ - GeometryGUI_BndBoxDlg.cxx \ - GeometryGUI_MaxToleranceDlg.cxx \ - GeometryGUI_WhatisDlg.cxx \ - GeometryGUI_DistanceDlg.cxx \ - GeometryGUI_SuppressFacesDlg.cxx \ - GeometryGUI_CheckShape.cxx \ - GeometryGUI_FilletDlg.cxx \ - GeometryGUI_ChamferDlg.cxx \ - GeometryGUI_MultiTranslationDlg.cxx \ - GeometryGUI_MultiRotationDlg.cxx \ - GeometryGUI_Swig.cxx \ - GeometryGUI_SuppressHoleDlg.cxx \ - GeometryGUI_EllipseDlg.cxx + GeometryGUI_Swig.cxx LIB_MOC = \ GeometryGUI.h \ - GeometryGUI_SpinBox.h \ - GeometryGUI_TransparencyDlg.h \ - GeometryGUI_NbIsosDlg.h \ - GeometryGUI_BoxDlg.h \ - GeometryGUI_ArchimedeDlg.h \ - GeometryGUI_PointDlg.h \ - GeometryGUI_VectorDlg.h \ - GeometryGUI_PlaneDlg.h \ - GeometryGUI_PrismDlg.h \ - GeometryGUI_FuseDlg.h \ - GeometryGUI_SectionDlg.h \ - GeometryGUI_CommonDlg.h \ - GeometryGUI_CutDlg.h \ - GeometryGUI_LineDlg.h \ - GeometryGUI_ScaleDlg.h \ - GeometryGUI_MirrorDlg.h \ - GeometryGUI_SphereDlg.h \ - GeometryGUI_CircleDlg.h \ - GeometryGUI_RevolDlg.h \ - GeometryGUI_RotationDlg.h \ - GeometryGUI_TranslationDlg.h \ - GeometryGUI_ArcDlg.h \ - GeometryGUI_PipeDlg.h \ - GeometryGUI_CylinderDlg.h \ - GeometryGUI_ConeDlg.h \ - GeometryGUI_TorusDlg.h \ - GeometryGUI_FillingDlg.h \ - GeometryGUI_SewingDlg.h \ - GeometryGUI_CompoundDlg.h \ - GeometryGUI_EdgeDlg.h \ - GeometryGUI_OrientationDlg.h \ - GeometryGUI_PartitionDlg.h \ - GeometryGUI_SubShapeDlg.h \ - GeometryGUI_aParameterDlg.h \ - GeometryGUI_WireDlg.h \ - GeometryGUI_WorkingPlaneDlg.h \ - GeometryGUI_PropertiesDlg.h \ - GeometryGUI_InertiaDlg.h \ - GeometryGUI_CenterMassDlg.h \ - GeometryGUI_FaceDlg.h \ - GeometryGUI_BndBoxDlg.h \ - GeometryGUI_MaxToleranceDlg.h \ - GeometryGUI_WhatisDlg.h \ - GeometryGUI_DistanceDlg.h \ - GeometryGUI_SuppressFacesDlg.h \ - GeometryGUI_CheckShape.h \ - GeometryGUI_FilletDlg.h \ - GeometryGUI_ChamferDlg.h \ - GeometryGUI_MultiTranslationDlg.h \ - GeometryGUI_MultiRotationDlg.h \ - GeometryGUI_SuppressHoleDlg.h \ - GeometryGUI_EllipseDlg.h LIB_CLIENT_IDL = SALOME_Exception.idl \ - GEOM_Gen.idl \ - GEOM_Shape.idl \ SALOMEDS.idl \ - SALOMEDS_Attributes.idl \ - SALOME_ModuleCatalog.idl \ - SALOME_Component.idl \ + SALOMEDS_Attributes.idl LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome - -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lGEOMSketcher $(CAS_LDPATH) -lTKFillet -lTKOffset -L${KERNEL_ROOT_DIR}/lib/salome +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS += -lGEOMContext @CONCLUDE@ diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx new file mode 100644 index 000000000..fe0e3cc9c --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -0,0 +1,911 @@ +// 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 : GEOMBase_Tools.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "GEOMToolsGUI.h" + +#include "QAD_Config.h" +#include "QAD_FileDlg.h" +#include "QAD_Tools.h" +#include "QAD_MessageBox.h" +#include "QAD_RightFrame.h" + +#include "OCCViewer_Viewer3d.h" +#include "VTKViewer_ViewFrame.h" + +#include "SALOME_ListIteratorOfListIO.hxx" +#include "SALOMEGUI_NameDlg.h" +#include "SALOMEGUI_ImportOperation.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement +#include "GEOMToolsGUI_TransparencyDlg.h" // Method TRANSPARENCY adjustement + +//======================================================================= +// function : GEOMToolsGUI() +// purpose : Constructor +//======================================================================= +GEOMToolsGUI::GEOMToolsGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; +} + + +//======================================================================= +// function : ~GEOMToolsGUI() +// purpose : Destructor +//======================================================================= +GEOMToolsGUI::~GEOMToolsGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + GEOMToolsGUI* myGEOMToolsGUI = new GEOMToolsGUI(); + myGEOMToolsGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + switch (theCommandID) + { + case 31: // COPY + { + myGEOMToolsGUI->OnEditCopy(); + break; + } + case 33: // DELETE + { + myGEOMToolsGUI->OnEditDelete(); + break; + } + case 111: // IMPORT BREP + { + myGEOMToolsGUI->Import(theCommandID); + break; + } + case 112: // IMPORT IGES + { + myGEOMToolsGUI->Import(theCommandID); + break; + } + case 113: // IMPORT STEP + { + myGEOMToolsGUI->Import(theCommandID); + break; + } + case 121: // EXPORT BREP + { + myGEOMToolsGUI->Export(theCommandID); + break; + } + case 122: // EXPORT IGES + { + myGEOMToolsGUI->Export(theCommandID); + break; + } + case 123: // EXPORT STEP + { + myGEOMToolsGUI->Export(theCommandID); + break; + } + case 411: // SETTINGS - ADD IN STUDY + { + QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); + QMenuData* pp; + QMenuItem* item = parent->menuBar()->findItem(411, &pp); + bool check = !pp->isItemChecked(411); + pp->setItemChecked(411,check); + //myGEOMToolsGUI->myGeomGUI->GetSettings_AddInStudy() = check; + QAD_CONFIG->addSetting("Geometry:SettingsAddInStudy", check); + break; + } + case 412: // SETTINGS - SHADING COLOR + { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + break; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed"); + QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen"); + QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue"); + QColor color; + if(!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty()) { + color = QColor (SCr.toInt(), SCg.toInt(), SCb.toInt()); + } + else { + Quantity_Color Default = Quantity_Color(); + color = QColor ((int)Default.Red() * 255.0, (int)Default.Green()* 255.0, (int)Default.Blue() * 255.0); + } + + QColor c = QColorDialog::getColor(color, QAD_Application::getDesktop()); + if(c.isValid()) { + //myGEOMToolsGUI->myGeomGUI->GetShadingColor() = Quantity_Color(c.red() / 255.0, c.green() / 255.0, c.blue() / 255.0, Quantity_TOC_RGB); + + 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()); + aSh->SetShadingColor(Quantity_Color(c.red() / 255.0, c.green() / 255.0, c.blue() / 255.0, Quantity_TOC_RGB)); + ic->Redisplay(aSh, Standard_True, Standard_True); + } + ite.Next(); + } + + ic->UpdateCurrentViewer(); + + QAD_CONFIG->addSetting("Geometry:SettingsShadingColorRed", c.red()); + QAD_CONFIG->addSetting("Geometry:SettingsShadingColorGreen", c.green()); + QAD_CONFIG->addSetting("Geometry:SettingsShadingColorBlue", c.blue()); + } + break; + } + case 413: // SETTINGS - ISOS + { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + break; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU"); + QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV"); + if(!IsoU.isEmpty()) + ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt()); + else + IsoU = "1"; + if (!IsoV.isEmpty()) + ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt()); + else + IsoV = "1"; + + GEOMBase_NbIsosDlg* NbIsosDlg = new GEOMBase_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE); + int UIso = IsoU.toInt(); + int VIso = IsoV.toInt(); + + NbIsosDlg->SpinBoxU->setValue(UIso); + NbIsosDlg->SpinBoxV->setValue(VIso); + + if(NbIsosDlg->exec()) { + UIso = NbIsosDlg->SpinBoxU->text().toInt(); + VIso = NbIsosDlg->SpinBoxV->text().toInt(); + + ic->DefaultDrawer()->UIsoAspect()->SetNumber(UIso); + ic->DefaultDrawer()->VIsoAspect()->SetNumber(VIso); + QAD_CONFIG->addSetting("Geometry:SettingsIsoU", NbIsosDlg->SpinBoxU->text()); /* text format */ + QAD_CONFIG->addSetting("Geometry:SettingsIsoV", NbIsosDlg->SpinBoxV->text()); /* text format */ + } + + AIS_ListOfInteractive List; + ic->DisplayedObjects(List); + AIS_ListOfInteractive List1; + ic->ObjectsInCollector(List1); + List.Append(List1); + + AIS_ListIteratorOfListOfInteractive ite(List); + ic->InitCurrent(); + if(ic->NbCurrents()) + while(ite.More()) { + if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + Handle (AIS_Drawer) CurDrawer; + CurDrawer = aSh->Attributes(); + CurDrawer->UIsoAspect()->SetNumber(UIso); + CurDrawer->VIsoAspect()->SetNumber(VIso); + ic->SetLocalAttributes(aSh, CurDrawer); + ic->Redisplay(aSh); + } + ite.Next(); + } + ic->UpdateCurrentViewer(); + break; + } + case 414: // SETTINGS : STEP VALUE FOR SPIN BOXES + { + QString step = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + if(step.isEmpty()) + step = "100.0"; + + Standard_Boolean res = false; + double dd = myGEOMToolsGUI->myGeomBase->Parameter(res, QString("%1").arg(step), tr("GEOM_MEN_STEP_LABEL"), tr("GEOM_STEP_TITLE"), 0.001, 10000.0, 3); + if(res) { + QAD_CONFIG->addSetting("Geometry:SettingsGeomStep", QString("%1").arg(dd)); + + /* Emit signal to GeometryGUI_SpinBoxes */ + myGEOMToolsGUI->myGeomGUI->EmitSignalDefaultStepValueChanged(dd); + } + else + parent->putInfo(tr("GEOM_PRP_ABORT")); + break; + } + case 804: // ADD IN STUDY - POPUP VIEWER + { + const SALOME_ListIO& ListSelected = Sel->StoredIObjects(); + SALOME_ListIteratorOfListIO It(ListSelected); + for(; It.More(); It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + myGEOMToolsGUI->myGeomBase->AddInStudy(true, IObject); + } + /* Is set on the dialog box */ + QApplication::restoreOverrideCursor(); + break; + } + case 901: // RENAME + { + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + for(; It.More(); It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeName")) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + + QString nm = QString(aName->Value()); + nm = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), nm); + if(!nm.isEmpty()) { + QApplication::setOverrideCursor(Qt::waitCursor); + QAD_Application::getDesktop()->getActiveStudy()->renameIObject(IObject, nm); + QApplication::restoreOverrideCursor(); + } + } + } + } + break; + } + case 5103: // CHECK GEOMETRY + { + QAD_PyEditor* PyEditor = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor(); + PyEditor->setText("from GEOM_usinggeom import *\n"); + PyEditor->setText(">>> "); + PyEditor->handleReturn(); + break; + } + case 5104: // LOAD SCRIPT + { + QStringList filtersList; + filtersList.append(tr("GEOM_MEN_LOAD_SCRIPT")); + filtersList.append(tr("GEOM_MEN_ALL_FILES")); + + QString aFile = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), "", filtersList, tr("GEOM_MEN_IMPORT"), true); + if(!aFile.isEmpty()) { + QFileInfo file = aFile; + QApplication::setOverrideCursor(Qt::waitCursor); + QAD_PyEditor* PyEditor = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor(); + + PyEditor->setText("import geompy\n"); + PyEditor->handleReturn(); + + QStringList aTextList = QStringList::split(".", file.fileName()); + PyEditor->setText("geompy.Path('" + file.dirPath() + "')\n"); + PyEditor->handleReturn(); + + PyEditor->setText("from " + aTextList.first() + " import *\n"); + PyEditor->handleReturn(); + } + QApplication::restoreOverrideCursor(); + break; + } + case 8032: // COLOR - POPUP VIEWER + { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + // VTK + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + Handle(SALOME_InteractiveObject) FirstIOS = Sel->firstIObject(); + if(!FirstIOS.IsNull()) { + QColor initcolor = myRenderInter->GetColor(FirstIOS); + QColor c = QColorDialog::getColor( initcolor, QAD_Application::getDesktop()); + + if(c.isValid()) { + QApplication::setOverrideCursor(Qt::waitCursor); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IOS = It.Value(); + myRenderInter->SetColor(IOS,c); + } + } + QApplication::restoreOverrideCursor(); + } + } + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + Handle(SALOME_InteractiveObject) IO = Sel->firstIObject(); + Standard_Boolean found; + Handle(GEOM_AISShape) Shape = myGEOMToolsGUI->myGeomBase->ConvertIOinGEOMAISShape(IO, found, true); + if(found) { + Quantity_Color CSFColor; + Shape->Color(CSFColor); + + QColor c = QColorDialog::getColor(QColor(CSFColor.Red() * 255.0, CSFColor.Green()* 255.0, CSFColor.Blue() * 255.0), QAD_Application::getDesktop()); + + if(c.isValid()) { + CSFColor = Quantity_Color (c.red()/255., c.green()/255., c.blue()/255., Quantity_TOC_RGB); + QApplication::setOverrideCursor( Qt::waitCursor ); + + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + Handle(GEOM_AISShape) Shape = myGEOMToolsGUI->myGeomBase->ConvertIOinGEOMAISShape(IObject, found, true); + if(found) { + Shape->SetColor(CSFColor); + Shape->SetShadingColor(CSFColor); + } + } + } + } + } + QApplication::restoreOverrideCursor(); + break; + } + case 8033: // TRANSPARENCY - POPUP VIEWER + { + OCCViewer_Viewer3d* v3d; + Handle(AIS_InteractiveContext) ic; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + } + GEOMBase_TransparencyDlg *aDlg = new GEOMBase_TransparencyDlg(parent, "", Sel, ic); + break; + } + case 8034: // ISOS - POPUP VIEWER + { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + break; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + ic->InitCurrent(); + if(ic->MoreCurrent()) { + Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU"); + QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV"); + + if(!IsoU.isEmpty()) + ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt()); + else + IsoU = "1"; + if (!IsoV.isEmpty()) + ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt()); + else + IsoV = "1"; + + GEOMBase_NbIsosDlg * NbIsosDlg = + new GEOMBase_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE); + + NbIsosDlg->SpinBoxU->setValue(IsoU.toInt()); + NbIsosDlg->SpinBoxV->setValue(IsoV.toInt()); + + if(NbIsosDlg->exec()) { + QApplication::setOverrideCursor(Qt::waitCursor); + for(; ic->MoreCurrent(); ic->NextCurrent()) { + Handle(AIS_Drawer) CurDrawer; + + CurDrawer = ic->Current()->Attributes(); + CurDrawer->UIsoAspect()->SetNumber(NbIsosDlg->SpinBoxU->text().toInt()); + CurDrawer->VIsoAspect()->SetNumber(NbIsosDlg->SpinBoxV->text().toInt()); + + ic->SetLocalAttributes(CurObject, CurDrawer); + ic->Redisplay(CurObject); + } + } + } + QApplication::restoreOverrideCursor(); + break; + } + case 9024 : // OPEN - OBJBROSER POPUP + { + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + Handle(SALOME_InteractiveObject) anIObject; + for(;It.More();It.Next()) { + anIObject = It.Value(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID(anIObject->getEntry()); + SALOMEDS::AttributePersistentRef_var aPersist; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + // this SObject may be GEOM module root SObject + SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(obj); + SALOMEDS::GenericAttribute_var anAttr; + bool useSubItems = false; + while (anIter->More() && !useSubItems) { + SALOMEDS::SObject_var subobj = anIter->Value(); + if (subobj->FindAttribute(anAttr, "AttributePersistentRef")) { + useSubItems = true; + obj = subobj; + } + else + anIter->Next(); + } + obj->FindAttribute(anAttr, "AttributePersistentRef"); + + while(useSubItems?anIter->More():!anAttr->_is_nil()) { + if(!obj->FindAttribute(anAttr, "AttributeIOR") && + obj->FindAttribute(anAttr, "AttributePersistentRef")) { + // load + Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer","GEOM"); + if (!CORBA::is_nil(comp)) { + SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + aStudyBuilder->LoadWith(aStudy->FindComponent("GEOM"),driver); + } + else { + MESSAGE("Component is null"); + } + } + if(useSubItems) { + anIter->Next(); + obj = anIter->Value(); + } + else + anAttr = SALOMEDS::GenericAttribute::_nil(); + } + } + } + break; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//=============================================================================== +// function : OnEditDelete() +// purpose : +//=============================================================================== +void GEOMToolsGUI::OnEditDelete() +{ + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + if(Sel->IObjectCount() == 0) + return; + + if(QAD_MessageBox::warn2(QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_REALLY_DELETE"), tr("GEOM_BUT_YES"), tr("GEOM_BUT_NO"), 1, 0, 0) != 1) + return; + + int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); + + Standard_Boolean found; + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + if(IObject->hasEntry()) { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var SO = aStudy->FindObjectID(IObject->getEntry()); + + /* Erase child graphical objects */ + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO); + for(; it->More();it->Next()) { + SALOMEDS::SObject_var CSO= it->Value(); + if(CSO->FindAttribute(anAttr, "AttributeIOR") ) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + /* Delete child(s) shape in Client : */ + const TCollection_AsciiString ASCior(anIOR->Value()) ; + myGeomGUI->GetShapeReader().RemoveShapeFromBuffer(ASCior); + + for(int i = 0; i < nbSf; i++) { + QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); + if(sf->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); + Handle(GEOM_AISShape) Result = myGeomBase->ConvertIORinGEOMAISShape(anIOR->Value(), found); + if(found) + myContext->Erase(Result, true, false); + } + else if(sf->getTypeView() == VIEW_VTK) { + //vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer(); + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor(); + GEOM_Actor* ac = myGeomBase->ConvertIORinGEOMActor(anIOR->Value(), found); + if(found) { + //Renderer->RemoveActor(ac); + if(ac->hasIO()) + myRenderInter->Remove(ac->getIO()); + } + } + } + } + } + + /* Erase main graphical object */ + for(int i = 0; i < nbSf; i++) { + QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); + if(sf->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) myContext = v3d->getAISContext(); + Handle(GEOM_AISShape) Result = myGeomBase->ConvertIOinGEOMAISShape(IObject, found ); + if(found) + myContext->Erase(Result, true, false); + } + else if(sf->getTypeView() == VIEW_VTK) { + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor(); + myRenderInter->Remove( IObject ); + } + } + + /* Delete main shape in Client : */ + if(SO->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + const TCollection_AsciiString ASCIor(anIOR->Value()) ; + myGeomGUI->GetShapeReader().RemoveShapeFromBuffer(ASCIor); + } + + /* Erase objects in Study */ + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry()); + if(!obj->_is_nil()) { + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); + op->start(); + aStudyBuilder->RemoveObject(obj); + op->finish(); + } + + } /* IObject->hasEntry() */ + } /* more/next */ + + /* Clear any previous selection */ + Sel->ClearIObjects(); + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); +} + + +//============================================================================== +// function : OnEditCopy() +// purpose : +//============================================================================== +void GEOMToolsGUI::OnEditCopy() +{ + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); + GEOM::GEOM_Gen::ListOfIOR_var listIOR = new GEOM::GEOM_Gen::ListOfIOR; + + const SALOME_ListIO& List = Sel->StoredIObjects(); + + myGeomBase->ConvertListOfIOInListOfIOR(List, listIOR); + + Sel->ClearIObjects(); + + for (unsigned int ind = 0; ind < listIOR->length();ind++) { + GEOM::GEOM_Shape_var aShapeInit = myGeom->GetIORFromString(listIOR[ind]); + try { + GEOM::GEOM_Shape_var result = myGeom->MakeCopy(aShapeInit) ; + result->NameType( aShapeInit->NameType() ); + myGeomBase->Display(result); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY")); +} + + +//===================================================================================== +// function : Import +// purpose : BRep, Iges, Step +//===================================================================================== +bool GEOMToolsGUI::Import(int aState) +{ + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + + GEOM::GEOM_Shape_var aShape; + QString file; + QStringList filtersList; + + switch(aState) + { + case 111 : // Import BREP + { + filtersList.append(tr("GEOM_MEN_IMPORT_BREP")); + filtersList.append(tr("GEOM_MEN_ALL_FILES")); + + file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), "", filtersList, tr("GEOM_MEN_IMPORT"), true); + if(!file.isEmpty()) { + QApplication::setOverrideCursor(Qt::waitCursor); + try { + aShape = myGeom->ImportBREP(file.latin1()); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + break; + } + case 112 : // Import IGES + { + filtersList.append( tr("GEOM_MEN_IMPORT_IGES") ) ; + filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ; + + file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), + "", + filtersList, + tr("GEOM_MEN_IMPORT"), + true); + if ( !file.isEmpty() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + aShape = myGeom->ImportIGES( file.latin1() ); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + break; + } + case 113 : // Import STEP + { + filtersList.append( tr("GEOM_MEN_IMPORT_STEP") ) ; + filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ; + + file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), + "", + filtersList, + tr("GEOM_MEN_IMPORT"), + true); + if ( !file.isEmpty() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + aShape = myGeom->ImportSTEP( file.latin1() ); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + break; + } + } + + if ( !file.isEmpty() ) { + QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_LOADING").arg(QAD_Tools::getFileNameFromPath( file )) ); + + SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM"); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributePixMap_var aPixmap; + int aLocked = false; + if (father->_is_nil()) { + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->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( tr("GEOM_MEN_COMPONENT") ); + 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(); + } +// if (aLocked) return false; + aStudyBuilder->DefineComponentInstance( father, myGeom ); + father->ComponentIOR(myGeomGUI->GetFatherior()); + + QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(myGeomGUI->GetNbGeom()++); + + if(myGeomBase->Display(aShape, strdup(nameShape.latin1()))) { + QAD_Application::getDesktop()->getActiveStudy()->setMessage( tr("GEOM_INF_LOADED").arg(QAD_Tools::getFileNameFromPath( file )) ); + QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_READY")); + } + } + QApplication::restoreOverrideCursor(); + return true; +} + + +//===================================================================================== +// function : Export +// purpose : BRep, Iges, Step +//===================================================================================== +bool GEOMToolsGUI::Export(int aState) +{ + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + + GEOM::GEOM_Shape_var aShape; + + static QString filters[] = { tr("GEOM_MEN_IMPORT_BREP"), + tr("GEOM_MEN_IMPORT_IGES"), + tr("GEOM_MEN_IMPORT_STEP") }; + + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + + switch (aState) + { + case 121 : + { + for(;It.More();It.Next()) { + QApplication::restoreOverrideCursor(); + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + GEOM::GEOM_Shape_var aShape = myGeomBase->ConvertIOinGEOMShape(IObject, found); + // Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found, true); + if ( found ) { + QString file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), + QString( IObject->getName() ) + ".brep", + tr("GEOM_MEN_IMPORT_BREP"), + tr("GEOM_MEN_EXPORT"), + false); + if ( !file.isEmpty() && !aShape->_is_nil() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + // Standard_Boolean result = BRepTools::Write(Shape->Shape(), strdup(file.latin1()) ); + try { + myGeom->ExportBREP(strdup( file.latin1()), aShape); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + } + } + break; + } + case 122 : + { + for(;It.More();It.Next()) { + QApplication::restoreOverrideCursor(); + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + GEOM::GEOM_Shape_var aShape = myGeomBase->ConvertIOinGEOMShape(IObject, found); + // Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found, true); + if ( found ) { + QString file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), + QString( IObject->getName() ) + ".igs", + tr("GEOM_MEN_IMPORT_IGES"), + tr("GEOM_MEN_EXPORT"), + false); + if ( !file.isEmpty() && !aShape->_is_nil() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + myGeom->ExportIGES(strdup( file.latin1()), aShape); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } +// //VRV: OCC 4.0 migration +// IGESControl_Controller::Init(); +// IGESControl_Writer ICW (Interface_Static::CVal("XSTEP.iges.unit"), +// Interface_Static::IVal("XSTEP.iges.writebrep.mode")); +// //VRV: OCC 4.0 migration + +// ICW.AddShape (Shape->Shape()); +// ICW.ComputeModel(); +// Standard_Boolean result = ICW.Write( strdup(file.latin1()) ); + } + } + } + break; + } + + case 123 : + { +// bool test = false ; +// IFSelect_ReturnStatus status ; +// //VRV: OCC 4.0 migration +// STEPControl_Writer aWriter; +// //VRV: OCC 4.0 migration + QString file; + + for( ; It.More(); It.Next() ) { +// GEOM::GEOM_Shape_var aShape = myGeomBase->ConvertIOinGEOMShape(IObject, found); + QApplication::restoreOverrideCursor(); + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + GEOM::GEOM_Shape_var aShape = myGeomBase->ConvertIOinGEOMShape(IObject, found); + // Handle(GEOM_AISShape) Shape = myGeomBase->ConvertIOinGEOMAISShape(IObject, found, true); + if ( found ) { + file = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), + QString( IObject->getName() ) + ".stp", + tr("GEOM_MEN_IMPORT_STEP"), + tr("GEOM_MEN_EXPORT"), + false); + if ( !file.isEmpty() && !aShape->_is_nil() ) { + + QApplication::setOverrideCursor( Qt::waitCursor ) ; + try { + myGeom->ExportSTEP(strdup( file.latin1()), aShape); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } +// //VRV: OCC 4.0 migration +// status = aWriter.Transfer( Shape->Shape(), STEPControl_ManifoldSolidBrep ) ; +// //VRV: OCC 4.0 migration +// test = true ; +// if ( status != IFSelect_RetDone ) { +// QApplication::restoreOverrideCursor() ; +// return false ; +// } + } + } + } +// if(test) { +// status = aWriter.Write( strdup(file.latin1()) ) ; +// QApplication::restoreOverrideCursor() ; +// return status ; +// } + break; + } + + } + QApplication::restoreOverrideCursor() ; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return GEOMToolsGUI::OnGUIEvent(theCommandID, parent);} +} diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h new file mode 100644 index 000000000..8296fdb69 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI.h @@ -0,0 +1,61 @@ +// 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 : GEOMBase_Tools.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef GEOMTOOLSGUI_H +#define GEOMTOOLSGUI_H + +#include "GEOMBase.h" + +//================================================================================= +// class : GEOMBase_Tools +// purpose : +//================================================================================= +class GEOMToolsGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + GEOMToolsGUI(); + ~GEOMToolsGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + + /* Import and export topology methods */ + bool Import(int aState); + bool Export(int aState); + + void OnEditCopy(); + void OnEditDelete(); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif diff --git a/src/GEOMGUI/GeometryGUI_NbIsosDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx similarity index 79% rename from src/GEOMGUI/GeometryGUI_NbIsosDlg.cxx rename to src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx index 849cb1a1d..5ef80f650 100644 --- a/src/GEOMGUI/GeometryGUI_NbIsosDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx @@ -21,14 +21,13 @@ // // // -// File : GeometryGUI_NbIsosDlg.cxx +// File : GEOMBase_NbIsosDlg.cxx // Author : // Module : GEOM // $Header: using namespace std; -#include "GeometryGUI_NbIsosDlg.h" -#include "GeometryGUI.h" +#include "GEOMToolsGUI_NbIsosDlg.h" #include "QAD_Tools.h" #include @@ -38,22 +37,22 @@ using namespace std; #include //================================================================================= -// class : GeometryGUI_NbIsosDlg() -// purpose : Constructs a GeometryGUI_NbIsosDlg which is a child of 'parent', with the +// class : GEOMBase_NbIsosDlg() +// purpose : Constructs a GEOMBase_NbIsosDlg 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. //================================================================================= -GeometryGUI_NbIsosDlg::GeometryGUI_NbIsosDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +GEOMBase_NbIsosDlg::GEOMBase_NbIsosDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - if ( !name ) - setName( "GeometryGUI_NbIsosDlg" ); - setCaption( name ); - setSizeGripEnabled( TRUE ); - QGridLayout* MyDialogLayout = new QGridLayout( this ); - MyDialogLayout->setSpacing( 6 ); - MyDialogLayout->setMargin( 11 ); + if( !name ) + setName("GEOMBase_NbIsosDlg"); + setCaption(name); + setSizeGripEnabled(TRUE); + QGridLayout* MyDialogLayout = new QGridLayout(this); + MyDialogLayout->setSpacing(6); + MyDialogLayout->setMargin(11); /***************************************************************/ QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); @@ -109,27 +108,24 @@ GeometryGUI_NbIsosDlg::GeometryGUI_NbIsosDlg( QWidget* parent, const char* name, GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); /***************************************************************/ - MyDialogLayout->addWidget( GroupC1, 0, 0 ); - MyDialogLayout->addWidget( GroupButtons, 1, 0 ); - - /* Retrieve GeomGUI */ - myGeomGUI = GeometryGUI::GetGeometryGUI() ; + MyDialogLayout->addWidget(GroupC1, 0, 0); + MyDialogLayout->addWidget(GroupButtons, 1, 0); + // signals and slots connections - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); /* Move widget on the botton right corner of main widget */ - QAD_Tools::centerWidget( this, parent ); + QAD_Tools::centerWidget(this, parent); } //================================================================================= -// function : ~GeometryGUI_NbIsosDlg() +// function : ~GEOMBase_NbIsosDlg() // purpose : Destroys the object and frees any allocated resources //================================================================================= -GeometryGUI_NbIsosDlg::~GeometryGUI_NbIsosDlg() +GEOMBase_NbIsosDlg::~GEOMBase_NbIsosDlg() { // no need to delete child widgets, Qt does it all for us } - diff --git a/src/GEOMGUI/GeometryGUI_NbIsosDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h similarity index 70% rename from src/GEOMGUI/GeometryGUI_NbIsosDlg.h rename to src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h index a5d3498cd..48c70c563 100644 --- a/src/GEOMGUI/GeometryGUI_NbIsosDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h @@ -21,41 +21,39 @@ // // // -// File : GeometryGUI_NbIsosDlg.h +// File : GEOMBase_NbIsosDlg.h // Author : // Module : GEOM // $Header: -#ifndef GEOMETRYGUI_NBISOSDLG_H -#define GEOMETRYGUI_NBISOSDLG_H +#ifndef GEOMBASE_NBISOSDLG_H +#define GEOMBASE_NBISOSDLG_H #include class QLabel; class QSpinBox; class QPushButton; -class GeometryGUI; //================================================================================= -// class : GeometryGUI_NbIsosDlg +// class : GEOMBase_NbIsosDlg // purpose : //================================================================================= -class GeometryGUI_NbIsosDlg : public QDialog +class GEOMBase_NbIsosDlg : public QDialog { Q_OBJECT public: - GeometryGUI_NbIsosDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); - ~GeometryGUI_NbIsosDlg(); + GEOMBase_NbIsosDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); + ~GEOMBase_NbIsosDlg(); - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ + QPushButton* buttonOk; + QPushButton* buttonCancel; + QLabel* TextLabel1; + QLabel* TextLabel2; + QSpinBox* SpinBoxU; + QSpinBox* SpinBoxV; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QLabel* TextLabel1 ; - QLabel* TextLabel2 ; - QSpinBox* SpinBoxU ; - QSpinBox* SpinBoxV ; }; #endif // GEOMETRYGUI_NBISOSDLG_H diff --git a/src/GEOMGUI/GeometryGUI_TransparencyDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx similarity index 64% rename from src/GEOMGUI/GeometryGUI_TransparencyDlg.cxx rename to src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx index 8925aeb1a..6fab217a5 100644 --- a/src/GEOMGUI/GeometryGUI_TransparencyDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx @@ -21,16 +21,16 @@ // // // -// File : GeometryGUI_TransparencyDlg.cxx +// File : GEOMBase_TransparencyDlg.cxx // Author : Lucien PIGNOLONI // Module : GEOM using namespace std; -#include "GeometryGUI_TransparencyDlg.h" -#include "GeometryGUI.h" +#include "GEOMToolsGUI_TransparencyDlg.h" #include "QAD_RightFrame.h" #include "SALOME_ListIteratorOfListIO.hxx" +#include #include #include @@ -47,29 +47,24 @@ using namespace std; #include "VTKViewer_RenderWindowInteractor.h" //================================================================================= -// class : GeometryGUI_TransparencyDlg() -// purpose : Constructs a GeometryGUI_SUBSHAPE which is a child of 'parent', with the +// class : GEOMBase_TransparencyDlg() +// purpose : Constructs a GEOMBase_SUBSHAPE which is a child of 'parent', with the // name 'name' and widget flags set to 'f'. // // : WARNING : this dialog is modal ! // //================================================================================= -GeometryGUI_TransparencyDlg::GeometryGUI_TransparencyDlg( QWidget* parent, - const char* name, - SALOME_Selection* Sel, - const Handle(AIS_InteractiveContext)& ic, - bool modal, - WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +GEOMBase_TransparencyDlg::GEOMBase_TransparencyDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, const Handle(AIS_InteractiveContext)& ic, bool modal, WFlags fl) + :QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { - if ( !name ) - setName( "GeometryGUI_TransparencyDlg" ); - resize( 152, 107 ); - setCaption( tr( "GEOM_TRANSPARENCY_TITLE" ) ); - setSizeGripEnabled( TRUE ); - GeometryGUI_TransparencyDlgLayout = new QGridLayout( this ); - GeometryGUI_TransparencyDlgLayout->setSpacing( 6 ); - GeometryGUI_TransparencyDlgLayout->setMargin( 11 ); + if(!name) + setName("GEOMBase_TransparencyDlg"); + resize(152, 107); + setCaption(tr("GEOM_TRANSPARENCY_TITLE")); + setSizeGripEnabled(TRUE); + GEOMBase_TransparencyDlgLayout = new QGridLayout(this); + GEOMBase_TransparencyDlgLayout->setSpacing(6); + GEOMBase_TransparencyDlgLayout->setMargin(11); /*************************************************************************/ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); @@ -116,40 +111,39 @@ GeometryGUI_TransparencyDlg::GeometryGUI_TransparencyDlg( QWidget* parent, GroupC1Layout->addMultiCellWidget( Slider1, 1, 1, 0, 2 ); /*************************************************************************/ - GeometryGUI_TransparencyDlgLayout->addWidget( GroupC1, 0, 0 ); - GeometryGUI_TransparencyDlgLayout->addWidget( GroupButtons, 1, 0 ); + GEOMBase_TransparencyDlgLayout->addWidget(GroupC1, 0, 0); + GEOMBase_TransparencyDlgLayout->addWidget(GroupButtons, 1, 0); /* Initialisations */ - this->myGeomGUI = GeometryGUI::GetGeometryGUI() ; - this->myIc = ic ; - this->mySel = Sel ; + this->myGeomGUI = GEOMContext::GetGeomGUI(); + this->myGeomBase = new GEOMBase(); + this->myIc = ic; + this->mySel = Sel; /* First call valueChanged() method for initialisation */ /* The default value of transparency will change with the selection */ - this->myFirstInit = true ; + this->myFirstInit = true; // Slider1->setMaxValue( 10 ); // Slider1->setValue( 5 ) ; - this->ValueHasChanged( Slider1->value() ) ; + this->ValueHasChanged(Slider1->value()); // signals and slots connections : after ValueHasChanged() - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( Slider1, SIGNAL( valueChanged(int) ), this, SLOT( ValueHasChanged(int) ) ); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(Slider1, SIGNAL(valueChanged(int)), this, SLOT(ValueHasChanged(int))); /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; + myGeomBase->DefineDlgPosition(this, x, y); + this->move(x, y) ; this->show() ; /* Displays this Dialog */ } - - //================================================================================= -// function : ~GeometryGUI_TransparencyDlg() +// function : ~GEOMBase_TransparencyDlg() // purpose : //================================================================================= -GeometryGUI_TransparencyDlg::~GeometryGUI_TransparencyDlg() +GEOMBase_TransparencyDlg::~GEOMBase_TransparencyDlg() { // no need to delete child widgets, Qt does it all for us } @@ -159,10 +153,10 @@ GeometryGUI_TransparencyDlg::~GeometryGUI_TransparencyDlg() // function : ClickOnOk() // purpose : //======================================================================= -void GeometryGUI_TransparencyDlg::ClickOnOk() +void GEOMBase_TransparencyDlg::ClickOnOk() { - accept() ; - return ; + accept(); + return; } @@ -170,10 +164,10 @@ void GeometryGUI_TransparencyDlg::ClickOnOk() // function : ClickOnClose() // purpose : //======================================================================= -void GeometryGUI_TransparencyDlg::ClickOnClose() +void GEOMBase_TransparencyDlg::ClickOnClose() { - accept() ; - return ; + accept(); + return; } @@ -182,68 +176,64 @@ void GeometryGUI_TransparencyDlg::ClickOnClose() // purpose : Called when value of slider change // : or the first time as initilisation //================================================================================= -void GeometryGUI_TransparencyDlg::ValueHasChanged( int newValue ) +void GEOMBase_TransparencyDlg::ValueHasChanged(int newValue) { - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) { + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { // VTK - // vtkQGLRenderWindowInteractor* myRenderInter= myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getVTKView()->getRWInteractor(); - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - SALOME_ListIteratorOfListIO It( this->mySel->StoredIObjects() ); + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + SALOME_ListIteratorOfListIO It(this->mySel->StoredIObjects()); Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject(); - if( !FirstIOS.IsNull() ) { - + if(!FirstIOS.IsNull()) { /* The first time as initialisation */ - if( this->myFirstInit ) { - this->myFirstInit = false ; - float transp = ( myRenderInter->GetTransparency(FirstIOS))*10.0 ; - this->Slider1->setValue( int(transp) ) ; + if(this->myFirstInit) { + this->myFirstInit = false; + float transp = (myRenderInter->GetTransparency(FirstIOS))*10.0; + this->Slider1->setValue(int(transp)); } } - QApplication::setOverrideCursor( Qt::waitCursor ); - for( ;It.More(); It.Next() ) { + QApplication::setOverrideCursor(Qt::waitCursor); + for(;It.More(); It.Next()) { Handle(SALOME_InteractiveObject) IOS = It.Value(); - myRenderInter->SetTransparency( IOS, newValue/10.0 ); + myRenderInter->SetTransparency(IOS, newValue/10.0); } QApplication::restoreOverrideCursor(); } - else if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { // OCC - SALOME_ListIteratorOfListIO It( this->mySel->StoredIObjects() ); - Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject() ; - if( !FirstIOS.IsNull() ) { + SALOME_ListIteratorOfListIO It(this->mySel->StoredIObjects()); + Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject(); + if(!FirstIOS.IsNull()) { /* The first time as initialisation */ - if( this->myFirstInit ) { - this->myFirstInit = false ; + if(this->myFirstInit) { + this->myFirstInit = false; Standard_Boolean found; - Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(FirstIOS, found); - if( !found ) { - return ; - } - float transp = ( int( Shape->Transparency() * 10.0 + 0.001) ); - this->Slider1->setValue(int(transp) ) ; - return ; + Handle(GEOM_AISShape) Shape = myGeomBase->ConvertIOinGEOMAISShape(FirstIOS, found); + if(!found) + return; + float transp = (int(Shape->Transparency() * 10.0 + 0.001)); + this->Slider1->setValue(int(transp)); + return; } } - QApplication::setOverrideCursor( Qt::waitCursor ); - for( ;It.More(); It.Next() ) { + QApplication::setOverrideCursor(Qt::waitCursor); + for(;It.More(); It.Next()) { Handle(SALOME_InteractiveObject) IObject = It.Value(); Standard_Boolean found; - Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found); - if( !found ) { + Handle(GEOM_AISShape) Shape = myGeomBase->ConvertIOinGEOMAISShape(IObject, found); + if(!found) { QApplication::restoreOverrideCursor(); - return ; + return; } - this->myIc->SetTransparency( Shape, newValue / 10.0, false ); - myIc->Redisplay( Shape, Standard_False, Standard_True ); + this->myIc->SetTransparency(Shape, newValue / 10.0, false); + myIc->Redisplay(Shape, Standard_False, Standard_True); } myIc->UpdateCurrentViewer(); } QApplication::restoreOverrideCursor(); - return ; + return; } diff --git a/src/GEOMGUI/GeometryGUI_TransparencyDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h similarity index 79% rename from src/GEOMGUI/GeometryGUI_TransparencyDlg.h rename to src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h index c9a2c2046..fbcc4efcd 100644 --- a/src/GEOMGUI/GeometryGUI_TransparencyDlg.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h @@ -21,7 +21,7 @@ // // // -// File : GeometryGUI_TransparencyDlg.h +// File : GEOMBase_TransparencyDlg.h // Author : Lucien PIGNOLONI // Module : GEOM // $Header$ @@ -32,10 +32,12 @@ #include #include -#include "SALOME_Selection.h" -#include "SALOME_InteractiveObject.hxx" -#include "GEOM_InteractiveObject.hxx" -#include "GEOM_AISShape.hxx" +/* #include "SALOME_Selection.h" */ +/* #include "SALOME_InteractiveObject.hxx" */ +/* #include "GEOM_InteractiveObject.hxx" */ +/* #include "GEOM_AISShape.hxx" */ + +#include "GEOMBase.h" class QVBoxLayout; @@ -45,32 +47,32 @@ class QFrame; class QLabel; class QPushButton; class QSlider; -class GeometryGUI; //================================================================================= -// class : GeometryGUI_TransparencyDlg +// class : GEOMBase_TransparencyDlg // purpose : // : WARNING : that is a MODAL dialog. //================================================================================= -class GeometryGUI_TransparencyDlg : public QDialog +class GEOMBase_TransparencyDlg : public QDialog { Q_OBJECT public: - GeometryGUI_TransparencyDlg( QWidget* parent = 0, + GEOMBase_TransparencyDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, const Handle(AIS_InteractiveContext)& ic = 0, bool modal = TRUE, WFlags fl = 0 ); - ~GeometryGUI_TransparencyDlg(); + ~GEOMBase_TransparencyDlg(); private : - GeometryGUI* myGeomGUI ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ bool myFirstInit ; /* Inform for the first init */ SALOME_Selection* mySel; /* User selection */ Handle(AIS_InteractiveContext) myIc ; /* Interactive context */ @@ -87,7 +89,7 @@ public slots: void ValueHasChanged( int newValue ) ; protected: - QGridLayout* GeometryGUI_TransparencyDlgLayout; + QGridLayout* GEOMBase_TransparencyDlgLayout; QHBoxLayout* Layout1; QHBoxLayout* Layout2; }; diff --git a/src/GEOMToolsGUI/Makefile.in b/src/GEOMToolsGUI/Makefile.in new file mode 100644 index 000000000..95cc8b8f8 --- /dev/null +++ b/src/GEOMToolsGUI/Makefile.in @@ -0,0 +1,63 @@ +# GEOM GEOMTOOLSGUI : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets +LIB = libGEOMToolsGUI.la + +# header files +EXPORT_HEADERS= + +LIB_SRC = GEOMToolsGUI.cxx \ + GEOMToolsGUI_NbIsosDlg.cxx \ + GEOMToolsGUI_TransparencyDlg.cxx + +LIB_MOC = \ + GEOMToolsGUI.h \ + GEOMToolsGUI_NbIsosDlg.h \ + GEOMToolsGUI_TransparencyDlg.h + +LIB_CLIENT_IDL = SALOMEDS_Attributes.idl + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lGEOMFiltersSelection -lGEOMBase + +@CONCLUDE@ diff --git a/src/GenerationGUI/GenerationGUI.cxx b/src/GenerationGUI/GenerationGUI.cxx new file mode 100644 index 000000000..78bc4fdeb --- /dev/null +++ b/src/GenerationGUI/GenerationGUI.cxx @@ -0,0 +1,233 @@ +// 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 : GenerationGUI.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "GenerationGUI.h" + +#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include "GenerationGUI_PrismDlg.h" // Method PRISM +#include "GenerationGUI_RevolDlg.h" // Method REVOL +#include "GenerationGUI_FillingDlg.h" // Method FILLING +#include "GenerationGUI_PipeDlg.h" // Method PIPE + +//======================================================================= +// function : GenerationGUI() +// purpose : Constructor +//======================================================================= +GenerationGUI::GenerationGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; +} + + +//======================================================================= +// function : ~GenerationGUI() +// purpose : Destructor +//======================================================================= +GenerationGUI::~GenerationGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool GenerationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + GenerationGUI* myGenerationGUI = new GenerationGUI(); + myGenerationGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + + switch (theCommandID) + { + case 4031: // PRISM + { + GenerationGUI_PrismDlg *aDlg = new GenerationGUI_PrismDlg(parent, "", myGenerationGUI, Sel); + break; + } + case 4032: // REVOL + { + GenerationGUI_RevolDlg *aDlg = new GenerationGUI_RevolDlg(parent, "", myGenerationGUI, Sel); + break; + } + case 4033: // FILLING + { + GenerationGUI_FillingDlg *aDlg = new GenerationGUI_FillingDlg(parent, "", myGenerationGUI, Sel); + break; + } + case 4034: // PIPE + { + GenerationGUI_PipeDlg *aDlg = new GenerationGUI_PipeDlg(parent, "", myGenerationGUI, Sel); + break; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//======================================================================= +// function : MakePrismAndDisplay() +// purpose : P1 and P2 is to define a vector for prism +//======================================================================= +void GenerationGUI::MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2) +{ + try { + if(BaseShape->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + + GEOM::PointStruct PS1 = myGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z()); + GEOM::PointStruct PS2 = myGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z()); + GEOM::GEOM_Shape_ptr result = myGeom->MakePrism(BaseShape, PS1, PS2); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + result->NameType(type); + + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//======================================================================================= +// function : MakeRevolutionAndDisplay() +// purpose : +//======================================================================================= +void GenerationGUI::MakeRevolutionAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc, const gp_Dir dir, const Standard_Real revolAngle) +{ + try { + GEOM::AxisStruct axis = myGeom->MakeAxisStruct(loc.X(), loc.Y(), loc.Z(), dir.X(), dir.Y(), dir.Z()); + GEOM::GEOM_Shape_ptr result = myGeom->MakeRevolution(Shape, axis, revolAngle) ; + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + result->NameType(type); + + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeFillingAndDisplay() +// purpose : +//===================================================================================== +void GenerationGUI::MakeFillingAndDisplay(GEOM::GEOM_Shape_ptr SectionShape, const short mindeg, + const short maxdeg, const double tol3d, + const double tol2d, const short nbiter) +{ + try { + GEOM::GEOM_Shape_ptr result = myGeom->MakeFilling(SectionShape, mindeg, maxdeg, + tol3d, tol2d, nbiter); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + result->NameType(type); + + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + return; + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakePipeAndDisplay() +// purpose : +//===================================================================================== +void GenerationGUI::MakePipeAndDisplay(GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Shape_ptr aBase) +{ + try { + GEOM::GEOM_Shape_ptr result = myGeom->MakePipe(aPath, aBase); + if (!result->_is_nil() && myGeomBase->Display(result)) { + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + result->NameType(type); + + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + else { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + } + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return GenerationGUI::OnGUIEvent(theCommandID, parent);} +} diff --git a/src/GenerationGUI/GenerationGUI.h b/src/GenerationGUI/GenerationGUI.h new file mode 100644 index 000000000..c565bda16 --- /dev/null +++ b/src/GenerationGUI/GenerationGUI.h @@ -0,0 +1,61 @@ +// 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 : BooleanGUI.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef GENERATIONGUI_H +#define GENERATIONGUI_H + +#include "GEOMBase.h" + +//================================================================================= +// class : GenerationGUI +// purpose : +//================================================================================= +class GenerationGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + GenerationGUI(); + ~GenerationGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + + void MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2); + void MakeRevolutionAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc, + const gp_Dir dir, Standard_Real revolAngle); + void MakeFillingAndDisplay(GEOM::GEOM_Shape_ptr SectionShape, const short mindeg, const short maxdeg, + const double tol3d, const double tol2d, const short nbiter); + void MakePipeAndDisplay(GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Shape_ptr aBase); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx new file mode 100644 index 000000000..968e4df57 --- /dev/null +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -0,0 +1,372 @@ +// 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 : GenerationGUI_FillingDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "GenerationGUI_FillingDlg.h" + +#include "QAD_Config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : GenerationGUI_FillingDlg() +// purpose : Constructs a GenerationGUI_FillingDlg 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. +//================================================================================= +GenerationGUI_FillingDlg::GenerationGUI_FillingDlg(QWidget* parent, const char* name, GenerationGUI* theGenerationGUI, 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_FILLING"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_FILLING_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_FILLING")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel5Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_FILLING_COMPOUND")); + GroupPoints->TextLabel2->setText(tr("GEOM_FILLING_MIN_DEG")); + GroupPoints->TextLabel3->setText(tr("GEOM_FILLING_TOL_2D")); + GroupPoints->TextLabel4->setText(tr("GEOM_FILLING_NB_ITER")); + GroupPoints->TextLabel5->setText(tr("GEOM_FILLING_MAX_DEG")); + GroupPoints->TextLabel6->setText(tr("GEOM_FILLING_TOL_3D")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myGenerationGUI = theGenerationGUI; + Init(); +} + + +//================================================================================= +// function : ~GenerationGUI_FillingDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GenerationGUI_FillingDlg::~GenerationGUI_FillingDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myMinDeg = 2; + myMaxDeg = 5; + myTol3D = 0.0001; + myTol2D = 0.0001; + myNbIter = 5; + myOkSectionShape = false; + + myCompoundFilter = new GEOM_ShapeTypeFilter(TopAbs_COMPOUND, myGeom); + mySelection->AddFilter(myCompoundFilter); + + double SpecificStep1 = 1; + double SpecificStep2 = 0.0001; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_1->RangeStepAndValidator(2.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); + GroupPoints->SpinBox_3->SetValue(myNbIter); + GroupPoints->SpinBox_4->SetValue(myMaxDeg); + GroupPoints->SpinBox_5->SetValue(myTol3D); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_4, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_5, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_1, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_2, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_3, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_4, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_5, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkSectionShape) + myGenerationGUI->MakeFillingAndDisplay(myGeomShape, myMinDeg, myMaxDeg, myTol3D, myTol2D, myNbIter); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void GenerationGUI_FillingDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkSectionShape = false; + return; + } + + // nbSel == 1 + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, mySectionShape)) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1 && mySectionShape.ShapeType() == TopAbs_COMPOUND) { + myEditCurrentArgument->setText(aString); + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myOkSectionShape = true; + } + + if(myOkSectionShape) + this->MakeFillingSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + mySelection->ClearFilters(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + mySelection->AddFilter(myCompoundFilter); + this->SelectionIntoArgument(); + } + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myCompoundFilter); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::ValueChangedInSpinBox(double newValue) +{ + QObject* send = (QObject*)sender(); + + if(send == GroupPoints->SpinBox_1) + myMinDeg = int(newValue); + else if(send == GroupPoints->SpinBox_2) + myTol2D = newValue; + else if(send == GroupPoints->SpinBox_3) + myNbIter = int(newValue); + else if(send == GroupPoints->SpinBox_4) + myMaxDeg = int(newValue); + else if(send == GroupPoints->SpinBox_5) + myTol3D = newValue; + + if(myOkSectionShape) + this->MakeFillingSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : MakeFillingSimulationAndDisplay() +// purpose : +//================================================================================= +void GenerationGUI_FillingDlg::MakeFillingSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + /* we verify the contents of the shape */ + TopExp_Explorer Ex; + TopoDS_Shape Scurrent; + Standard_Real First, Last; + Handle(Geom_Curve) C; + GeomFill_SectionGenerator Section; + + Standard_Integer i = 0; + for(Ex.Init(mySectionShape, TopAbs_EDGE); Ex.More(); Ex.Next()) { + Scurrent = Ex.Current(); + if( Scurrent.IsNull() || Scurrent.ShapeType() != TopAbs_EDGE) + return; + C = BRep_Tool::Curve(TopoDS::Edge(Scurrent), First, Last); + C = new Geom_TrimmedCurve(C, First, Last); + Section.AddCurve(C) ; + i++ ; + } + + /* a 'tolerance' is used to compare 2 knots : see GeomFill_Generator.cdl */ + /* We set 'tolerance' = tol3d */ + // Section.Perform( tol3d ) ; NRI */ + Section.Perform(Precision::Confusion()); + Handle(GeomFill_Line) Line = new GeomFill_Line(i); + + GeomFill_AppSurf App(myMinDeg, myMaxDeg, myTol3D, myTol2D, myNbIter) ; /* user parameters */ + App.Perform(Line, Section); + + if(!App.IsDone()) + return; + + Standard_Integer UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots; + App.SurfShape(UDegree, VDegree, NbUPoles, NbVPoles, NbUKnots, NbVKnots); + Handle(Geom_BSplineSurface) GBS = new Geom_BSplineSurface(App.SurfPoles(), App.SurfWeights(), App.SurfUKnots(), App.SurfVKnots(), App.SurfUMults(), App.SurfVMults(), App.UDegree(), App.VDegree()); + + if(GBS.IsNull()) + return; + mySimulationTopoDs = BRepBuilderAPI_MakeFace(GBS); + if(mySimulationTopoDs.IsNull()) + return; + else + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakePrismSimulationAndDisplay" << endl); + return; + } + return; +} diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.h b/src/GenerationGUI/GenerationGUI_FillingDlg.h new file mode 100644 index 000000000..967c9d78c --- /dev/null +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.h @@ -0,0 +1,82 @@ +// 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 : GenerationGUI_FillingDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_FILLING_H +#define DIALOGBOX_FILLING_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel5Spin.h" + +#include "GenerationGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" + +//================================================================================= +// class : GenerationGUI_FillingDlg +// purpose : +//================================================================================= +class GenerationGUI_FillingDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + GenerationGUI_FillingDlg(QWidget* parent = 0, const char* name = 0, GenerationGUI* theGenerationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~GenerationGUI_FillingDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + void MakeFillingSimulationAndDisplay(); + + GenerationGUI* myGenerationGUI; + + Handle(GEOM_ShapeTypeFilter) myCompoundFilter; /* Filter selection */ + + GEOM::GEOM_Shape_var myGeomShape; /* is mySectionShape */ + TopoDS_Shape mySectionShape; + Standard_Integer myMinDeg; + Standard_Integer myMaxDeg; + Standard_Real myTol3D; + Standard_Real myTol2D; + Standard_Integer myNbIter; + bool myOkSectionShape; /* to check when arguments is defined */ + + DlgRef_1Sel5Spin* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_FILLING_H diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx new file mode 100644 index 000000000..dae7c23f6 --- /dev/null +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -0,0 +1,310 @@ +// 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 : GenerationGUI_PipeDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "GenerationGUI_PipeDlg.h" + +#include +#include +#include +#if OCC_VERSION_MAJOR >= 5 +#include +#else +#include +#endif + +//================================================================================= +// class : GenerationGUI_PipeDlg() +// purpose : Constructs a GenerationGUI_PipeDlg 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. +//================================================================================= +GenerationGUI_PipeDlg::GenerationGUI_PipeDlg(QWidget* parent, const char* name, GenerationGUI* theGenerationGUI, 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_PIPE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_PIPE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_PIPE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_PATH_OBJECT")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myGenerationGUI = theGenerationGUI; + Init(); +} + + +//================================================================================= +// function : ~GenerationGUI_PipeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GenerationGUI_PipeDlg::~GenerationGUI_PipeDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void GenerationGUI_PipeDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myOkShape1 = myOkShape2 = false; + + /* signals and slots connections */ + 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void GenerationGUI_PipeDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnAply() +// purpose : +//================================================================================= +void GenerationGUI_PipeDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkShape1 && myOkShape2) + myGenerationGUI->MakePipeAndDisplay(myGeomShape2 ,myGeomShape1); + + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void GenerationGUI_PipeDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkShape1 = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkShape2 = false; + return; + } + + // nbSel == 1 + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + 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) { + 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) + this->MakePipeSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void GenerationGUI_PipeDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void GenerationGUI_PipeDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void GenerationGUI_PipeDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void GenerationGUI_PipeDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : MakeMirrorSimulationAndDisplay() +// purpose : S1 is a shape and S2 a mirror. +//================================================================================= +void GenerationGUI_PipeDlg::MakePipeSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + TopoDS_Wire aWire; + + if(myShape2.ShapeType() == TopAbs_WIRE) + aWire = TopoDS::Wire(myShape2); + else if(myShape2.ShapeType() == TopAbs_EDGE) { + TopoDS_Edge aEdge = TopoDS::Edge(myShape2); + aWire = BRepBuilderAPI_MakeWire(aEdge); + } + + TopoDS_Shape tds = BRepOffsetAPI_MakePipe(aWire,myShape1); +#if OCC_VERSION_MAJOR >= 5 + if(BRepAlgo::IsValid(tds)) +#else + if(BRepAlgoAPI::IsValid(tds)) +#endif + { + //Draw Pipe + mySimulationTopoDs = tds; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakePipeSimulationAndDisplay"); + return; + } + return; +} diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.h b/src/GenerationGUI/GenerationGUI_PipeDlg.h new file mode 100644 index 000000000..795c36ed4 --- /dev/null +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.h @@ -0,0 +1,75 @@ +// 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 : GenerationGUI_PipeDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_PIPE_H +#define DIALOGBOX_PIPE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel_QTD.h" + +#include "GenerationGUI.h" + +//================================================================================= +// class : GenerationGUI_PipeDlg +// purpose : +//================================================================================= +class GenerationGUI_PipeDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + GenerationGUI_PipeDlg(QWidget* parent = 0, const char* name = 0, GenerationGUI* theGenerationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~GenerationGUI_PipeDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + void MakePipeSimulationAndDisplay(); + + GenerationGUI* myGenerationGUI; + + TopoDS_Shape myShape1; /* topology used */ + TopoDS_Shape myShape2; /* topology used */ + GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */ + GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */ + bool myOkShape1; + bool myOkShape2; /* to check when arguments are defined */ + + DlgRef_2Sel_QTD* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + +}; + +#endif // DIALOGBOX_PIPE_H diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx new file mode 100644 index 000000000..f2b9ea58f --- /dev/null +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -0,0 +1,351 @@ +// 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 : GenerationGUI_PrismDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "GenerationGUI_PrismDlg.h" + +#include +#include "QAD_Config.h" + +//================================================================================= +// class : GenerationGUI_PrismDlg() +// purpose : Constructs a GenerationGUI_PrismDlg 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. +//================================================================================= +GenerationGUI_PrismDlg::GenerationGUI_PrismDlg(QWidget* parent, const char* name, GenerationGUI* theGenerationGUI, 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_PRISM"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_PRISM_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_PRISM")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel1Spin1Check(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_PRISM_BSV")); + GroupPoints->TextLabel1->setText(tr("GEOM_BASE")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->TextLabel3->setText(tr("GEOM_HEIGHT")); + GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myGenerationGUI = theGenerationGUI; + Init(); +} + + +//================================================================================= +// function : ~GenerationGUI_PrismDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GenerationGUI_PrismDlg::~GenerationGUI_PrismDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myHeight = 100.000; + myDx = myDy = myDz = 0.0; + myOkBase = myOkLine = 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(); + + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupPoints->SpinBox_DX->SetValue(myHeight); + + /* signals and slots connections */ + 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + gp_Pnt P1, P2; + + try { + gp_Vec Vec(myDx, myDy, myDz); + Vec.Normalize(); + Vec *= myHeight; + P1.SetCoord(0.0, 0.0, 0.0); + P2.SetCoord(Vec.X(), Vec.Y(), Vec.Z()); + + if(myOkBase && myOkLine) + myGenerationGUI->MakePrismAndDisplay(myGeomShape, P1, P2); + } + catch(Standard_Failure) { + MESSAGE("Exception intercepted in GenerationGUI_PrismDlg" << endl); + return; + } + + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void GenerationGUI_PrismDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkBase = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkLine = false; + return; + } + + // nbSel == 1 + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + gp_Pnt aPoint1, aPoint2; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + if(S.ShapeType() <= 2) + return; + myEditCurrentArgument->setText(aString); + myOkBase = true; + myBaseTopo = S; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->LinearEdgeExtremities(S, aPoint1, aPoint2)) { + myGeomBase->GetBipointDxDyDz(aPoint1, aPoint2, myDx, myDy, myDz); + myEditCurrentArgument->setText(aString); + myOkLine = true; + } + + if(myOkBase && myOkLine) + this->MakePrismSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + 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); + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void GenerationGUI_PrismDlg::enterEvent(QEvent * e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::ValueChangedInSpinBox(double newValue) +{ + myHeight = newValue; + if(myOkBase && myOkLine) + this->MakePrismSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : ReverseVector() +// purpose : 'state' not used here +//================================================================================= +void GenerationGUI_PrismDlg::ReverseVector(int state) +{ + myDx = -myDx; + myDy = -myDy; + myDz = -myDz; + if(myOkBase && myOkLine) + this->MakePrismSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : MakePrismSimulationAndDisplay() +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::MakePrismSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + gp_Vec Vec(myDx, myDy, myDz); + Vec.Normalize(); + Vec *= myHeight; + mySimulationTopoDs = BRepPrimAPI_MakePrism(myBaseTopo, Vec, Standard_False).Shape(); + if(mySimulationTopoDs.IsNull()) + return; + else + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakePrismSimulationAndDisplay" << endl); + return; + } + return; +} diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.h b/src/GenerationGUI/GenerationGUI_PrismDlg.h new file mode 100644 index 000000000..77b47a410 --- /dev/null +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.h @@ -0,0 +1,84 @@ +// 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 : GenerationGUI_PrismDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_PRISM_H +#define DIALOGBOX_PRISM_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel1Spin1Check.h" + +#include "GenerationGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" + +//================================================================================= +// class : GenerationGUI_PrismDlg +// purpose : +//================================================================================= +class GenerationGUI_PrismDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + GenerationGUI_PrismDlg(QWidget* parent = 0, const char* name = 0, GenerationGUI* theGenerationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~GenerationGUI_PrismDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakePrismSimulationAndDisplay(); + + GenerationGUI* myGenerationGUI; + + double step; + Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */ + + Standard_Real myDx; + Standard_Real myDy; + Standard_Real myDz; + Standard_Real myHeight; /* Height used for prism (extrusion) */ + TopoDS_Shape myBaseTopo; /* topology used as base of prism */ + GEOM::GEOM_Shape_var myGeomShape; /* that is myBaseTopo */ + bool myOkBase; + bool myOkLine; /* to check when arguments myDx, myDy, myDz are defined */ + + DlgRef_2Sel1Spin1Check* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ReverseVector(int state); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_PRISM_H diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx new file mode 100644 index 000000000..79e7e1bac --- /dev/null +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -0,0 +1,334 @@ +// 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 : GenerationGUI_RevolDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "GenerationGUI_RevolDlg.h" + +#include +#include +#include +#include "QAD_Config.h" + +//================================================================================= +// class : GenerationGUI_RevolDlg() +// purpose : Constructs a GenerationGUI_RevolDlg 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. +//================================================================================= +GenerationGUI_RevolDlg::GenerationGUI_RevolDlg(QWidget* parent, const char* name, GenerationGUI* theGenerationGUI, 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_REVOL"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_REVOLUTION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_REVOLUTION")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel1Spin1Check(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); + GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE")); + GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myGenerationGUI = theGenerationGUI; + Init(); +} + + +//================================================================================= +// function : ~GenerationGUI_RevolDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GenerationGUI_RevolDlg::~GenerationGUI_RevolDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myAngle = 45.0; + myOkBase = myOkAxis = false; + + myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom); + + double SpecificStep = 5; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, SpecificStep, 3); + GroupPoints->SpinBox_DX->SetValue(myAngle); + + /* signals and slots connections */ + 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + 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())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkBase && myOkAxis) + myGenerationGUI->MakeRevolutionAndDisplay(myGeomShape, myLoc, myDir, myAngle*PI180); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void GenerationGUI_RevolDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkBase = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkAxis = false; + return; + } + + // nbSel == 1 + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + TopAbs_ShapeEnum aType = S.ShapeType(); + if(aType != TopAbs_VERTEX && aType != TopAbs_EDGE && aType != TopAbs_WIRE && aType != TopAbs_FACE && aType != TopAbs_SHELL && aType != TopAbs_COMPOUND) + return; + myEditCurrentArgument->setText(aString); + myOkBase = true; + myBase = S; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + BRepAdaptor_Curve curv(TopoDS::Edge(S)); + myDir = curv.Line().Direction(); + myLoc = curv.Line().Location(); + myEditCurrentArgument->setText(aString); + myOkAxis = true; + } + + if(myOkBase && myOkAxis) + this->MakeRevolutionSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + 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); + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::ValueChangedInSpinBox(double newValue) +{ + myAngle = newValue; + if(myOkBase && myOkAxis) + this->MakeRevolutionSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : ReverseAngle() +// purpose : 'state' not used here +//================================================================================= +void GenerationGUI_RevolDlg::ReverseAngle(int state) +{ + myAngle = -myAngle; + GroupPoints->SpinBox_DX->SetValue(myAngle); + if(myOkBase && myOkAxis) + this->MakeRevolutionSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : MakeRevolutionSimulationAndDisplay() +// purpose : +//================================================================================= +void GenerationGUI_RevolDlg::MakeRevolutionSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + TopAbs_ShapeEnum aType = myBase.ShapeType(); + if(aType != TopAbs_VERTEX && aType != TopAbs_EDGE && aType != TopAbs_WIRE && aType != TopAbs_FACE && aType != TopAbs_SHELL && aType !=TopAbs_COMPOUND) + return; + + try { + gp_Ax1 AX(myLoc, myDir); + mySimulationTopoDs = BRepPrimAPI_MakeRevol(myBase, AX, myAngle*PI180); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeRevolutionSimulationAndDisplay"); + return; + } + return; +} diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.h b/src/GenerationGUI/GenerationGUI_RevolDlg.h new file mode 100644 index 000000000..eddc3c30f --- /dev/null +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.h @@ -0,0 +1,83 @@ +// 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 : GenerationGUI_RevolDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_REVOLUTION_H +#define DIALOGBOX_REVOLUTION_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel1Spin1Check.h" + +#include "GenerationGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" +#include + +//================================================================================= +// class : GenerationGUI_RevolDlg +// purpose : +//================================================================================= +class GenerationGUI_RevolDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + GenerationGUI_RevolDlg(QWidget* parent = 0, const char* name = 0, GenerationGUI* theGenerationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~GenerationGUI_RevolDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakeRevolutionSimulationAndDisplay(); + + GenerationGUI* myGenerationGUI; + + Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */ + + TopoDS_Shape myBase; + GEOM::GEOM_Shape_var myGeomShape; /* is myBase */ + gp_Pnt myLoc; + gp_Dir myDir; + Standard_Real myAngle; + bool myOkBase; + bool myOkAxis; + + DlgRef_2Sel1Spin1Check* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ReverseAngle(int state); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_REVOLUTION_H diff --git a/src/GenerationGUI/Makefile.in b/src/GenerationGUI/Makefile.in new file mode 100644 index 000000000..06eb796c0 --- /dev/null +++ b/src/GenerationGUI/Makefile.in @@ -0,0 +1,67 @@ +# GEOM GENERATIONGUI : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= + +# Libraries targets +LIB = libGenerationGUI.la + +LIB_SRC = GenerationGUI.cxx \ + GenerationGUI_PrismDlg.cxx \ + GenerationGUI_RevolDlg.cxx \ + GenerationGUI_FillingDlg.cxx \ + GenerationGUI_PipeDlg.cxx + +LIB_MOC = \ + GenerationGUI.h \ + GenerationGUI_PrismDlg.h \ + GenerationGUI_RevolDlg.h \ + GenerationGUI_FillingDlg.h \ + GenerationGUI_PipeDlg.h + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lGEOMFiltersSelection -lGEOMBase $(CAS_LDPATH) -lTKOffset + +@CONCLUDE@ diff --git a/src/Makefile.in b/src/Makefile.in index dfd82101c..766733aad 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -32,6 +32,6 @@ VPATH=.:@srcdir@ @COMMENCE@ -SUBDIRS = OBJECT SKETCHER ARCHIMEDE PARTITION GEOMDS GEOM GEOMClient GEOMFiltersSelection GEOMGUI GEOM_SWIG +SUBDIRS = OBJECT ARCHIMEDE PARTITION SKETCHER GEOMDS GEOM GEOMClient GEOMFiltersSelection DlgRef GEOMContext GEOMBase DisplayGUI GEOMToolsGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GEOMGUI GEOM_SWIG @MODULE@ diff --git a/src/MeasureGUI/Makefile.in b/src/MeasureGUI/Makefile.in new file mode 100644 index 000000000..2b983be0d --- /dev/null +++ b/src/MeasureGUI/Makefile.in @@ -0,0 +1,89 @@ +# GEOM MEASUREGUI : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= + +# Libraries targets +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 \ + MeasureGUI_BndBoxDlg.cxx \ + MeasureGUI_DistanceDlg.cxx \ + MeasureGUI_MaxToleranceDlg.cxx \ + MeasureGUI_WhatisDlg.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 \ + MeasureGUI_BndBoxDlg.h \ + MeasureGUI_DistanceDlg.h \ + MeasureGUI_MaxToleranceDlg.h \ + MeasureGUI_WhatisDlg.h \ + MeasureGUI_CheckShapeDlg.h + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lGEOMBase + +@CONCLUDE@ diff --git a/src/MeasureGUI/MeasureGUI.cxx b/src/MeasureGUI/MeasureGUI.cxx new file mode 100644 index 000000000..d2a67dac4 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI.cxx @@ -0,0 +1,157 @@ +// 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.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "MeasureGUI.h" + +#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include "MeasureGUI_PropertiesDlg.h" // Method PROPERTIES +#include "MeasureGUI_CenterMassDlg.h" // Method CENTER MASS +#include "MeasureGUI_InertiaDlg.h" // Method INERTIA +#include "MeasureGUI_BndBoxDlg.h" // Method BNDBOX +#include "MeasureGUI_DistanceDlg.h" // Method DISTANCE +#include "MeasureGUI_MaxToleranceDlg.h" // Method MAXTOLERANCE +#include "MeasureGUI_WhatisDlg.h" // Method WHATIS +#include "MeasureGUI_CheckShapeDlg.h" // Method CHECKSHAPE + +//======================================================================= +// function : MeasureGUI() +// purpose : Constructor +//======================================================================= +MeasureGUI::MeasureGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; +} + + +//======================================================================= +// function : ~MeasureGUI() +// purpose : Destructor +//======================================================================= +MeasureGUI::~MeasureGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool MeasureGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + MeasureGUI* myMeasureGUI = new MeasureGUI(); + myMeasureGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + + switch (theCommandID) + { + case 701: // PROPERTIES (Length, surface, volume) + { + MeasureGUI_PropertiesDlg *aDlg = new MeasureGUI_PropertiesDlg(parent, "", Sel); + break; + } + case 702: // CDG : Center of mass + { + MeasureGUI_CenterMassDlg *aDlg = new MeasureGUI_CenterMassDlg(parent, "", myMeasureGUI, Sel); + break; + } + case 703: // INERTIA + { + MeasureGUI_InertiaDlg *aDlg = new MeasureGUI_InertiaDlg(parent, "", Sel); + break; + } + case 7041: // BOUNDING BOX + { + MeasureGUI_BndBoxDlg *aDlg = new MeasureGUI_BndBoxDlg(parent, "", Sel); + break; + } + case 7042: // MIN DISTANCE + { + MeasureGUI_DistanceDlg *aDlg = new MeasureGUI_DistanceDlg(parent, "", Sel); + break; + } + case 705: // MAXTOLERANCE + { + MeasureGUI_MaxToleranceDlg *aDlg = new MeasureGUI_MaxToleranceDlg(parent, "", Sel); + break; + } + case 706: // WHATIS + { + MeasureGUI_WhatisDlg *aDlg = new MeasureGUI_WhatisDlg(parent, "", Sel); + break; + } + case 707: // CHECKSHAPE + { + MeasureGUI_CheckShapeDlg *aDlg = new MeasureGUI_CheckShapeDlg(parent, "", Sel); + break; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//===================================================================================== +// function : MakeCDGAndDisplay() +// purpose : +//===================================================================================== +void MeasureGUI::MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->MakeCDG(Shape); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + result->NameType(tr("GEOM_POINT")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return MeasureGUI::OnGUIEvent(theCommandID, parent);} +} diff --git a/src/MeasureGUI/MeasureGUI.h b/src/MeasureGUI/MeasureGUI.h new file mode 100644 index 000000000..751574e47 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI.h @@ -0,0 +1,56 @@ +// 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.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef MEASUREGUI_H +#define MEASUREGUI_H + +#include "GEOMBase.h" + +//================================================================================= +// class : MeasureGUI +// purpose : +//================================================================================= +class MeasureGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + MeasureGUI(); + ~MeasureGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + + void MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif 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 new file mode 100644 index 000000000..fc9feffb6 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx @@ -0,0 +1,243 @@ +// 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_BndBoxDlg.cxx +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +using namespace std; +#include "MeasureGUI_BndBoxDlg.h" + +#include +#include + +//================================================================================= +// class : MeasureGUI_BndBoxDlg() +// purpose : Constructs a MeasureGUI_BndBoxDlg 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_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"))); + + 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(); +} + + +//================================================================================= +// function : ~MeasureGUI_BndBoxDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +MeasureGUI_BndBoxDlg::~MeasureGUI_BndBoxDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void MeasureGUI_BndBoxDlg::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_BndBoxDlg::SelectionIntoArgument() +{ + 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) || S.IsNull()) + return; + + GroupC1->LineEdit1->setText(aString); + + this->CalculateAndDisplayBndBox(S); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void MeasureGUI_BndBoxDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void MeasureGUI_BndBoxDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; + else + return; + + MeasureGUI_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void MeasureGUI_BndBoxDlg::ActivateThisDialog() +{ + MeasureGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void MeasureGUI_BndBoxDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : CalculateAndDisplayBndBox() +// purpose : +//================================================================================= +void MeasureGUI_BndBoxDlg::CalculateAndDisplayBndBox(const TopoDS_Shape& S) +{ + 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); + GroupC1->LineEdit11->setText(tr("%1").arg(axmin, 12, 'f', 6)); + GroupC1->LineEdit12->setText(tr("%1").arg(axmax, 12, 'f', 6)); + GroupC1->LineEdit21->setText(tr("%1").arg(aymin, 12, 'f', 6)); + GroupC1->LineEdit22->setText(tr("%1").arg(aymax, 12, 'f', 6)); + GroupC1->LineEdit31->setText(tr("%1").arg(azmin, 12, 'f', 6)); + GroupC1->LineEdit32->setText(tr("%1").arg(azmax, 12, 'f', 6)); + + mySimulationTopoDs = BRepPrimAPI_MakeBox(gp_Pnt(axmin, aymin, azmin), gp_Pnt(axmax, aymax, azmax)).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Catch intercepted in CalculateAndDisplayBndBox()"); + } + return; +} diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.h b/src/MeasureGUI/MeasureGUI_BndBoxDlg.h new file mode 100644 index 000000000..ee17c7008 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.h @@ -0,0 +1,64 @@ +// 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_BndBoxDlg.h +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_BNDBOX_H +#define DIALOGBOX_BNDBOX_H + +#include "MeasureGUI_Skeleton.h" +#include "MeasureGUI_1Sel6LineEdit_QTD.h" + +#include "MeasureGUI.h" + +//================================================================================= +// class : DialogBox_PROPERTIES +// purpose : +//================================================================================= +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(); + +private: + void Init(); + void enterEvent(QEvent* e); + void CalculateAndDisplayBndBox(const TopoDS_Shape& S); + + MeasureGUI_1Sel6LineEdit_QTD* GroupC1; + +private slots: + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_BNDBOX_H diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx new file mode 100644 index 000000000..691fd8694 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx @@ -0,0 +1,297 @@ +// 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_CenterMassDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "MeasureGUI_CenterMassDlg.h" + +#include +#include +#include +#include + +//================================================================================= +// class : MeasureGUI_CenterMassDlg() +// purpose : Constructs a MeasureGUI_CenterMassDlg 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_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"))); + + 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(); +} + + +//================================================================================= +// function : ~MeasureGUI_CenterMassDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +MeasureGUI_CenterMassDlg::~MeasureGUI_CenterMassDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void MeasureGUI_CenterMassDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupC1->LineEdit1; + + myOkCenterMass = false; + + /* 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())); + + /* displays Dialog */ + GroupC1->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void MeasureGUI_CenterMassDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void MeasureGUI_CenterMassDlg::ClickOnApply() +{ + QAD_Application::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(""); + QString aString = ""; + + myOkCenterMass = false; + GroupC1->LineEdit2->setText(""); + GroupC1->LineEdit3->setText(""); + GroupC1->LineEdit4->setText(""); + + 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; + + Standard_Boolean testResult; + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + + myEditCurrentArgument->setText(aString); + + if(this->CalculateAndDisplayCenterMass()) + myOkCenterMass = true; + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void MeasureGUI_CenterMassDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void MeasureGUI_CenterMassDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void MeasureGUI_CenterMassDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void MeasureGUI_CenterMassDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : CalculateAndDisplayCenterMass() +// purpose : +//================================================================================= +bool MeasureGUI_CenterMassDlg::CalculateAndDisplayCenterMass() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + QString resString; + GProp_GProps System; + + 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(myShape.ShapeType() == TopAbs_FACE || myShape.ShapeType() == TopAbs_SHELL) { + BRepGProp::SurfaceProperties(myShape, System); + myCenterMass = System.CentreOfMass(); + } + else { + BRepGProp::VolumeProperties(myShape, System); + myCenterMass = System.CentreOfMass(); + } + + BRepBuilderAPI_MakeVertex V(myCenterMass); + mySimulationTopoDs = V.Shape(); + + resString = tr("%1").arg(myCenterMass.X(), 12, 'f', 6); + GroupC1->LineEdit2->setText(resString); + + resString = tr("%1").arg(myCenterMass.Y(), 12, 'f', 6); + GroupC1->LineEdit3->setText(resString); + + resString = tr("%1").arg(myCenterMass.Z(), 12, 'f', 6); + GroupC1->LineEdit4->setText(resString); + + + if(!mySimulationTopoDs.IsNull()) { + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return true; + } + } + catch(Standard_Failure) { + MESSAGE("Catch intercepted in CalculateAndDisplayCenterMass()"); + } + return false; +} + + diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.h b/src/MeasureGUI/MeasureGUI_CenterMassDlg.h new file mode 100644 index 000000000..e67a67ccf --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.h @@ -0,0 +1,74 @@ +// 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_CenterMassDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM + +#ifndef DIALOGBOX_CMASS_H +#define DIALOGBOX_CMASS_H + +#include "GEOMBase_Skeleton.h" +#include "MeasureGUI_1Sel3LineEdit_QTD.h" + +#include "MeasureGUI.h" + +#include + +//================================================================================= +// class : MeasureGUI_CenterMassDlg +// purpose : +//================================================================================= +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(); + +private: + void Init(); + void enterEvent(QEvent* e); + bool CalculateAndDisplayCenterMass(); + + 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 */ + + MeasureGUI_1Sel3LineEdit_QTD* GroupC1; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_CMASS_H diff --git a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx new file mode 100644 index 000000000..fa6d776ca --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx @@ -0,0 +1,211 @@ +// 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 + +#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 new file mode 100644 index 000000000..d527eee7f --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -0,0 +1,368 @@ +// 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_DistanceDlg.cxx +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +using namespace std; +#include "MeasureGUI_DistanceDlg.h" + +#include "QAD_RightFrame.h" +#include "OCCViewer_Viewer3d.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : MeasureGUI_DistanceDlg() +// purpose : Constructs a MeasureGUI_DistanceDlg 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_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"))); + + 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(); +} + + +//================================================================================= +// function : ~MeasureGUI_DistanceDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +MeasureGUI_DistanceDlg::~MeasureGUI_DistanceDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +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())); + + connect(GroupC1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupC1->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupC1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupC1->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupC1->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void MeasureGUI_DistanceDlg::ClickOnCancel() +{ + this->EraseDistance(); + MeasureGUI_Skeleton::ClickOnCancel(); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void MeasureGUI_DistanceDlg::SelectionIntoArgument() +{ + 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; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + + if(myEditCurrentArgument == GroupC1->LineEdit1) { + myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape1 = S; + myEditCurrentArgument->setText(aString); + myOkShape1 = true; + } + else if(myEditCurrentArgument == GroupC1->LineEdit2) { + myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape2 = S; + myEditCurrentArgument->setText(aString); + myOkShape2 = true; + } + + if(myOkShape1 && myOkShape2) + this->MakeDistanceSimulationAndDisplay(myShape1 ,myShape2); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void MeasureGUI_DistanceDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + else if(send == GroupC1->PushButton2) { + GroupC1->LineEdit2->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit2; + } + + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void MeasureGUI_DistanceDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; + else if(send == GroupC1->LineEdit2) + myEditCurrentArgument = GroupC1->LineEdit2; + else + return; + + MeasureGUI_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void MeasureGUI_DistanceDlg::ActivateThisDialog() +{ + MeasureGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void MeasureGUI_DistanceDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void MeasureGUI_DistanceDlg::closeEvent(QCloseEvent* e) +{ + /* same than click on cancel button */ + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : MakeDistanceSimulationAndDisplay() +// purpose : +//================================================================================= +void MeasureGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape& S1, const TopoDS_Shape& S2) +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + GroupC1->LineEdit3->setText(""); + + 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); + + GroupC1->LineEdit3->setText("0.0"); + } + else { + BRepBuilderAPI_MakeEdge MakeEdge(P1, P2); + mySimulationTopoDs = MakeEdge.Edge(); + + TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(P1); + TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(P2); + + QString S; + 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(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + ic->Display(Distance); + ic->UpdateCurrentViewer(); + } + } + } + } + catch(Standard_Failure) { + MESSAGE("Catch intercepted in MakeDistanceSimulationAndDisplay()"); + } + return; +} + + +//================================================================================= +// function : EraseDistance() +// purpose : +//================================================================================= +void MeasureGUI_DistanceDlg::EraseDistance() +{ + int count = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); + for(int i = 0; i < count; i++) { + if (QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC ) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + AIS_ListOfInteractive L; + ic->DisplayedObjects(AIS_KOI_Relation, -1, L); + AIS_ListIteratorOfListOfInteractive ite(L); + while (ite.More()) { + ic->Remove(ite.Value()); + ic->UpdateCurrentViewer(); + ite.Next(); + } + } + } + return; +} diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.h b/src/MeasureGUI/MeasureGUI_DistanceDlg.h new file mode 100644 index 000000000..50718dd40 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.h @@ -0,0 +1,74 @@ +// 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_DistanceDlg.h +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_DISTANCE_H +#define DIALOGBOX_DISTANCE_H + +#include "MeasureGUI_Skeleton.h" +#include "MeasureGUI_2Sel1LineEdit_QTD.h" + +#include "MeasureGUI.h" + +//================================================================================= +// class : MeasureGUI_DistanceDlg +// purpose : +//================================================================================= +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(); + +private: + void Init(); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); + 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 */ + + MeasureGUI_2Sel1LineEdit_QTD* GroupC1; + +private slots: + void ClickOnCancel(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_DISTANCE_H diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx new file mode 100644 index 000000000..e8c796ad8 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx @@ -0,0 +1,286 @@ +// 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_InertiaDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM + +using namespace std; +#include "MeasureGUI_InertiaDlg.h" + +#include +#include +#include + +//================================================================================= +// class : MeasureGUI_InertiaDlg() +// purpose : Constructs a MeasureGUI_InertiaDlg 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_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"))); + + 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(); +} + + +//================================================================================= +// function : ~MeasureGUI_InertiaDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +MeasureGUI_InertiaDlg::~MeasureGUI_InertiaDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void MeasureGUI_InertiaDlg::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_InertiaDlg::SelectionIntoArgument() +{ + 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; + + GroupC1->LineEdit1->setText(aString); + + this->CalculateAndDisplayInertia(S); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void MeasureGUI_InertiaDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void MeasureGUI_InertiaDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; + else + return; + + MeasureGUI_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void MeasureGUI_InertiaDlg::ActivateThisDialog() +{ + MeasureGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void MeasureGUI_InertiaDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : CalculateAndDisplayInertia() +// purpose : +//================================================================================= +void MeasureGUI_InertiaDlg::CalculateAndDisplayInertia(const TopoDS_Shape& S) +{ + 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 { + 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) + BRepGProp::SurfaceProperties(S, System); + else + BRepGProp::VolumeProperties(S, System); + + gp_Mat I = System.MatrixOfInertia() ; + GProp_PrincipalProps Pr = System.PrincipalProperties(); + Standard_Real Ix,Iy,Iz; + Pr.Moments(Ix,Iy,Iz); + + /* matrix 3x3 */ + 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); + 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()"); + } + return; +} diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.h b/src/MeasureGUI/MeasureGUI_InertiaDlg.h new file mode 100644 index 000000000..4e6bc2f02 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.h @@ -0,0 +1,64 @@ +// 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_InertiaDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_INERTIA_H +#define DIALOGBOX_INERTIA_H + +#include "MeasureGUI_Skeleton.h" +#include "MeasureGUI_1Sel12LineEdit_QTD.h" + +#include "MeasureGUI.h" + +//================================================================================= +// class : MeasureGUI_InertiaDlg +// purpose : +//================================================================================= +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(); + +private: + void Init(); + void enterEvent(QEvent* e); + void CalculateAndDisplayInertia(const TopoDS_Shape& S); + + MeasureGUI_1Sel12LineEdit_QTD* GroupC1; + +private slots: + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_INERTIA_H diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx new file mode 100644 index 000000000..93f2da25f --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx @@ -0,0 +1,284 @@ +// 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_MaxToleranceDlg.cxx +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +using namespace std; +#include "MeasureGUI_MaxToleranceDlg.h" + +#include +#include +#include +#include +#include + +//================================================================================= +// class : MeasureGUI_MaxToleranceDlg() +// purpose : Constructs a MeasureGUI_MaxToleranceDlg 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_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"))); + + 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(); +} + + +//================================================================================= +// function : ~MeasureGUI_MaxToleranceDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +MeasureGUI_MaxToleranceDlg::~MeasureGUI_MaxToleranceDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void MeasureGUI_MaxToleranceDlg::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_MaxToleranceDlg::SelectionIntoArgument() +{ + 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) || S.IsNull()) + return; + + if(S.IsNull()) + return; + + GroupC1->LineEdit1->setText(aString); + + this->CalculateMaxTolerance(S); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void MeasureGUI_MaxToleranceDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void MeasureGUI_MaxToleranceDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; + else + return; + + MeasureGUI_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void MeasureGUI_MaxToleranceDlg::ActivateThisDialog() +{ + MeasureGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void MeasureGUI_MaxToleranceDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : CalculateMaxTolerance() +// purpose : +//================================================================================= +void MeasureGUI_MaxToleranceDlg::CalculateMaxTolerance(const TopoDS_Shape& S) +{ + 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()"); + } + return; +} diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h new file mode 100644 index 000000000..5513582b7 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h @@ -0,0 +1,64 @@ +// 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_MaxToleranceDlg.h +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_MAXTOLERANCE_H +#define DIALOGBOX_MAXTOLERANCE_H + +#include "MeasureGUI_Skeleton.h" +#include "MeasureGUI_1Sel6LineEdit_QTD.h" + +#include "MeasureGUI.h" + +//================================================================================= +// class : DialogBox_PROPERTIES +// purpose : +//================================================================================= +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(); + +private: + void Init(); + void enterEvent(QEvent* e); + void CalculateMaxTolerance(const TopoDS_Shape& S); + + MeasureGUI_1Sel6LineEdit_QTD* GroupC1; + +private slots: + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_MAXTOLERANCE_H diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx new file mode 100644 index 000000000..934551b84 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx @@ -0,0 +1,258 @@ +// 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_PropertiesDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "MeasureGUI_PropertiesDlg.h" + +#include +#include +#include +#include + +//================================================================================= +// class : MeasureGUI_PropertiesDlg() +// purpose : Constructs a MeasureGUI_PropertiesDlg 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_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"))); + + 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(); +} + + +//================================================================================= +// function : ~MeasureGUI_PropertiesDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +MeasureGUI_PropertiesDlg::~MeasureGUI_PropertiesDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void MeasureGUI_PropertiesDlg::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_PropertiesDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; + + GroupC1->LineEdit2->setText(""); + GroupC1->LineEdit3->setText(""); + GroupC1->LineEdit4->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() || S.ShapeType() == TopAbs_VERTEX) + return; + + 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; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void MeasureGUI_PropertiesDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void MeasureGUI_PropertiesDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; + else + return; + + MeasureGUI_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void MeasureGUI_PropertiesDlg::ActivateThisDialog() +{ + MeasureGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void MeasureGUI_PropertiesDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : CalculateAndDisplayProperties() +// purpose : +//================================================================================= +void MeasureGUI_PropertiesDlg::CalculateAndDisplayProperties(const TopoDS_Shape& S) +{ + GroupC1->LineEdit2->setText(""); + GroupC1->LineEdit3->setText(""); + GroupC1->LineEdit4->setText(""); + + if(S.IsNull()) + return; + + Standard_Real result; + 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); + 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); + GroupC1->LineEdit4->setText(resString); + } + } + catch(Standard_Failure) { + MESSAGE("Catch intercepted in CalculateAndDisplayProperties()"); + } + return; +} diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.h b/src/MeasureGUI/MeasureGUI_PropertiesDlg.h new file mode 100644 index 000000000..d2402393d --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.h @@ -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 : MeasureGUI_PropertiesDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM + +#ifndef DIALOGBOX_PROPERTIES_H +#define DIALOGBOX_PROPERTIES_H + +#include "MeasureGUI_Skeleton.h" +#include "MeasureGUI_1Sel3LineEdit_QTD.h" + +#include "MeasureGUI.h" + +//================================================================================= +// class : MeasureGUI_PropertiesDlg +// purpose : +//================================================================================= +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(); + +private: + void Init(); + void enterEvent(QEvent* e); + void CalculateAndDisplayProperties(const TopoDS_Shape& S); + + MeasureGUI_1Sel3LineEdit_QTD* GroupC1; + +private slots: + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); + +}; + +#endif // DIALOGBOX_PROPERTIES_H diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.cxx b/src/MeasureGUI/MeasureGUI_Skeleton.cxx new file mode 100644 index 000000000..39498d509 --- /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 new file mode 100644 index 000000000..23c2895c3 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx @@ -0,0 +1,255 @@ +// 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_WhatisDlg.cxx +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +using namespace std; +#include "MeasureGUI_WhatisDlg.h" + +#include +#include +#include +#include +#include + +#include + +//================================================================================= +// class : MeasureGUI_WhatisDlg() +// purpose : Constructs a MeasureGUI_WhatisDlg 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_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"))); + + 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(); +} + + +//================================================================================= +// function : ~MeasureGUI_WhatisDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +MeasureGUI_WhatisDlg::~MeasureGUI_WhatisDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void MeasureGUI_WhatisDlg::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_WhatisDlg::SelectionIntoArgument() +{ + 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; + + /* nbSel == 1 */ + TopoDS_Shape S; + 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); + + GroupC1->LineEdit1->setText(SelectedName); + this->CalculateWhatis(S); + + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void MeasureGUI_WhatisDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupC1->PushButton1) { + GroupC1->LineEdit1->setFocus(); + myEditCurrentArgument = GroupC1->LineEdit1; + } + + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void MeasureGUI_WhatisDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupC1->LineEdit1) + myEditCurrentArgument = GroupC1->LineEdit1; + else + return; + + MeasureGUI_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void MeasureGUI_WhatisDlg::ActivateThisDialog() +{ + MeasureGUI_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void MeasureGUI_WhatisDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : CalculateWhatis() +// purpose : +//================================================================================= +void MeasureGUI_WhatisDlg::CalculateWhatis(const TopoDS_Shape& S) +{ + if(S.IsNull()) + return; + + TCollection_AsciiString Astr; + Astr = Astr + " Number of shapes in " + strdup(SelectedName.latin1()) + " : \n"; + + try { + int iType, nbTypes [TopAbs_SHAPE]; + for(iType = 0; iType < TopAbs_SHAPE; ++iType) + nbTypes[iType] = 0; + nbTypes[S.ShapeType()]++; + + TopTools_MapOfShape aMapOfShape; + aMapOfShape.Add(S); + TopTools_ListOfShape aListOfShape; + aListOfShape.Append(S); + + TopTools_ListIteratorOfListOfShape itL(aListOfShape); + for(; itL.More(); itL.Next()) { + TopoDS_Iterator it(itL.Value()); + for(; it.More(); it.Next()) { + TopoDS_Shape s = it.Value(); + 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()); + + GroupC1->TextEdit1->setText(Astr.ToCString()); + } + catch(Standard_Failure) { + MESSAGE("Catch intercepted in CalculateWhatis()"); + } + return; +} diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.h b/src/MeasureGUI/MeasureGUI_WhatisDlg.h new file mode 100644 index 000000000..2714f0b26 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.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_WhatisDlg.h +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_WHATIS_H +#define DIALOGBOX_WHATIS_H + +#include "MeasureGUI_Skeleton.h" +#include "MeasureGUI_1Sel1TextView_QTD.h" + +#include "MeasureGUI.h" + +//================================================================================= +// class : DialogBox_PROPERTIES +// purpose : +//================================================================================= +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(); + +private: + void Init(); + void enterEvent(QEvent* e); + void CalculateWhatis(const TopoDS_Shape& S); + + QString SelectedName; + MeasureGUI_1Sel1TextView_QTD* GroupC1; + +private slots: + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void LineEditReturnPressed(); + void ActivateThisDialog(); + +}; + +#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/Makefile.in b/src/OperationGUI/Makefile.in new file mode 100644 index 000000000..fe9386d87 --- /dev/null +++ b/src/OperationGUI/Makefile.in @@ -0,0 +1,67 @@ +# GEOM OPERATIONGUI : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= + +# Libraries targets +LIB = libOperationGUI.la + +LIB_SRC = OperationGUI.cxx \ + OperationGUI_ArchimedeDlg.cxx \ + OperationGUI_PartitionDlg.cxx \ + OperationGUI_FilletDlg.cxx \ + OperationGUI_ChamferDlg.cxx + +LIB_MOC = \ + OperationGUI.h \ + OperationGUI_ArchimedeDlg.h \ + OperationGUI_PartitionDlg.h \ + OperationGUI_FilletDlg.h \ + OperationGUI_ChamferDlg.h + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lDisplayGUI $(CAS_LDPATH) -lTKFillet + +@CONCLUDE@ diff --git a/src/OperationGUI/OperationGUI.cxx b/src/OperationGUI/OperationGUI.cxx new file mode 100644 index 000000000..842a5a12f --- /dev/null +++ b/src/OperationGUI/OperationGUI.cxx @@ -0,0 +1,455 @@ +// 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 : OperationGUI.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "OperationGUI.h" + +#include "DisplayGUI.h" + +#include "QAD_RightFrame.h" +#include "OCCViewer_Viewer3d.h" +#include "OCCViewer_ViewFrame.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include +#include +#include + +#include "OperationGUI_PartitionDlg.h" // Method PARTITION +#include "OperationGUI_ArchimedeDlg.h" // Method ARCHIMEDE +#include "OperationGUI_FilletDlg.h" // Method FILLET +#include "OperationGUI_ChamferDlg.h" // Method CHAMFER + +//======================================================================= +// function : OperationGUI() +// purpose : Constructor +//======================================================================= +OperationGUI::OperationGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; +} + + +//======================================================================= +// function : ~OperationGUI() +// purpose : Destructor +//======================================================================= +OperationGUI::~OperationGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool OperationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + OperationGUI* myOperationGUI = new OperationGUI(); + myOperationGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + + switch (theCommandID) + { + case 503: // PARTITION + { + OperationGUI_PartitionDlg *aDlg = new OperationGUI_PartitionDlg(parent, "", myOperationGUI, Sel); + break; + } + case 504: // ARCHIMEDE + { + OperationGUI_ArchimedeDlg *aDlg = new OperationGUI_ArchimedeDlg(parent, "", myOperationGUI, Sel); + break; + } + case 505: // FILLET + { + Handle(AIS_InteractiveContext) ic; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + ic = v3d->getAISContext(); + } + OperationGUI_FilletDlg *aDlg = new OperationGUI_FilletDlg(parent, "", myOperationGUI, Sel, ic); + break; + } + case 506: // CHAMFER + { + Handle(AIS_InteractiveContext) ic; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + ic = v3d->getAISContext(); + } + OperationGUI_ChamferDlg *aDlg = new OperationGUI_ChamferDlg(parent, "", myOperationGUI, Sel, ic); + break; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//===================================================================================== +// function : MakePartitionAndDisplay() +// purpose : +//===================================================================================== +void OperationGUI::MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, + const GEOM::GEOM_Gen::ListOfIOR& listToolsIOR, + const GEOM::GEOM_Gen::ListOfIOR& listKeepInsIOR, + const GEOM::GEOM_Gen::ListOfIOR& listRemoveInsIOR, + const GEOM::shape_type limit) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->Partition(listShapesIOR, listToolsIOR, + listKeepInsIOR, listRemoveInsIOR, + (CORBA::Short) limit); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(tr("GEOM_PARTITION")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + return; + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } +} + + +//======================================================================= +// function : Archimede() +// purpose : +//======================================================================= +void OperationGUI::Archimede(const Handle(SALOME_InteractiveObject)& IO, const double aWeight, + const double aWaterDensity, const double aMeshingDeflection) +{ + try { + if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { + Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(IO); + GEOM::GEOM_Shape_var Shape = myGeom->GetIORFromString(GIO->getIOR()); + + GEOM::GEOM_Shape_var Result = myGeom->Archimede(Shape, aWeight, aWaterDensity, aMeshingDeflection); + Result->NameType(tr("GEOM_PLANE")); + if(myGeomBase->Display(Result)) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + return; + } + if(IO->hasEntry()) { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var Shape = myGeom->GetIORFromString(anIOR->Value()); + GEOM::GEOM_Shape_var Result = myGeom->Archimede(Shape, aWeight, aWaterDensity, aMeshingDeflection); + Result->NameType(tr("GEOM_PLANE")); + if (myGeomBase->Display(Result)) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + } + } + } + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } +} + + +//===================================================================================== +// function : OnFilletGetAll() +// purpose : +//===================================================================================== +bool OperationGUI::OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Radius, + const int SubShapeType, const char* ShapeTopoIOR) +{ + GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; + ListOfID->length(0); + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); + if(theObj->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return false; + } + + try { + if(Radius <= Precision::Confusion()) + return false; + + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); + GEOM::GEOM_Shape_var result = myGeom->MakeFillet(aShape, Radius, SubShapeType, ListOfID); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return false; + } + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + result->NameType(type); + + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return true; +} + + +//===================================================================================== +// function : OnFilletGetSelected() +// purpose : +//===================================================================================== +bool OperationGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, + const double Radius, const int SubShapeType, + Standard_Integer& aLocalContextId, bool& myUseLocalContext) +{ + if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + + if(myUseLocalContext == false) { + /* No local context opened for fillet method */ + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return false; + } + + GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; + ic->InitSelected(); + int nbSelected = ic->NbSelected(); + int i = 0; + ic->InitSelected(); + + while(ic->MoreSelected()) { + TopoDS_Shape s = ic->SelectedShape(); + if(s.ShapeType() == TopAbs_FACE) { + TopExp_Explorer Exp(s, TopAbs_EDGE); + TopTools_MapOfShape M; + while(Exp.More()) { + if(M.Add(Exp.Current())) { /* if a new edge : do not add doublons indices */ + ListOfID->length(i + 1); + ListOfID[i] = myGeomBase->GetIndex(Exp.Current(), ShapeTopo, (int)TopAbs_EDGE); + i++; + } + Exp.Next(); + } + } + else { + ListOfID->length(i + 1); + ListOfID[i] = myGeomBase->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType); + i++; + } + ic->NextSelected(); + } + + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); + GEOM::GEOM_Shape_var aResult; + try { + aResult = myGeom->MakeFillet(aShape, Radius, 6, ListOfID); + + /* local context from DialogBox */ + ic->CloseLocalContext(aLocalContextId); + myUseLocalContext = false; + + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + aResult->NameType(type); + + if(myGeomBase->Display(aResult)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + if(myUseLocalContext) { + /* local context from DialogBox */ + ic->CloseLocalContext(aLocalContextId); + myUseLocalContext = false; + } + + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true) ; + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY")); + + return true; +} + + +//===================================================================================== +// function : OnChamferGetAll() +// purpose : +//===================================================================================== +bool OperationGUI::OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D1, const double D2, const int SubShapeType, const char* ShapeTopoIOR) +{ + GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; + ListOfID->length(0); + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); + if(theObj->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return false; + } + + try { + if(D1 <= Precision::Confusion()) + return false; + if(D2 <= Precision::Confusion()) + return false; + + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); + GEOM::GEOM_Shape_var result = myGeom->MakeChamfer(aShape, D1, D2, SubShapeType, ListOfID); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return false; + } + + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + result->NameType(type); + + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return true; +} + + +//===================================================================================== +// function : OnChamferGetSelected() +// purpose : +//===================================================================================== +bool OperationGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, + const double D1, const double D2, const int SubShapeType, + Standard_Integer& aLocalContextId, bool& myUseLocalContext) +{ + if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + if(myUseLocalContext == false) { + /* No local context opened for chamfer method */ + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return false; + } + + GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; + ic->InitSelected(); + int nbSelected = ic->NbSelected(); + int i = 0; + ic->InitSelected(); + + while(ic->MoreSelected()) { + TopoDS_Shape s = ic->SelectedShape(); + if (s.ShapeType() == TopAbs_FACE) { + TopExp_Explorer Exp(s, TopAbs_EDGE); + TopTools_MapOfShape M; + while(Exp.More()) { + if(M.Add(Exp.Current())) { /* if a new edge : do not add doublons indices */ + ListOfID->length(i + 1); + ListOfID[i] = myGeomBase->GetIndex(Exp.Current(), ShapeTopo, (int)TopAbs_EDGE); + i++; + } + Exp.Next(); + } + } + else { + ListOfID->length(i + 1); + ListOfID[i] = myGeomBase->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType); + i++; + } + ic->NextSelected(); + } + + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); + GEOM::GEOM_Shape_var aResult; + try { + aResult = myGeom->MakeChamfer(aShape, D1, D2, 6, ListOfID); + + /* local context from DialogBox */ + ic->CloseLocalContext(aLocalContextId); + myUseLocalContext = false; + + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + aResult->NameType(type); + + if(myGeomBase->Display(aResult)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + if (myUseLocalContext) { + /* local context from DialogBox */ + ic->CloseLocalContext(aLocalContextId); + myUseLocalContext = false; + } + + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true) ; + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY")); + + return true; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return OperationGUI::OnGUIEvent(theCommandID, parent);} +} diff --git a/src/OperationGUI/OperationGUI.h b/src/OperationGUI/OperationGUI.h new file mode 100644 index 000000000..c30dc16f7 --- /dev/null +++ b/src/OperationGUI/OperationGUI.h @@ -0,0 +1,78 @@ +// 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 : OperationGUI.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef OPERATIONGUI_H +#define OPERATIONGUI_H + +#include "GEOMBase.h" + +//================================================================================= +// class : OperationGUI +// purpose : +//================================================================================= +class OperationGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + OperationGUI(); + ~OperationGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + + void MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, + const GEOM::GEOM_Gen::ListOfIOR& listToolsIOR, + const GEOM::GEOM_Gen::ListOfIOR& listKeepInsIOR, + const GEOM::GEOM_Gen::ListOfIOR& listRemoveInsIOR, + const GEOM::shape_type limit ) ; + void Archimede(const Handle(SALOME_InteractiveObject)& IO, const double aWeight, + const double aWaterDensity, const double aMeshingDeflection); + + /* Method for Fillet */ + bool OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Radius, + const int SubShapeType, const char* ShapeTopoIOR); + bool OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, + const double Radius, const int SubShapeType, + Standard_Integer& aLocalContextId, bool& myUseLocalContext); + + /* Methods for Chamfer */ + bool OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D1, const double D2, + const int SubShapeType, const char* ShapeTopoIOR); + bool OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, + const char* ShapeTopoIOR, + const double D1, const double D2, const int SubShapeType, + Standard_Integer& aLocalContextId, + bool& myUseLocalContext); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx new file mode 100644 index 000000000..77468ea95 --- /dev/null +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx @@ -0,0 +1,261 @@ +// 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 : OperationGUI_ArchimedeDlg.cxx +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +using namespace std; +#include "OperationGUI_ArchimedeDlg.h" + +#include "QAD_Config.h" + +//================================================================================= +// class : OperationGUI_ArchimedeDlg() +// purpose : Constructs a OperationGUI_ArchimedeDlg 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. +//================================================================================= +OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg(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_ARCHIMEDE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_ARCHIMEDE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_ARCHIMEDE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel3Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->TextLabel2->setText(tr("GEOM_WEIGHT")); + GroupPoints->TextLabel3->setText(tr("GEOM_WATER_DENSITY")); + GroupPoints->TextLabel4->setText(tr("GEOM_MESHING_DEFLECTION")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myOperationGUI = theOperationGUI; + Init(); +} + + +//================================================================================= +// function : ~OperationGUI_ArchimedeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_ArchimedeDlg::~OperationGUI_ArchimedeDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myWeight = 100.0; + myWaterDensity = 1.0; + myMeshingDeflection = 0.01; + myOkIO = false; + + /* Get setting of step value from file configuration */ + 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, SpecificStep1, 3); + GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, 999.999, SpecificStep2, 3); + + GroupPoints->SpinBox_DX->SetValue(myWeight); + GroupPoints->SpinBox_DY->SetValue(myWaterDensity); + GroupPoints->SpinBox_DZ->SetValue(myMeshingDeflection); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, 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(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)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if(myOkIO) + myOperationGUI->Archimede(myIO, myWeight, myWaterDensity, myMeshingDeflection); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void OperationGUI_ArchimedeDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel != 1) { + myOkIO = false; + return; + } + else { + myEditCurrentArgument->setText(aString); + myIO = mySelection->firstIObject(); + myOkIO = true; + } + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + this->SelectionIntoArgument(); + } + + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void OperationGUI_ArchimedeDlg::ValueChangedInSpinBox(double newValue) +{ + QObject* send = (QObject*)sender(); + + if(send == GroupPoints->SpinBox_DX) + myWeight = newValue; + else if(send == GroupPoints->SpinBox_DY) + myWaterDensity = newValue; + else if(send == GroupPoints->SpinBox_DZ) + myMeshingDeflection = newValue; + + return; +} diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.h b/src/OperationGUI/OperationGUI_ArchimedeDlg.h new file mode 100644 index 000000000..a9a14a1fe --- /dev/null +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.h @@ -0,0 +1,78 @@ +// 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 : OperationGUI_ArchimedeDlg.h +// Author : Nicolas REJNERI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_ARCHIMEDE_H +#define DIALOGBOX_ARCHIMEDE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel3Spin.h" + +#include "OperationGUI.h" + +//#include "SALOME_InteractiveObject.hxx" + +//================================================================================= +// class : OperationGUI_ArchimedeDlg +// purpose : +//================================================================================= +class OperationGUI_ArchimedeDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + OperationGUI_ArchimedeDlg(QWidget* parent = 0, const char* name = 0, OperationGUI* theOperationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~OperationGUI_ArchimedeDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + + double step; + + OperationGUI* myOperationGUI; + + Handle(SALOME_InteractiveObject) myIO; + Standard_Real myWeight; + Standard_Real myWaterDensity; + Standard_Real myMeshingDeflection; + bool myOkIO; + + DlgRef_1Sel3Spin* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_ARCHIMEDE_H diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx new file mode 100644 index 000000000..92085d229 --- /dev/null +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -0,0 +1,586 @@ +// 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 : OperationGUI_ChamferDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +using namespace std; +#include "OperationGUI_ChamferDlg.h" + +#include "DisplayGUI.h" + +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : OperationGUI_ChamferDlg() +// purpose : Constructs a OperationGUI_ChamferDlg 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. +//================================================================================= +OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(QWidget* parent, const char* name, OperationGUI* theOperationGUI, SALOME_Selection* Sel, Handle(AIS_InteractiveContext) ic, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_ALL"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_FACE"))); + QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_CHAMFER_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_CHAMFER")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->setPixmap(image2); + + Group1 = new DlgRef_1Sel2Spin(this, "Group1"); + Group1->GroupBox1->setTitle(tr("GEOM_CHAMFER_ALL")); + Group1->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + Group1->TextLabel2->setText(tr("GEOM_D1")); + Group1->TextLabel3->setText(tr("GEOM_D2")); + Group1->PushButton1->setPixmap(image3); + + Group2 = new DlgRef_1Sel2Spin(this, "Group2"); + Group2->GroupBox1->setTitle(tr("GEOM_CHAMFER_EDGES")); + Group2->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + Group2->TextLabel2->setText(tr("GEOM_D1")); + Group2->TextLabel3->setText(tr("GEOM_D2")); + Group2->PushButton1->setPixmap(image3); + + Group3 = new DlgRef_1Sel2Spin(this, "Group3"); + Group3->GroupBox1->setTitle(tr("GEOM_CHAMFER_FACES")); + Group3->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + Group3->TextLabel2->setText(tr("GEOM_D1")); + Group3->TextLabel3->setText(tr("GEOM_D2")); + Group3->PushButton1->setPixmap(image3); + + Layout1->addWidget(Group1, 1, 0); + Layout1->addWidget(Group2, 1, 0); + Layout1->addWidget(Group3, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myOperationGUI = theOperationGUI; + Init(ic); +} + + +//================================================================================= +// function : ~OperationGUI_ChamferDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::Init(Handle (AIS_InteractiveContext) ic) +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = Group1->LineEdit1; + + myD1 = 5.0; + myD2 = 5.0; + myOkShape = false; + myIC = ic; + myLocalContextId = -1; + myUseLocalContext = false; + + double SpecificStep = 10.0; + /* min, max, step and decimals for spin boxes */ + Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group2->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group1->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group2->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group3->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + + Group1->SpinBox_DX->SetValue(myD1); + Group2->SpinBox_DX->SetValue(myD1); + Group3->SpinBox_DX->SetValue(myD1); + Group1->SpinBox_DY->SetValue(myD2); + Group2->SpinBox_DY->SetValue(myD2); + 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))); + + connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group1->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3->SpinBox_DY, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + Group2->hide(); + Group3->hide(); + Group1->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void OperationGUI_ChamferDlg::ConstructorsClicked(int constructorId) +{ + myConstructorId = constructorId; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + disconnect(mySelection, 0, this, 0); + myOkShape = false; + myD1 = 5.0; + myD2 = 5.0; + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + myUseLocalContext = false; + } + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + switch (constructorId) + { + case 0: /* Chamfer All */ + { + Group2->hide(); + Group3->hide(); + resize(0, 0); + Group1->show(); + + myEditCurrentArgument = Group1->LineEdit1; + Group1->LineEdit1->setText(""); + myShapeType = -1; + + Group1->SpinBox_DX->SetValue(myD1); + Group1->SpinBox_DY->SetValue(myD2); + break; + } + case 1: /* Chamfer edges */ + { + Group1->hide(); + Group3->hide(); + resize(0, 0); + Group2->show(); + + myEditCurrentArgument = Group2->LineEdit1; + Group2->LineEdit1->setText(""); + myShapeType = 6; + + Group2->SpinBox_DX->SetValue(myD1); + Group2->SpinBox_DY->SetValue(myD2); + break; + } + case 2: /* Chamfer Faces */ + { + Group1->hide(); + Group2->hide(); + resize(0, 0); + Group3->show(); + + myEditCurrentArgument = Group3->LineEdit1; + Group3->LineEdit1->setText(""); + myShapeType = 4; + + Group3->SpinBox_DX->SetValue(myD1); + Group3->SpinBox_DY->SetValue(myD2); + break; + } + } + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::ClickOnOk() +{ + this->ClickOnApply(); + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::ClickOnApply() +{ + QApplication::setOverrideCursor(Qt::waitCursor); + QAD_Application::getDesktop()->putInfo(tr("")); + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + bool testResult = false; + switch(myConstructorId) + { + case 0 : /* Chamfer All */ + { + if(myOkShape) + testResult = myOperationGUI->OnChamferGetAll(myShape, myD1, myD2, myShapeType, myShapeIOR); + break; + } + case 1 : /* Chamfer Edge */ + { + if(myOkShape) + testResult = myOperationGUI->OnChamferGetSelected(myShape, myShapeIOR, myD1, myD2, myShapeType, + myLocalContextId, myUseLocalContext); + break; + } + case 2 : /* Chamfer Face */ + { + if(myOkShape) + testResult = myOperationGUI->OnChamferGetSelected(myShape, myShapeIOR, myD1, myD2, myShapeType, + myLocalContextId, myUseLocalContext); + break; + } + } + + if(!testResult) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + else + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + /* Reset all arguments and local context to allow user a new selection ...*/ + this->ResetStateOfDialog(); + QApplication::restoreOverrideCursor(); + return; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::ClickOnCancel() +{ + this->ResetStateOfDialog(); + GEOMBase_Skeleton::ClickOnCancel(); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void OperationGUI_ChamferDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + this->ResetStateOfDialog(); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel == 1) { + TopoDS_Shape S; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + if(!IO->hasEntry()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return; + } + + if(!S.IsNull() && S.ShapeType() <= 2) { + if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { + Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IO); + myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ + myEditCurrentArgument->setText(aString); + myShape = S; + myOkShape = true; + } + + if(IO->hasEntry()) { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + myShapeIOR = anIOR->Value(); + myOkShape = true; + myShape = S; + myEditCurrentArgument->setText(aString); + } + } + } + } + if(myConstructorId == 0) + this->MakePreview(); + + } + else + return; + + if(myOkShape && myShapeType!=-1 && myConstructorId != 0) { + /* local context is defined into the method */ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelection(myShapeType, myLocalContextId); + myUseLocalContext = true; + } +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == Group1->LineEdit1) + myEditCurrentArgument = Group1->LineEdit1; + else if (send == Group2->LineEdit1) + myEditCurrentArgument = Group2->LineEdit1; + else if (send == Group3->LineEdit1) + myEditCurrentArgument = Group3->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == Group1->PushButton1) { + Group1->LineEdit1->setFocus(); + myEditCurrentArgument = Group1->LineEdit1; + } + else if(send == Group2->PushButton1) { + Group2->LineEdit1->setFocus(); + myEditCurrentArgument = Group2->LineEdit1; + } + else if(send == Group3->PushButton1) { + Group3->LineEdit1->setFocus(); + myEditCurrentArgument = Group3->LineEdit1; + } + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::DeactivateActiveDialog() +{ + this->ResetStateOfDialog(); + GEOMBase_Skeleton::DeactivateActiveDialog(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::closeEvent(QCloseEvent* e) +{ + /* same than click on cancel button */ + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double newValue ) +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + QObject* send = (QObject*)sender(); + if(send == Group1->SpinBox_DX || send == Group2->SpinBox_DX || send == Group3->SpinBox_DX) { /* D1 */ + myD1 = newValue; + if(myConstructorId == 0) + this->MakePreview(); + return ; + } + else if(send == Group1->SpinBox_DY || send == Group2->SpinBox_DY || send == Group3->SpinBox_DY) { /* D2 */ + myD2 = newValue; + if(myConstructorId == 0) + this->MakePreview(); + return; + } + return; +} + + +//================================================================================= +// function : ResetStateOfDialog() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::ResetStateOfDialog() +{ + myOkShape = false; + myEditCurrentArgument->setText(""); + QApplication::restoreOverrideCursor(); + + /* Close its local contact if opened */ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + } + return; +} + + +//================================================================================= +// function : MakePreview() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::MakePreview() +{ + QApplication::setOverrideCursor(Qt::waitCursor); + + if(!myOkShape) { + QApplication::restoreOverrideCursor(); + return; + } + + GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; + ListOfID->length(0); + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(myShapeIOR); + if(theObj->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + QApplication::restoreOverrideCursor(); + return; + } + + try { + if(myD1 <= Precision::Confusion() || myD2 <= Precision::Confusion()) { + QApplication::restoreOverrideCursor(); + return; + } + + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(myShapeIOR); + GEOM::GEOM_Shape_var result = myGeom->MakeChamfer(aShape, myD1, myD2, myShapeType, ListOfID); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QApplication::restoreOverrideCursor(); + return; + } + + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); + + mySimulationTopoDs = S; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakePreview"); + QApplication::restoreOverrideCursor(); + return; + } + QApplication::restoreOverrideCursor(); + return; + +} diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.h b/src/OperationGUI/OperationGUI_ChamferDlg.h new file mode 100644 index 000000000..46e114443 --- /dev/null +++ b/src/OperationGUI/OperationGUI_ChamferDlg.h @@ -0,0 +1,93 @@ +// 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 : OperationGUI_ChamferDlg.h +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_CHAMFER_H +#define DIALOGBOX_CHAMFER_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel2Spin.h" + +#include "OperationGUI.h" + +//================================================================================= +// class : OperationGUI_ChamferDlg +// purpose : +//================================================================================= +class OperationGUI_ChamferDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + OperationGUI_ChamferDlg(QWidget* parent = 0, const char* name = 0, OperationGUI* theOperationGUI = 0, SALOME_Selection* Sel = 0, Handle(AIS_InteractiveContext) ic = 0, bool modal = FALSE, WFlags fl = 0); + ~OperationGUI_ChamferDlg(); + +private : + void Init(Handle(AIS_InteractiveContext) ic); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); + void MakeFilletSimulationAndDisplay(); + + void ResetStateOfDialog(); + void MakePreview(); + + OperationGUI* myOperationGUI; + + int myConstructorId; /* Current constructor id = radio button id */ + + /* Interactive and local context management see also : bool myUseLocalContext() */ + Handle(AIS_InteractiveContext) myIC; /* Interactive context */ + Standard_Integer myLocalContextId; /* identify a local context used by this method */ + bool myUseLocalContext; /* true when this method as opened a local context */ + + TopoDS_Shape myShape; + bool myOkShape; + char* myShapeIOR; + int myShapeType; + double myD1; + double myD2; + + DlgRef_1Sel2Spin* Group1; + DlgRef_1Sel2Spin* Group2; + DlgRef_1Sel2Spin* Group3; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ClickOnCancel(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(double newValue); + void ConstructorsClicked(int constructorId); + +}; + +#endif // DIALOGBOX_CHAMFER_H + diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx new file mode 100644 index 000000000..746c9eb08 --- /dev/null +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -0,0 +1,550 @@ +// 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 : OperationGUI_FilletDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +using namespace std; +#include "OperationGUI_FilletDlg.h" + +#include "DisplayGUI.h" + +#include +#include +#include +#include + +//================================================================================= +// class : OperationGUI_FilletDlg() +// purpose : Constructs a OperationGUI_FilletDlg 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. +//================================================================================= +OperationGUI_FilletDlg::OperationGUI_FilletDlg(QWidget* parent, const char* name, OperationGUI* theOperationGUI, SALOME_Selection* Sel, Handle(AIS_InteractiveContext) ic, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FILLET_ALL"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FILLET_EDGE"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FILLET_FACE"))); + QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_FILLET_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_FILLET")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->setPixmap(image2); + + Group1 = new DlgRef_1Sel1Spin(this, "Group1"); + Group1->GroupBox1->setTitle(tr("GEOM_FILLET_ALL")); + Group1->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + Group1->TextLabel2->setText(tr("GEOM_RADIUS")); + Group1->PushButton1->setPixmap(image3); + + Group2 = new DlgRef_1Sel1Spin(this, "Group2"); + Group2->GroupBox1->setTitle(tr("GEOM_FILLET_EDGES")); + Group2->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + Group2->TextLabel2->setText(tr("GEOM_RADIUS")); + Group2->PushButton1->setPixmap(image3); + + Group3 = new DlgRef_1Sel1Spin(this, "Group3"); + Group3->GroupBox1->setTitle(tr("GEOM_FILLET_FACES")); + Group3->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + Group3->TextLabel2->setText(tr("GEOM_RADIUS")); + Group3->PushButton1->setPixmap(image3); + + Layout1->addWidget(Group1, 1, 0); + Layout1->addWidget(Group2, 1, 0); + Layout1->addWidget(Group3, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myOperationGUI = theOperationGUI; + Init(ic); +} + + +//================================================================================= +// function : ~OperationGUI_FilletDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_FilletDlg::~OperationGUI_FilletDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::Init(Handle(AIS_InteractiveContext) ic) +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = Group1->LineEdit1; + + myRadius = 5.0; + myOkShape = false; + myIC = ic; + myLocalContextId = -1; + myUseLocalContext = false; + + double SpecificStep = 10.0; + /* min, max, step and decimals for spin boxes */ + Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group2->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + + Group1->SpinBox_DX->SetValue(myRadius); + Group2->SpinBox_DX->SetValue(myRadius); + 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))); + + connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3->SpinBox_DX, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + Group2->hide(); + Group3->hide(); + Group1->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void OperationGUI_FilletDlg::ConstructorsClicked(int constructorId) +{ + myConstructorId = constructorId; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + disconnect(mySelection, 0, this, 0); + myOkShape = false; + myRadius = 5.0; + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + myUseLocalContext = false; + } + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + switch (constructorId) + { + case 0: /* Fillet All */ + { + Group2->hide(); + Group3->hide(); + resize(0, 0); + Group1->show(); + + myEditCurrentArgument = Group1->LineEdit1; + Group1->LineEdit1->setText(""); + myShapeType = -1; + + Group1->SpinBox_DX->SetValue(myRadius); + break; + } + case 1: /* Fillet edges */ + { + Group1->hide(); + Group3->hide(); + resize(0, 0); + Group2->show(); + + myEditCurrentArgument = Group2->LineEdit1; + Group2->LineEdit1->setText(""); + myShapeType = 6; + + Group2->SpinBox_DX->SetValue(myRadius); + break; + } + case 2: /* Fillet Faces */ + { + Group1->hide(); + Group2->hide(); + resize(0, 0); + Group3->show(); + + myEditCurrentArgument = Group3->LineEdit1; + Group3->LineEdit1->setText(""); + myShapeType = 4; + + Group3->SpinBox_DX->SetValue(myRadius); + break; + } + } + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::ClickOnOk() +{ + this->ClickOnApply(); + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::ClickOnApply() +{ + QApplication::setOverrideCursor(Qt::waitCursor); + QAD_Application::getDesktop()->putInfo(tr("")); + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + bool testResult = false; + switch(myConstructorId) + { + case 0 : /* Fillet All */ + { + if(myOkShape) + testResult = myOperationGUI->OnFilletGetAll(myShape, myRadius, myShapeType, myShapeIOR); + break; + } + case 1 : /* Fillet Edge */ + { + if(myOkShape) + testResult = myOperationGUI->OnFilletGetSelected(myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext); + break; + } + case 2 : /* Fillet Face */ + { + if(myOkShape) + testResult = myOperationGUI->OnFilletGetSelected(myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext); + break; + } + } + + if(!testResult) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + else + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + /* Reset all arguments and local context to allow user a new selection ...*/ + this->ResetStateOfDialog(); + QApplication::restoreOverrideCursor(); + return; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::ClickOnCancel() +{ + this->ResetStateOfDialog(); + GEOMBase_Skeleton::ClickOnCancel(); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void OperationGUI_FilletDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + this->ResetStateOfDialog(); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel == 1) { + TopoDS_Shape S; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + if(!IO->hasEntry()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return; + } + + if(!S.IsNull() && S.ShapeType() <= 2) { + if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { + Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IO); + myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ + myEditCurrentArgument->setText(aString); + myShape = S; + myOkShape = true; + } + + if(IO->hasEntry()) { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + myShapeIOR = anIOR->Value(); + myOkShape = true; + myShape = S; + myEditCurrentArgument->setText(aString); + } + } + } + } + if(myConstructorId == 0) + this->MakePreview(); + } + else + return; + + if(myOkShape && myShapeType!=-1 && myConstructorId != 0) { + /* local context is defined into the method */ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelection(myShapeType, myLocalContextId); + myUseLocalContext = true; + } +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == Group1->LineEdit1) + myEditCurrentArgument = Group1->LineEdit1; + else if (send == Group2->LineEdit1) + myEditCurrentArgument = Group2->LineEdit1; + else if (send == Group3->LineEdit1) + myEditCurrentArgument = Group3->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == Group1->PushButton1) { + Group1->LineEdit1->setFocus(); + myEditCurrentArgument = Group1->LineEdit1; + } + else if(send == Group2->PushButton1) { + Group2->LineEdit1->setFocus(); + myEditCurrentArgument = Group2->LineEdit1; + } + else if(send == Group3->PushButton1) { + Group3->LineEdit1->setFocus(); + myEditCurrentArgument = Group3->LineEdit1; + } + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::DeactivateActiveDialog() +{ + this->ResetStateOfDialog(); + GEOMBase_Skeleton::DeactivateActiveDialog(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::closeEvent(QCloseEvent* e) +{ + /* same than click on cancel button */ + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ResetStateOfDialog() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::ResetStateOfDialog() +{ + myOkShape = false; + myEditCurrentArgument->setText(""); + QApplication::restoreOverrideCursor(); + + /* Close its local contact if opened */ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + } + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::ValueChangedInSpinBox(double newValue) +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + myRadius = newValue; + + if(myConstructorId == 0) + this->MakePreview(); + return; +} + + +//================================================================================= +// function : MakePreview() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::MakePreview() +{ + QApplication::setOverrideCursor(Qt::waitCursor); + + if(!myOkShape) { + QApplication::restoreOverrideCursor(); + return; + } + + GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; + ListOfID->length(0); + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(myShapeIOR); + if(theObj->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + QApplication::restoreOverrideCursor(); + return; + } + + try { + if(myRadius <= Precision::Confusion()) { + QApplication::restoreOverrideCursor(); + return; + } + + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(myShapeIOR); + GEOM::GEOM_Shape_var result = myGeom->MakeFillet(aShape, myRadius, myShapeType, ListOfID); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + QApplication::restoreOverrideCursor(); + return; + } + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); + + mySimulationTopoDs = S; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakePreview"); + QApplication::restoreOverrideCursor(); + return; + } + QApplication::restoreOverrideCursor(); + return; +} diff --git a/src/OperationGUI/OperationGUI_FilletDlg.h b/src/OperationGUI/OperationGUI_FilletDlg.h new file mode 100644 index 000000000..76fbab6f5 --- /dev/null +++ b/src/OperationGUI/OperationGUI_FilletDlg.h @@ -0,0 +1,92 @@ +// 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 : OperationGUI_FilletDlg.h +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_FILLET_H +#define DIALOGBOX_FILLET_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel1Spin.h" + +#include "OperationGUI.h" + +//================================================================================= +// class : OperationGUI_FilletDlg +// purpose : +//================================================================================= +class OperationGUI_FilletDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + OperationGUI_FilletDlg(QWidget* parent = 0, const char* name = 0, OperationGUI* theOperationGUI = 0, SALOME_Selection* Sel = 0, Handle(AIS_InteractiveContext) ic = 0, bool modal = FALSE, WFlags fl = 0); + ~OperationGUI_FilletDlg(); + +private : + void Init(Handle(AIS_InteractiveContext) ic); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); + void MakeFilletSimulationAndDisplay(); + + void ResetStateOfDialog(); + void MakePreview(); + + OperationGUI* myOperationGUI; + + int myConstructorId; /* Current constructor id = radio button id */ + + /* Interactive and local context management see also : bool myUseLocalContext() */ + Handle(AIS_InteractiveContext) myIC; /* Interactive context */ + Standard_Integer myLocalContextId; /* identify a local context used by this method */ + bool myUseLocalContext; /* true when this method as opened a local context */ + + TopoDS_Shape myShape; + bool myOkShape; + char* myShapeIOR; + int myShapeType; + double myRadius; + + DlgRef_1Sel1Spin* Group1; + DlgRef_1Sel1Spin* Group2; + DlgRef_1Sel1Spin* Group3; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ClickOnCancel(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(double newValue); + void ConstructorsClicked(int constructorId); + +}; + +#endif // DIALOGBOX_FILLET_H + diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx new file mode 100644 index 000000000..add70022d --- /dev/null +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -0,0 +1,340 @@ +// 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 : OperationGUI_PartitionDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "OperationGUI_PartitionDlg.h" + +//================================================================================= +// class : OperationGUI_PartitionDlg() +// purpose : Constructs a OperationGUI_PartitionDlg 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. +//================================================================================= +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"))); + + 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(); +} + + +//================================================================================= +// function : ~OperationGUI_PartitionDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +OperationGUI_PartitionDlg::~OperationGUI_PartitionDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myOkListShapes = myOkListTools = myOkKeepShape = myOkRemoveShape = false; + + /* type for sub shape selection */ + 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' */ + GroupPoints->ComboBox1->setCurrentItem(0); + myLimit = GroupPoints->ComboBox1->currentItem(); + + /* signals and slots connections */ + 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(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::ClickOnApply() +{ + QAD_Application::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); + } + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void OperationGUI_PartitionDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + 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 == GroupPoints->LineEdit1) { + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes); + myEditCurrentArgument->setText(aString); + myOkListShapes = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListTools); + myEditCurrentArgument->setText(aString); + myOkListTools = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit3) { + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListRemoveInside); + myEditCurrentArgument->setText(aString); + myOkKeepShape = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit4) { + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListKeepInside); + myEditCurrentArgument->setText(aString); + myOkRemoveShape = true; + } + + /* no simulation */ + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + } + else if(send == GroupPoints->PushButton3) { + GroupPoints->LineEdit3->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit3; + } + else if(send == GroupPoints->PushButton4) { + GroupPoints->LineEdit4->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit4; + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::LineEditReturnPressed() +{ + 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; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void OperationGUI_PartitionDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//======================================================================= +//function : ComboTextChanged +//purpose : +//======================================================================= + +void OperationGUI_PartitionDlg::ComboTextChanged() +{ + 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 new file mode 100644 index 000000000..20673e83e --- /dev/null +++ b/src/OperationGUI/OperationGUI_PartitionDlg.h @@ -0,0 +1,79 @@ +// 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 : OperationGUI_PartitionDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_PARTITION_H +#define DIALOGBOX_PARTITION_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_4Sel1List_QTD.h" + +#include "OperationGUI.h" + +//================================================================================= +// class : OperationGUI_PartitionDlg +// purpose : +//================================================================================= +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(); + +private: + void Init(); + void enterEvent(QEvent* e); + + OperationGUI* myOperationGUI; + + 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; + + DlgRef_4Sel1List_QTD* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ComboTextChanged(); + +}; + +#endif // DIALOGBOX_PARTITION_H diff --git a/src/PrimitiveGUI/Makefile.in b/src/PrimitiveGUI/Makefile.in new file mode 100644 index 000000000..d7407c810 --- /dev/null +++ b/src/PrimitiveGUI/Makefile.in @@ -0,0 +1,69 @@ +# GEOM PRIMITIVEGUI : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= + +# Libraries targets +LIB = libPrimitiveGUI.la + +LIB_SRC = PrimitiveGUI.cxx \ + PrimitiveGUI_BoxDlg.cxx \ + PrimitiveGUI_CylinderDlg.cxx \ + PrimitiveGUI_SphereDlg.cxx \ + PrimitiveGUI_TorusDlg.cxx \ + PrimitiveGUI_ConeDlg.cxx + +LIB_MOC = \ + PrimitiveGUI.h \ + PrimitiveGUI_BoxDlg.h \ + PrimitiveGUI_CylinderDlg.h \ + PrimitiveGUI_SphereDlg.h \ + PrimitiveGUI_TorusDlg.h \ + PrimitiveGUI_ConeDlg.h + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lGEOMFiltersSelection -lGEOMBase + +@CONCLUDE@ diff --git a/src/PrimitiveGUI/PrimitiveGUI.cxx b/src/PrimitiveGUI/PrimitiveGUI.cxx new file mode 100644 index 000000000..343759a6a --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI.cxx @@ -0,0 +1,249 @@ +// 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 : PrimitiveGUI.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "PrimitiveGUI.h" + +#include "SALOMEGUI_QtCatchCorbaException.hxx" +#include + +#include "PrimitiveGUI_BoxDlg.h" // Method BOX +#include "PrimitiveGUI_CylinderDlg.h" // Method CYLINDER +#include "PrimitiveGUI_SphereDlg.h" // Method SPHERE +#include "PrimitiveGUI_TorusDlg.h" // Method TORUS +#include "PrimitiveGUI_ConeDlg.h" // Method CONE + +//======================================================================= +// function : PrimitiveGUI() +// purpose : Constructor +//======================================================================= +PrimitiveGUI::PrimitiveGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; +} + + +//======================================================================= +// function : ~PrimitiveGUI() +// purpose : Destructor +//======================================================================= +PrimitiveGUI::~PrimitiveGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool PrimitiveGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + PrimitiveGUI* aPrimitiveGUI = new PrimitiveGUI(); + aPrimitiveGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + switch (theCommandID) + { + case 4021: // BOX + { + PrimitiveGUI_BoxDlg* aDlg = new PrimitiveGUI_BoxDlg(parent, "", aPrimitiveGUI, Sel); + break; + } + case 4022: // CYLINDER + { + PrimitiveGUI_CylinderDlg* aDlg = new PrimitiveGUI_CylinderDlg(parent, "", aPrimitiveGUI, Sel); + break; + } + case 4023: // SPHERE + { + PrimitiveGUI_SphereDlg* aDlg = new PrimitiveGUI_SphereDlg(parent, "", aPrimitiveGUI, Sel); + break; + } + case 4024: // TORUS + { + PrimitiveGUI_TorusDlg* aDlg = new PrimitiveGUI_TorusDlg(parent, "", aPrimitiveGUI, Sel); + break; + } + case 4025: // CONE + { + PrimitiveGUI_ConeDlg* aDlg = new PrimitiveGUI_ConeDlg(parent, "", aPrimitiveGUI, Sel); + break; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//======================================================================= +// function : MakeBoxAndDisplay() +// purpose : +//======================================================================= +void PrimitiveGUI::MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2) +{ + try { + GEOM::GEOM_Shape_var box = myGeom->MakeBox(P1.X(), P1.Y(), P1.Z(), P2.X(), P2.Y(), P2.Z()); + box->NameType(tr("GEOM_BOX")); + if(myGeomBase->Display(box)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } +} + + +//===================================================================================== +// function : MakeCylinderAndDisplay() +// purpose : +//===================================================================================== +void PrimitiveGUI::MakeCylinderAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir, + const double Radius, const double aHeight) +{ + try { + if(Radius <= Precision::Confusion() || aHeight <= Precision::Confusion()) + return; + + GEOM::PointStruct pstruct = myGeom->MakePointStruct(BasePoint.X(), BasePoint.Y(), BasePoint.Z()); + GEOM::PointStruct d = myGeom->MakePointStruct(aDir.X(), aDir.Y(), aDir.Z()); + GEOM::DirStruct dstruct = myGeom->MakeDirection(d); + + GEOM::GEOM_Shape_var result = myGeom->MakeCylinder(pstruct, dstruct, Radius, aHeight); + if (result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + result->NameType(tr("GEOM_CYLINDER")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeSphere() +// purpose : +//===================================================================================== +void PrimitiveGUI::MakeSphereAndDisplay(const gp_Pnt aCenterPoint, const double aRadius) +{ + try { + if(aRadius <= Precision::Confusion()) + return; + + GEOM::GEOM_Shape_ptr result = myGeom->MakeSphere(aCenterPoint.X(),aCenterPoint.Y(),aCenterPoint.Z(), aRadius); + result->NameType(tr("GEOM_SPHERE")); + if (myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeTorusAndDisplay() +// purpose : +//===================================================================================== +void PrimitiveGUI::MakeTorusAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir, + const double Radius1, const double Radius2) +{ + try { + if(Radius1 <= Precision::Confusion() || Radius2 <= Precision::Confusion()) + return; + + GEOM::PointStruct pstruct = myGeom->MakePointStruct(BasePoint.X(), BasePoint.Y(), BasePoint.Z()); + GEOM::PointStruct d = myGeom ->MakePointStruct(aDir.X(), aDir.Y(), aDir.Z()); + GEOM::DirStruct dstruct = myGeom->MakeDirection(d); + + GEOM::GEOM_Shape_var result = myGeom->MakeTorus(pstruct, dstruct, Radius1, Radius2); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + result->NameType(tr("GEOM_TORUS")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeConeAndDisplay() +// purpose : +//===================================================================================== +void PrimitiveGUI::MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir, + const double Radius1, const double Radius2, const double aHeight) +{ + try { + if((Radius1 <= Precision::Confusion() && Radius2 <= Precision::Confusion()) || aHeight <= Precision::Confusion()) + return; + + GEOM::PointStruct pstruct = myGeom->MakePointStruct(BasePoint.X(), BasePoint.Y(), BasePoint.Z()); + GEOM::PointStruct d = myGeom->MakePointStruct(aDir.X(), aDir.Y(), aDir.Z()); + GEOM::DirStruct dstruct = myGeom->MakeDirection(d); + + GEOM::GEOM_Shape_var result = myGeom->MakeCone(pstruct, dstruct, Radius1, Radius2, aHeight); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + result->NameType(tr("GEOM_CONE")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return PrimitiveGUI::OnGUIEvent(theCommandID, parent);} +} diff --git a/src/PrimitiveGUI/PrimitiveGUI.h b/src/PrimitiveGUI/PrimitiveGUI.h new file mode 100644 index 000000000..f85e68815 --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI.h @@ -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 : PrimitiveGUI.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef PRIMITIVEGUI_H +#define PRIMITIVEGUI_H + +#include "GEOMBase.h" + +//================================================================================= +// class : PrimitiveGUI +// purpose : +//================================================================================= +class PrimitiveGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + PrimitiveGUI(); + ~PrimitiveGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + + void MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2); + void MakeCylinderAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir, + const double Radius, const double aHeight); + void MakeSphereAndDisplay(const gp_Pnt aCenterPoint, const double aRadius); + void MakeTorusAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir, + const double Radius1, const double Radius2); + void MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir, + const double Radius1, const double Radius2, const double aHeight); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx new file mode 100644 index 000000000..39e12f88c --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -0,0 +1,418 @@ +// 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 : PrimitiveGUI_BoxDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "PrimitiveGUI_BoxDlg.h" + +#include +#include +#include "QAD_Config.h" + +//================================================================================= +// class : PrimitiveGUI_BoxDlg() +// purpose : Constructs a PrimitiveGUI_BoxDlg 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. +//================================================================================= +PrimitiveGUI_BoxDlg::PrimitiveGUI_BoxDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, 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_BOX_2P"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_DLG_BOX_DXYZ"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM", tr("ICON_SELECT"))); + + setCaption(tr("GEOM_BOX_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_BOX")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_DIAGONAL_POINTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1")); + GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + + GroupDimensions = new DlgRef_3Spin(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); + GroupDimensions->TextLabel1->setText(tr("GEOM_DX")); + GroupDimensions->TextLabel2->setText(tr("GEOM_DY")); + GroupDimensions->TextLabel3->setText(tr("GEOM_DZ")); + + Layout1->addWidget(GroupPoints, 1, 0); + Layout1->addWidget(GroupDimensions, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myPrimitiveGUI = thePrimitiveGUI; + Init(); +} + + +//================================================================================= +// function : ~DialogBox_Box() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +PrimitiveGUI_BoxDlg::~PrimitiveGUI_BoxDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::Init() +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupPoints->LineEdit1; + + myPoint1.SetCoord(0.0, 0.0, 0.0); + myPoint2.SetCoord(0.0, 0.0, 0.0); + myOkPoint1 = myOkPoint2 = false; + + /* Vertices Filter for all arguments */ + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + /* min, max, step and decimals for spin boxes */ + 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); + + double initValue = 200.0; + GroupDimensions->SpinBox_DX->SetValue(initValue); + GroupDimensions->SpinBox_DY->SetValue(initValue); + GroupDimensions->SpinBox_DZ->SetValue(initValue); + + /* signals and slots connections */ + 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(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + 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(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(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupDimensions->hide(); + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId) +{ + myConstructorId = constructorId; + mySelection->ClearFilters(); + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + disconnect(mySelection, 0, this, 0); + myOkPoint1 = myOkPoint2 = false; + + switch (constructorId) + { + case 0: + { + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(""); + GroupPoints->LineEdit2->setText(""); + + /* filter for next selection */ + mySelection->AddFilter(myVertexFilter); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + case 1: + { + GroupPoints->hide(); + resize(0, 0); + GroupDimensions->show(); + + double initValue = 200.0; + GroupDimensions->SpinBox_DX->SetValue(initValue); + GroupDimensions->SpinBox_DY->SetValue(initValue); + GroupDimensions->SpinBox_DZ->SetValue(initValue); + + myPoint1.SetCoord(0.0, 0.0, 0.0) ; + myPoint2.SetCoord(initValue, initValue, initValue); + + mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + break; + } + } + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + switch(myConstructorId) + { + case 0 : + { + if(myOkPoint1 && myOkPoint2) + myPrimitiveGUI->MakeBoxAndDisplay(myPoint1, myPoint2); + break; + } + case 1 : + { + /* Recup args and call method */ + double vx = GroupDimensions->SpinBox_DX->GetValue(); + double vy = GroupDimensions->SpinBox_DY->GetValue(); + double vz = GroupDimensions->SpinBox_DZ->GetValue(); + myPoint1.SetCoord(0.0, 0.0, 0.0); + myPoint2.SetCoord(vx, vy, vz); + myPrimitiveGUI->MakeBoxAndDisplay(myPoint1, myPoint2); + break; + } + } + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed +//================================================================================= +void PrimitiveGUI_BoxDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel != 1) { + if (myEditCurrentArgument == GroupPoints->LineEdit1) + myOkPoint1 = false; + else if ( myEditCurrentArgument == GroupPoints->LineEdit2) + myOkPoint2 = false; + return; + } + + // nbSel == 1 + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + myEditCurrentArgument->setText(aString); + myOkPoint1 = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint2)) { + myEditCurrentArgument->setText(aString); + myOkPoint2 = true; + } + + if(myOkPoint1 && myOkPoint2 && TestBoxDimensions(myPoint1, myPoint2)) { + mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::SetEditCurrentArgument() +{ + if(myConstructorId != 0) + return; + + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + } + mySelection->AddFilter(myVertexFilter); + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : enterEvent [REDEFINED] +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void PrimitiveGUI_BoxDlg::ValueChangedInSpinBox(double newValue) +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + QObject* send = (QObject*)sender(); + double vx, vy, vz; + + if(send == GroupDimensions->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 = newValue; + vz = GroupDimensions->SpinBox_DZ->GetValue(); + } + else if(send == GroupDimensions->SpinBox_DZ) { + vx = GroupDimensions->SpinBox_DX->GetValue(); + vy = GroupDimensions->SpinBox_DY->GetValue(); + vz = newValue; + } + + myPoint1.SetCoord(0.0, 0.0, 0.0); + myPoint2.SetCoord(vx, vy, vz); + + if(TestBoxDimensions(myPoint1, myPoint2)) { + mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + return; +} + + +//================================================================================= +// function : TestBoxDimensions() +// purpose : +//================================================================================= +bool PrimitiveGUI_BoxDlg::TestBoxDimensions(gp_Pnt P1, gp_Pnt P2) +{ + if ((fabs(P1.X() - P2.X()) > Precision::Confusion()) && + (fabs(P1.Y() - P2.Y()) > Precision::Confusion()) && + (fabs(P1.Z() - P2.Z()) > Precision::Confusion())) + return true; + return false; +} diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h new file mode 100644 index 000000000..0638af8fe --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h @@ -0,0 +1,84 @@ +// 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 : PrimitiveGUI_BoxDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_BOX_H +#define DIALOGBOX_BOX_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel_QTD.h" +#include "DlgRef_3Spin.h" + +#include "PrimitiveGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" +#include + +//================================================================================= +// class : PrimitiveGUI_BoxDlg +// purpose : +//================================================================================= +class PrimitiveGUI_BoxDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + PrimitiveGUI_BoxDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~PrimitiveGUI_BoxDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + bool TestBoxDimensions(gp_Pnt P1, gp_Pnt P2); + + PrimitiveGUI* myPrimitiveGUI; + + double step; + int myConstructorId; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */ + + gp_Pnt myPoint1; /* Points containing the vector */ + gp_Pnt myPoint2; + bool myOkPoint1; /* true when myPoint is defined */ + bool myOkPoint2; + + DlgRef_2Sel_QTD* GroupPoints; + DlgRef_3Spin* GroupDimensions; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked(int constructorId); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_BOX_H diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx new file mode 100644 index 000000000..480eca52d --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -0,0 +1,446 @@ +// 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 : PrimitiveGUI_ConeDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "PrimitiveGUI_ConeDlg.h" + +#include +#include +#include +#include +#include +#include "QAD_Config.h" + +//================================================================================= +// class : PrimitiveGUI_ConeDlg() +// purpose : Constructs a PrimitiveGUI_ConeDlg 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. +//================================================================================= +PrimitiveGUI_ConeDlg::PrimitiveGUI_ConeDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, 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_CONE_PV"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CONE_DXYZ"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_CONE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_CONE")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel3Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_I").arg("1")); + GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_I").arg("2")); + GroupPoints->TextLabel5->setText(tr("GEOM_HEIGHT")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + + GroupDimensions = new DlgRef_3Spin(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); + GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS_I").arg("1")); + GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS_I").arg("2")); + GroupDimensions->TextLabel3->setText(tr("GEOM_HEIGHT")); + + Layout1->addWidget(GroupPoints, 1, 0); + Layout1->addWidget(GroupDimensions, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myPrimitiveGUI = thePrimitiveGUI; + Init(); +} + + +//================================================================================= +// function : ~PrimitiveGUI_ConeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +PrimitiveGUI_ConeDlg::~PrimitiveGUI_ConeDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::Init() +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupPoints->LineEdit1; + + myRadius1 = 100.0; + myRadius2 = 0.0; + myHeight = 300.0; + + myOkRadius1 = myOkRadius2 = myOkHeight = true; + myOkPoint1 = myOkDir = false; + + myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom); + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + /* 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(-999.999, 999.999, step, 3); + GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupDimensions->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + + GroupPoints->SpinBox_DX->SetValue(myRadius1); + GroupPoints->SpinBox_DY->SetValue(myRadius2); + GroupPoints->SpinBox_DZ->SetValue(myHeight); + GroupDimensions->SpinBox_DX->SetValue(myRadius1); + GroupDimensions->SpinBox_DY->SetValue(myRadius2); + GroupDimensions->SpinBox_DZ->SetValue(myHeight); + + /* signals and slots connections */ + 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(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, 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(GroupPoints->SpinBox_DZ, 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(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(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(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupDimensions->hide(); + GroupPoints->show(); + this->show(); + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void PrimitiveGUI_ConeDlg::ConstructorsClicked(int constructorId) +{ + myConstructorId = constructorId; + mySelection->ClearFilters(); + myGeomBase->EraseSimulationShape(); + disconnect(mySelection, 0, this, 0); + myOkHeight = myOkRadius1 = myOkRadius2 = true; + myRadius1 = 100.0; + myRadius2 = 0.0; + myHeight = 300.0; + + switch(myConstructorId) + { + case 0 : + { + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + myOkPoint1 = myOkDir = false; + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(tr("")); + GroupPoints->LineEdit2->setText(tr("")); + + GroupPoints->SpinBox_DX->SetValue(myRadius1); + GroupPoints->SpinBox_DY->SetValue(myRadius2); + GroupPoints->SpinBox_DZ->SetValue(myHeight); + + /* filter for next selection */ + mySelection->AddFilter(myVertexFilter); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + case 1 : + { + GroupPoints->hide(); + resize( 0, 0 ); + GroupDimensions->show(); + myOkPoint1 = myOkDir = true; + + GroupDimensions->SpinBox_DX->SetValue(myRadius1); + GroupDimensions->SpinBox_DY->SetValue(myRadius2); + GroupDimensions->SpinBox_DZ->SetValue(myHeight); + + myPoint1.SetCoord(0.0, 0.0, 0.0); + myDir.SetCoord(0.0, 0.0, 1.0); + + MakeConeSimulationAndDisplay(); + break; + } + } + return ; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) { + gp_Dir aDir = myDir; + /* allows user to reverse direction of construction with a negative height */ + if(this->myHeight < -Precision::Confusion()) + aDir.Reverse(); + myPrimitiveGUI->MakeConeAndDisplay(myPoint1, aDir, myRadius1, myRadius2, fabs(myHeight)); + } + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void PrimitiveGUI_ConeDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkPoint1 = false; + else if (myEditCurrentArgument == GroupPoints->LineEdit2) + myOkDir = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + /* gp_Pnt : not used */ + if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + GroupPoints->LineEdit1->setText(aString); + myOkPoint1 = true; + } + else if (myEditCurrentArgument == GroupPoints->LineEdit2) { + BRepAdaptor_Curve curv(TopoDS::Edge(S)); + myDir = curv.Line().Direction(); + GroupPoints->LineEdit2->setText(aString); + myOkDir = true; + } + + if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) + MakeConeSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::SetEditCurrentArgument() +{ + if(myConstructorId != 0) + return; + + QPushButton* send = (QPushButton*)sender(); + mySelection->ClearFilters(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + mySelection->AddFilter(myVertexFilter); + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + mySelection->AddFilter(myEdgeFilter); + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::ValueChangedInSpinBox(double newValue) +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + QObject* send = (QObject*)sender(); + + if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DX) { + myRadius1 = newValue; + myOkRadius1 = true; + } + else if(send == GroupPoints->SpinBox_DY || send == GroupDimensions->SpinBox_DY) { + myRadius2 = newValue; + myOkRadius2 = true; + } + else if(send == GroupPoints->SpinBox_DZ || send == GroupDimensions->SpinBox_DZ) { + myHeight = newValue; + myOkHeight = true; + } + + if (myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) + MakeConeSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : MakeConeSimulationAndDisplay() +// purpose : +//================================================================================= +void PrimitiveGUI_ConeDlg::MakeConeSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + gp_Dir aDir = myDir; + + try { + /* allows user to reverse direction of construction with a negative height */ + if(this->myHeight < -Precision::Confusion()) + aDir.Reverse(); + + gp_Ax2 anAxis(this->myPoint1, aDir); + + if(fabs(myRadius1 - myRadius2) <= Precision::Confusion()) + mySimulationTopoDs = BRepPrimAPI_MakeCylinder(anAxis, (myRadius1+myRadius2)/2.0, fabs(myHeight)).Shape(); + else { + if(fabs(myHeight) > Precision::Confusion()) + mySimulationTopoDs = BRepPrimAPI_MakeCone(anAxis, myRadius1, myRadius2, fabs(myHeight)).Shape(); + } + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeConeSimulationAndDisplay"); + } + return; +} diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h new file mode 100644 index 000000000..20ea84f88 --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h @@ -0,0 +1,95 @@ +// 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 : PrimitiveGUI_ConeDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_CONE_H +#define DIALOGBOX_CONE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel3Spin.h" +#include "DlgRef_3Spin.h" + +#include "PrimitiveGUI.h" + +#include "GEOM_EdgeFilter.hxx" +#include "GEOM_ShapeTypeFilter.hxx" + +#include +#include + +//================================================================================= +// class : PrimitiveGUI_ConeDlg +// purpose : +//================================================================================= +class PrimitiveGUI_ConeDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + PrimitiveGUI_ConeDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~PrimitiveGUI_ConeDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + void MakeConeSimulationAndDisplay(); + + PrimitiveGUI* myPrimitiveGUI; + + double step; + int myConstructorId; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; + Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */ + + gp_Pnt myPoint1; /* topology used */ + gp_Dir myDir; + bool myOkPoint1; /* to check when arguments is defined */ + bool myOkDir; + + Standard_Real myRadius1; + Standard_Real myRadius2; + Standard_Real myHeight; + bool myOkRadius1; + bool myOkRadius2; + bool myOkHeight; + + DlgRef_2Sel3Spin* GroupPoints; + DlgRef_3Spin* GroupDimensions; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked(int constructorId); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_CONE_H diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx new file mode 100644 index 000000000..0826eef58 --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -0,0 +1,425 @@ +// 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 : PrimitiveGUI_CylinderDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "PrimitiveGUI_CylinderDlg.h" + +#include +#include +#include +#include +#include "QAD_Config.h" + +//================================================================================= +// class : PrimitiveGUI_CylinderDlg() +// purpose : Constructs a PrimitiveGUI_CylinderDlg 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. +//================================================================================= +PrimitiveGUI_CylinderDlg::PrimitiveGUI_CylinderDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, 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_CYLINDER_PV"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CYLINDER_DXYZ"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_CYLINDER_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_CYLINDER")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel2Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS")); + GroupPoints->TextLabel4->setText(tr("GEOM_HEIGHT")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + + GroupDimensions = new DlgRef_2Spin(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); + GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS")); + GroupDimensions->TextLabel2->setText(tr("GEOM_HEIGHT")); + + Layout1->addWidget(GroupPoints, 1, 0); + Layout1->addWidget(GroupDimensions, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myPrimitiveGUI = thePrimitiveGUI; + Init(); +} + + +//================================================================================= +// function : ~PrimitiveGUI_CylinderDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +PrimitiveGUI_CylinderDlg::~PrimitiveGUI_CylinderDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::Init() +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupPoints->LineEdit1; + + myRadius = 100.0; + myHeight = 300.0; + myOkRadius = myOkHeight = true; + myOkPoint1 = myOkDir = false; + + myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom); + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + /* min, max, step and decimals for spin boxes & initial values */ + /* First constructor : radius */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + /* First constructor : algebric height */ + GroupPoints->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + /* Second constructor : radius */ + GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + /* Second constructor : algebric height */ + GroupDimensions->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + + GroupPoints->SpinBox_DX->SetValue(myRadius); + GroupPoints->SpinBox_DY->SetValue(myHeight); + GroupDimensions->SpinBox_DX->SetValue(myRadius); + GroupDimensions->SpinBox_DY->SetValue(myHeight); + + /* signals and slots connections */ + 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(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, 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_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY, 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_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupDimensions->hide(); + GroupPoints->show(); + this->show(); + + return ; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void PrimitiveGUI_CylinderDlg::ConstructorsClicked(int constructorId) +{ + myConstructorId = constructorId; + mySelection->ClearFilters(); + myGeomBase->EraseSimulationShape(); + disconnect(mySelection, 0, this, 0); + myOkHeight = myOkRadius = true; + myRadius = 100.0; + myHeight = 300.0; + + switch(myConstructorId) + { + case 0 : + { + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + myOkPoint1 = myOkDir = false; + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(tr("")); + GroupPoints->LineEdit2->setText(tr("")); + + GroupPoints->SpinBox_DX->SetValue(myRadius); + GroupPoints->SpinBox_DY->SetValue(myHeight); + + /* filter for next selection */ + mySelection->AddFilter(myVertexFilter); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + case 1 : + { + GroupPoints->hide(); + resize( 0, 0 ); + GroupDimensions->show(); + myOkPoint1 = myOkDir = true; + + GroupDimensions->SpinBox_DX->SetValue(myRadius); + GroupDimensions->SpinBox_DY->SetValue(myHeight); + myPoint1.SetCoord(0.0, 0.0, 0.0); + myDir.SetCoord(0.0, 0.0, 1.0); + + MakeCylinderSimulationAndDisplay(); + break; + } + } + return ; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkPoint1 && myOkDir && myOkRadius && myOkHeight) { + gp_Dir aDir = myDir; + /* allows user to reverse direction of construction with a negative height */ + if(this->myHeight < -Precision::Confusion()) + aDir.Reverse(); + myPrimitiveGUI->MakeCylinderAndDisplay(myPoint1, aDir, myRadius, fabs(myHeight)); + } + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void PrimitiveGUI_CylinderDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkPoint1 = false; + else if (myEditCurrentArgument == GroupPoints->LineEdit2) + myOkDir = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + /* gp_Pnt : not used */ + if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + GroupPoints->LineEdit1->setText(aString); + myOkPoint1 = true; + } + else if (myEditCurrentArgument == GroupPoints->LineEdit2) { + BRepAdaptor_Curve curv(TopoDS::Edge(S)); + myDir = curv.Line().Direction(); + GroupPoints->LineEdit2->setText(aString); + myOkDir = true; + } + + if(myOkPoint1 && myOkDir && myOkRadius && myOkHeight) + MakeCylinderSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument() +{ + if(myConstructorId != 0) + return; + + QPushButton* send = (QPushButton*)sender(); + mySelection->ClearFilters(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + mySelection->AddFilter(myVertexFilter); + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + mySelection->AddFilter(myEdgeFilter); + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::ValueChangedInSpinBox( double newValue ) +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + QObject* send = (QObject*)sender(); + + /* radius */ + if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DX) { + myRadius = newValue; + myOkRadius = true; + } /* algebric height */ + else if(send == GroupPoints->SpinBox_DY || send == GroupDimensions->SpinBox_DY) { + myHeight = newValue; + myOkHeight = true; + } + + if (myOkPoint1 && myOkDir && myOkRadius && myOkHeight) + MakeCylinderSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : MakeCylinderSimulationAndDisplay() +// purpose : +//================================================================================= +void PrimitiveGUI_CylinderDlg::MakeCylinderSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + gp_Dir aDir = this->myDir; + + try { + /* allows user to reverse direction of construction with a negative height */ + if(this->myHeight < -Precision::Confusion()) + aDir.Reverse(); + + gp_Ax2 anAxis(this->myPoint1, aDir); + + mySimulationTopoDs = BRepPrimAPI_MakeCylinder(anAxis, this->myRadius, fabs(myHeight)).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeCylinderSimulationAndDisplay"); + } + return; +} diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h new file mode 100644 index 000000000..47cc31526 --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h @@ -0,0 +1,93 @@ +// 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 : PrimitiveGUI_CylinderDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_CYLINDER_H +#define DIALOGBOX_CYLINDER_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel2Spin.h" +#include "DlgRef_2Spin.h" + +#include "PrimitiveGUI.h" + +#include "GEOM_EdgeFilter.hxx" +#include "GEOM_ShapeTypeFilter.hxx" + +#include +#include + +//================================================================================= +// class : PrimitiveGUI_CylinderDlg +// purpose : +//================================================================================= +class PrimitiveGUI_CylinderDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + PrimitiveGUI_CylinderDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~PrimitiveGUI_CylinderDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + void MakeCylinderSimulationAndDisplay(); + + PrimitiveGUI* myPrimitiveGUI; + + double step; + int myConstructorId; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; + Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */ + + gp_Pnt myPoint1; /* topology used */ + gp_Dir myDir; + bool myOkPoint1; /* to check when arguments is defined */ + bool myOkDir; + + Standard_Real myRadius; + Standard_Real myHeight; + bool myOkRadius; + bool myOkHeight; + + DlgRef_2Sel2Spin* GroupPoints; + DlgRef_2Spin* GroupDimensions; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked(int constructorId); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_CYLINDER_H diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx new file mode 100644 index 000000000..a26177ca1 --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -0,0 +1,340 @@ +// 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 : PrimitiveGUI_SphereDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "PrimitiveGUI_SphereDlg.h" + +#include +#include "QAD_Config.h" + +//================================================================================= +// class : PrimitiveGUI_SphereDlg() +// purpose : Constructs a PrimitiveGUI_SphereDlg 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. +//================================================================================= +PrimitiveGUI_SphereDlg::PrimitiveGUI_SphereDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, 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_SPHERE_P"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SPHERE_DXYZ"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SPHERE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SPHERE")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel1Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_SPHERE_CR")); + GroupPoints->TextLabel1->setText(tr("GEOM_CENTER")); + GroupPoints->TextLabel2->setText(tr("GEOM_RADIUS")); + GroupPoints->PushButton1->setPixmap(image2); + + GroupDimensions = new DlgRef_1Spin(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_SPHERE_RO")); + GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS")); + + Layout1->addWidget(GroupPoints, 1, 0); + Layout1->addWidget(GroupDimensions, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myPrimitiveGUI = thePrimitiveGUI; + Init(); +} + + +//================================================================================= +// function : ~PrimitiveGUI_SphereDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +PrimitiveGUI_SphereDlg::~PrimitiveGUI_SphereDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::Init() +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupPoints->LineEdit1; + + myPoint1.SetCoord(0.0, 0.0, 0.0); + myRadius = 100.0; + myOkPoint1 = false; + + /* Vertices Filter for all arguments */ + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + /* min, max, step and decimals for spin boxes */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupPoints->SpinBox_DX->SetValue(myRadius); + GroupDimensions->SpinBox_DX->SetValue(myRadius); + + /* signals and slots connections */ + 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->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DX, 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(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupDimensions->hide(); + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId) +{ + myConstructorId = constructorId; + mySelection->ClearFilters(); + myGeomBase->EraseSimulationShape(); + disconnect(mySelection, 0, this, 0); + myRadius = 100.0; + + switch (constructorId) + { + case 0: + { + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(""); + + GroupPoints->SpinBox_DX->SetValue(myRadius); + myOkPoint1 = false; + + /* filter for next selections */ + mySelection->AddFilter(myVertexFilter); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + case 1: + { + GroupPoints->hide(); + resize(0, 0); + GroupDimensions->show(); + + GroupDimensions->SpinBox_DX->SetValue(myRadius); + myPoint1.SetCoord(0.0, 0.0, 0.0); /* at origin */ + myOkPoint1 = true; + + mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + break; + } + } + return ; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if(mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkPoint1) + myPrimitiveGUI->MakeSphereAndDisplay(myPoint1, myRadius); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void PrimitiveGUI_SphereDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + GroupPoints->LineEdit1->setText(""); + myOkPoint1 = false; + } + return; + } + + /* nbSel == 1 ! */ + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + /* Constructor 1 treatment */ + if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + GroupPoints->LineEdit1->setText(aString); + myOkPoint1 = true; + } + + if(myOkPoint1) { + mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + return ; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::SetEditCurrentArgument() +{ + if(myConstructorId != 0) + return; + + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + mySelection->AddFilter(myVertexFilter); + this->SelectionIntoArgument(); + } + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void PrimitiveGUI_SphereDlg::ValueChangedInSpinBox(double newValue) +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myRadius = newValue; + + if(myOkPoint1) { + mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + return; +} diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h new file mode 100644 index 000000000..c09fe193c --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h @@ -0,0 +1,82 @@ +// 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 : PrimitiveGUI_SphereDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_SPHERE_H +#define DIALOGBOX_SPHERE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel1Spin.h" +#include "DlgRef_1Spin.h" + +#include "PrimitiveGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" +#include + +//================================================================================= +// class : PrimitiveGUI_SphereDlg +// purpose : +//================================================================================= +class PrimitiveGUI_SphereDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + PrimitiveGUI_SphereDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~PrimitiveGUI_SphereDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + + PrimitiveGUI* myPrimitiveGUI; + + double step; + int myConstructorId; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */ + + gp_Pnt myPoint1; /* Points containing the vector */ + Standard_Real myRadius; + bool myOkPoint1; + + DlgRef_1Sel1Spin* GroupPoints; + DlgRef_1Spin* GroupDimensions; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked(int constructorId); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_SPHERE_H diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx new file mode 100644 index 000000000..e67d4ae54 --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -0,0 +1,409 @@ +// 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 : PrimitiveGUI_TorusDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "PrimitiveGUI_TorusDlg.h" + +#include +#include +#include +#include "QAD_Config.h" + +//================================================================================= +// class : PrimitiveGUI_TorusDlg() +// purpose : Constructs a PrimitiveGUI_TorusDlg 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. +//================================================================================= +PrimitiveGUI_TorusDlg::PrimitiveGUI_TorusDlg(QWidget* parent, const char* name, PrimitiveGUI* thePrimitiveGUI, 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_TORUS_PV"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_TORUS_DXYZ"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_TORUS_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_TORUS")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel2Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_BASE_POINT")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR")); + GroupPoints->TextLabel3->setText(tr("GEOM_RADIUS_I").arg("1")); + GroupPoints->TextLabel4->setText(tr("GEOM_RADIUS_I").arg("2")); + GroupPoints->PushButton1->setPixmap(image2); + GroupPoints->PushButton2->setPixmap(image2); + + GroupDimensions = new DlgRef_2Spin(this, "GroupDimensions"); + GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); + GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS_I").arg("1")); + GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS_I").arg("2")); + + Layout1->addWidget(GroupPoints, 1, 0); + Layout1->addWidget(GroupDimensions, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myPrimitiveGUI = thePrimitiveGUI; + Init(); +} + + +//================================================================================= +// function : ~PrimitiveGUI_TorusDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +PrimitiveGUI_TorusDlg::~PrimitiveGUI_TorusDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::Init() +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupPoints->LineEdit1; + + myRadius1 = 300.0; + myRadius2 = 100.0; + myOkRadius1 = myOkRadius2 = true; + myOkPoint1 = myOkDir = false; + + myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom); + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + /* 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); + GroupDimensions->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupDimensions->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); + + GroupPoints->SpinBox_DX->SetValue(myRadius1); + GroupPoints->SpinBox_DY->SetValue(myRadius2); + GroupDimensions->SpinBox_DX->SetValue(myRadius1); + GroupDimensions->SpinBox_DY->SetValue(myRadius2); + + /* signals and slots connections */ + 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(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, 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_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupDimensions->SpinBox_DY, 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_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupDimensions->SpinBox_DY, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupDimensions->hide(); + GroupPoints->show(); + this->show(); + + return; +} + + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId) +{ + myConstructorId = constructorId; + mySelection->ClearFilters(); + myGeomBase->EraseSimulationShape(); + disconnect(mySelection, 0, this, 0); + myOkRadius1 = myOkRadius2 = true; + myRadius1 = 300.0; + myRadius2 = 100.0; + + switch(myConstructorId) + { + case 0 : + { + GroupDimensions->hide(); + resize(0, 0); + GroupPoints->show(); + myOkPoint1 = myOkDir = false; + + myEditCurrentArgument = GroupPoints->LineEdit1; + GroupPoints->LineEdit1->setText(tr("")); + GroupPoints->LineEdit2->setText(tr("")); + + GroupPoints->SpinBox_DX->SetValue(myRadius1); + GroupPoints->SpinBox_DY->SetValue(myRadius2); + + /* filter for next selection */ + mySelection->AddFilter(myVertexFilter); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break ; + } + case 1 : + { + GroupPoints->hide(); + resize( 0, 0 ); + GroupDimensions->show(); + myOkPoint1 = myOkDir = true; + + GroupDimensions->SpinBox_DX->SetValue(myRadius1); + GroupDimensions->SpinBox_DY->SetValue(myRadius2); + myPoint1.SetCoord(0.0, 0.0, 0.0); + myDir.SetCoord(0.0, 0.0, 1.0); + + MakeTorusSimulationAndDisplay(); + break ; + } + } + return ; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) + myPrimitiveGUI->MakeTorusAndDisplay(myPoint1, myDir, myRadius1, myRadius2); + return ; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void PrimitiveGUI_TorusDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkPoint1 = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkDir = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + /* gp_Pnt : not used */ + if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + GroupPoints->LineEdit1->setText(aString); + myOkPoint1 = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + BRepAdaptor_Curve curv(TopoDS::Edge(S)); + myDir = curv.Line().Direction(); + GroupPoints->LineEdit2->setText(aString); + myOkDir = true; + } + + if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2) + MakeTorusSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::SetEditCurrentArgument() +{ + if(myConstructorId != 0) + return; + + QPushButton* send = (QPushButton*)sender(); + mySelection->ClearFilters(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + mySelection->AddFilter(myVertexFilter); + } + else if(send == GroupPoints->PushButton2) { + GroupPoints->LineEdit2->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit2; + mySelection->AddFilter(myEdgeFilter); + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::ValueChangedInSpinBox(double newValue) +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + QObject* send = (QObject*)sender(); + + if(send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DX) { + myRadius1 = newValue; + myOkRadius1 = true; + } + else if(send == GroupPoints->SpinBox_DY || send == GroupDimensions->SpinBox_DY) { + myRadius2 = newValue; + myOkRadius2 = true; + } + + if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2) + MakeTorusSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : MakeTorusSimulationAndDisplay() +// purpose : +//================================================================================= +void PrimitiveGUI_TorusDlg::MakeTorusSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + gp_Ax2 anAxis(myPoint1, myDir); + mySimulationTopoDs = BRepPrimAPI_MakeTorus(anAxis, myRadius1, myRadius2).Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeTorusSimulationAndDisplay"); + } + return; +} diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h new file mode 100644 index 000000000..2eb3b32b5 --- /dev/null +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h @@ -0,0 +1,93 @@ +// 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 : PrimitiveGUI_TorusDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_TORUS_H +#define DIALOGBOX_TORUS_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel2Spin.h" +#include "DlgRef_2Spin.h" + +#include "PrimitiveGUI.h" + +#include "GEOM_EdgeFilter.hxx" +#include "GEOM_ShapeTypeFilter.hxx" + +#include +#include + +//================================================================================= +// class : PrimitiveGUI_TorusDlg +// purpose : +//================================================================================= +class PrimitiveGUI_TorusDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + PrimitiveGUI_TorusDlg(QWidget* parent = 0, const char* name = 0, PrimitiveGUI* thePrimitiveGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~PrimitiveGUI_TorusDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + void MakeTorusSimulationAndDisplay(); + + PrimitiveGUI* myPrimitiveGUI; + + double step; + int myConstructorId; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; + Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */ + + gp_Pnt myPoint1; /* topology used */ + gp_Dir myDir; + bool myOkPoint1; /* to check when arguments is defined */ + bool myOkDir; + + Standard_Real myRadius1; + Standard_Real myRadius2; + bool myOkRadius1; + bool myOkRadius2; + + DlgRef_2Sel2Spin* GroupPoints; + DlgRef_2Spin* GroupDimensions; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked(int constructorId); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_TORUS_H diff --git a/src/RepairGUI/Makefile.in b/src/RepairGUI/Makefile.in new file mode 100644 index 000000000..3b4d328f1 --- /dev/null +++ b/src/RepairGUI/Makefile.in @@ -0,0 +1,67 @@ +# GEOM REPAIRGUI : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= + +# Libraries targets +LIB = libRepairGUI.la + +LIB_SRC = RepairGUI.cxx \ + RepairGUI_SewingDlg.cxx \ + RepairGUI_OrientationDlg.cxx \ + RepairGUI_SuppressFacesDlg.cxx \ + RepairGUI_SuppressHoleDlg.cxx + +LIB_MOC = \ + RepairGUI.h \ + RepairGUI_SewingDlg.h \ + RepairGUI_OrientationDlg.h \ + RepairGUI_SuppressFacesDlg.h \ + RepairGUI_SuppressHoleDlg.h + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lDisplayGUI + +@CONCLUDE@ diff --git a/src/RepairGUI/RepairGUI.cxx b/src/RepairGUI/RepairGUI.cxx new file mode 100644 index 000000000..0c456bdd7 --- /dev/null +++ b/src/RepairGUI/RepairGUI.cxx @@ -0,0 +1,340 @@ +// 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 : RepairGUI.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "RepairGUI.h" + +#include "QAD_RightFrame.h" +#include "OCCViewer_Viewer3d.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include "RepairGUI_SewingDlg.h" // Method SEWING +#include "RepairGUI_OrientationDlg.h" // Method ORIENTATION +#include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES +#include "RepairGUI_SuppressHoleDlg.h" // Method SUPPRESS HOLE + +//======================================================================= +// function : RepairGUI() +// purpose : Constructor +//======================================================================= +RepairGUI::RepairGUI() : + QObject() +{ + 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; +} + + +//======================================================================= +// function : ~RepairGUI() +// purpose : Destructor +//======================================================================= +RepairGUI::~RepairGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool RepairGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + RepairGUI* myRepairGUI = new RepairGUI(); + myRepairGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + + switch (theCommandID) + { + case 601: // SEWING + { + RepairGUI_SewingDlg *aDlg = new RepairGUI_SewingDlg(parent, "", myRepairGUI, Sel); + break; + } + case 602: // ORIENTATION + { + RepairGUI_OrientationDlg *aDlg = new RepairGUI_OrientationDlg(parent, "", myRepairGUI, Sel); + break; + } + case 603: // SUPPRESS FACES : use ic + { + Handle(AIS_InteractiveContext) ic; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + ic = v3d->getAISContext(); + } + RepairGUI_SuppressFacesDlg *aDlg = new RepairGUI_SuppressFacesDlg(parent, "", myRepairGUI, Sel, ic); + break; + } + case 604: // SUPPRESS HOLES : use ic + { + Handle(AIS_InteractiveContext) ic; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + ic = v3d->getAISContext(); + } + RepairGUI_SuppressHoleDlg *aDlg = new RepairGUI_SuppressHoleDlg(parent, "", myRepairGUI, Sel, ic); + break; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//===================================================================================== +// function : MakeSewingAndDisplay() +// purpose : +//===================================================================================== +void RepairGUI::MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, + const Standard_Real precision) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->MakeSewing(listShapesIOR, precision); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + result->NameType(type); + + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + return; + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeOrientationChangeAndDisplay() +// purpose : +//===================================================================================== +void RepairGUI::MakeOrientationChangeAndDisplay(GEOM::GEOM_Shape_ptr Shape) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->OrientationChange(Shape); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(Shape->NameType()); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + return; + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : OnSuppressHole() +// purpose : To suppress an hole on a shape 'ShapeTopo'. +// : 'ListOfIdEndFace' may be an empty list. +// : This means that hole do not traverse ShapeTopo. +// : Warning : the hole to be suppressed must be defined by one or two single closed wires ! +//===================================================================================== +bool RepairGUI::OnSuppressHole(const char* ShapeTopoIOR, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdFace, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWire, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace) +{ + /* Test the type of viewer */ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) + return false; + + try { + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); + GEOM::GEOM_Shape_var aResult = myGeom->SuppressHole(aShape, ListOfIdFace, ListOfIdWire, ListOfIdEndFace); + + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + aResult->NameType(type); + + if(myGeomBase->Display(aResult)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return true; +} + + +//===================================================================================== +// function : OnSuppressHolesInFaceOrShell() +// purpose : To suppress one or more holes on a face +// : 'ListOfIdWires' contains indices or wires/holes. +//===================================================================================== +bool RepairGUI::OnSuppressHolesInFaceOrShell(const char* ShapeTopoIOR, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires) +{ + /* Test the type of viewer */ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + try { + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); + GEOM::GEOM_Shape_var aResult = myGeom->SuppressHolesInFaceOrShell(aShape, ListOfIdWires); + + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + aResult->NameType(type); + + if(myGeomBase->Display(aResult)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return true; +} + + +//===================================================================================== +// function : OnSuppressFaces() +// purpose : To suppress faces from a shape +// : The result is one or more shells/faces as main shapes ! +//===================================================================================== +bool RepairGUI::OnSuppressFaces(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, + const Standard_Integer& aLocalContextId, bool& myUseLocalContext) +{ + /* Test the type of viewer */ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); + if(theObj->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return false; + } + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + + if(myUseLocalContext == false) { + /* local context is from DialogBox */ + MESSAGE("Error : No local context opened for suppress faces method" << endl); + return false; + } + + GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; + ic->InitSelected(); + int nbSelected = ic->NbSelected(); + ListOfID->length(nbSelected); + + /* Create a list of indices of faces to be suppressed */ + int i = 0; + const int SubShapeType = 4; /* GEOM::FACE type */ + ic->InitSelected(); /* to repositioning at beginning */ + while(ic->MoreSelected()) { + int index = myGeomBase->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType); + ListOfID[i] = index; + i++; + ic->NextSelected(); + } + + /* Close local context opened in DialogBox */ + ic->CloseLocalContext(aLocalContextId); + myUseLocalContext = false; + + /* Here is the main shape */ + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); + GEOM::GEOM_Gen::ListOfGeomShapes_var listGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes; + + /* Call geom method that return a list of shells/faces as result of suppress */ + try { + listGeomShapes = myGeom->SuppressFaces(aShape, ListOfID); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + /* Test list of shells/faces */ + if(listGeomShapes->length() < 1) { + return false; + } + + /* Loop on each object created */ + for(int i=0; ilength(); i++) { + GEOM::GEOM_Shape_var aShellOrFace = listGeomShapes[i]; + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aShellOrFace); + + if(S.IsNull()) + return false; + + char* nameG = (char *)malloc(20); + Standard_CString Type; + if(myGeomBase->GetShapeTypeString(S, Type)) { + aShellOrFace->NameType(Type); + sprintf (nameG, "%s_%d", Type, myGeomGUI->GetNbGeom()++); + } + else { + aShellOrFace->NameType(tr("GEOM_SHAPE")); + sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); + } + + /* Display with name */ + if(!myGeomBase->Display(aShellOrFace, nameG)) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return false; + } + } + + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY")); + return true; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return RepairGUI::OnGUIEvent(theCommandID, parent);} +} diff --git a/src/RepairGUI/RepairGUI.h b/src/RepairGUI/RepairGUI.h new file mode 100644 index 000000000..1afe5a85f --- /dev/null +++ b/src/RepairGUI/RepairGUI.h @@ -0,0 +1,68 @@ +// 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 : RepairGUI.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef REPAIRGUI_H +#define REPAIRGUI_H + +#include "GEOMBase.h" + +//================================================================================= +// class : RepairGUI +// purpose : +//================================================================================= +class RepairGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + RepairGUI(); + ~RepairGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + + void MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, + const Standard_Real precision); + void MakeOrientationChangeAndDisplay(GEOM::GEOM_Shape_ptr Shape); + bool OnSuppressHole(const char* ShapeTopoIOR, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdFace, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWire, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace); + bool OnSuppressHolesInFaceOrShell(const char* ShapeTopoIOR, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires); + bool OnSuppressFaces(const TopoDS_Shape& ShapeTopo, + const char* ShapeTopoIOR, + const Standard_Integer& aLocalContextId, + bool& myUseLocalContext); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif diff --git a/src/GEOMGUI/GeometryGUI_FillingHoleDlg.cxx b/src/RepairGUI/RepairGUI_FillingHoleDlg.cxx similarity index 97% rename from src/GEOMGUI/GeometryGUI_FillingHoleDlg.cxx rename to src/RepairGUI/RepairGUI_FillingHoleDlg.cxx index 9e26e9498..904e9d156 100644 --- a/src/GEOMGUI/GeometryGUI_FillingHoleDlg.cxx +++ b/src/RepairGUI/RepairGUI_FillingHoleDlg.cxx @@ -265,7 +265,7 @@ void GeometryGUI_FillingHoleDlg::ClickOnOk() void GeometryGUI_FillingHoleDlg::ClickOnApply() { bool testResult = false ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; + QAD_Application::getDesktop()->putInfo( tr("") ) ; switch(myConstructorId) { @@ -275,10 +275,10 @@ void GeometryGUI_FillingHoleDlg::ClickOnApply() testResult = myGeomGUI->OnFillingHole( myShape, myShapeIOR, myLocalContextId, myUseLocalContext ) ; } if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("Operation aborted")) ; + QAD_Application::getDesktop()->putInfo(tr("Operation aborted")) ; } else { - myGeomGUI->GetDesktop()->putInfo(tr("Operation done")); + QAD_Application::getDesktop()->putInfo(tr("Operation done")); } /* Reset arguments to allow a new selection */ this->ResetStateOfDialog() ; @@ -334,7 +334,7 @@ void GeometryGUI_FillingHoleDlg::SelectionIntoArgument() return ; // if( !IO->hasEntry() ) { -// myGeomGUI->GetDesktop()->putInfo(tr("Main shape must be in the study before")) ; +// QAD_Application::getDesktop()->putInfo(tr("Main shape must be in the study before")) ; // return ; // } @@ -351,7 +351,7 @@ void GeometryGUI_FillingHoleDlg::SelectionIntoArgument() } if ( IO->hasEntry() ) { - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() ); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeIOR_var anIOR; @@ -492,7 +492,7 @@ void GeometryGUI_FillingHoleDlg::ActivateUserSelection() if( !this->myOkShape ) { this->ResetStateOfDialog() ; - myGeomGUI->GetDesktop()->putInfo(tr("Select main shape first")) ; + QAD_Application::getDesktop()->putInfo(tr("Select main shape first")) ; return ; } @@ -509,7 +509,7 @@ void GeometryGUI_FillingHoleDlg::ActivateUserSelection() TopAbs_ShapeEnum aType = TopAbs_EDGE ; myGeomGUI->PrepareSubShapeSelection( int(aType), this->myLocalContextId ) ; myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("Select edges to fill an hole and click on Ok/Apply")) ; + QAD_Application::getDesktop()->putInfo(tr("Select edges to fill an hole and click on Ok/Apply")) ; } return ; } diff --git a/src/GEOMGUI/GeometryGUI_FillingHoleDlg.h b/src/RepairGUI/RepairGUI_FillingHoleDlg.h similarity index 100% rename from src/GEOMGUI/GeometryGUI_FillingHoleDlg.h rename to src/RepairGUI/RepairGUI_FillingHoleDlg.h diff --git a/src/RepairGUI/RepairGUI_OrientationDlg.cxx b/src/RepairGUI/RepairGUI_OrientationDlg.cxx new file mode 100644 index 000000000..7b877f19e --- /dev/null +++ b/src/RepairGUI/RepairGUI_OrientationDlg.cxx @@ -0,0 +1,400 @@ +// 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 : RepairGUI_OrientationDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "RepairGUI_OrientationDlg.h" + +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : RepairGUI_OrientationDlg() +// purpose : Constructs a RepairGUI_OrientationDlg 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. +//================================================================================= +RepairGUI_OrientationDlg::RepairGUI_OrientationDlg(QWidget* parent, const char* name, RepairGUI* theRepairGUI, SALOME_Selection* Sel, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_ORIENTATION"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_ORIENTATION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_ORIENTATION")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel1Spin1Check(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR_LENGTH")); + GroupPoints->CheckButton1->setText(tr("GEOM_ORIENTATION_OPT")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myRepairGUI = theRepairGUI; + Init(); +} + + +//================================================================================= +// function : ~RepairGUI_OrientationDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_OrientationDlg::~RepairGUI_OrientationDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_OrientationDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myLength = 25.0; + myOkShape = false; + + double SpecificStep = 10; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, SpecificStep, 3); + GroupPoints->SpinBox_DX->SetValue(myLength); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + 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())); + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void RepairGUI_OrientationDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void RepairGUI_OrientationDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkShape && GroupPoints->CheckButton1->isChecked()) { + myRepairGUI->MakeOrientationChangeAndDisplay(myGeomShape); + GroupPoints->CheckButton1->setChecked(FALSE); + } + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void RepairGUI_OrientationDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkShape = false; + return; + } + + // nbSel == 1 + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myEditCurrentArgument->setText(aString); + myShape = S; + myOkShape = true; + } + + if(myOkShape) + this->MakeOrientationSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_OrientationDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_OrientationDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_OrientationDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void RepairGUI_OrientationDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void RepairGUI_OrientationDlg::ValueChangedInSpinBox(double newValue) +{ + myLength = newValue; + if(myOkShape) + this->MakeOrientationSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : ReverseOrientation() +// purpose : +//================================================================================= +void RepairGUI_OrientationDlg::ReverseAngle(int state) +{ + if(myOkShape) + this->MakeOrientationSimulationAndDisplay(); + return; +} + + +//================================================================================== +// function : MakeOrientationSimulationAndDisplay() +// purpose : Create 'aCompound1' and 'aCompound2' each contains edges oriented +// : respectively FORWARD and REVERSE for all faces of 'aTopoDS' +// : These edges represent normal vectors on faces of 'aTopoDS' +// : For a unique edge an arrow is displayed to show its orientation. +//================================================================================== +void RepairGUI_OrientationDlg::MakeOrientationSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + TopoDS_Compound aCompound1, aCompound2; + TopoDS_Compound NullComp; + BRep_Builder aBuilder1, aBuilder2; + aCompound1 = aCompound2 = NullComp; + aBuilder1.MakeCompound(aCompound1); + aBuilder2.MakeCompound(aCompound2); + + if(myShape.IsNull()) + return; + + try { + /* Case of an edge */ + if(myShape.ShapeType() == TopAbs_EDGE) { + /* Try to display a cone simulation shape to show direction of edge */ + TopoDS_Shape tmpShape = myShape ; + if(GroupPoints->CheckButton1->isChecked()) { + if(myShape.Orientation() == TopAbs_FORWARD) + tmpShape.Orientation(TopAbs_REVERSED); + else + tmpShape.Orientation(TopAbs_FORWARD); + } + if(myGeomBase->CreateArrowForLinearEdge(tmpShape, mySimulationTopoDs)) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; + } + + gp_Pnt P1, P2 ; + gp_Vec V, V1, V2; + TopExp_Explorer ex(myShape, TopAbs_FACE); + int test = 0; + while(ex.More()) { + const TopoDS_Face& F = TopoDS::Face(ex.Current()); + /* find the center of the minmax */ + BRepAdaptor_Surface SF(F); + Standard_Real u, v, x; + + u = SF.FirstUParameter(); + x = SF.LastUParameter(); + if(Precision::IsInfinite(u)) { + if(Precision::IsInfinite(x)) + u = 0.0; + else + u = x; + } + else if(!Precision::IsInfinite(x)) + u = (u+x) / 2.0; + + v = SF.FirstVParameter(); + x = SF.LastVParameter(); + if(Precision::IsInfinite(v)) { + if(Precision::IsInfinite(x)) + v = 0.0; + else + v = x; + } + else if(!Precision::IsInfinite(x)) + v = (v+x) / 2.0; + + SF.D1(u, v, P1, V1, V2); + V = V1.Crossed(V2); + x = V.Magnitude(); + if(x > 1.e-10) + V.Multiply(myLength/x); + else { + V.SetCoord(myLength/2.0, 0.0, 0.0); + MESSAGE ("Null normal in Orientation " << endl); + } + + P2 = P1; + /* test orientation of each face and displays forward (aCompound1) */ + if(F.Orientation() == TopAbs_FORWARD) + P2.Translate(V); + else + P2.Translate(-V); + BRepBuilderAPI_MakeEdge anEdge(P1, P2); + aBuilder1.Add(aCompound1, anEdge); + + P2 = P1; + /* test orientation of each face and displays forward (aCompound2) */ + if(F.Orientation() == TopAbs_FORWARD) + P2.Translate(-V); + else + P2.Translate(V); + anEdge = BRepBuilderAPI_MakeEdge(P1, P2); + aBuilder2.Add(aCompound2, anEdge); + + ex.Next(); + test++; + } + + /* display simulation compounds */ + if(test > 0 && GroupPoints->CheckButton1->isChecked()) + mySimulationTopoDs = aCompound1; + else if(test > 0 && !GroupPoints->CheckButton1->isChecked()) + mySimulationTopoDs = aCompound2; + + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) + MESSAGE("Exception catched in MakeOrientationSimulationAndDisplay"); + return; +} diff --git a/src/RepairGUI/RepairGUI_OrientationDlg.h b/src/RepairGUI/RepairGUI_OrientationDlg.h new file mode 100644 index 000000000..49f54a5da --- /dev/null +++ b/src/RepairGUI/RepairGUI_OrientationDlg.h @@ -0,0 +1,75 @@ +// 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 : RepairGUI_OrientationDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_ORIENTATION_H +#define DIALOGBOX_ORIENTATION_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel1Spin1Check.h" + +#include "RepairGUI.h" + +//================================================================================= +// class : DialogBox_ORIENTATION +// purpose : +//================================================================================= +class RepairGUI_OrientationDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + RepairGUI_OrientationDlg(QWidget* parent = 0, const char* name = 0, RepairGUI* theRepairGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~RepairGUI_OrientationDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakeOrientationSimulationAndDisplay(); + + RepairGUI* myRepairGUI; + + GEOM::GEOM_Shape_var myGeomShape; /* is myShape */ + TopoDS_Shape myShape; /* topology used */ + Standard_Real myLength; /* to simulate normal vector */ + bool myOkShape; + + DlgRef_1Sel1Spin1Check* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ReverseAngle(int state); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_ORIENTATION_H diff --git a/src/RepairGUI/RepairGUI_SewingDlg.cxx b/src/RepairGUI/RepairGUI_SewingDlg.cxx new file mode 100644 index 000000000..2cc0e2066 --- /dev/null +++ b/src/RepairGUI/RepairGUI_SewingDlg.cxx @@ -0,0 +1,216 @@ +// 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 : RepairGUI_SewingDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "RepairGUI_SewingDlg.h" + +#include "QAD_Config.h" + +//================================================================================= +// class : RepairGUI_SewingDlg() +// purpose : Constructs a RepairGUI_SewingDlg 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. +//================================================================================= +RepairGUI_SewingDlg::RepairGUI_SewingDlg(QWidget* parent, const char* name, RepairGUI* theRepairGUI, SALOME_Selection* Sel, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SEWING"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SEWING_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SEWING")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel1Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->TextLabel2->setText(tr("GEOM_PRECISION")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myRepairGUI = theRepairGUI; + Init(); +} + + +//================================================================================= +// function : ~RepairGUI_SewingDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_SewingDlg::~RepairGUI_SewingDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myOkListShapes = false; + myPrecision = 0.00001; + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + /* min, max, step and decimals for spin boxes */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.00001, 999.99999, step, 5); + GroupPoints->SpinBox_DX->SetValue(myPrecision); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if(myOkListShapes) + myRepairGUI->MakeSewingAndDisplay(myListShapes, myPrecision); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void RepairGUI_SewingDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + myOkListShapes = false; + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel < 2) + return; + + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes); + myEditCurrentArgument->setText(aString); + myOkListShapes = true; + /* no simulation */ + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + this->SelectionIntoArgument(); + } + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void RepairGUI_SewingDlg::ValueChangedInSpinBox(double newValue) +{ + myPrecision = newValue; + return; +} diff --git a/src/RepairGUI/RepairGUI_SewingDlg.h b/src/RepairGUI/RepairGUI_SewingDlg.h new file mode 100644 index 000000000..7e55b400b --- /dev/null +++ b/src/RepairGUI/RepairGUI_SewingDlg.h @@ -0,0 +1,73 @@ +// 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 : RepairGUI_SewingDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_SEWING_H +#define DIALOGBOX_SEWING_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel1Spin.h" + +#include "RepairGUI.h" + +//================================================================================= +// class : RepairGUI_SewingDlg +// purpose : +//================================================================================= +class RepairGUI_SewingDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + RepairGUI_SewingDlg(QWidget* parent = 0, const char* name = 0, RepairGUI* theRepairGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~RepairGUI_SewingDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + + RepairGUI* myRepairGUI; + + double step; + + GEOM::GEOM_Gen::ListOfIOR myListShapes; + Standard_Real myPrecision; + bool myOkListShapes; /* to check when arguments is defined */ + + DlgRef_1Sel1Spin* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_SEWING_H diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx new file mode 100644 index 000000000..e7923e8e2 --- /dev/null +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx @@ -0,0 +1,389 @@ +// 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 : RepairGUI_SuppressFacesDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "RepairGUI_SuppressFacesDlg.h" + +#include "DisplayGUI.h" +#include "QAD_RightFrame.h" +#include "OCCViewer_Viewer3d.h" + +//================================================================================= +// class : RepairGUI_SuppressFacesDlg() +// purpose : Constructs a RepairGUI_SuppressFacesDlg 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. +//================================================================================= +RepairGUI_SuppressFacesDlg::RepairGUI_SuppressFacesDlg(QWidget* parent, const char* name, RepairGUI* theRepairGUI, SALOME_Selection* Sel, Handle(AIS_InteractiveContext) ic, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUPRESS_FACE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SUPRESSFACE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SUPRESSFACE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel1Check_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + GroupPoints->CheckButton1->setText(tr("GEOM_SUPRESSFACE_SELECT")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myRepairGUI = theRepairGUI; + Init(ic); +} + + +//================================================================================= +// function : ~RepairGUI_SuppressFacesDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_SuppressFacesDlg::~RepairGUI_SuppressFacesDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::Init(Handle(AIS_InteractiveContext) ic) +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myOkSelectSubMode = false; + myOkShape = myUseLocalContext = false; + myIC = ic; + myLocalContextId = -1; + + /* 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(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ActivateUserSelection())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : Same than click on apply but close this dialog. +//================================================================================= +void RepairGUI_SuppressFacesDlg::ClickOnOk() +{ + this->ClickOnApply(); + this->ClickOnCancel(); + return; +} + + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + bool testResult = false; + + if(myOkShape && myOkSelectSubMode) + testResult = myRepairGUI->OnSuppressFaces(myShape, myShapeIOR, myLocalContextId, myUseLocalContext); + + if(!testResult) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + else + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + + /* Reset arguments to allow a new selection */ + this->ResetStateOfDialog(); + return ; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::ClickOnCancel() +{ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + } + GEOMBase_Skeleton::ClickOnCancel(); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +// : used only by SelectButtonC1A1 (LineEditC1A1) +//================================================================================= +void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + this->ResetStateOfDialog(); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + myOkShape = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(!IO->hasEntry()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return; + } + + /* Test the exact type of topology to suppress faces into */ + if(!S.IsNull() && (S.ShapeType() == TopAbs_SOLID || S.ShapeType() == TopAbs_SHELL || S.ShapeType() == TopAbs_COMPOUND)) { + if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { + Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IO); + myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ + myEditCurrentArgument->setText(aString); + myShape = S; + myOkShape = true; + return; + } + + if(IO->hasEntry()) { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + myShapeIOR = anIOR->Value(); + myOkShape = true; + myShape = S; + myEditCurrentArgument->setText(aString); + return; + } + } + } + + } + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::DeactivateActiveDialog() +{ + if(GroupConstructors->isEnabled()) { + this->ResetStateOfDialog(); + GEOMBase_Skeleton::DeactivateActiveDialog(); + } + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void RepairGUI_SuppressFacesDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void RepairGUI_SuppressFacesDlg::closeEvent(QCloseEvent* e) +{ + /* same than click on cancel button */ + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ActivateUserSelection() +// purpose : Activate selection of faces when CheckBox1->isChecked()... +//================================================================================= +void RepairGUI_SuppressFacesDlg::ActivateUserSelection() +{ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + if(!myOkShape) { + this->ResetStateOfDialog(); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")); + return; + } + + myOkSelectSubMode = GroupPoints->CheckButton1->isChecked(); + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + } + + if(myOkShape && myOkSelectSubMode) { + /* local context is defined into the method : 4 = FACES sub selection */ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelection(int(TopAbs_FACE), myLocalContextId); + myUseLocalContext = true; + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")); + } + } + else + GroupPoints->CheckButton1->setChecked(false); + return; +} + + + +//================================================================================= +// function : ResetStateOfDialog() +// purpose : Completely reset the state of method including local context +//================================================================================= +void RepairGUI_SuppressFacesDlg::ResetStateOfDialog() +{ + myOkShape = false ; + myEditCurrentArgument->setText(""); + + /* Select sub shapes mode not checked */ + myOkSelectSubMode = false; + GroupPoints->CheckButton1->setChecked(FALSE); + + /* Close its local contact if opened */ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + myIC = v3d->getAISContext(); + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + } + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + } + return; +} diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.h b/src/RepairGUI/RepairGUI_SuppressFacesDlg.h new file mode 100644 index 000000000..4c92a694c --- /dev/null +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.h @@ -0,0 +1,84 @@ +// 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 : RepairGUI_SuppressFacesDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_SUPPRESSFACES_H +#define DIALOGBOX_SUPPRESSFACES_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel1Check_QTD.h" + +#include "RepairGUI.h" + +//================================================================================= +// class : RepairGUI_SuppressFacesDlg +// purpose : +//================================================================================= +class RepairGUI_SuppressFacesDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + RepairGUI_SuppressFacesDlg(QWidget* parent = 0, const char* name = 0, RepairGUI* theRepairGUI = 0, SALOME_Selection* Sel = 0, Handle(AIS_InteractiveContext) ic = 0, bool modal = FALSE, WFlags fl = 0); + + ~RepairGUI_SuppressFacesDlg(); + +private : + void Init(Handle(AIS_InteractiveContext) ic); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); + + void ResetStateOfDialog(); + + RepairGUI* myRepairGUI; + + /* Interactive and local context management see also : bool myUseLocalContext() */ + Handle(AIS_InteractiveContext) myIC; /* Interactive context */ + Standard_Integer myLocalContextId; /* identify a local context used by this method */ + bool myUseLocalContext; /* true when this method as opened a local context */ + + TopoDS_Shape myShape; + char* myShapeIOR; + bool myOkShape; + bool myOkSelectSubMode; /* true = sub mode selection activated */ + + DlgRef_1Sel1Check_QTD* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ClickOnCancel(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ActivateUserSelection(); + +}; + +#endif // DIALOGBOX_SUPPRESSFACES_H diff --git a/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx b/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx new file mode 100644 index 000000000..8a7a36b1e --- /dev/null +++ b/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx @@ -0,0 +1,748 @@ +// 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 : RepairGUI_SuppressHoleDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "RepairGUI_SuppressHoleDlg.h" + +#include "DisplayGUI.h" + +#include "QAD_RightFrame.h" +#include "OCCViewer_Viewer3d.h" + +#include + +//================================================================================= +// class : RepairGUI_SuppressHoleDlg() +// purpose : Constructs a RepairGUI_SuppressHoleDlg 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. +//================================================================================= +RepairGUI_SuppressHoleDlg::RepairGUI_SuppressHoleDlg(QWidget* parent, const char* name, RepairGUI* theRepairGUI, SALOME_Selection* Sel, Handle(AIS_InteractiveContext) ic, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUPRESS_HOLE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUPRESS_HOLE_FACE_SHELL"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SUPPRESSHOLE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + Group1 = new DlgRef_1Sel3Check_QTD(this, "Group1"); + Group1->GroupBox1->setTitle(tr("")); + Group1->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + Group1->CheckButton1->setText(tr("GEOM_SUPPRESSHOLE_SELECTFACE")); + Group1->CheckButton2->setText(tr("GEOM_SUPPRESSHOLE_SELECTWIRE")); + Group1->CheckButton3->setText(tr("GEOM_SUPPRESSHOLE_SELECTFACE_END")); + Group1->PushButton1->setPixmap(image2); + + Group2 = new DlgRef_1Sel1Check_QTD(this, "Group2"); + Group2->GroupBox1->setTitle(tr("")); + Group2->TextLabel1->setText(tr("GEOM_SUPPRESSHOLE_FACE_SHELL")); + Group2->CheckButton1->setText(tr("GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE")); + Group2->PushButton1->setPixmap(image2); + + Layout1->addWidget(Group1, 1, 0); + Layout1->addWidget(Group2, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myRepairGUI = theRepairGUI; + Init(ic); +} + + +//================================================================================= +// function : ~RepairGUI_SuppressHoleDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +RepairGUI_SuppressHoleDlg::~RepairGUI_SuppressHoleDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void RepairGUI_SuppressHoleDlg::Init(Handle (AIS_InteractiveContext) ic) +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = Group1->LineEdit1; + + myIC = ic; + myUseLocalContext = myOkShape = myOkSelectFace = false; + myLocalContextId = -1; + + myListOfIdFace = new GEOM::GEOM_Shape::ListOfSubShapeID; + myListOfIdWire = new GEOM::GEOM_Shape::ListOfSubShapeID; + myListOfIdEndFace = new GEOM::GEOM_Shape::ListOfSubShapeID; + + myListOfIdFace->length(0); + myListOfIdWire->length(0); + myListOfIdEndFace->length(0); + + /* 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(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(Group1->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ActivateUserFaceSelection())); + connect(Group1->CheckButton2, SIGNAL(stateChanged(int)), this, SLOT(ActivateUserWireSelection())); + connect(Group1->CheckButton3, SIGNAL(stateChanged(int)), this, SLOT(ActivateUserEndFaceSelection())); + connect(Group2->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ActivateUserWiresOnFaceShellSelection())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + Group2->hide(); + Group1->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void RepairGUI_SuppressHoleDlg::ConstructorsClicked(int constructorId) +{ + myConstructorId = constructorId; + disconnect(mySelection, 0, this, 0); + myOkShape = false; + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + myUseLocalContext = false; + } + + switch (constructorId) + { + case 0: + { + Group2->hide(); + resize(0, 0); + Group1->show(); + + myEditCurrentArgument = Group1->LineEdit1; + Group1->LineEdit1->setText(""); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + myOkSelectFace = false; + this->ResetPartial(); + break; + } + case 1: + { + Group1->hide(); + resize(0, 0); + Group2->show(); + + myEditCurrentArgument = Group2->LineEdit1; + Group2->LineEdit1->setText(""); + + this->ResetPartial(); + connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + this->ResetPartial(); + break; + } + } + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : Same than click on apply but close this dialog. +//================================================================================= +void RepairGUI_SuppressHoleDlg::ClickOnOk() +{ + this->ClickOnApply(); + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void RepairGUI_SuppressHoleDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + bool testResult = false; + + if(!myOkShape) + return; + + switch (myConstructorId) + { + case 0: /* default constructor */ + { + if(!myOkSelectFace) + return; + + if(Group1->CheckButton2->isChecked()) { + if(!Group1->CheckButton3->isChecked()) { + /* Call method to get sub shape selection of GEOM::WIRE */ + bool aTest = this->GetIndexSubShapeSelected(myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext); + + /* Display all objects so that next method using ic can memorize them */ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + + if(!aTest || myListOfIdWire->length() != 1) { + Group1->CheckButton2->setChecked(FALSE); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + } + else { + myListOfIdEndFace->length(0); /* no end face */ + QApplication::setOverrideCursor(Qt::waitCursor); + testResult = myRepairGUI->OnSuppressHole(myShapeIOR, myListOfIdFace, myListOfIdWire, myListOfIdEndFace); + QApplication::restoreOverrideCursor(); + } + } + else { /* Group1->CheckButton3->isChecked() */ + + /* Call method to get sub shape selection of END GEOM::FACE */ + bool aTest = this->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdEndFace, myLocalContextId, myUseLocalContext); + + /* Display all objects so that next method using ic can memorize them */ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + + if(!aTest || myListOfIdEndFace->length() != 1) { + Group1->CheckButton3->setChecked(FALSE); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + } + else { + QApplication::setOverrideCursor(Qt::waitCursor); + testResult = myRepairGUI->OnSuppressHole(myShapeIOR, myListOfIdFace, myListOfIdWire, myListOfIdEndFace); + QApplication::restoreOverrideCursor(); + } + } + } + break; + } + case 1: /* second constructor */ + { + if(Group2->CheckButton1->isChecked()) { + /* Call method to get sub shape selection of one or more GEOM::WIRE(s) on a face or a shell */ + bool aTest = this->GetIndexSubShapeSelected(myShape, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext); + + /* Display all objects so that next method using ic can memorize them */ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + + if(!aTest || myListOfIdWire->length() < 1) { + Group2->CheckButton1->setChecked(FALSE); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + } + else { + QApplication::setOverrideCursor(Qt::waitCursor); + testResult = myRepairGUI->OnSuppressHolesInFaceOrShell(myShapeIOR, myListOfIdWire); + QApplication::restoreOverrideCursor(); + } + } + break; + } + } + + + if(!testResult) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + else + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + + /* Reset arguments to allow a new selection */ + this->ResetStateOfDialog(); + return; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void RepairGUI_SuppressHoleDlg::ClickOnCancel() +{ + this->ResetStateOfDialog(); + GEOMBase_Skeleton::ClickOnCancel(); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +// : used only by SelectButtonC1A1 and SelectButtonC2A1 +//================================================================================= +void RepairGUI_SuppressHoleDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + this->ResetStateOfDialog(); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) + return; + + /* nbSel == 1 */ + TopoDS_Shape S; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(S.IsNull() || S.ShapeType() == TopAbs_VERTEX || S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) + return; + + /* Test the exact type of topology to suppress faces into. */ + /* For the second constructor a face or shell selection is needed */ + if(myConstructorId == 0 || (myConstructorId == 1 && (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL))) { + if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { + Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IO); + + /* The Geom IOR string of selection */ + myShapeIOR = GIObject->getIOR(); + myEditCurrentArgument->setText(aString); + myShape = S; + myOkShape = true; + return; + } + + if(IO->hasEntry()) { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + myShapeIOR = anIOR->Value(); + myOkShape = true; + myShape = S; + myEditCurrentArgument->setText(aString); + return; + } + } + } + + } + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void RepairGUI_SuppressHoleDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == Group1->PushButton1) { + Group1->LineEdit1->setFocus(); + myEditCurrentArgument = Group1->LineEdit1; + } + else if(send == Group2->PushButton1) { + Group2->LineEdit1->setFocus(); + myEditCurrentArgument = Group2->LineEdit1; + } + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void RepairGUI_SuppressHoleDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == Group1->LineEdit1) + myEditCurrentArgument = Group1->LineEdit1; + else if (send == Group2->LineEdit1) + myEditCurrentArgument = Group2->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void RepairGUI_SuppressHoleDlg::DeactivateActiveDialog() +{ + this->ResetStateOfDialog(); + GEOMBase_Skeleton::DeactivateActiveDialog(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void RepairGUI_SuppressHoleDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : Mouse enter onto the dialog to activate it +//================================================================================= +void RepairGUI_SuppressHoleDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void RepairGUI_SuppressHoleDlg::closeEvent(QCloseEvent* e) +{ + /* same than click on cancel button */ + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ActivateUserFaceSelection() +// purpose : Called when CheckBox1 state has changed. (Face selection is ckecked) +// : Be careful user must first select a face then a wire ! +//================================================================================= +void RepairGUI_SuppressHoleDlg::ActivateUserFaceSelection() +{ + if(!this->myOkShape) { + this->ResetStateOfDialog(); + QAD_Application::getDesktop()->putInfo(tr("GEOM_MAIN_OBJECT")); + return; + } + + if(Group1->CheckButton1->isChecked()) { + /* local context is opened into the method : Prepare GEOM::FACE sub selection */ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelection(int(TopAbs_FACE), myLocalContextId); + myUseLocalContext = true; + QAD_Application::getDesktop()->putInfo(tr("GEOM_SUPPRESSHOLE_SELECTFACE")); + } + else + this->ResetPartial(); + + return; +} + + +//================================================================================= +// function : ActivateUserWireSelection() +// purpose : Called when CheckBox2 state has changed. (Wire selection is ckecked) +// : Be careful user must first select a face then a wire ! +//================================================================================= +void RepairGUI_SuppressHoleDlg::ActivateUserWireSelection() +{ + + if(!myOkShape) { + this->ResetStateOfDialog(); + QAD_Application::getDesktop()->putInfo(tr("GEOM_MAIN_OBJECT")); + return; + } + + if(Group1->CheckButton1->isChecked()) { + /* Get sub shape selection GEOM::FACE : local context is closed */ + bool aTest = this->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdFace, myLocalContextId, myUseLocalContext); + + /* Display all objects so that next method using ic can memorize them */ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + if(!aTest || myListOfIdFace->length() != 1) { + Group1->CheckButton1->setChecked(FALSE); + myOkSelectFace = false; + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + } + else + myOkSelectFace = true; + } + else { + this->ResetPartial(); + return; + } + + + if(Group1->CheckButton2->isChecked()) { + /* Get the face selection */ + myFace = FaceFromList(myShape, myListOfIdFace); + /* Local context is opened into the method : Prepare GEOM::WIRE sub selection into a face */ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelectionArgumentShape(myFace, int(TopAbs_WIRE), myLocalContextId); + myUseLocalContext = true; + QAD_Application::getDesktop()->putInfo(tr("GEOM_SUPPRESSHOLE_SELECTWIRE")); + } + else { + this->ResetPartial(); + } + return; +} + + +//================================================================================= +// function : ActivateUserlEndFaceSelection() +// purpose : Called when CheckBox3 state has changed. ( Optional End Face selection ) +// : Be careful user must first select a face then a wire then this optional end face ! +//================================================================================= +void RepairGUI_SuppressHoleDlg::ActivateUserEndFaceSelection() +{ + + if(!myOkShape) { + this->ResetStateOfDialog(); + QAD_Application::getDesktop()->putInfo(tr("GEOM_MAIN_OBJECT")); + return; + } + + if(Group1->CheckButton2->isChecked()) { + /* Call method to get sub shape selection for the GEOM::WIRE into myFace : local context is closed */ + bool aTest = this->GetIndexSubShapeSelected(myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext); + + /* Display all objects so that next method using ic can memorize them */ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + + if(!aTest || myListOfIdWire->length() != 1) { + Group1->CheckButton2->setChecked(FALSE); + Group1->CheckButton3->setChecked(FALSE); + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + } + else { + this->ResetPartial(); + return; + } + + + if(Group1->CheckButton3->isChecked()) { + /* Local context is opened into the method : prepare GEOM::FACE(end) into myShape sub selection */ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelectionArgumentShape(myShape, int(TopAbs_FACE), myLocalContextId); + myUseLocalContext = true; + QAD_Application::getDesktop()->putInfo(tr("GEOM_SUPPRESSHOLE_SELECTFACE_END")); + } + else + this->ResetPartial(); + return; +} + + +//================================================================================= +// function : ActivateUserWiresOnFaceShellSelection() +// purpose : Called when CheckBoxC2_1 state has changed. +// : Only for second constructor ! +// : Prepare selection for wire(s) on main object that is a face or a shell +//================================================================================= +void RepairGUI_SuppressHoleDlg::ActivateUserWiresOnFaceShellSelection() +{ + + if(!myOkShape) { + this->ResetStateOfDialog(); + QAD_Application::getDesktop()->putInfo(tr("GEOM_MAIN_OBJECT")); + return; + } + + if(Group2->CheckButton1->isChecked()) { + /* Local context is opened to prepare GEOM::WIRE(S) selection into 'myShape' that is a (main) face */ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelectionArgumentShape(myShape, int(TopAbs_WIRE), myLocalContextId); + myUseLocalContext = true; + QAD_Application::getDesktop()->putInfo(tr("GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE")); + } + else + this->ResetPartial(); + return; +} + + +//================================================================================= +// function : FaceFromList() +// purpose : Return the face (selected by user) that is a sub shape of 'aShape' +// : and which unique index is in 'ListOfSub'. +// : This allows opening a local context with this face loaded. +// : See : myGeomBase->PrepareSubShapeSelectionArgumentShape(...) +//================================================================================= +TopoDS_Shape RepairGUI_SuppressHoleDlg::FaceFromList(const TopoDS_Shape& aShape, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfSub) +{ + TopoDS_Shape tds; + tds.Nullify(); + if(ListOfSub.length() != 1 || aShape.IsNull()) + return tds; + + int i = ListOfSub[0]; + TopExp_Explorer exp; + int j = 1; + for(exp.Init(aShape, TopAbs_FACE); exp.More(); exp.Next()) { + if(j == i) + return exp.Current(); + j++; + } + return tds; +} + + +//================================================================================= +// function : ResetStateOfDialog() +// purpose : Completely reset the state of method including local context +//================================================================================= +void RepairGUI_SuppressHoleDlg::ResetStateOfDialog() +{ + myOkShape = false; + myEditCurrentArgument->setText(""); + QApplication::restoreOverrideCursor(); + + /* Partial reset and more ...*/ + this->ResetPartial(); + + return; +} + + +//================================================================================= +// function : ResetPartial() +// purpose : Partially reset to keep only main selection +//================================================================================= +void RepairGUI_SuppressHoleDlg::ResetPartial() +{ + /* Select sub shape modes not checked */ + myOkSelectFace = false ; + Group1->CheckButton1->setChecked(FALSE); + Group1->CheckButton2->setChecked(FALSE); + Group1->CheckButton3->setChecked(FALSE); + Group2->CheckButton1->setChecked(FALSE); + + myListOfIdFace->length(0); + myListOfIdWire->length(0); + myListOfIdEndFace->length(0); + + /* Close its local contact if opened */ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC && myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + } + 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(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->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 new file mode 100644 index 000000000..ddc476099 --- /dev/null +++ b/src/RepairGUI/RepairGUI_SuppressHoleDlg.h @@ -0,0 +1,112 @@ +// 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 : RepairGUI_SuppressHoleDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef GEOMETRYGUI_SUPPRESSHOLE_H +#define GEOMETRYGUI_SUPPRESSHOLE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel1Check_QTD.h" +#include "DlgRef_1Sel3Check_QTD.h" + +#include "RepairGUI.h" + +//================================================================================= +// class : RepairGUI_SuppressHoleDlg +// purpose : +//================================================================================= +class RepairGUI_SuppressHoleDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + RepairGUI_SuppressHoleDlg(QWidget* parent = 0, const char* name = 0, RepairGUI* theRepairGUI = 0, SALOME_Selection* Sel = 0, Handle(AIS_InteractiveContext) ic = 0, bool modal = FALSE, WFlags fl = 0); + ~RepairGUI_SuppressHoleDlg(); + +private : + void Init(Handle(AIS_InteractiveContext) ic); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); + + void ResetStateOfDialog(); + void ResetPartial(); + + RepairGUI* myRepairGUI; + + int myConstructorId; /* Current constructor id = radio button id */ + + /* 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, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfSub); + + /* Interactive and local context management see also : bool myUseLocalContext() */ + Handle(AIS_InteractiveContext) myIC; /* Interactive context */ + Standard_Integer myLocalContextId; /* identify a local context used by this method */ + bool myUseLocalContext; /* true when this method as opened a local context */ + + TopoDS_Shape myShape; /* Main shape selected */ + TopoDS_Shape myFace; /* Face selected */ + + char* myShapeIOR; + bool myOkShape; + + bool myOkSelectFace; /* true = sub mode GEOM::FACE selection done */ + bool myOkSelectWire; /* true = sub mode GEOM::WIRE selection done (first wire) */ + + /* After selection contains index of face into myShape, wire into myFace, end face into myShape*/ + GEOM::GEOM_Shape::ListOfSubShapeID_var myListOfIdFace; + GEOM::GEOM_Shape::ListOfSubShapeID_var myListOfIdWire; + GEOM::GEOM_Shape::ListOfSubShapeID_var myListOfIdEndFace; + + DlgRef_1Sel3Check_QTD* Group1; + DlgRef_1Sel1Check_QTD* Group2; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ClickOnCancel(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked(int constructorId); + void ActivateUserFaceSelection(); + void ActivateUserWireSelection(); + void ActivateUserEndFaceSelection(); + + /* For the second constructor */ + void ActivateUserWiresOnFaceShellSelection() ; + +}; + +#endif // GEOMETRYGUI_SUPPRESSHOLE_H diff --git a/src/TransformationGUI/Makefile.in b/src/TransformationGUI/Makefile.in new file mode 100644 index 000000000..bf544b577 --- /dev/null +++ b/src/TransformationGUI/Makefile.in @@ -0,0 +1,71 @@ +# GEOM TRANSFORMATIONGUI : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= + +# Libraries targets +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 + +LIB_MOC = \ + TransformationGUI.h \ + TransformationGUI_MultiTranslationDlg.h \ + TransformationGUI_MultiRotationDlg.h \ + TransformationGUI_TranslationDlg.h \ + TransformationGUI_RotationDlg.h \ + TransformationGUI_MirrorDlg.h \ + TransformationGUI_ScaleDlg.h + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lGEOMFiltersSelection -lGEOMBase + +@CONCLUDE@ diff --git a/src/TransformationGUI/TransformationGUI.cxx b/src/TransformationGUI/TransformationGUI.cxx new file mode 100644 index 000000000..54ea7d019 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI.cxx @@ -0,0 +1,333 @@ +// 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 : TransformationGUI.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "TransformationGUI.h" + +#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 + +//======================================================================= +// function : TransformationGUI() +// purpose : Constructor +//======================================================================= +TransformationGUI::TransformationGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; +} + + +//======================================================================= +// function : ~TransformationGUI() +// purpose : Destructor +//======================================================================= +TransformationGUI::~TransformationGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool TransformationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + TransformationGUI* myTransformationGUI = new TransformationGUI(); + myTransformationGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + + switch (theCommandID) + { + case 5021: // TRANSLATION + { + TransformationGUI_TranslationDlg *aDlg = new TransformationGUI_TranslationDlg(parent, "", myTransformationGUI, Sel); + break; + } + case 5022: // ROTATION + { + TransformationGUI_RotationDlg *aDlg = new TransformationGUI_RotationDlg(parent, "", myTransformationGUI, Sel); + break; + } + case 5023: // MIRROR + { + TransformationGUI_MirrorDlg *aDlg = new TransformationGUI_MirrorDlg(parent, "", myTransformationGUI, Sel); + break; + } + case 5024: // SCALE + { + TransformationGUI_ScaleDlg *aDlg = new TransformationGUI_ScaleDlg(parent, "", myTransformationGUI, Sel ); + break; + } + case 5025: // MULTI TRANSLATION + { + TransformationGUI_MultiTranslationDlg *aDlg = new TransformationGUI_MultiTranslationDlg(parent, "", myTransformationGUI, Sel); + break; + } + case 5026: // MULTI ROTATION + { + TransformationGUI_MultiRotationDlg *aDlg = new TransformationGUI_MultiRotationDlg(parent, "", myTransformationGUI, Sel); + break; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//================================================================================= +// function : MakeTranslationAndDisplay() +// purpose : Translate a shape +//================================================================================= +void TransformationGUI::MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, gp_Vec V) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->MakeTranslation(Shape, V.X(), V.Y(), V.Z()); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + result->NameType(Shape->NameType()); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//======================================================================================= +// function : MakeRotationAndDisplay() +// purpose : +//======================================================================================= +void TransformationGUI::MakeRotationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc, + const gp_Dir dir, const Standard_Real angle) +{ + try { + const GEOM::AxisStruct axis = myGeom->MakeAxisStruct(loc.X(), loc.Y(), loc.Z(), + dir.X(), dir.Y(), dir.Z()); + GEOM::GEOM_Shape_var result = myGeom->MakeRotation(Shape, axis, angle); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return ; + } + result->NameType(Shape->NameType()); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeMirrorAndDisplay() +// purpose : +//===================================================================================== +void TransformationGUI::MakeMirrorAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->MakeMirrorByPlane(Shape1, Shape2); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(Shape1->NameType()); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeScaleAndDisplay() +// purpose : +//===================================================================================== +void TransformationGUI::MakeScaleAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt centralPoint, + const Standard_Real factor) +{ + try { + GEOM::PointStruct P = myGeom->MakePointStruct(centralPoint.X(), centralPoint.Y(), centralPoint.Z()); + GEOM::GEOM_Shape_var result = myGeom->MakeScaleTransform(Shape, P, factor); + result->NameType(Shape->NameType()); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + else + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//================================================================================= +// function : MakeMultiTranslation1DAndDisplay() +// purpose : Multi-Translate a shape +//================================================================================= +void TransformationGUI::MakeMultiTranslation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, + const double Step, const short NbTimes) +{ + try { + GEOM::PointStruct d = myGeom->MakePointStruct(Dir.X(), Dir.Y(), Dir.Z()); + GEOM::DirStruct dstruct = myGeom->MakeDirection(d); + + GEOM::GEOM_Shape_var result = myGeom->MakeMultiTranslation1D(Shape, dstruct, Step, NbTimes); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + result->NameType(tr("GEOM_COMPOUND")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//================================================================================= +// function : MakeMultiTranslation2DAndDisplay() +// 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) +{ + try { + GEOM::PointStruct d1 = myGeom->MakePointStruct(Dir1.X(), Dir1.Y(), Dir1.Z()); + GEOM::DirStruct dstruct1 = myGeom->MakeDirection(d1); + GEOM::PointStruct d2 = myGeom->MakePointStruct(Dir2.X(), Dir2.Y(), Dir2.Z()); + GEOM::DirStruct dstruct2 = myGeom->MakeDirection(d2); + + GEOM::GEOM_Shape_var result = myGeom->MakeMultiTranslation2D(Shape, dstruct1, Step1, NbTimes1, + dstruct2, Step2, NbTimes2); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + result->NameType(tr("GEOM_COMPOUND")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//================================================================================= +// function : MakeMultiRotation1DAndDisplay() +// purpose : Multi-Rotate a shape +//================================================================================= +void TransformationGUI::MakeMultiRotation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Dir Dir, + const gp_Pnt Loc, const short NbTimes) +{ + try { + GEOM::PointStruct d = myGeom->MakePointStruct(Dir.X(), Dir.Y(), Dir.Z()); + GEOM::DirStruct dstruct = myGeom->MakeDirection(d) ; + GEOM::PointStruct pstruct = myGeom->MakePointStruct(Loc.X(), Loc.Y(), Loc.Z()); + + GEOM::GEOM_Shape_var result = myGeom->MakeMultiRotation1D(Shape, dstruct, pstruct, NbTimes); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + result->NameType(tr("GEOM_COMPOUND")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//================================================================================= +// function : MakeMultiRotation2DAndDisplay() +// 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 double Step, const short NbTimes2) +{ + try { + GEOM::PointStruct d = myGeom->MakePointStruct(Dir.X(), Dir.Y(), Dir.Z()); + GEOM::DirStruct dstruct = myGeom->MakeDirection(d); + GEOM::PointStruct pstruct = myGeom->MakePointStruct(Loc.X(), Loc.Y(), Loc.Z()); + + GEOM::GEOM_Shape_var result = myGeom->MakeMultiRotation2D(Shape, dstruct, pstruct, + Ang, NbTimes1, Step, NbTimes2); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + return; + } + result->NameType(tr("GEOM_COMPOUND")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return TransformationGUI::OnGUIEvent(theCommandID, parent);} +} diff --git a/src/TransformationGUI/TransformationGUI.h b/src/TransformationGUI/TransformationGUI.h new file mode 100644 index 000000000..f8451c60e --- /dev/null +++ b/src/TransformationGUI/TransformationGUI.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 : TransformationGUI.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef TRANSFORMATIONGUI_H +#define TRANSFORMATIONGUI_H + +#include "GEOMBase.h" +#include + +//================================================================================= +// class : TransformationGUI +// purpose : +//================================================================================= +class TransformationGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + TransformationGUI(); + ~TransformationGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + + void MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Vec V); + void MakeRotationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc, + const gp_Dir dir, const Standard_Real angle); + void MakeMirrorAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_Shape_ptr Shape2); + void MakeScaleAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt centralPoint, + const Standard_Real factor); + void MakeMultiTranslation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape, + const gp_Dir Dir, const double Step, const short NbTimes); + void 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); + void MakeMultiRotation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape, + const gp_Dir Dir, const gp_Pnt Loc, const short NbTimes); + void MakeMultiRotation2DAndDisplay(GEOM::GEOM_Shape_ptr Shape, + const gp_Dir Dir, const gp_Pnt Loc, const double Ang, + const short NbTimes1, const double Step, const short NbTimes2); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx new file mode 100644 index 000000000..6a968659c --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -0,0 +1,301 @@ +// 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 : TransformationGUI_MirrorDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "TransformationGUI_MirrorDlg.h" + +#include +#include +#include + +//================================================================================= +// class : TransformationGUI_MirrorDlg() +// purpose : Constructs a TransformationGUI_MirrorDlg 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. +//================================================================================= +TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(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_MIRROR"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_MIRROR_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_MIRROR")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_PLANE_MIRROR")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myTransformationGUI = theTransformationGUI; + Init(); +} + + +//================================================================================= +// function : ~TransformationGUI_MirrorDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +TransformationGUI_MirrorDlg::~TransformationGUI_MirrorDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_MirrorDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myOkShape1 = myOkShape2 = false; + + /* Vertices Filter for all arguments */ + myFaceFilter = new GEOM_FaceFilter(StdSelect_Plane, myGeom); + + /* signals and slots connections */ + 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_MirrorDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void TransformationGUI_MirrorDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkShape1 && myOkShape2) + myTransformationGUI->MakeMirrorAndDisplay(myGeomShape1, myGeomShape2); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void TransformationGUI_MirrorDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkShape1 = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkShape2 = false; + return; + } + + // nbSel == 1 + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myShape1 = S; + myEditCurrentArgument->setText(aString); + myOkShape1 = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return ; + myShape2 = S; + myEditCurrentArgument->setText(aString); + myOkShape2 = true; + } + + if(myOkShape1 && myOkShape2) + MakeMirrorSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_MirrorDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + 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(myFaceFilter); + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void TransformationGUI_MirrorDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if(send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void TransformationGUI_MirrorDlg::enterEvent(QEvent * e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : MakeMirrorSimulationAndDisplay() +// purpose : S1 is a shape and S2 a mirror. +//================================================================================= +void TransformationGUI_MirrorDlg::MakeMirrorSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + Handle(Geom_Surface) surf = BRep_Tool::Surface(TopoDS::Face(myShape2)); + Handle(Geom_Plane) myPlane = Handle(Geom_Plane)::DownCast(surf); + const gp_Ax3 pos = myPlane->Position(); + const gp_Pnt loc = pos.Location(); /* location of the plane */ + const gp_Dir dir = pos.Direction(); /* Main direction of the plane (Z axis) */ + + /* plane used for mirroring */ + gp_Ax2 pln(loc, dir); + gp_Trsf theTransformation; + theTransformation.SetMirror(pln); + BRepBuilderAPI_Transform myBRepTransformation(myShape1, theTransformation, Standard_False); + + this->mySimulationTopoDs = myBRepTransformation.Shape(); + if(mySimulationTopoDs.IsNull()) + return; + else + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeMirrorSimulationAndDisplay"); + return; + } + return; +} diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.h b/src/TransformationGUI/TransformationGUI_MirrorDlg.h new file mode 100644 index 000000000..71c118981 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.h @@ -0,0 +1,79 @@ +// 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 : TransformationGUI_MirrorDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_MIRROR_H +#define DIALOGBOX_MIRROR_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel_QTD.h" + +#include "TransformationGUI.h" + +#include "GEOM_FaceFilter.hxx" + +//================================================================================= +// class : TransformationGUI_MirrorDlg +// purpose : +//================================================================================= +class TransformationGUI_MirrorDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + TransformationGUI_MirrorDlg(QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~TransformationGUI_MirrorDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakeMirrorSimulationAndDisplay(); + + TransformationGUI* myTransformationGUI; + + Handle(GEOM_FaceFilter) myFaceFilter; /* To filter selections */ + + TopoDS_Shape myShape1; /* topology used */ + TopoDS_Shape myShape2; /* topology used */ + GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */ + GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */ + bool myOkShape1; + bool myOkShape2; /* to check when arguments are defined */ + + DlgRef_2Sel_QTD* GroupPoints; + +private slots : + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + +}; + +#endif // DIALOGBOX_MIRROR_H diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx new file mode 100644 index 000000000..c347d7256 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -0,0 +1,554 @@ +// 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 : TransformationGUI_MultiTranslationDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +using namespace std; +#include "TransformationGUI_MultiRotationDlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "QAD_Config.h" + +//================================================================================= +// class : TransformationGUI_MultiRotationDlg() +// purpose : Constructs a TransformationGUI_MultiRotationDlg 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. +//================================================================================= +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_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 +//================================================================================= +TransformationGUI_MultiRotationDlg::~TransformationGUI_MultiRotationDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::Init() +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupPoints->LineEdit1; + + myAng = 45.0; + myStep = 50.0; + myNbTimes1 = 2; + myNbTimes2 = 2; + myOkBase = myOkDir = 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 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); + + 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(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))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupDimensions->hide(); + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) +{ + 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; + + switch (constructorId) + { + case 0: /* Rotate simple */ + { + 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 */ + { + GroupPoints->hide(); + resize(0, 0); + GroupDimensions->show(); + + myEditCurrentArgument = GroupDimensions->LineEdit1; + GroupDimensions->LineEdit1->setText(""); + GroupDimensions->LineEdit2->setText(""); + + GroupDimensions->SpinBox_DX1->SetValue(myAng); + GroupDimensions->SpinBox_DY1->SetValue(myNbTimes1); + GroupDimensions->SpinBox_DX2->SetValue(myStep); + GroupDimensions->SpinBox_DY2->SetValue(myNbTimes2); + + /* filter for next selection */ + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; + } + } + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myConstructorId == 0) { + if(myOkBase && myOkDir) + myTransformationGUI->MakeMultiRotation1DAndDisplay(myGeomShape, myDir, myLoc, myNbTimes1); + } + 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() +{ + 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; + } + + // 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; + } + + if(myOkBase && myOkDir) + this->MakeMultiRotationSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + 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); + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +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 : ActivateThisDialog() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::ActivateThisDialog() +{ + 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; + } + + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox(double newValue) +{ + 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 : ReverseAngle() +// purpose : 'state' not used here +//================================================================================= +void TransformationGUI_MultiRotationDlg::ReverseAngle(int state) +{ + 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; +} + + +//================================================================================= +// function : MakeMultiRotationSimulationAndDisplay() +// purpose : +//================================================================================= +void TransformationGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay() +{ + 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); + + 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(); + } + else if(myBase.ShapeType() == TopAbs_FACE || myBase.ShapeType() == TopAbs_SHELL) { + BRepGProp::SurfaceProperties(myBase, System); + myPoint = System.CentreOfMass(); + } + else { + BRepGProp::VolumeProperties(myBase, System); + myPoint = System.CentreOfMass(); + } + + TopoDS_Shape S = BRepBuilderAPI_MakeVertex(myPoint).Shape(); + + try { + switch (myConstructorId) + { + case 0 : + { + 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()); + } + mySimulationTopoDs = compound; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + break; + } + case 1 : + { + 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())) + return; + + 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()); + } + } + mySimulationTopoDs = compound; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + break; + } + } + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeMultitranslationSimulationAndDisplay"); + return; + } + return; +} diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h new file mode 100644 index 000000000..10a4a401e --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h @@ -0,0 +1,93 @@ +// 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 : TransformationGUI_MultiRotationDlg.h +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_MULTIROTATION_H +#define DIALOGBOX_MULTIROTATION_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel4Spin1Check.h" +#include "DlgRef_2Sel1Spin.h" + +#include "TransformationGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" +#include +#include + +//================================================================================= +// class : TransformationGUI_MultiRotationDlg +// purpose : +//================================================================================= +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(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakeMultiRotationSimulationAndDisplay(); + + TransformationGUI* myTransformationGUI; + + 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 ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ReverseAngle(int state); + void ValueChangedInSpinBox(double newValue); + void ConstructorsClicked(int constructorId); + +}; + +#endif // DIALOGBOX_MULTIROTATION_H diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx new file mode 100644 index 000000000..5e89231e2 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -0,0 +1,624 @@ +// 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 : TransformationGUI_MultiTranslationDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +using namespace std; +#include "TransformationGUI_MultiTranslationDlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "QAD_Config.h" + +//================================================================================= +// class : TransformationGUI_MultiTranslationDlg() +// purpose : Constructs a TransformationGUI_MultiTranslationDlg 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. +//================================================================================= +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_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 +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +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 */ + 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(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(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupDimensions->hide(); + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId) +{ + 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; + + switch (constructorId) + { + case 0: /* Translate simple */ + { + 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 */ + { + 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; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myConstructorId == 0) { + if(myOkBase && myOkDir1) + myTransformationGUI->MakeMultiTranslation1DAndDisplay(myGeomShape, myDir1, myStep1, myNbTimes1); + } + 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() +{ + 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; + } + + // nbSel == 1 + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + switch(myConstructorId) + { + case 0 : + { + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myEditCurrentArgument->setText(aString); + myBase = S; + myOkBase = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + BRepAdaptor_Curve curv(TopoDS::Edge(S)); + myDir1 = curv.Line().Direction(); + myEditCurrentArgument->setText(aString); + myOkDir1 = true; + } + + if(myOkBase && myOkDir1) + this->MakeMultiTranslationSimulationAndDisplay(); + break; + } + case 1 : + { + if(myEditCurrentArgument == GroupDimensions->LineEdit1) { + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myEditCurrentArgument->setText(aString); + myBase = S; + myOkBase = true; + } + else if(myEditCurrentArgument == GroupDimensions->LineEdit2) { + BRepAdaptor_Curve curv(TopoDS::Edge(S)); + myDir1 = curv.Line().Direction(); + myEditCurrentArgument->setText(aString); + myOkDir1 = true; + } + else if(myEditCurrentArgument == GroupDimensions->LineEdit3) { + BRepAdaptor_Curve curv(TopoDS::Edge(S)); + myDir2 = curv.Line().Direction(); + myEditCurrentArgument->setText(aString); + myOkDir2 = true; + } + + if(myOkBase && myOkDir1 && myOkDir2) + this->MakeMultiTranslationSimulationAndDisplay(); + break; + } + } + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + 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 : LineEditReturnPressed() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::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 if (send == GroupDimensions->LineEdit3) + myEditCurrentArgument = GroupDimensions->LineEdit3; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ActivateThisDialog() +{ + 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; + } + + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox(double newValue) +{ + 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 : ReverseAngle1() +// purpose : 'state' not used here +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ReverseAngle1(int state) +{ + 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 : ReverseAngle2() +// purpose : 'state' not used here +//================================================================================= +void TransformationGUI_MultiTranslationDlg::ReverseAngle2(int state) +{ + myStep2 = -myStep2; + GroupDimensions->SpinBox_DX2->SetValue(myStep2); + if(myOkBase && myOkDir1 && myOkDir2) + MakeMultiTranslationSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : MakeMultiTranslationSimulationAndDisplay() +// purpose : +//================================================================================= +void TransformationGUI_MultiTranslationDlg::MakeMultiTranslationSimulationAndDisplay() +{ + 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); + + try { + BRepGProp::LinearProperties(myBase, System); + gp_Pnt myPoint = System.CentreOfMass(); + TopoDS_Shape S = BRepBuilderAPI_MakeVertex(myPoint).Shape(); + + switch (myConstructorId) + { + case 0 : + { + 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); + + theTransformation.SetTranslation(myVec); + BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False); + B.Add(compound, myBRepTransformation.Shape()); + } + mySimulationTopoDs = compound; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + break; + } + case 1 : + { + gp_Vec Vec1(myDir1); + Vec1.Normalize(); + 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); + + theTransformation.SetTranslation(myVec); + BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False); + B.Add(compound, myBRepTransformation.Shape()); + } + } + mySimulationTopoDs = compound; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + break; + } + } + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeMultitranslationSimulationAndDisplay"); + return; + } + return; +} diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h new file mode 100644 index 000000000..26b39d78a --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h @@ -0,0 +1,95 @@ +// 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 : TransformationGUI_MultiTranslationDlg.h +// Author : Damien COQUERET +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_MULTITRANSLATION_H +#define DIALOGBOX_MULTITRANSLATION_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel2Spin1Check.h" +#include "DlgRef_3Sel4Spin2Check.h" + +#include "TransformationGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" +#include +#include + +//================================================================================= +// class : TransformationGUI_MultiTranslationDlg +// purpose : +//================================================================================= +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(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakeMultiTranslationSimulationAndDisplay(); + + TransformationGUI* myTransformationGUI; + + 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 ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ReverseAngle1(int state); + void ReverseAngle2(int state); + void ValueChangedInSpinBox(double newValue); + void ConstructorsClicked(int constructorId); + +}; + +#endif // DIALOGBOX_MULTITRANSLATION_H diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx new file mode 100644 index 000000000..4c410e4c4 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -0,0 +1,327 @@ +// 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 : TransformationGUI_RotationDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "TransformationGUI_RotationDlg.h" + +#include +#include +#include + +//================================================================================= +// class : TransformationGUI_RotationDlg() +// purpose : Constructs a TransformationGUI_RotationDlg 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. +//================================================================================= +TransformationGUI_RotationDlg::TransformationGUI_RotationDlg(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_ROTATION"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_ROTATION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_ROTATION")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel1Spin1Check(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); + GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE")); + GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myTransformationGUI = theTransformationGUI; + Init(); +} + + +//================================================================================= +// function : ~TransformationGUI_RotationDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +TransformationGUI_RotationDlg::~TransformationGUI_RotationDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myAngle = 0.0; + myOkBase = myOkAxis = false; + + myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom); + + double SpecificStep = 5; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, SpecificStep, 3); + GroupPoints->SpinBox_DX->SetValue(myAngle); + + /* signals and slots connections */ + 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + 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(ReverseAngle(int))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkBase && myOkAxis) + myTransformationGUI->MakeRotationAndDisplay(myGeomShape, myLoc, myDir, myAngle*PI180); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void TransformationGUI_RotationDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkBase = false; + else if(myEditCurrentArgument == GroupPoints->LineEdit2) + myOkAxis = false; + return; + } + + // nbSel == 1 + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return; + myEditCurrentArgument->setText(aString); + myOkBase = true; + myBase = S; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2) { + BRepAdaptor_Curve curv(TopoDS::Edge(S)); + myDir = curv.Line().Direction(); + myLoc = curv.Line().Location(); + myEditCurrentArgument->setText(aString); + myOkAxis = true; + } + + if(myOkBase && myOkAxis) + this->MakeRotationSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + 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); + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::ValueChangedInSpinBox(double newValue) +{ + myAngle = newValue; + if(myOkBase && myOkAxis) + MakeRotationSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : MakeRotationSimulationAndDisplay() +// purpose : +//================================================================================= +void TransformationGUI_RotationDlg::MakeRotationSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + gp_Ax1 AX(myLoc, myDir); + gp_Trsf theTransformation; + theTransformation.SetRotation(AX, myAngle*PI180); + BRepBuilderAPI_Transform myBRepTransformation(myBase, theTransformation, Standard_False); + this->mySimulationTopoDs = myBRepTransformation.Shape(); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeRotationSimulationAndDisplay"); + return; + } + return; +} + + +//================================================================================= +// function : ReverseAngle() +// purpose : 'state' not used here +//================================================================================= +void TransformationGUI_RotationDlg::ReverseAngle(int state) +{ + myAngle = -myAngle; + GroupPoints->SpinBox_DX->SetValue(myAngle); + if(myOkBase && myOkAxis) + MakeRotationSimulationAndDisplay(); + return; +} diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.h b/src/TransformationGUI/TransformationGUI_RotationDlg.h new file mode 100644 index 000000000..c0cda42cc --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.h @@ -0,0 +1,83 @@ +// 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 : TransformationGUI_RotationDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_ROTATION_H +#define DIALOGBOX_ROTATION_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel1Spin1Check.h" + +#include "TransformationGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" +#include + +//================================================================================= +// class : TransformationGUI_RotationDlg +// purpose : +//================================================================================= +class TransformationGUI_RotationDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + TransformationGUI_RotationDlg(QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~TransformationGUI_RotationDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakeRotationSimulationAndDisplay(); + + TransformationGUI* myTransformationGUI; + + Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */ + + TopoDS_Shape myBase; + GEOM::GEOM_Shape_var myGeomShape; /* is myBase */ + gp_Pnt myLoc; + gp_Dir myDir; + Standard_Real myAngle; + bool myOkBase; + bool myOkAxis; + + DlgRef_2Sel1Spin1Check* GroupPoints; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ReverseAngle(int state); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_ROTATION_H diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx new file mode 100644 index 000000000..6f408cff1 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -0,0 +1,311 @@ +// 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 : TransformationGUI_ScaleDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "TransformationGUI_ScaleDlg.h" + +#include + +//================================================================================= +// class : TransformationGUI_ScaleDlg() +// purpose : Constructs a TransformationGUI_ScaleDlg 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. +//================================================================================= +TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(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_SCALE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SCALE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SCALE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_2Sel1Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_CENTRAL_POINT")); + GroupPoints->TextLabel3->setText(tr("GEOM_SCALE_FACTOR")); + GroupPoints->PushButton1->setPixmap(image1); + GroupPoints->PushButton2->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myTransformationGUI = theTransformationGUI; + Init(); +} + + +//================================================================================= +// function : ~TransformationGUI_ScaleDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +TransformationGUI_ScaleDlg::~TransformationGUI_ScaleDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myPoint1.SetCoord(0.0, 0.0, 0.0); + myOkPoint1 = myOkBaseTopo = false; + myFactor = 2.0; + + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + + double SpecificStep = 0.5; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, SpecificStep, 3); + GroupPoints->SpinBox_DX->SetValue(myFactor); + + /* signals and slots connections */ + 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->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkBaseTopo && myOkPoint1) + myTransformationGUI->MakeScaleAndDisplay(myGeomShape, myPoint1, myFactor); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void TransformationGUI_ScaleDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkBaseTopo = false; + else if (myEditCurrentArgument == GroupPoints->LineEdit2) + myOkPoint1 = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + /* gp_Pnt : not used */ + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return ; + GroupPoints->LineEdit1->setText(aString); + myBaseTopo = S; + myOkBaseTopo = true; + } + else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint1)) { + GroupPoints->LineEdit2->setText(aString); + myOkPoint1 = true; + } + + if(myOkPoint1 && myOkBaseTopo) + this->MakeScaleSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else if (send == GroupPoints->LineEdit2) + myEditCurrentArgument = GroupPoints->LineEdit2; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + 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(myVertexFilter); + } + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +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; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::ValueChangedInSpinBox(double newValue) +{ + myFactor = newValue; + if(fabs(myFactor) > 0.00001 && myOkPoint1 && myOkBaseTopo) + MakeScaleSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : MakeScaleSimulationAndDisplay() +// purpose : +//================================================================================= +void TransformationGUI_ScaleDlg::MakeScaleSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + gp_Trsf theTransformation; + theTransformation.SetScale(myPoint1, myFactor); + BRepBuilderAPI_Transform myBRepTransformation(myBaseTopo, theTransformation, Standard_False); + mySimulationTopoDs = myBRepTransformation.Shape(); + if(mySimulationTopoDs.IsNull()) + return; + else + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeScaleSimulationAndDisplay"); + return; + } + return; +} diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.h b/src/TransformationGUI/TransformationGUI_ScaleDlg.h new file mode 100644 index 000000000..bb7c59c51 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.h @@ -0,0 +1,80 @@ +// 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 : TransformationGUI_ScaleDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_SCALE_H +#define DIALOGBOX_SCALE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_2Sel1Spin.h" + +#include "TransformationGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" + +//================================================================================= +// class : TransformationGUI_ScaleDlg +// purpose : +//================================================================================= +class TransformationGUI_ScaleDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + TransformationGUI_ScaleDlg(QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~TransformationGUI_ScaleDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakeScaleSimulationAndDisplay(); + + TransformationGUI* myTransformationGUI; + + Handle(GEOM_ShapeTypeFilter) myVertexFilter; + + gp_Pnt myPoint1; /* Points containing the vector */ + bool myOkPoint1; /* true when myPoint1 is defined */ + TopoDS_Shape myBaseTopo; + bool myOkBaseTopo; /* true when myBaseTopo is defined */ + GEOM::GEOM_Shape_var myGeomShape; /* is myBaseTopo */ + Standard_Real myFactor; + + DlgRef_2Sel1Spin* GroupPoints; + +private slots : + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_SCALE_H diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx new file mode 100644 index 000000000..46778b0c7 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -0,0 +1,322 @@ +// 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 : TransformationGUI_TranslationDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "TransformationGUI_TranslationDlg.h" + +#include +#include "QAD_Config.h" + +//================================================================================= +// class : TransformationGUI_TranslationDlg() +// purpose : Constructs a TransformationGUI_TranslationDlg 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. +//================================================================================= +TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg(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_TRANSLATION"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_TRANSLATION_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_TRANSLATION")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel3Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupPoints->TextLabel2->setText(tr("GEOM_DX")); + GroupPoints->TextLabel3->setText(tr("GEOM_DY")); + GroupPoints->TextLabel4->setText(tr("GEOM_DZ")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myTransformationGUI = theTransformationGUI; + Init(); +} + + +//================================================================================= +// function : ~TransformationGUI_TranslationDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +TransformationGUI_TranslationDlg::~TransformationGUI_TranslationDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myVec.SetCoord(0.0, 0.0, 0.0); + myOkBase = false; + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + /* min, max, step and decimals for spin boxes & initial values */ + 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); + + 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())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, 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(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)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(myOkBase) + myTransformationGUI->MakeTranslationAndDisplay(myGeomShape, myVec); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void TransformationGUI_TranslationDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel != 1) { + if(myEditCurrentArgument == GroupPoints->LineEdit1) + myOkBase = false; + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + /* gp_Pnt : not used */ + if(myEditCurrentArgument == GroupPoints->LineEdit1) { + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); + if(!testResult) + return ; + GroupPoints->LineEdit1->setText(aString); + myBase = S; + myOkBase = true; + } + + if(myOkBase) + this->MakeTranslationSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::LineEditReturnPressed() +{ + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + this->SelectionIntoArgument(); + } + + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::ValueChangedInSpinBox(double newValue) +{ + QObject* send = (QObject*)sender(); + Standard_Real Dx, Dy, Dz; + + if(send == GroupPoints->SpinBox_DX) { + Dx = newValue; + Dy = GroupPoints->SpinBox_DY->GetValue(); + Dz = GroupPoints->SpinBox_DZ->GetValue(); + } + else if(send == GroupPoints->SpinBox_DY) { + Dx = GroupPoints->SpinBox_DX->GetValue(); + Dy = newValue; + Dz = GroupPoints->SpinBox_DZ->GetValue(); + } + else if(send == GroupPoints->SpinBox_DZ) { + Dx = GroupPoints->SpinBox_DX->GetValue(); + Dy = GroupPoints->SpinBox_DY->GetValue(); + Dz = newValue; + } + + myVec.SetCoord(Dx, Dy, Dz); + if(myOkBase) + MakeTranslationSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : MakeTranslationSimulationAndDisplay() +// purpose : +//================================================================================= +void TransformationGUI_TranslationDlg::MakeTranslationSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + try { + gp_Trsf theTransformation; + theTransformation.SetTranslation(myVec); + BRepBuilderAPI_Transform myBRepTransformation(myBase, theTransformation, Standard_False); + mySimulationTopoDs = myBRepTransformation.Shape(); + if(mySimulationTopoDs.IsNull()) + return; + else + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeTranslationSimulationAndDisplay"); + return; + } + return; +} diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.h b/src/TransformationGUI/TransformationGUI_TranslationDlg.h new file mode 100644 index 000000000..52334bc22 --- /dev/null +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.h @@ -0,0 +1,77 @@ +// 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 : TransformationGUI_TranslationDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_TRANSLATION_H +#define DIALOGBOX_TRANSLATION_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel3Spin.h" + +#include "TransformationGUI.h" + +#include + +//================================================================================= +// class : TransformationGUI_TranslationDlg +// purpose : +//================================================================================= +class TransformationGUI_TranslationDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + TransformationGUI_TranslationDlg(QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~TransformationGUI_TranslationDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void MakeTranslationSimulationAndDisplay(); + + TransformationGUI* myTransformationGUI; + double step; + + TopoDS_Shape myBase; /* is myBase */ + GEOM::GEOM_Shape_var myGeomShape; + bool myOkBase; + gp_Vec myVec; + + DlgRef_1Sel3Spin* GroupPoints; + +private slots : + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // DIALOGBOX_TRANSLATION_H