]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_View_i.hh
Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/visu.git] / src / VISU_I / VISU_View_i.hh
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  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 //
23 //  File   : VISU_View_i.hh
24 //  Author : Alexey PETROV
25 //  Module : VISU
26
27 #ifndef VISU_View_i_HeaderFile
28 #define VISU_View_i_HeaderFile
29
30 #include "VISUConfig.hh"
31
32 class QWidget;
33
34 class VisuGUI_TableDlg;
35
36 class SalomeApp_Application;
37
38 class SUIT_ViewManager;
39 class SUIT_ViewWindow;
40
41 class Plot2d_ViewFrame;
42
43 namespace VISU
44 {
45   class Prs3d_i;
46   class Curve_i;
47
48   class VISU_I_EXPORT View_i : public virtual POA_VISU::View,
49                  public virtual Storable
50   {
51   public:
52     View_i (SalomeApp_Application *theApplication,
53             SUIT_ViewManager* theViewManager);
54     virtual ~View_i();
55
56   public:
57     virtual void ShowPart( VISU::View::ViewRepresentation ViewRepr, CORBA::Boolean state );
58     virtual CORBA::Boolean IsPartShown( VISU::View::ViewRepresentation ViewRepr );
59
60     // Begin: New methods for view parameters management
61     virtual void SplitRight();
62     virtual void SplitLeft();
63     virtual void SplitBottom();
64     virtual void SplitTop();
65
66     virtual void OnTop();
67
68     virtual void Attract   (VISU::View_ptr theView);
69     virtual void AttractAll(VISU::View_ptr theView);
70
71     virtual void SetRelativePositionInSplitter(CORBA::Double thePosition);
72     virtual void SetRelativeSizeInSplitter(CORBA::Double theSize);
73
74     virtual void SetRelativePositionX(CORBA::Double thePosition);
75     virtual void SetRelativePositionY(CORBA::Double thePosition);
76
77     virtual void SetRelativeSizeX(CORBA::Double theSize);
78     virtual void SetRelativeSizeY(CORBA::Double theSize);
79     // End: New methods for view parameters management
80
81     // Begin: Old methods for view parameters management, they don't work now
82     virtual void SetViewWidth(CORBA::Long Width);
83     virtual void SetViewHeight(CORBA::Long Height);
84     virtual CORBA::Long GetViewWidth();
85     virtual CORBA::Long GetViewHeight();
86     virtual void SetViewPositionHorizontal(VISU::View::ViewPosition ViewPosHor);
87     virtual void SetViewPositionVertical(VISU::View::ViewPosition ViewPosVer);
88     virtual void SetRelativePosition( CORBA::Double x, CORBA::Double y );
89     virtual void SetRelativeSize( CORBA::Double x, CORBA::Double y );
90     virtual void Minimize();
91     virtual void Restore();
92     virtual void Maximize();
93     // End: Old methods for view parameters management, they don't work now
94
95     virtual void SetBackground(const SALOMEDS::Color& theColor);
96     virtual SALOMEDS::Color GetBackground();
97
98     virtual void EraseAll();
99     virtual void DisplayAll();
100     virtual void Erase(PrsObject_ptr thePrsObj);
101     virtual void Display(PrsObject_ptr thePrsObj);
102     virtual void DisplayOnly(PrsObject_ptr thePrsObj);
103
104     virtual void Update();
105
106     virtual CORBA::Boolean SavePicture(const char* theFileName);
107
108     virtual void Close() = 0;
109     virtual void ToStream(std::ostringstream& theStr);
110     virtual const char* GetComment() const;
111
112     SUIT_ViewWindow* GetViewWindow();
113     void             SetViewWindow(SUIT_ViewWindow* theViewWindow);
114
115   public:
116     QWidget *myWorkspace;
117
118     SalomeApp_Application *myApplication;
119     SUIT_ViewManager      *myViewManager;
120
121   private:
122     SUIT_ViewWindow *myViewWindow;
123   };
124
125
126   //===========================================================================
127   class VISU_I_EXPORT XYPlot_i : public virtual POA_VISU::XYPlot,
128                    public virtual View_i
129   {
130   public:
131     typedef VISU::XYPlot TInterface;
132
133     XYPlot_i (SalomeApp_Application *theApplication);
134     virtual ~XYPlot_i();
135
136     virtual VISU::VISUType GetType() { return VISU::TXYPLOT; };
137
138     virtual void SetTitle (const char* theTitle);
139     virtual char* GetTitle();
140
141     virtual void SetSubTitle (const char* theTitle);
142     virtual char* GetSubTitle();
143
144     virtual void SetCurveType (VISU::XYPlot::CurveType theType);
145     virtual VISU::XYPlot::CurveType GetCurveType();
146
147     virtual void SetMarkerSize (CORBA::Long theSize);
148     virtual CORBA::Long GetMarkerSize();
149
150     virtual void EnableXGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
151                               CORBA::Boolean theMinor, CORBA::Long theNumMinor);
152     virtual void EnableYGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
153                               CORBA::Boolean theMinor, CORBA::Long theNumMinor);
154
155     virtual void EnableYGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
156                               CORBA::Boolean theMinor, CORBA::Long theNumMinor,
157                               CORBA::Boolean the2Major, CORBA::Long the2NumMajor,
158                               CORBA::Boolean the2Minor, CORBA::Long the2NumMinor);
159                               
160     virtual void SetHorScaling (VISU::Scaling theScaling);
161     virtual VISU::Scaling GetHorScaling();
162     virtual void SetVerScaling (VISU::Scaling theScaling);
163     virtual VISU::Scaling GetVerScaling();
164
165     virtual void SetXTitle (const char* theTitle);
166     virtual char* GetXTitle();
167
168     virtual void SetYTitle (const char* theTitle);
169     virtual char* GetYTitle();
170
171     virtual void ShowLegend (CORBA::Boolean theShowing);
172
173     virtual void EraseAll();
174     virtual void Erase (PrsObject_ptr thePrsObj);
175     virtual void Display (PrsObject_ptr thePrsObj);
176     virtual void DisplayOnly (PrsObject_ptr thePrsObj);
177     virtual void Update();
178
179     virtual void FitAll();
180     virtual void FitXRange(CORBA::Double xMin, CORBA::Double xMax);
181     virtual void FitYRange(CORBA::Double yMin, CORBA::Double yMax);
182     virtual void FitRange(CORBA::Double xMin, CORBA::Double xMax,
183                                       CORBA::Double yMin, CORBA::Double yMax);
184     virtual void GetFitRanges(double& xMin, double& xMax, double& yMin, double& yMax);
185
186     virtual void Close();
187   protected:
188     Plot2d_ViewFrame* myView;
189   public:
190     virtual Storable* Create (int theNew);
191   };
192
193
194   //===========================================================================
195   class VISU_I_EXPORT TableView_i : public virtual POA_VISU::TableView,
196                       public virtual View_i
197   {
198   public:
199     typedef VISU::TableView TInterface;
200
201     TableView_i (SalomeApp_Application *theApplication);
202     virtual ~TableView_i();
203
204     virtual VISU::VISUType GetType() { return VISU::TTABLEVIEW; };
205
206     virtual void SetTitle (const char* theTitle);
207     virtual char* GetTitle();
208
209     virtual void Close();
210   protected:
211     VisuGUI_TableDlg* myView;
212   public:
213     virtual Storable* Create (VISU::Table_ptr theTable);
214   };
215
216
217   //===========================================================================
218   class VISU_I_EXPORT View3D_i : public virtual POA_VISU::View3D,
219                    public virtual View_i
220   {
221   public:
222     typedef VISU::View3D TInterface;
223
224     View3D_i (SalomeApp_Application *theApplication);
225     virtual ~View3D_i();
226
227     virtual VISU::VISUType GetType() { return VISU::TVIEW3D; };
228
229     //View interface
230     virtual void SetTitle (const char* theTitle);
231     virtual char* GetTitle();
232
233     static  void SetBackground (SUIT_ViewWindow* theViewWindow,
234                                 const SALOMEDS::Color& theColor);
235
236     static  SALOMEDS::Color GetBackground (SUIT_ViewWindow* theViewWindow);
237
238     virtual void EraseAll();
239     virtual void DisplayAll();
240     virtual void Erase (PrsObject_ptr thePrsObj);
241     virtual void Display (PrsObject_ptr thePrsObj);
242     virtual void DisplayOnly (PrsObject_ptr thePrsObj);
243     virtual void Update();
244
245     //View3D interface
246     virtual void FitAll();
247     virtual void SetView (VISU::View3D::ViewType theType);
248
249     static  void SetPointOfView (SUIT_ViewWindow* theViewWindow,
250                                  const CORBA::Double thePosition[3]);
251     virtual void SetPointOfView (const VISU::View3D::XYZ theCoord);
252
253     static  void GetPointOfView (SUIT_ViewWindow* theViewWindow,
254                                  CORBA::Double thePosition[3]);
255     virtual VISU::View3D::XYZ_slice* GetPointOfView();
256
257     static  void SetViewUp (SUIT_ViewWindow* theViewWindow,
258                             const CORBA::Double theViewUp[3]);
259     virtual void SetViewUp (const VISU::View3D::XYZ theDir);
260
261     static  void GetViewUp (SUIT_ViewWindow* theViewWindow, CORBA::Double theViewUp[3]);
262     virtual VISU::View3D::XYZ_slice* GetViewUp();
263
264     static  void SetFocalPoint (SUIT_ViewWindow* theViewWindow, const CORBA::Double theFocalPnt[3]);
265     virtual void SetFocalPoint (const VISU::View3D::XYZ theCoord);
266
267     static  void GetFocalPoint (SUIT_ViewWindow* theViewWindow, CORBA::Double theFocalPnt[3]);
268     virtual VISU::View3D::XYZ_slice* GetFocalPoint();
269
270     static  void SetParallelScale (SUIT_ViewWindow* theViewWindow, CORBA::Double theScale);
271     virtual void SetParallelScale (CORBA::Double theScale);
272
273     static  CORBA::Double GetParallelScale (SUIT_ViewWindow* theViewWindow);
274     virtual CORBA::Double GetParallelScale ();
275
276     static  void ScaleView (SUIT_ViewWindow* theViewWindow,
277                             VISU::View3D::Axis theAxis, CORBA::Double theParam);
278     virtual void ScaleView (VISU::View3D::Axis theAxis, CORBA::Double theParam);
279     virtual void RemoveScale();
280
281     static std::string ToString (SUIT_ViewWindow* theViewWindow);
282
283     static void ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr);
284
285     static  bool           SaveViewParams (SUIT_ViewManager* theViewManager,
286                                            const std::string& theName);
287     virtual CORBA::Boolean SaveViewParams (const char* theViewParamsName);
288
289     static  bool           RestoreViewParams (SUIT_ViewManager* theViewManager,
290                                               const std::string& theName);
291     virtual CORBA::Boolean RestoreViewParams (const char* theViewParamsName);
292
293     static QString GenerateViewParamsName();
294
295     static  void Restore (SUIT_ViewWindow* theViewWindow,
296                           const Storable::TRestoringMap& theMap);
297
298     virtual void Close();
299
300     // Certain presentation view parameters management
301     virtual PresentationType GetPresentationType(ScalarMap_ptr thePrs);
302     virtual CORBA::Boolean   IsShrinked         (ScalarMap_ptr thePrs);
303     virtual CORBA::Boolean   IsShaded           (ScalarMap_ptr thePrs);
304     virtual CORBA::Double    GetOpacity         (ScalarMap_ptr thePrs);
305     virtual CORBA::Double    GetLineWidth       (ScalarMap_ptr thePrs);
306
307     virtual char* SetPresentationType(ScalarMap_ptr thePrs, PresentationType thePrsType);
308     virtual char* SetShrinked        (ScalarMap_ptr thePrs, CORBA::Boolean   isShrinked);
309     virtual char* SetShaded          (ScalarMap_ptr thePrs, CORBA::Boolean   isShaded);
310     virtual char* SetOpacity         (ScalarMap_ptr thePrs, CORBA::Double    theOpacity);
311     virtual char* SetLineWidth       (ScalarMap_ptr thePrs, CORBA::Double    theLineWidth);
312
313   protected:
314     static int myNbViewParams;
315
316   public:
317     virtual Storable* Create (int theNew);
318     virtual void ToStream (std::ostringstream& theStr);
319     virtual const char* GetComment() const;
320     static const std::string myComment;
321   };
322 }
323
324 #endif