Salome HOME
b61f74fc6055a89cbd03994e76f40347c214f153
[modules/hexablock.git] / src / HEXABLOCKGUI / MyBasicGUI_PointDlg.hxx
1 // Copyright (C) 2009-2023  CEA, EDF
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, or (at your option) any later version.
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   bool                               myBusy;
82
83   MyDlgRef_3Spin*                      GroupXYZ;
84   MyDlgRef_1Sel3Spin*                  GroupRefPoint;
85   MyDlgRef_2Sel1Spin*                  GroupOnCurve;
86   MyDlgRef_2Sel*                       GroupLineIntersection;
87   MyDlgRef_1Sel2Spin*                  GroupOnSurface;
88
89   QGroupBox*                         myCoordGrp;
90   QLineEdit*                         myX;
91   QLineEdit*                         myY;
92   QLineEdit*                         myZ;
93
94
95
96   QGroupBox*                         myParamGroup;
97   QButtonGroup*                      myParamCoord;
98
99   QMenu*                             myBtnPopup;
100   QMenu*                             myBtnPopup2;
101   QAction*                           action_line1_edge;
102   QAction*                           action_line1_wire;
103   QAction*                           action_line2_edge;
104   QAction*                           action_line2_wire;
105
106 private slots:
107   void                               ConstructorsClicked( int );
108   void                               SetDoubleSpinBoxStep( double );
109   void                               ClickParamCoord( int );
110   void                               onBtnPopup( QAction* );
111   void                               updateSize();
112  // void                               onRefPointChanged(const QString& pointName);
113  // void                               onStartPointSelected(const QString& pointName);
114   void                               onParamValueChanged(double newValue);
115   void                               onXCoordChanged(double newValue);
116   void                               onYCoordChanged(double newValue);
117   void                               onZCoordChanged(double newValue);
118   void                               onUpdateResults(const QString& data);
119
120 // HEXABLOCK
121 public:
122   void clear();
123   TopoDS_Vertex computeGeomVertex(bool preview=false);
124   TopoDS_Vertex computeGeomPointXYZ();
125   TopoDS_Vertex computeGeomPointRef();
126   TopoDS_Vertex computeGeomPointEdge();
127   TopoDS_Vertex computeGeomPointInt();
128   TopoDS_Vertex computeGeomPointSurf();
129
130 protected:
131   virtual void showEvent ( QShowEvent * event );
132
133   virtual bool apply(QModelIndex& result);
134   virtual void _initInputWidget( Mode editmode );
135   void updateInputs(const int constructorId);
136
137   TopoDS_Vertex currentVertex;
138   QMap<int, double> paramInputValue;
139   QMap<int, QVector3D*> coordsInputValue;
140
141 protected slots:
142   void onWindowActivated( SUIT_ViewManager* vm );
143   void updateHelpFileName();
144   virtual void onSelectionChanged(  const QItemSelection& sel, const QItemSelection& unsel );
145
146 } VertexAssocDialog;
147
148   }
149 }
150
151 #endif // MYBASICGUI_POINTDLG_H