Salome HOME
670c2f9d062893f1dd386708fef56574846f325b
[modules/geom.git] / src / AdvancedGUI / AdvancedGUI_PipeTShapeDlg.h
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18
19 #ifndef ADVANCEDGUI_PIPETSHAPEDLG_H
20 #define ADVANCEDGUI_PIPETSHAPEDLG_H
21
22 #include <GEOMBase_Skeleton.h>
23
24 class DlgRef_1Spin;
25 class DlgRef_2Spin;
26 class DlgRef_3Spin;
27 class DlgRef_4Spin;
28 class DlgRef_3Sel;
29 class DlgRef_6Sel;
30 class QCheckBox;
31 class QLineEdit;
32 class QLabel;
33 class QGridLayout;
34 class QGroupBox;
35 class SalomeApp_DoubleSpinBox;
36
37 //=================================================================================
38 // class    : AdvancedGUI_4Spin
39 // purpose  :
40 //=================================================================================
41 class AdvancedGUI_4Spin : public QWidget
42 {
43   Q_OBJECT
44
45  public:
46   AdvancedGUI_4Spin ();
47   ~AdvancedGUI_4Spin();
48
49  public:
50   QGroupBox *GroupBox1;
51   QGridLayout *gridLayout1;
52
53   QLabel *TextLabel1;
54   QLabel *TextLabel2;
55   QLabel *TextLabel3;
56   QLabel *TextLabel4;
57   SalomeApp_DoubleSpinBox *SpinBox1;
58   SalomeApp_DoubleSpinBox *SpinBox2;
59   SalomeApp_DoubleSpinBox *SpinBox3;
60   SalomeApp_DoubleSpinBox *SpinBox4;
61 };
62
63 //=================================================================================
64 // class    : AdvancedGUI_PipeTShapeDlg
65 // purpose  :
66 //=================================================================================
67 class AdvancedGUI_PipeTShapeDlg: public GEOMBase_Skeleton
68 {
69   Q_OBJECT
70
71 public:
72   AdvancedGUI_PipeTShapeDlg (GeometryGUI*, QWidget* = 0);
73   ~AdvancedGUI_PipeTShapeDlg();
74
75 protected:
76   // redefined from GEOMBase_Helper
77   virtual GEOM::GEOM_IOperations_ptr createOperation();
78   virtual bool isValid (QString&);
79   virtual bool execute (ObjectList&);
80   virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
81
82 private:
83   void Init();
84   void enterEvent (QEvent*);
85   void resizeEvent (QResizeEvent *event);
86   void updateLabelImgPipeTShape();
87   bool CheckCompatiblePosition (GEOM::GEOM_Object_var theP1, 
88                                 GEOM::GEOM_Object_var theP2,
89                                 GEOM::GEOM_Object_var theP3, double theTolerance);
90
91 private:
92   QPixmap imagePipeTShape;
93   QPixmap imageReduction;
94   QLabel* LabelImgPipeTShape;
95   QLabel* LabelImgReduction;
96
97   // Main parameters
98   DlgRef_3Spin* MainTubeGroupParams;
99   DlgRef_3Spin* IncidentTubeGroupParams;
100   DlgRef_2Spin* ChamferGroupParams;
101   DlgRef_1Spin* FilletGroupParams;
102   QCheckBox*    HexMeshCheckBox;
103
104   // Thickness reduction parameters
105   AdvancedGUI_4Spin* LReductionGroupParams;
106   AdvancedGUI_4Spin* RReductionGroupParams;
107   AdvancedGUI_4Spin* IReductionGroupParams;
108
109   // Position parameters
110   DlgRef_6Sel* JunctionPointsSel;
111
112   QString CssNormal, CssAcceptable, CssRefused;
113   GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3;
114   bool myOkPoint1, myOkPoint2, myOkPoint3;
115   ObjectList pipeTShapeGroupObjects;
116
117 private slots:
118   void ClickOnOk();
119   bool ClickOnApply();
120   void ActivateThisDialog();
121   void currentChanged (int);
122   void SelectionIntoArgument();
123   void SetEditCurrentArgument();
124   void DisplayPreview (const bool activate = false, const bool update = true,
125                        const bool toRemoveFromEngine = true, const double lineWidth = -1,
126                        const int displayMode = -1, const int color = -1);
127   virtual void processPreview();
128   void SetPosition (bool);
129   void ChamferOrFillet (bool);
130   void SetDoubleSpinBoxStep (double);
131   void ValueChangedInSpinBox (double);
132   void UpdatePicture (QWidget* old, QWidget* now);
133   void ApplyNewDimensions();
134   bool executeNoCheck (ObjectList& objects);
135 };
136
137 #endif // ADVANCEDGUI_PIPETSHAPEDLG_H