Salome HOME
Merge from V6_main (04/10/2012)
[modules/hexablock.git] / src / HEXABLOCKGUI / MyBasicGUI_PointDlg.hxx
1 // Copyright (C) 2009-2012  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 "GEOM_GenericObjPtr.h"
29 #include <QMap>
30
31 class DlgRef_2Sel1Spin;
32 class DlgRef_3Spin;
33 class DlgRef_2Sel;
34 class DlgRef_1Sel3Spin;
35 class DlgRef_1Sel2Spin;
36
37 class QLineEdit;
38 class QGroupBox;
39 class QButtonGroup;
40 class QMenu;
41 class QAction;
42
43 class gp_Pnt;
44
45 #include <QItemSelection>
46 #include <SUIT_ViewManager.h>
47 #include <SUIT_Session.h>
48 #include <OCCViewer_ViewWindow.h>
49 #include <OCCViewer_ViewManager.h>
50 // #include <VTKViewer_ViewModel.h>
51
52
53
54 #include "SVTK_Selection.h"
55 #include <SVTK_ViewModel.h>
56 namespace HEXABLOCK
57 {
58   namespace GUI
59   {
60     class DocumentModel;
61     class PatternDataSelectionModel;
62 //   }
63 // }
64
65
66 //=================================================================================
67 // class    : MyBasicGUI_PointDlg
68 // purpose  :
69 //=================================================================================
70 typedef class MyBasicGUI_PointDlg : public MyGEOMBase_Skeleton
71
72   Q_OBJECT
73
74 public:
75   MyBasicGUI_PointDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 );
76   ~MyBasicGUI_PointDlg();
77
78   bool                               acceptMouseEvent() const { return ( getConstructorId() == 0 );  }
79   void                               OnPointSelected( const gp_Pnt& ); // called by BasicGUI::OnMousePress()
80
81 protected:
82   // redefined from GEOMBase_Helper
83
84   virtual GEOM::GEOM_IOperations_ptr createOperation();
85   virtual bool                       isValid( QString& );
86   virtual bool                       execute( ObjectList& );
87   virtual void                       addSubshapesToStudy();
88
89 private:
90   void                               Init();
91   void                               enterEvent( QEvent* );
92   double                             getParameter() const;
93   double                             getUParameter() const;
94   double                             getVParameter() const;
95   void                               updateParamCoord(bool theIsUpdate);
96
97 private:
98   GEOM::GeomObjPtr                   myEdge;
99   GEOM::GeomObjPtr                   myFace;
100   GEOM::GeomObjPtr                   myRefPoint; 
101   GEOM::GeomObjPtr                   myLine1; 
102   GEOM::GeomObjPtr                   myLine2;
103
104   bool                               myBusy;
105
106   DlgRef_3Spin*                      GroupXYZ;
107   DlgRef_1Sel3Spin*                  GroupRefPoint;
108   DlgRef_2Sel1Spin*                  GroupOnCurve;
109   DlgRef_2Sel*                       GroupLineIntersection;
110   DlgRef_1Sel2Spin*                  GroupOnSurface;
111   
112   QGroupBox*                         myCoordGrp;
113   QLineEdit*                         myX;
114   QLineEdit*                         myY;
115   QLineEdit*                         myZ;
116
117   
118
119   QGroupBox*                         myParamGroup;
120   QButtonGroup*                      myParamCoord;
121
122   QMenu*                             myBtnPopup;
123   QMap<QAction*, int>                myActions;
124
125   TopAbs_ShapeEnum                   myNeedType;
126   
127 private slots:
128   void                               ClickOnOk();
129   bool                               ClickOnApply();
130   void                               ActivateThisDialog();
131   void                               DeactivateActiveDialog();
132   void                               SelectionIntoArgument();
133   void                               SetEditCurrentArgument();
134   void                               ConstructorsClicked( int );
135   void                               ValueChangedInSpinBox( double );
136   void                               SetDoubleSpinBoxStep( double );
137   void                               ClickParamCoord( int );
138   void                               CheckBoxClicked( int );
139   void                               onBtnPopup( QAction* );
140   void                               updateSize();
141
142
143 // HEXABLOCK
144 public:
145   void setDocumentModel( HEXABLOCK::GUI::DocumentModel* m );
146   void setPatternDataSelectionModel( HEXABLOCK::GUI::PatternDataSelectionModel* s );
147
148   bool onAccept( const bool publish = true, const bool useTransaction = true );
149
150
151 protected:
152   virtual bool eventFilter( QObject *obj, QEvent *event );
153   virtual void hideEvent ( QHideEvent * event );
154   virtual void showEvent ( QShowEvent * event );
155   void _initInputWidget();
156   void _initViewManager();
157   void _highlightWidget(QObject* obj, Qt::GlobalColor clr);
158   bool _isLineOrListWidget(QObject*);
159
160 protected slots:
161   void onSelectionChanged(  const QItemSelection& sel, const QItemSelection& unsel );
162   void onWindowActivated( SUIT_ViewManager* vm );
163
164
165 private:
166   HEXABLOCK::GUI::DocumentModel*              _documentModel;
167   HEXABLOCK::GUI::PatternDataSelectionModel*  _patternDataSelectionModel;
168   LightApp_SelectionMgr*                      _mgr;
169   SUIT_ViewManager*                           _vtkVm;
170   SUIT_ViewManager*                           _occVm;
171 //   QLineEdit*                                  _vertex_le;
172
173   QObject*                                    _currentObj;
174   bool                                        _selectionMutex;
175
176
177 } VertexAssocDialog;
178
179   }
180 }
181
182 #endif // MYBASICGUI_POINTDLG_H