Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OCCViewer_ViewFrame.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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 #ifndef OCCVIEWER_VIEWFRAME_H
24 #define OCCVIEWER_VIEWFRAME_H
25 
26 #include "OCCViewer.h"
27 #include "OCCViewer_ViewWindow.h"
28 
29 #include <gp_Pln.hxx>
30 #include <TopAbs_ShapeEnum.hxx>
31 
32 class SUIT_Desktop;
33 class OCCViewer_Viewer;
34 class QGridLayout;
35 
37 {
38  Q_OBJECT
39 public:
40  enum { MAIN_VIEW, BOTTOM_RIGHT=MAIN_VIEW, BOTTOM_LEFT, TOP_LEFT, TOP_RIGHT };
41 
42  OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel);
43  virtual ~OCCViewer_ViewFrame();
44 
45  bool event( QEvent* e );
46 
47  OCCViewer_ViewWindow* getView( const int ) const;
48 
49  OCCViewer_ViewWindow* getActiveView() const;
50 
51  virtual OCCViewer_ViewPort3d* getViewPort() { return getView(MAIN_VIEW)->getViewPort(); }
52  OCCViewer_ViewPort3d* getViewPort(int theView);
53 
54  virtual void performRestoring( const viewAspect& theAspect) { getView(MAIN_VIEW)->performRestoring(theAspect); }
55  virtual void initLayout() {}
56 
57  virtual void updateEnabledDrawMode();
58  virtual void setCuttingPlane( bool on, const double x = 0 , const double y = 0 , const double z = 0,
59  const double dx = 0, const double dy = 0, const double dz = 1);
60 
61  virtual void setCuttingPlane( bool on, const gp_Pln thePln );
62 
63  virtual bool isCuttingPlane() { return getView(MAIN_VIEW)->isCuttingPlane(); }
64 
65  virtual QString getVisualParameters();
66  virtual void setVisualParameters( const QString& parameters );
67 
68  virtual void initSketchers() { getView(MAIN_VIEW)->initSketchers(); }
69  virtual OCCViewer_ViewSketcher* getSketcher( const int i) { return getView(MAIN_VIEW)->getSketcher(i); }
70  virtual void activateSketching( int i ) { getView(MAIN_VIEW)->activateSketching(i); }
71 
72  virtual int interactionStyle() const { return getView(MAIN_VIEW)->interactionStyle(); }
73  virtual void setInteractionStyle( const int i );
74 
75  virtual int projectionType() const;
76  virtual void setProjectionType( int );
77 
78  virtual int stereoType() const;
79  virtual void setStereoType( const int );
80 
81  virtual int anaglyphFilter() const;
82  virtual void setAnaglyphFilter( const int );
83 
84  virtual void setStereographicFocus( const int, const double );
85  virtual int stereographicFocusType() const;
86  virtual double stereographicFocusValue() const;
87 
88  virtual void setInterocularDistance( const int, const double );
89  virtual int interocularDistanceType() const;
90  virtual double interocularDistanceValue() const;
91 
92  virtual bool isReverseStereo() const;
93  virtual void setReverseStereo( const bool );
94 
95  virtual bool isVSync() const;
96  virtual void setVSync( const bool );
97 
98  virtual bool isQuadBufferSupport() const;
99  virtual void setQuadBufferSupport( const bool );
100 
101  virtual int zoomingStyle() const { return getView(MAIN_VIEW)->zoomingStyle(); }
102  virtual void setZoomingStyle( const int );
103 
104  virtual bool isSelectionEnabled() const { return getView(MAIN_VIEW)->isSelectionEnabled(); }
105  virtual void enableSelection( bool );
106 
107  virtual bool isPreselectionEnabled() const { return getView(MAIN_VIEW)->isPreselectionEnabled(); }
108  virtual void enablePreselection( bool );
109 
110  virtual bool enableDrawMode( bool );
111 
112  virtual void setViewManager( SUIT_ViewManager* );
113 
114  virtual bool eventFilter(QObject* watched, QEvent* e) { return SUIT_ViewWindow::eventFilter(watched, e); }
115 
116  virtual QColor backgroundColor() const; // obsolete
117  virtual void setBackgroundColor( const QColor& ); // obsolete
118 
119  virtual Qtx::BackgroundData background() const;
120  virtual void setBackground( const Qtx::BackgroundData& );
121 
122  virtual void showStaticTrihedron( bool );
123 
124  virtual void setDropDownButtons( bool );
125 
127 
128 public slots:
129  virtual void onFrontView() { getView(MAIN_VIEW)->onFrontView(); }
130  virtual void onViewFitAll();
131  virtual void onBackView() { getView(MAIN_VIEW)->onBackView(); }
132  virtual void onTopView() { getView(MAIN_VIEW)->onTopView(); }
133  virtual void onBottomView() { getView(MAIN_VIEW)->onBottomView(); }
134  virtual void onLeftView() { getView(MAIN_VIEW)->onLeftView(); }
135  virtual void onRightView() { getView(MAIN_VIEW)->onRightView(); }
136  virtual void onClockWiseView() { getView(MAIN_VIEW)->onClockWiseView(); }
137  virtual void onAntiClockWiseView() { getView(MAIN_VIEW)->onAntiClockWiseView(); }
138  virtual void onResetView() { getView(MAIN_VIEW)->onResetView(); }
139  virtual void onFitAll();
140  virtual void activateZoom() {}
141  virtual void activateWindowFit() {}
142  virtual void activateRotation() {}
143  virtual void activatePanning() {}
144  virtual void activateGlobalPanning() {}
145  virtual void onSetRotationPoint( bool on ) {}
146  virtual void onAxialScale() {}
147  virtual void onAmbientToogle() {}
148  virtual void onMemorizeView() {}
149  virtual void onRestoreView() {}
150  virtual void onSwitchInteractionStyle( bool on ) {}
151 
152  virtual void activateSetRotationGravity() {}
153  virtual void activateSetRotationSelected( double theX, double theY, double theZ ) {}
154  virtual void activateStartPointSelection( TopAbs_ShapeEnum ) {}
155  virtual void updateGravityCoords() {}
156 
157  void onMaximizedView( OCCViewer_ViewWindow*, bool );
158  void returnTo3dView();
159 
160  virtual void onDumpView();
161 
162 protected:
163  virtual QImage dumpView();
164  virtual bool dumpViewToFormat( const QImage&, const QString&, const QString& );
165 
166 private slots:
167  void onContextMenuRequested(QContextMenuEvent*);
168  void onMousePressed(SUIT_ViewWindow*, QMouseEvent*);
169 
170 private:
171  void connectViewSignals( OCCViewer_ViewWindow* theView );
172  void updateWindowTitle( OCCViewer_ViewWindow* theView );
173  void createSubViews();
174  void splitSubViews();
175  void setSubViewParams( OCCViewer_ViewWindow* theView );
176 
178  QGridLayout* myLayout;
183 
185 };
186 
187 #endif