1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 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 // 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"
34 class VisuGUI_TableDlg;
36 class SalomeApp_Application;
38 class SUIT_ViewManager;
39 class SUIT_ViewWindow;
41 class Plot2d_ViewFrame;
48 class VISU_I_EXPORT View_i : public virtual POA_VISU::View,
49 public virtual Storable
52 View_i (SalomeApp_Application *theApplication,
53 SUIT_ViewManager* theViewManager);
57 virtual void ShowPart( VISU::View::ViewRepresentation ViewRepr, CORBA::Boolean state );
58 virtual CORBA::Boolean IsPartShown( VISU::View::ViewRepresentation ViewRepr );
60 // Begin: New methods for view parameters management
61 virtual void SplitRight();
62 virtual void SplitLeft();
63 virtual void SplitBottom();
64 virtual void SplitTop();
68 virtual void Attract (VISU::View_ptr theView);
69 virtual void AttractAll(VISU::View_ptr theView);
71 virtual void SetRelativePositionInSplitter(CORBA::Double thePosition);
72 virtual void SetRelativeSizeInSplitter(CORBA::Double theSize);
74 virtual void SetRelativePositionX(CORBA::Double thePosition);
75 virtual void SetRelativePositionY(CORBA::Double thePosition);
77 virtual void SetRelativeSizeX(CORBA::Double theSize);
78 virtual void SetRelativeSizeY(CORBA::Double theSize);
79 // End: New methods for view parameters management
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
95 virtual void SetBackground(const SALOMEDS::Color& theColor);
96 virtual SALOMEDS::Color GetBackground();
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);
104 virtual void Update();
106 virtual CORBA::Boolean SavePicture(const char* theFileName);
108 virtual void Close() = 0;
109 virtual void ToStream(std::ostringstream& theStr);
110 virtual const char* GetComment() const;
112 SUIT_ViewWindow* GetViewWindow();
113 void SetViewWindow(SUIT_ViewWindow* theViewWindow);
116 QWidget *myWorkspace;
118 SalomeApp_Application *myApplication;
119 SUIT_ViewManager *myViewManager;
122 SUIT_ViewWindow *myViewWindow;
126 //===========================================================================
127 class VISU_I_EXPORT XYPlot_i : public virtual POA_VISU::XYPlot,
128 public virtual View_i
131 typedef VISU::XYPlot TInterface;
133 XYPlot_i (SalomeApp_Application *theApplication);
136 virtual VISU::VISUType GetType() { return VISU::TXYPLOT; };
138 virtual void SetTitle (const char* theTitle);
139 virtual char* GetTitle();
141 virtual void SetSubTitle (const char* theTitle);
142 virtual char* GetSubTitle();
144 virtual void SetCurveType (VISU::XYPlot::CurveType theType);
145 virtual VISU::XYPlot::CurveType GetCurveType();
147 virtual void SetMarkerSize (CORBA::Long theSize);
148 virtual CORBA::Long GetMarkerSize();
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);
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);
160 virtual void SetHorScaling (VISU::Scaling theScaling);
161 virtual VISU::Scaling GetHorScaling();
162 virtual void SetVerScaling (VISU::Scaling theScaling);
163 virtual VISU::Scaling GetVerScaling();
165 virtual void SetXTitle (const char* theTitle);
166 virtual char* GetXTitle();
168 virtual void SetYTitle (const char* theTitle);
169 virtual char* GetYTitle();
171 virtual void ShowLegend (CORBA::Boolean theShowing);
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();
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);
186 virtual void Close();
188 Plot2d_ViewFrame* myView;
190 virtual Storable* Create (int theNew);
194 //===========================================================================
195 class VISU_I_EXPORT TableView_i : public virtual POA_VISU::TableView,
196 public virtual View_i
199 typedef VISU::TableView TInterface;
201 TableView_i (SalomeApp_Application *theApplication);
202 virtual ~TableView_i();
204 virtual VISU::VISUType GetType() { return VISU::TTABLEVIEW; };
206 virtual void SetTitle (const char* theTitle);
207 virtual char* GetTitle();
209 virtual void Close();
211 VisuGUI_TableDlg* myView;
213 virtual Storable* Create (VISU::Table_ptr theTable);
217 //===========================================================================
218 class VISU_I_EXPORT View3D_i : public virtual POA_VISU::View3D,
219 public virtual View_i
222 typedef VISU::View3D TInterface;
224 View3D_i (SalomeApp_Application *theApplication);
227 virtual VISU::VISUType GetType() { return VISU::TVIEW3D; };
230 virtual void SetTitle (const char* theTitle);
231 virtual char* GetTitle();
233 static void SetBackground (SUIT_ViewWindow* theViewWindow,
234 const SALOMEDS::Color& theColor);
236 static SALOMEDS::Color GetBackground (SUIT_ViewWindow* theViewWindow);
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();
246 virtual void FitAll();
247 virtual void SetView (VISU::View3D::ViewType theType);
249 static void SetPointOfView (SUIT_ViewWindow* theViewWindow,
250 const CORBA::Double thePosition[3]);
251 virtual void SetPointOfView (const VISU::View3D::XYZ theCoord);
253 static void GetPointOfView (SUIT_ViewWindow* theViewWindow,
254 CORBA::Double thePosition[3]);
255 virtual VISU::View3D::XYZ_slice* GetPointOfView();
257 static void SetViewUp (SUIT_ViewWindow* theViewWindow,
258 const CORBA::Double theViewUp[3]);
259 virtual void SetViewUp (const VISU::View3D::XYZ theDir);
261 static void GetViewUp (SUIT_ViewWindow* theViewWindow, CORBA::Double theViewUp[3]);
262 virtual VISU::View3D::XYZ_slice* GetViewUp();
264 static void SetFocalPoint (SUIT_ViewWindow* theViewWindow, const CORBA::Double theFocalPnt[3]);
265 virtual void SetFocalPoint (const VISU::View3D::XYZ theCoord);
267 static void GetFocalPoint (SUIT_ViewWindow* theViewWindow, CORBA::Double theFocalPnt[3]);
268 virtual VISU::View3D::XYZ_slice* GetFocalPoint();
270 static void SetParallelScale (SUIT_ViewWindow* theViewWindow, CORBA::Double theScale);
271 virtual void SetParallelScale (CORBA::Double theScale);
273 static CORBA::Double GetParallelScale (SUIT_ViewWindow* theViewWindow);
274 virtual CORBA::Double GetParallelScale ();
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();
281 static std::string ToString (SUIT_ViewWindow* theViewWindow);
283 static void ToStream (SUIT_ViewWindow* theViewWindow, std::ostringstream& theStr);
285 static bool SaveViewParams (SUIT_ViewManager* theViewManager,
286 const std::string& theName);
287 virtual CORBA::Boolean SaveViewParams (const char* theViewParamsName);
289 static bool RestoreViewParams (SUIT_ViewManager* theViewManager,
290 const std::string& theName);
291 virtual CORBA::Boolean RestoreViewParams (const char* theViewParamsName);
293 static QString GenerateViewParamsName();
295 static void Restore (SUIT_ViewWindow* theViewWindow,
296 const Storable::TRestoringMap& theMap);
298 virtual void Close();
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);
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);
314 static int myNbViewParams;
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;