Salome HOME
updated copyright message
[modules/gui.git] / src / SVTK / SVTK_ViewParameterDlg.h
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
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 //  SALOME VTKViewer : build VTK viewer into Salome desktop
21 //  File   : 
22 //  Author : 
23
24 #ifndef SVTK_VIEWPARAMETERDLG_H
25 #define SVTK_VIEWPARAMETERDLG_H
26
27 #include "SVTK.h"
28
29 #include <ViewerTools_DialogBase.h>
30
31 #include <vtkSmartPointer.h>
32 #include <vtkTimeStamp.h>
33
34 class SVTK_ViewWindow;
35 class SVTK_RenderWindowInteractor;
36
37 class QtxAction;
38
39 class QLineEdit;
40 class QPushButton;
41 class QFrame;
42 class QCheckBox;
43 class QButtonGroup;
44
45 class vtkCallbackCommand;
46 class vtkObject;
47
48 class SVTK_EXPORT SVTK_ViewParameterDlg : public ViewerTools_DialogBase
49 {
50   Q_OBJECT
51
52 public:
53   SVTK_ViewParameterDlg(QtxAction* theAction,
54                         SVTK_ViewWindow* theParent,
55                         const char* theName);
56
57   ~SVTK_ViewParameterDlg();
58   
59   void addObserver();
60   
61 protected:
62   SVTK_ViewWindow *myMainWindow;
63   SVTK_RenderWindowInteractor* myRWInteractor;
64   bool myIsObserverAdded;
65   bool myBusy;
66   
67   QButtonGroup* myProjectionMode;
68
69   QPushButton*  myToBBCenter;
70   QPushButton*  myToOrigin;
71   QPushButton*  mySelectPoint;
72
73   QFrame*       myFocalCoords;
74   QLineEdit*    myFocalX;
75   QLineEdit*    myFocalY;
76   QLineEdit*    myFocalZ;
77   
78   QButtonGroup* myCameraPositionMode;
79
80   QFrame*       myCameraCoords;
81   QLineEdit*    myCameraX;
82   QLineEdit*    myCameraY;
83   QLineEdit*    myCameraZ;
84
85   QFrame*       myProjDirection;
86   QLineEdit*    myProjDirX;
87   QLineEdit*    myProjDirY;
88   QLineEdit*    myProjDirZ;
89
90   QLineEdit*    myDistance;
91
92   QFrame*       myViewDirection;
93   QLineEdit*    myViewDirX;
94   QLineEdit*    myViewDirY;
95   QLineEdit*    myViewDirZ;
96
97   QFrame*       myScaleBox;
98   QLineEdit*    myScale;
99
100   QFrame*       myViewAngleBox;
101   QLineEdit*    myViewAngle;
102
103   void setEnabled(QFrame* theWidget, const bool theState);
104   bool computePoint(const double start[3], const double dir[3], 
105                     const double dist, double result[3]);
106   void updateProjection();
107   void updateCoordinates();
108
109   void updateData();
110
111   //----------------------------------------------------------------------------
112   // Priority at which events are processed
113   double myPriority;
114
115   // Used to process events
116   vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
117
118   // Used to update camera
119   vtkTimeStamp myCameraMTime;
120
121   // Description:
122   // Main process event method
123   static void ProcessEvents(vtkObject* object, 
124                             unsigned long event,
125                             void* clientdata, 
126                             void* calldata);
127
128 protected slots:
129   void onProjectionModeChanged(int);
130   void onPositionModeChanged(int);
131   
132   void onToBBCenter();
133   void onToOrigin();
134   void onSelectPoint();
135
136   void onFocalCoordChanged();
137   void onCameraCoordChanged();
138   void onDirectionChanged();
139   void onDistanceChanged();
140   void onViewDirectionChanged();
141
142   void onZoomChanged();
143
144   void onClickClose();
145
146 };
147
148 #endif // SVTK_VIEWPARAMETERDLG_H