Version: 9.12.0
OCCViewer_ViewFrame.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, 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 
80 
81  virtual int stereoType() const;
82  virtual void setStereoType( const int );
83 
84  virtual int anaglyphFilter() const;
85  virtual void setAnaglyphFilter( const int );
86 
87  virtual void setStereographicFocus( const int, const double );
88  virtual int stereographicFocusType() const;
89  virtual double stereographicFocusValue() const;
90 
91  virtual void setInterocularDistance( const int, const double );
92  virtual int interocularDistanceType() const;
93  virtual double interocularDistanceValue() const;
94 
95  virtual bool isReverseStereo() const;
96  virtual void setReverseStereo( const bool );
97 
98  virtual bool isVSync() const;
99  virtual void setVSync( const bool );
100 
101  virtual bool isQuadBufferSupport() const;
102  virtual void setQuadBufferSupport( const bool );
103 
104  virtual int zoomingStyle() const { return getView(MAIN_VIEW)->zoomingStyle(); }
105  virtual void setZoomingStyle( const int );
106 
107  virtual bool isSelectionEnabled() const { return getView(MAIN_VIEW)->isSelectionEnabled(); }
108  virtual void enableSelection( bool );
109 
110  virtual bool isPreselectionEnabled() const { return getView(MAIN_VIEW)->isPreselectionEnabled(); }
111  virtual void enablePreselection( bool );
112 
113  virtual bool enableDrawMode( bool );
114 
115  virtual void setViewManager( SUIT_ViewManager* );
116 
117  virtual bool eventFilter(QObject* watched, QEvent* e) { return SUIT_ViewWindow::eventFilter(watched, e); }
118 
119  virtual QColor backgroundColor() const; // obsolete
120  virtual void setBackgroundColor( const QColor& ); // obsolete
121 
122  virtual Qtx::BackgroundData background() const;
123  virtual void setBackground( const Qtx::BackgroundData& );
124 
125  virtual void showStaticTrihedron( bool );
126 
127  virtual void setDropDownButtons( bool );
128 
130 
131 public slots:
132  virtual void onFrontView() { getView(MAIN_VIEW)->onFrontView(); }
133  virtual void onViewFitAll();
134  virtual void onBackView() { getView(MAIN_VIEW)->onBackView(); }
135  virtual void onTopView() { getView(MAIN_VIEW)->onTopView(); }
136  virtual void onBottomView() { getView(MAIN_VIEW)->onBottomView(); }
137  virtual void onLeftView() { getView(MAIN_VIEW)->onLeftView(); }
138  virtual void onRightView() { getView(MAIN_VIEW)->onRightView(); }
139  virtual void onClockWiseView() { getView(MAIN_VIEW)->onClockWiseView(); }
140  virtual void onAntiClockWiseView() { getView(MAIN_VIEW)->onAntiClockWiseView(); }
141  virtual void onResetView() { getView(MAIN_VIEW)->onResetView(); }
142  virtual void onFitAll();
143  virtual void activateZoom() {}
144  virtual void activateWindowFit() {}
145  virtual void activateRotation() {}
146  virtual void activatePanning() {}
147  virtual void activateGlobalPanning() {}
148  virtual void onSetRotationPoint( bool /*on*/ ) {}
149  virtual void onAxialScale() {}
150  virtual void onAmbientToogle() {}
151  virtual void onMemorizeView() {}
152  virtual void onRestoreView() {}
153  virtual void onSwitchInteractionStyle( bool /*on*/ ) {}
154 
155  virtual void activateSetRotationGravity() {}
156  virtual void activateSetRotationSelected( double /*theX*/, double /*theY*/, double /*theZ*/ ) {}
157  virtual void activateStartPointSelection( TopAbs_ShapeEnum ) {}
158  virtual void updateGravityCoords() {}
159 
160  void onMaximizedView( OCCViewer_ViewWindow*, bool );
161  void returnTo3dView();
162 
163  virtual void onDumpView();
164 
165 protected:
166  virtual QImage dumpView();
167  virtual bool dumpViewToFormat( const QImage&, const QString&, const QString& );
168 
169 private slots:
170  void onContextMenuRequested(QContextMenuEvent*);
171  void onMousePressed(SUIT_ViewWindow*, QMouseEvent*);
172 
173 private:
174  void connectViewSignals( OCCViewer_ViewWindow* theView );
175  void updateWindowTitle( OCCViewer_ViewWindow* theView );
176  void createSubViews();
177  void splitSubViews();
178  void setSubViewParams( OCCViewer_ViewWindow* theView );
179 
181  QGridLayout* myLayout;
186 
188 };
189 
190 #endif
#define OCCVIEWER_EXPORT
Definition: OCCViewer.h:33
Definition: OCCViewer_ViewFrame.h:37
virtual OCCViewer_ViewPort3d * getViewPort()
Definition: OCCViewer_ViewFrame.h:51
QList< OCCViewer_ViewWindow * > myViews
Definition: OCCViewer_ViewFrame.h:180
virtual void updateGravityCoords()
Definition: OCCViewer_ViewFrame.h:158
virtual void onFrontView()
Definition: OCCViewer_ViewFrame.h:132
QGridLayout * myLayout
Definition: OCCViewer_ViewFrame.h:181
QList< int > myViewsMode
Definition: OCCViewer_ViewFrame.h:185
virtual void activateStartPointSelection(TopAbs_ShapeEnum)
Definition: OCCViewer_ViewFrame.h:157
virtual int interactionStyle() const
Get current interaction style.
Definition: OCCViewer_ViewFrame.h:72
OCCViewer_ViewWindow * myMaximizedView
Definition: OCCViewer_ViewFrame.h:182
@ BOTTOM_LEFT
Definition: OCCViewer_ViewFrame.h:40
virtual void onClockWiseView()
Definition: OCCViewer_ViewFrame.h:139
virtual void onSetRotationPoint(bool)
Definition: OCCViewer_ViewFrame.h:148
virtual void activateRotation()
Definition: OCCViewer_ViewFrame.h:145
virtual void onAxialScale()
Definition: OCCViewer_ViewFrame.h:149
virtual void activateGlobalPanning()
Definition: OCCViewer_ViewFrame.h:147
virtual bool isCuttingPlane()
Check if any cutting plane is enabled.
Definition: OCCViewer_ViewFrame.h:63
int mySplitMode
Definition: OCCViewer_ViewFrame.h:184
virtual void onSwitchInteractionStyle(bool)
Definition: OCCViewer_ViewFrame.h:153
virtual void onLeftView()
Definition: OCCViewer_ViewFrame.h:137
virtual void onTopView()
Definition: OCCViewer_ViewFrame.h:135
virtual void activateSetRotationGravity()
Definition: OCCViewer_ViewFrame.h:155
virtual void performRestoring(const viewAspect &theAspect)
Definition: OCCViewer_ViewFrame.h:54
virtual void onResetView()
Definition: OCCViewer_ViewFrame.h:141
virtual void activateZoom()
Definition: OCCViewer_ViewFrame.h:143
virtual void onBackView()
Definition: OCCViewer_ViewFrame.h:134
OCCViewer_ViewWindow * myActiveView
Definition: OCCViewer_ViewFrame.h:183
virtual void initLayout()
Internal initialization.
Definition: OCCViewer_ViewFrame.h:55
virtual bool isPreselectionEnabled() const
Indicates whether preselection is enabled.
Definition: OCCViewer_ViewFrame.h:110
virtual int zoomingStyle() const
Get current zooming style.
Definition: OCCViewer_ViewFrame.h:104
virtual OCCViewer_ViewSketcher * getSketcher(const int i)
Definition: OCCViewer_ViewFrame.h:69
virtual void onMemorizeView()
Definition: OCCViewer_ViewFrame.h:151
virtual void activatePanning()
Definition: OCCViewer_ViewFrame.h:146
virtual void initSketchers()
Definition: OCCViewer_ViewFrame.h:68
virtual void onAmbientToogle()
Definition: OCCViewer_ViewFrame.h:150
OCCViewer_ViewWindow * myPopupRequestedView
Definition: OCCViewer_ViewFrame.h:187
virtual void onAntiClockWiseView()
Definition: OCCViewer_ViewFrame.h:140
virtual void onRestoreView()
Definition: OCCViewer_ViewFrame.h:152
virtual void onRightView()
Definition: OCCViewer_ViewFrame.h:138
virtual void onBottomView()
Definition: OCCViewer_ViewFrame.h:136
virtual bool isSelectionEnabled() const
Indicates whether selection is enabled.
Definition: OCCViewer_ViewFrame.h:107
virtual void activateWindowFit()
Definition: OCCViewer_ViewFrame.h:144
virtual void activateSketching(int i)
Definition: OCCViewer_ViewFrame.h:70
virtual bool eventFilter(QObject *watched, QEvent *e)
Customize event handling.
Definition: OCCViewer_ViewFrame.h:117
virtual void activateSetRotationSelected(double, double, double)
Definition: OCCViewer_ViewFrame.h:156
Definition: OCCViewer_ViewPort3d.h:43
Definition: OCCViewer_ViewSketcher.h:47
Definition: OCCViewer_ViewWindow.h:147
virtual QString getVisualParameters()
Get visual parameters of this view window.
Definition: OCCViewer_ViewWindow.cxx:2643
virtual bool isVSync() const
Definition: OCCViewer_ViewWindow.cxx:3471
virtual void returnTo3dView()
Definition: OCCViewer_ViewWindow.cxx:3248
virtual void setProjectionType(int)
Definition: OCCViewer_ViewWindow.cxx:1893
virtual void showStaticTrihedron(bool)
Definition: OCCViewer_ViewWindow.cxx:3536
virtual void onRightView()
Perform "right view" transformation.
Definition: OCCViewer_ViewWindow.cxx:1752
virtual void activateSketching(int)
Definition: OCCViewer_ViewWindow.cxx:3106
virtual OCCViewer_ViewPort3d * getViewPort()
Definition: OCCViewer_ViewWindow.cxx:3207
virtual void onFrontView()
Perform "front view" transformation.
Definition: OCCViewer_ViewWindow.cxx:1662
virtual void setAnaglyphFilter(const int)
Definition: OCCViewer_ViewWindow.cxx:3349
virtual QColor backgroundColor() const
Definition: OCCViewer_ViewWindow.cxx:3515
virtual QImage dumpView()
Dump view window contents to the pixmap.
Definition: OCCViewer_ViewWindow.cxx:2362
virtual double stereographicFocusValue() const
Definition: OCCViewer_ViewWindow.cxx:3399
virtual int zoomingStyle() const
Get current zooming style.
Definition: OCCViewer_ViewWindow.cxx:2343
virtual void setCuttingPlane(bool on, const double x=0, const double y=0, const double z=0, const double dx=0, const double dy=0, const double dz=1)
Set parameters of the cutting plane.
Definition: OCCViewer_ViewWindow.cxx:2472
virtual int projectionType() const
Definition: OCCViewer_ViewWindow.cxx:3313
virtual void onLeftView()
Perform "left view" transformation.
Definition: OCCViewer_ViewWindow.cxx:1734
virtual int stereographicFocusType() const
Definition: OCCViewer_ViewWindow.cxx:3388
virtual void setSelectionStyle(SelectionStyle)
Definition: OCCViewer_ViewWindow.cxx:2278
virtual bool isReverseStereo() const
Definition: OCCViewer_ViewWindow.cxx:3450
virtual double interocularDistanceValue() const
Definition: OCCViewer_ViewWindow.cxx:3430
virtual void onTopView()
Perform "top view" transformation.
Definition: OCCViewer_ViewWindow.cxx:1698
virtual int stereoType() const
Definition: OCCViewer_ViewWindow.cxx:3338
virtual void setZoomingStyle(const int)
Set current zooming style.
Definition: OCCViewer_ViewWindow.cxx:2352
virtual bool enableDrawMode(bool)
Enable / disable draw rect (rubber band) mode.
Definition: OCCViewer_ViewWindow.cxx:448
virtual void setQuadBufferSupport(const bool)
Definition: OCCViewer_ViewWindow.cxx:3483
virtual SelectionStyle selectionStyle() const
Definition: OCCViewer_ViewWindow.cxx:2269
virtual void setVSync(const bool)
Definition: OCCViewer_ViewWindow.cxx:3461
virtual void onMaximizedView()
Definition: OCCViewer_ViewWindow.cxx:3243
virtual OCCViewer_ViewSketcher * getSketcher(const int) const
Definition: OCCViewer_ViewWindow.cxx:3090
virtual bool isPreselectionEnabled() const
Indicates whether preselection is enabled.
Definition: OCCViewer_ViewWindow.cxx:3683
virtual void initSketchers()
Definition: OCCViewer_ViewWindow.cxx:3081
virtual void setInterocularDistance(const int, const double)
Definition: OCCViewer_ViewWindow.cxx:3410
virtual int anaglyphFilter() const
Definition: OCCViewer_ViewWindow.cxx:3363
virtual bool isCuttingPlane()
Check if any cutting plane is enabled.
Definition: OCCViewer_ViewWindow.cxx:2524
virtual void setBackgroundColor(const QColor &)
Definition: OCCViewer_ViewWindow.cxx:3521
virtual Qtx::BackgroundData background() const
Definition: OCCViewer_ViewWindow.cxx:3526
virtual int interactionStyle() const
Get current interaction style.
Definition: OCCViewer_ViewWindow.cxx:2325
virtual bool isSelectionEnabled() const
Indicates whether selection is enabled.
Definition: OCCViewer_ViewWindow.cxx:3701
virtual int interocularDistanceType() const
Definition: OCCViewer_ViewWindow.cxx:3419
virtual void onAntiClockWiseView()
Rotate view 90 degrees conterclockwise.
Definition: OCCViewer_ViewWindow.cxx:1780
SelectionStyle
Definition: OCCViewer_ViewWindow.h:173
virtual bool dumpViewToFormat(const QImage &, const QString &fileName, const QString &format)
Definition: OCCViewer_ViewWindow.cxx:2440
virtual void onFitAll()
Perform "fit all" transformation.
Definition: OCCViewer_ViewWindow.cxx:1955
virtual void enableSelection(bool)
Enables/disables selection.
Definition: OCCViewer_ViewWindow.cxx:3710
virtual void onBackView()
Perform "back view" transformation.
Definition: OCCViewer_ViewWindow.cxx:1680
virtual bool isQuadBufferSupport() const
Definition: OCCViewer_ViewWindow.cxx:3493
virtual SUIT_CameraProperties cameraProperties()
Definition: OCCViewer_ViewWindow.cxx:3579
virtual void setStereoType(const int)
Definition: OCCViewer_ViewWindow.cxx:3329
virtual void performRestoring(const viewAspect &, bool=false)
Restore view parameters.
Definition: OCCViewer_ViewWindow.cxx:2089
virtual void setBackground(const Qtx::BackgroundData &)
Definition: OCCViewer_ViewWindow.cxx:3531
virtual void onViewFitAll()
Perform 'fit all' operation.
Definition: OCCViewer_ViewWindow.cxx:1654
virtual void onBottomView()
Perform "bottom view" transformation.
Definition: OCCViewer_ViewWindow.cxx:1716
virtual void onClockWiseView()
Rotate view 90 degrees clockwise.
Definition: OCCViewer_ViewWindow.cxx:1770
virtual void setReverseStereo(const bool)
Definition: OCCViewer_ViewWindow.cxx:3441
virtual void onResetView()
Perform "reset view" transformation.
Definition: OCCViewer_ViewWindow.cxx:1792
virtual OCCViewer_ViewWindow * getView(const int) const
Definition: OCCViewer_ViewWindow.cxx:337
virtual void setInteractionStyle(const int)
Set current interaction style.
Definition: OCCViewer_ViewWindow.cxx:2334
virtual void enablePreselection(bool)
Enables/disables preselection.
Definition: OCCViewer_ViewWindow.cxx:3692
virtual void setVisualParameters(const QString &parameters)
Restore visual parameters of the view window.
Definition: OCCViewer_ViewWindow.cxx:2812
virtual void setStereographicFocus(const int, const double)
Definition: OCCViewer_ViewWindow.cxx:3379
virtual void updateEnabledDrawMode()
Update state of enable draw mode state.
Definition: OCCViewer_ViewWindow.cxx:459
Definition: OCCViewer_ViewModel.h:77
For more information see QT documentation.
Definition: SUIT_Application.h:42
Stores background data.
Definition: Qtx.h:178
Base class for Camera Properties.
Definition: SUIT_CameraProperties.h:29
Definition: SUIT_Desktop.h:47
Definition: SUIT_ViewManager.h:50
Definition: SUIT_ViewWindow.h:42
virtual void setViewManager(SUIT_ViewManager *)
Definition: SUIT_ViewWindow.cxx:76
bool event(QEvent *)
Definition: SUIT_ViewWindow.cxx:182
virtual void setDropDownButtons(bool)
Set buttons mode to drop-down (on = true) or ligned (on = false)
Definition: SUIT_ViewWindow.cxx:276
virtual void onDumpView()
Definition: SUIT_ViewWindow.cxx:165
Definition: OCCViewer_ViewWindow.h:45