1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // VISU OBJECT : interactive object for VISU entities implementation
24 // File : VISU_View_i.hh
25 // Author : Alexey PETROV
28 #ifndef VISU_View_i_HeaderFile
29 #define VISU_View_i_HeaderFile
31 #include "VISUConfig.hh"
32 #include "SALOME_GenericObj_i.hh"
38 class SalomeApp_Application;
40 class SUIT_ViewManager;
41 class SUIT_ViewWindow;
43 class Plot2d_ViewFrame;
50 class VISU_I_EXPORT View_i : public virtual POA_VISU::View,
51 public virtual SALOME::GenericObj_i,
52 public virtual Storable
55 View_i (SalomeApp_Application *theApplication,
56 SUIT_ViewManager* theViewManager);
60 virtual void ShowPart( VISU::View::ViewRepresentation ViewRepr, CORBA::Boolean state );
61 virtual CORBA::Boolean IsPartShown( VISU::View::ViewRepresentation ViewRepr );
63 // Begin: New methods for view parameters management
64 virtual void SplitRight();
65 virtual void SplitLeft();
66 virtual void SplitBottom();
67 virtual void SplitTop();
71 virtual void Attract (VISU::View_ptr theView);
72 virtual void AttractAll(VISU::View_ptr theView);
74 virtual void SetRelativePositionInSplitter(CORBA::Double thePosition);
75 virtual void SetRelativeSizeInSplitter(CORBA::Double theSize);
77 virtual void SetRelativePositionX(CORBA::Double thePosition);
78 virtual void SetRelativePositionY(CORBA::Double thePosition);
80 virtual void SetRelativeSizeX(CORBA::Double theSize);
81 virtual void SetRelativeSizeY(CORBA::Double theSize);
82 // End: New methods for view parameters management
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
98 virtual void SetBackground(const SALOMEDS::Color& theColor);
99 virtual SALOMEDS::Color GetBackground();
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);
107 virtual void Update();
109 virtual CORBA::Boolean SavePicture(const char* theFileName);
111 virtual void Close() = 0;
112 virtual void ToStream(std::ostringstream& theStr);
113 virtual const char* GetComment() const;
115 SUIT_ViewWindow* GetViewWindow();
116 void SetViewWindow(SUIT_ViewWindow* theViewWindow);
119 QWidget *myWorkspace;
121 SalomeApp_Application *myApplication;
122 SUIT_ViewManager *myViewManager;
125 SUIT_ViewWindow *myViewWindow;
129 //===========================================================================
130 class VISU_I_EXPORT XYPlot_i : public virtual POA_VISU::XYPlot,
131 public virtual View_i
134 typedef VISU::XYPlot TInterface;
136 XYPlot_i (SalomeApp_Application *theApplication);
139 virtual VISU::VISUType GetType() { return VISU::TXYPLOT; };
141 virtual void SetTitle (const char* theTitle);
142 virtual char* GetTitle();
144 virtual void SetSubTitle (const char* theTitle);
145 virtual char* GetSubTitle();
147 virtual void SetCurveType (VISU::XYPlot::CurveType theType);
148 virtual VISU::XYPlot::CurveType GetCurveType();
150 virtual void SetMarkerSize (CORBA::Long theSize);
151 virtual CORBA::Long GetMarkerSize();
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);
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);
163 virtual void SetHorScaling (VISU::Scaling theScaling);
164 virtual VISU::Scaling GetHorScaling();
165 virtual void SetVerScaling (VISU::Scaling theScaling);
166 virtual VISU::Scaling GetVerScaling();
168 virtual void SetXTitle (const char* theTitle);
169 virtual char* GetXTitle();
171 virtual void SetYTitle (const char* theTitle);
172 virtual char* GetYTitle();
174 virtual void ShowLegend (CORBA::Boolean theShowing);
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();
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);
189 virtual void Close();
191 Plot2d_ViewFrame* GetView() { return myView; }
193 Plot2d_ViewFrame* myView;
195 virtual Storable* Create (int theNew);
199 //===========================================================================
200 class VISU_I_EXPORT TableView_i : public virtual POA_VISU::TableView,
201 public virtual View_i
204 typedef VISU::TableView TInterface;
206 TableView_i (SalomeApp_Application *theApplication);
207 virtual ~TableView_i();
209 virtual VISU::VISUType GetType() { return VISU::TTABLEVIEW; };
211 virtual void SetTitle (const char* theTitle);
212 virtual char* GetTitle();
214 virtual void Close();
216 VISU_TableDlg* myView;
218 virtual Storable* Create (VISU::Table_ptr theTable);
222 //===========================================================================
223 class VISU_I_EXPORT View3D_i : public virtual POA_VISU::View3D,
224 public virtual View_i
227 typedef VISU::View3D TInterface;
229 View3D_i (SalomeApp_Application *theApplication);
232 virtual VISU::VISUType GetType() { return VISU::TVIEW3D; };
235 virtual void SetTitle (const char* theTitle);
236 virtual char* GetTitle();
238 static void SetBackground (SUIT_ViewWindow* theViewWindow,
239 const SALOMEDS::Color& theColor);
241 static SALOMEDS::Color GetBackground (SUIT_ViewWindow* theViewWindow);
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();
251 virtual void FitAll();
252 virtual void SetView (VISU::View3D::ViewType theType);
254 static void SetPointOfView (SUIT_ViewWindow* theViewWindow,
255 const CORBA::Double thePosition[3]);
256 virtual void SetPointOfView (const VISU::View3D::XYZ theCoord);
258 static void GetPointOfView (SUIT_ViewWindow* theViewWindow,
259 CORBA::Double thePosition[3]);
260 virtual VISU::View3D::XYZ_slice* GetPointOfView();
262 static void SetViewUp (SUIT_ViewWindow* theViewWindow,
263 const CORBA::Double theViewUp[3]);
264 virtual void SetViewUp (const VISU::View3D::XYZ theDir);
266 static void GetViewUp (SUIT_ViewWindow* theViewWindow, CORBA::Double theViewUp[3]);
267 virtual VISU::View3D::XYZ_slice* GetViewUp();
269 static void SetFocalPoint (SUIT_ViewWindow* theViewWindow, const CORBA::Double theFocalPnt[3]);
270 virtual void SetFocalPoint (const VISU::View3D::XYZ theCoord);
272 static void GetFocalPoint (SUIT_ViewWindow* theViewWindow, CORBA::Double theFocalPnt[3]);
273 virtual VISU::View3D::XYZ_slice* GetFocalPoint();
275 static void SetParallelScale (SUIT_ViewWindow* theViewWindow, CORBA::Double theScale);
276 virtual void SetParallelScale (CORBA::Double theScale);
278 static CORBA::Double GetParallelScale (SUIT_ViewWindow* theViewWindow);
279 virtual CORBA::Double GetParallelScale ();
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();
286 static std::string ToString (SUIT_ViewWindow* theViewWindow);
288 static void ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr);
290 static bool SaveViewParams (SUIT_ViewManager* theViewManager,
291 const std::string& theName);
292 virtual CORBA::Boolean SaveViewParams (const char* theViewParamsName);
294 static bool RestoreViewParams (SUIT_ViewManager* theViewManager,
295 const std::string& theName);
296 virtual CORBA::Boolean RestoreViewParams (const char* theViewParamsName);
298 static QString GenerateViewParamsName();
300 static void Restore (SUIT_ViewWindow* theViewWindow,
301 const Storable::TRestoringMap& theMap);
303 virtual void Close();
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);
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);
321 static int myNbViewParams;
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;