Salome HOME
Livraison C-S du 28/11/2013
[modules/hexablock.git] / src / HEXABLOCKGUI / MyBasicGUI_PointDlg.hxx
1 // Copyright (C) 2009-2013  CEA/DEN, EDF R&D
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
20
21 #ifndef MYBASICGUI_POINTDLG_H
22 #define MYBASICGUI_POINTDLG_H
23
24
25
26
27 #include "MyGEOMBase_Skeleton.hxx"
28 #include <QMap>
29
30 class DlgRef_2Sel1Spin;
31 class DlgRef_3Spin;
32 class DlgRef_2Sel;
33 class DlgRef_1Sel3Spin;
34 class DlgRef_1Sel2Spin;
35
36 class QLineEdit;
37 class QGroupBox;
38 class QButtonGroup;
39 class QMenu;
40 class QAction;
41
42 class gp_Pnt;
43
44 #include <QItemSelection>
45 #include <SUIT_ViewManager.h>
46 #include <SUIT_Session.h>
47 #include <OCCViewer_ViewWindow.h>
48 #include <OCCViewer_ViewManager.h>
49
50 #include "SVTK_Selection.h"
51 #include <SVTK_ViewModel.h>
52 namespace HEXABLOCK
53 {
54   namespace GUI
55   {
56     class DocumentModel;
57     class PatternDataSelectionModel;
58 //   }
59 // }
60
61
62 //=================================================================================
63 // class    : MyBasicGUI_PointDlg
64 // purpose  :
65 //=================================================================================
66 #include "hexa_base.hxx"
67 typedef class HexaExport MyBasicGUI_PointDlg : public MyGEOMBase_Skeleton
68 {
69   Q_OBJECT
70
71 public:
72   MyBasicGUI_PointDlg( QWidget* = 0, Qt::WindowFlags = 0 );
73   ~MyBasicGUI_PointDlg();
74
75   bool                               acceptMouseEvent() const { return ( getConstructorId() == 0 );  }
76   void                               OnPointSelected( const gp_Pnt& );
77
78 private:
79   double                             getParameter() const;
80   double                             getUParameter() const;
81   double                             getVParameter() const;
82   void                               updateParamCoord(bool theIsUpdate);
83
84 private:
85   bool                               myBusy;
86
87   DlgRef_3Spin*                      GroupXYZ;
88   DlgRef_1Sel3Spin*                  GroupRefPoint;
89   DlgRef_2Sel1Spin*                  GroupOnCurve;
90   DlgRef_2Sel*                       GroupLineIntersection;
91   DlgRef_1Sel2Spin*                  GroupOnSurface;
92
93   QGroupBox*                         myCoordGrp;
94   QLineEdit*                         myX;
95   QLineEdit*                         myY;
96   QLineEdit*                         myZ;
97
98
99
100   QGroupBox*                         myParamGroup;
101   QButtonGroup*                      myParamCoord;
102
103   QMenu*                             myBtnPopup;
104   QMenu*                             myBtnPopup2;
105   QAction*                           action_line1_edge;
106   QAction*                           action_line1_wire;
107   QAction*                           action_line2_edge;
108   QAction*                           action_line2_wire;
109
110 private slots:
111   void                               ConstructorsClicked( int );
112   void                               SetDoubleSpinBoxStep( double );
113   void                               ClickParamCoord( int );
114   void                               onBtnPopup( QAction* );
115   void                               updateSize();
116   void                               onRefPointChanged(const QString& pointName);
117   void                               onStartPointSelected(const QString& pointName);
118   void                               onParamValueChanged(double newValue);
119   void                               onXCoordChanged(double newValue);
120   void                               onYCoordChanged(double newValue);
121   void                               onZCoordChanged(double newValue);
122   void                               onUpdateResults(const QString& data);
123
124 // HEXABLOCK
125 public:
126   void clear();
127   TopoDS_Vertex computeGeomVertex(bool preview=false);
128   TopoDS_Vertex computeGeomPointXYZ();
129   TopoDS_Vertex computeGeomPointRef();
130   TopoDS_Vertex computeGeomPointEdge();
131   TopoDS_Vertex computeGeomPointInt();
132   TopoDS_Vertex computeGeomPointSurf();
133
134 protected:
135   virtual void showEvent ( QShowEvent * event );
136
137   virtual bool apply(QModelIndex& result);
138   virtual void _initInputWidget( Mode editmode );
139   void updateInputs(const int constructorId);
140
141   TopoDS_Vertex currentVertex;
142   QMap<int, double> paramInputValue;
143   QMap<int, QVector3D*> coordsInputValue;
144
145 protected slots:
146   void onWindowActivated( SUIT_ViewManager* vm );
147   void updateHelpFileName();
148   virtual void onSelectionChanged(  const QItemSelection& sel, const QItemSelection& unsel );
149
150 } VertexAssocDialog;
151
152   }
153 }
154
155 #endif // MYBASICGUI_POINTDLG_H