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