Salome HOME
Porting HEXABLOCK to the CMake build system: initial version.
[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 typedef class MyBasicGUI_PointDlg : public MyGEOMBase_Skeleton
67 {
68   Q_OBJECT
69
70 public:
71   MyBasicGUI_PointDlg( QWidget* = 0, Qt::WindowFlags = 0 );
72   ~MyBasicGUI_PointDlg();
73
74   bool                               acceptMouseEvent() const { return ( getConstructorId() == 0 );  }
75   void                               OnPointSelected( const gp_Pnt& );
76
77 private:
78   double                             getParameter() const;
79   double                             getUParameter() const;
80   double                             getVParameter() const;
81   void                               updateParamCoord(bool theIsUpdate);
82
83 private:
84   bool                               myBusy;
85
86   DlgRef_3Spin*                      GroupXYZ;
87   DlgRef_1Sel3Spin*                  GroupRefPoint;
88   DlgRef_2Sel1Spin*                  GroupOnCurve;
89   DlgRef_2Sel*                       GroupLineIntersection;
90   DlgRef_1Sel2Spin*                  GroupOnSurface;
91
92   QGroupBox*                         myCoordGrp;
93   QLineEdit*                         myX;
94   QLineEdit*                         myY;
95   QLineEdit*                         myZ;
96
97
98
99   QGroupBox*                         myParamGroup;
100   QButtonGroup*                      myParamCoord;
101
102   QMenu*                             myBtnPopup;
103   QMenu*                             myBtnPopup2;
104   QAction*                           action_line1_edge;
105   QAction*                           action_line1_wire;
106   QAction*                           action_line2_edge;
107   QAction*                           action_line2_wire;
108
109 private slots:
110   void                               ConstructorsClicked( int );
111   void                               SetDoubleSpinBoxStep( double );
112   void                               ClickParamCoord( int );
113   void                               onBtnPopup( QAction* );
114   void                               updateSize();
115 //void                               onRefPointChanged(const QString& pointName);
116 //void                               onStartPointSelected(const QString& pointName);
117   void                               onParamValueChanged(double newValue);
118   void                               onXCoordChanged(double newValue);
119   void                               onYCoordChanged(double newValue);
120   void                               onZCoordChanged(double newValue);
121   void                               onUpdateResults(const QString& data);
122
123 // HEXABLOCK
124 public:
125   void clear();
126   TopoDS_Vertex computeGeomVertex(bool preview=false);
127   TopoDS_Vertex computeGeomPointXYZ();
128   TopoDS_Vertex computeGeomPointRef();
129   TopoDS_Vertex computeGeomPointEdge();
130   TopoDS_Vertex computeGeomPointInt();
131   TopoDS_Vertex computeGeomPointSurf();
132
133 protected:
134   virtual void showEvent ( QShowEvent * event );
135
136   virtual bool apply(QModelIndex& result);
137   virtual void _initInputWidget( Mode editmode );
138   void updateInputs(const int constructorId);
139
140   TopoDS_Vertex currentVertex;
141   QMap<int, double> paramInputValue;
142   QMap<int, QVector3D*> coordsInputValue;
143
144 protected slots:
145   void onWindowActivated( SUIT_ViewManager* vm );
146   void updateHelpFileName();
147   virtual void onSelectionChanged(  const QItemSelection& sel, const QItemSelection& unsel );
148
149 } VertexAssocDialog;
150
151   }
152 }
153
154 #endif // MYBASICGUI_POINTDLG_H