1 // Copyright (C) 2007-2008 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
22 // VISU OBJECT : interactive object for VISU entities implementation
23 // File : VISU_View_i.hh
24 // Author : Alexey PETROV
27 #ifndef VISU_View_i_HeaderFile
28 #define VISU_View_i_HeaderFile
30 #include "VISUConfig.hh"
31 #include "SALOME_GenericObj_i.hh"
35 class VisuGUI_TableDlg;
37 class SalomeApp_Application;
39 class SUIT_ViewManager;
40 class SUIT_ViewWindow;
42 class Plot2d_ViewFrame;
49 class VISU_I_EXPORT View_i : public virtual POA_VISU::View,
50 public virtual SALOME::GenericObj_i,
51 public virtual Storable
54 View_i (SalomeApp_Application *theApplication,
55 SUIT_ViewManager* theViewManager);
59 virtual void ShowPart( VISU::View::ViewRepresentation ViewRepr, CORBA::Boolean state );
60 virtual CORBA::Boolean IsPartShown( VISU::View::ViewRepresentation ViewRepr );
62 // Begin: New methods for view parameters management
63 virtual void SplitRight();
64 virtual void SplitLeft();
65 virtual void SplitBottom();
66 virtual void SplitTop();
70 virtual void Attract (VISU::View_ptr theView);
71 virtual void AttractAll(VISU::View_ptr theView);
73 virtual void SetRelativePositionInSplitter(CORBA::Double thePosition);
74 virtual void SetRelativeSizeInSplitter(CORBA::Double theSize);
76 virtual void SetRelativePositionX(CORBA::Double thePosition);
77 virtual void SetRelativePositionY(CORBA::Double thePosition);
79 virtual void SetRelativeSizeX(CORBA::Double theSize);
80 virtual void SetRelativeSizeY(CORBA::Double theSize);
81 // End: New methods for view parameters management
83 // Begin: Old methods for view parameters management, they don't work now
84 virtual void SetViewWidth(CORBA::Long Width);
85 virtual void SetViewHeight(CORBA::Long Height);
86 virtual CORBA::Long GetViewWidth();
87 virtual CORBA::Long GetViewHeight();
88 virtual void SetViewPositionHorizontal(VISU::View::ViewPosition ViewPosHor);
89 virtual void SetViewPositionVertical(VISU::View::ViewPosition ViewPosVer);
90 virtual void SetRelativePosition( CORBA::Double x, CORBA::Double y );
91 virtual void SetRelativeSize( CORBA::Double x, CORBA::Double y );
92 virtual void Minimize();
93 virtual void Restore();
94 virtual void Maximize();
95 // End: Old methods for view parameters management, they don't work now
97 virtual void SetBackground(const SALOMEDS::Color& theColor);
98 virtual SALOMEDS::Color GetBackground();
100 virtual void EraseAll();
101 virtual void DisplayAll();
102 virtual void Erase(PrsObject_ptr thePrsObj);
103 virtual void Display(PrsObject_ptr thePrsObj);
104 virtual void DisplayOnly(PrsObject_ptr thePrsObj);
106 virtual void Update();
108 virtual CORBA::Boolean SavePicture(const char* theFileName);
110 virtual void Close() = 0;
111 virtual void ToStream(std::ostringstream& theStr);
112 virtual const char* GetComment() const;
114 SUIT_ViewWindow* GetViewWindow();
115 void SetViewWindow(SUIT_ViewWindow* theViewWindow);
118 QWidget *myWorkspace;
120 SalomeApp_Application *myApplication;
121 SUIT_ViewManager *myViewManager;
124 SUIT_ViewWindow *myViewWindow;
128 //===========================================================================
129 class VISU_I_EXPORT XYPlot_i : public virtual POA_VISU::XYPlot,
130 public virtual View_i
133 typedef VISU::XYPlot TInterface;
135 XYPlot_i (SalomeApp_Application *theApplication);
138 virtual VISU::VISUType GetType() { return VISU::TXYPLOT; };
140 virtual void SetTitle (const char* theTitle);
141 virtual char* GetTitle();
143 virtual void SetSubTitle (const char* theTitle);
144 virtual char* GetSubTitle();
146 virtual void SetCurveType (VISU::XYPlot::CurveType theType);
147 virtual VISU::XYPlot::CurveType GetCurveType();
149 virtual void SetMarkerSize (CORBA::Long theSize);
150 virtual CORBA::Long GetMarkerSize();
152 virtual void EnableXGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
153 CORBA::Boolean theMinor, CORBA::Long theNumMinor);
154 virtual void EnableYGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
155 CORBA::Boolean theMinor, CORBA::Long theNumMinor);
157 virtual void EnableYGrid (CORBA::Boolean theMajor, CORBA::Long theNumMajor,
158 CORBA::Boolean theMinor, CORBA::Long theNumMinor,
159 CORBA::Boolean the2Major, CORBA::Long the2NumMajor,
160 CORBA::Boolean the2Minor, CORBA::Long the2NumMinor);
162 virtual void SetHorScaling (VISU::Scaling theScaling);
163 virtual VISU::Scaling GetHorScaling();
164 virtual void SetVerScaling (VISU::Scaling theScaling);
165 virtual VISU::Scaling GetVerScaling();
167 virtual void SetXTitle (const char* theTitle);
168 virtual char* GetXTitle();
170 virtual void SetYTitle (const char* theTitle);
171 virtual char* GetYTitle();
173 virtual void ShowLegend (CORBA::Boolean theShowing);
175 virtual void EraseAll();
176 virtual void Erase (PrsObject_ptr thePrsObj);
177 virtual void Display (PrsObject_ptr thePrsObj);
178 virtual void DisplayOnly (PrsObject_ptr thePrsObj);
179 virtual void Update();
181 virtual void FitAll();
182 virtual void FitXRange(CORBA::Double xMin, CORBA::Double xMax);
183 virtual void FitYRange(CORBA::Double yMin, CORBA::Double yMax);
184 virtual void FitRange(CORBA::Double xMin, CORBA::Double xMax,
185 CORBA::Double yMin, CORBA::Double yMax);
186 virtual void GetFitRanges(double& xMin, double& xMax, double& yMin, double& yMax);
188 virtual void Close();
190 Plot2d_ViewFrame* GetView() { return myView; }
192 Plot2d_ViewFrame* myView;
194 virtual Storable* Create (int theNew);
198 //===========================================================================
199 class VISU_I_EXPORT TableView_i : public virtual POA_VISU::TableView,
200 public virtual View_i
203 typedef VISU::TableView TInterface;
205 TableView_i (SalomeApp_Application *theApplication);
206 virtual ~TableView_i();
208 virtual VISU::VISUType GetType() { return VISU::TTABLEVIEW; };
210 virtual void SetTitle (const char* theTitle);
211 virtual char* GetTitle();
213 virtual void Close();
215 VisuGUI_TableDlg* myView;
217 virtual Storable* Create (VISU::Table_ptr theTable);
221 //===========================================================================
222 class VISU_I_EXPORT View3D_i : public virtual POA_VISU::View3D,
223 public virtual View_i
226 typedef VISU::View3D TInterface;
228 View3D_i (SalomeApp_Application *theApplication);
231 virtual VISU::VISUType GetType() { return VISU::TVIEW3D; };
234 virtual void SetTitle (const char* theTitle);
235 virtual char* GetTitle();
237 static void SetBackground (SUIT_ViewWindow* theViewWindow,
238 const SALOMEDS::Color& theColor);
240 static SALOMEDS::Color GetBackground (SUIT_ViewWindow* theViewWindow);
242 virtual void EraseAll();
243 virtual void DisplayAll();
244 virtual void Erase (PrsObject_ptr thePrsObj);
245 virtual void Display (PrsObject_ptr thePrsObj);
246 virtual void DisplayOnly (PrsObject_ptr thePrsObj);
247 virtual void Update();
250 virtual void FitAll();
251 virtual void SetView (VISU::View3D::ViewType theType);
253 static void SetPointOfView (SUIT_ViewWindow* theViewWindow,
254 const CORBA::Double thePosition[3]);
255 virtual void SetPointOfView (const VISU::View3D::XYZ theCoord);
257 static void GetPointOfView (SUIT_ViewWindow* theViewWindow,
258 CORBA::Double thePosition[3]);
259 virtual VISU::View3D::XYZ_slice* GetPointOfView();
261 static void SetViewUp (SUIT_ViewWindow* theViewWindow,
262 const CORBA::Double theViewUp[3]);
263 virtual void SetViewUp (const VISU::View3D::XYZ theDir);
265 static void GetViewUp (SUIT_ViewWindow* theViewWindow, CORBA::Double theViewUp[3]);
266 virtual VISU::View3D::XYZ_slice* GetViewUp();
268 static void SetFocalPoint (SUIT_ViewWindow* theViewWindow, const CORBA::Double theFocalPnt[3]);
269 virtual void SetFocalPoint (const VISU::View3D::XYZ theCoord);
271 static void GetFocalPoint (SUIT_ViewWindow* theViewWindow, CORBA::Double theFocalPnt[3]);
272 virtual VISU::View3D::XYZ_slice* GetFocalPoint();
274 static void SetParallelScale (SUIT_ViewWindow* theViewWindow, CORBA::Double theScale);
275 virtual void SetParallelScale (CORBA::Double theScale);
277 static CORBA::Double GetParallelScale (SUIT_ViewWindow* theViewWindow);
278 virtual CORBA::Double GetParallelScale ();
280 static void ScaleView (SUIT_ViewWindow* theViewWindow,
281 VISU::View3D::Axis theAxis, CORBA::Double theParam);
282 virtual void ScaleView (VISU::View3D::Axis theAxis, CORBA::Double theParam);
283 virtual void RemoveScale();
285 static std::string ToString (SUIT_ViewWindow* theViewWindow);
287 static void ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr);
289 static bool SaveViewParams (SUIT_ViewManager* theViewManager,
290 const std::string& theName);
291 virtual CORBA::Boolean SaveViewParams (const char* theViewParamsName);
293 static bool RestoreViewParams (SUIT_ViewManager* theViewManager,
294 const std::string& theName);
295 virtual CORBA::Boolean RestoreViewParams (const char* theViewParamsName);
297 static QString GenerateViewParamsName();
299 static void Restore (SUIT_ViewWindow* theViewWindow,
300 const Storable::TRestoringMap& theMap);
302 virtual void Close();
304 // Certain presentation view parameters management
305 virtual PresentationType GetPresentationType(ScalarMap_ptr thePrs);
306 virtual CORBA::Boolean IsShrinked (ScalarMap_ptr thePrs);
307 virtual CORBA::Boolean IsShaded (ScalarMap_ptr thePrs);
308 virtual CORBA::Double GetOpacity (ScalarMap_ptr thePrs);
309 virtual CORBA::Double GetLineWidth (ScalarMap_ptr thePrs);
310 virtual Quadratic2DPresentationType GetQuadratic2DPresentationType(ScalarMap_ptr thePrs);
312 virtual char* SetPresentationType(ScalarMap_ptr thePrs, PresentationType thePrsType);
313 virtual char* SetShrinked (ScalarMap_ptr thePrs, CORBA::Boolean isShrinked);
314 virtual char* SetShaded (ScalarMap_ptr thePrs, CORBA::Boolean isShaded);
315 virtual char* SetOpacity (ScalarMap_ptr thePrs, CORBA::Double theOpacity);
316 virtual char* SetLineWidth (ScalarMap_ptr thePrs, CORBA::Double theLineWidth);
317 virtual char* SetQuadratic2DPresentationType(ScalarMap_ptr thePrs, Quadratic2DPresentationType theType);
320 static int myNbViewParams;
323 virtual Storable* Create (int theNew);
324 virtual void ToStream (std::ostringstream& theStr);
325 virtual const char* GetComment() const;
326 static const std::string myComment;