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