Salome HOME
3a6f3e8b03ff72e4c30fed3b524a2173a53aa88f
[modules/gui.git] / src / SVTK / SVTK_ViewParameterDlg.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  SALOME VTKViewer : build VTK viewer into Salome desktop
23 //  File   : 
24 //  Author : 
25 //  Module : SALOME
26 //  $Header:
27 //
28 #ifndef SVTK_VIEWPARAMETERDLG_H
29 #define SVTK_VIEWPARAMETERDLG_H
30
31 #include "SVTK.h"
32
33 #include "SVTK_DialogBase.h"
34
35 #include <vtkSmartPointer.h>
36 #include <vtkTimeStamp.h>
37
38 class SVTK_ViewWindow;
39 class SVTK_RenderWindowInteractor;
40
41 class QtxAction;
42
43 class QLineEdit;
44 class QPushButton;
45 class QFrame;
46 class QCheckBox;
47 class QButtonGroup;
48
49 class vtkCallbackCommand;
50 class vtkObject;
51
52 class SVTK_EXPORT SVTK_ViewParameterDlg : public SVTK_DialogBase
53 {
54   Q_OBJECT;
55
56 public:
57   SVTK_ViewParameterDlg(QtxAction* theAction,
58                         SVTK_ViewWindow* theParent,
59                         const char* theName);
60
61   ~SVTK_ViewParameterDlg();
62   
63   void addObserver();
64   
65 protected:
66   SVTK_ViewWindow *myMainWindow;
67   SVTK_RenderWindowInteractor* myRWInteractor;
68   bool myIsObserverAdded;
69   bool myBusy;
70   
71   QButtonGroup* myProjectionMode;
72
73   QPushButton*  myToBBCenter;
74   QPushButton*  myToOrigin;
75   QPushButton*  mySelectPoint;
76
77   QFrame*       myFocalCoords;
78   QLineEdit*    myFocalX;
79   QLineEdit*    myFocalY;
80   QLineEdit*    myFocalZ;
81   
82   QButtonGroup* myCameraPositionMode;
83
84   QFrame*       myCameraCoords;
85   QLineEdit*    myCameraX;
86   QLineEdit*    myCameraY;
87   QLineEdit*    myCameraZ;
88
89   QFrame*       myProjDirection;
90   QLineEdit*    myProjDirX;
91   QLineEdit*    myProjDirY;
92   QLineEdit*    myProjDirZ;
93
94   QLineEdit*    myDistance;
95
96   QFrame*       myViewDirection;
97   QLineEdit*    myViewDirX;
98   QLineEdit*    myViewDirY;
99   QLineEdit*    myViewDirZ;
100
101   QFrame*       myScaleBox;
102   QLineEdit*    myScale;
103
104   QFrame*       myViewAngleBox;
105   QLineEdit*    myViewAngle;
106
107   void setEnabled(QFrame* theWidget, const bool theState);
108   bool computePoint(const double start[3], const double dir[3], 
109                     const double dist, double result[3]);
110   void updateProjection();
111   void updateCoordinates();
112
113   void updateData();
114
115   //----------------------------------------------------------------------------
116   // Priority at which events are processed
117   vtkFloatingPointType myPriority;
118
119   // Used to process events
120   vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
121
122   // Used to update camera
123   vtkTimeStamp myCameraMTime;
124
125   // Description:
126   // Main process event method
127   static void ProcessEvents(vtkObject* object, 
128                             unsigned long event,
129                             void* clientdata, 
130                             void* calldata);
131
132 protected slots:
133   void onProjectionModeChanged(int);
134   void onPositionModeChanged(int);
135   
136   void onToBBCenter();
137   void onToOrigin();
138   void onSelectPoint();
139
140   void onFocalCoordChanged();
141   void onCameraCoordChanged();
142   void onDirectionChanged();
143   void onDistanceChanged();
144   void onViewDirectionChanged();
145
146   void onZoomChanged();
147
148   void onClickClose();
149
150 };
151
152 #endif // SVTK_VIEWPARAMETERDLG_H