1 // Copyright (C) 2007-2019 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, or (at your option) any later version.
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 #ifndef OCCVIEWER_VIEWFRAME_H
24 #define OCCVIEWER_VIEWFRAME_H
26 #include "OCCViewer.h"
27 #include "OCCViewer_ViewWindow.h"
30 #include <TopAbs_ShapeEnum.hxx>
33 class OCCViewer_Viewer;
36 class OCCVIEWER_EXPORT OCCViewer_ViewFrame : public OCCViewer_ViewWindow
40 enum { MAIN_VIEW, BOTTOM_RIGHT=MAIN_VIEW, BOTTOM_LEFT, TOP_LEFT, TOP_RIGHT };
42 OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel);
43 virtual ~OCCViewer_ViewFrame();
45 bool event( QEvent* e );
47 OCCViewer_ViewWindow* getView( const int ) const;
49 OCCViewer_ViewWindow* getActiveView() const;
51 virtual OCCViewer_ViewPort3d* getViewPort() { return getView(MAIN_VIEW)->getViewPort(); }
52 OCCViewer_ViewPort3d* getViewPort(int theView);
54 virtual void performRestoring( const viewAspect& theAspect) { getView(MAIN_VIEW)->performRestoring(theAspect); }
55 virtual void initLayout() {}
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);
61 virtual void setCuttingPlane( bool on, const gp_Pln thePln );
63 virtual bool isCuttingPlane() { return getView(MAIN_VIEW)->isCuttingPlane(); }
65 virtual QString getVisualParameters();
66 virtual void setVisualParameters( const QString& parameters );
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); }
72 virtual int interactionStyle() const { return getView(MAIN_VIEW)->interactionStyle(); }
73 virtual void setInteractionStyle( const int i );
75 virtual int projectionType() const;
76 virtual void setProjectionType( int );
78 virtual int selectionStyle() const;
79 virtual void setSelectionStyle(int);
81 virtual int stereoType() const;
82 virtual void setStereoType( const int );
84 virtual int anaglyphFilter() const;
85 virtual void setAnaglyphFilter( const int );
87 virtual void setStereographicFocus( const int, const double );
88 virtual int stereographicFocusType() const;
89 virtual double stereographicFocusValue() const;
91 virtual void setInterocularDistance( const int, const double );
92 virtual int interocularDistanceType() const;
93 virtual double interocularDistanceValue() const;
95 virtual bool isReverseStereo() const;
96 virtual void setReverseStereo( const bool );
98 virtual bool isVSync() const;
99 virtual void setVSync( const bool );
101 virtual bool isQuadBufferSupport() const;
102 virtual void setQuadBufferSupport( const bool );
104 virtual int zoomingStyle() const { return getView(MAIN_VIEW)->zoomingStyle(); }
105 virtual void setZoomingStyle( const int );
107 virtual bool isSelectionEnabled() const { return getView(MAIN_VIEW)->isSelectionEnabled(); }
108 virtual void enableSelection( bool );
110 virtual bool isPreselectionEnabled() const { return getView(MAIN_VIEW)->isPreselectionEnabled(); }
111 virtual void enablePreselection( bool );
113 virtual bool enableDrawMode( bool );
115 virtual void setViewManager( SUIT_ViewManager* );
117 virtual bool eventFilter(QObject* watched, QEvent* e) { return SUIT_ViewWindow::eventFilter(watched, e); }
119 virtual QColor backgroundColor() const; // obsolete
120 virtual void setBackgroundColor( const QColor& ); // obsolete
122 virtual Qtx::BackgroundData background() const;
123 virtual void setBackground( const Qtx::BackgroundData& );
125 virtual void showStaticTrihedron( bool );
127 virtual void setDropDownButtons( bool );
129 virtual SUIT_CameraProperties cameraProperties();
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 ) {}
155 virtual void activateSetRotationGravity() {}
156 virtual void activateSetRotationSelected( double theX, double theY, double theZ ) {}
157 virtual void activateStartPointSelection( TopAbs_ShapeEnum ) {}
158 virtual void updateGravityCoords() {}
160 void onMaximizedView( OCCViewer_ViewWindow*, bool );
161 void returnTo3dView();
163 virtual void onDumpView();
166 virtual QImage dumpView();
167 virtual bool dumpViewToFormat( const QImage&, const QString&, const QString& );
170 void onContextMenuRequested(QContextMenuEvent*);
171 void onMousePressed(SUIT_ViewWindow*, QMouseEvent*);
174 void connectViewSignals( OCCViewer_ViewWindow* theView );
175 void updateWindowTitle( OCCViewer_ViewWindow* theView );
176 void createSubViews();
177 void splitSubViews();
178 void setSubViewParams( OCCViewer_ViewWindow* theView );
180 QList<OCCViewer_ViewWindow*> myViews;
181 QGridLayout* myLayout;
182 OCCViewer_ViewWindow* myMaximizedView;
183 OCCViewer_ViewWindow* myActiveView;
185 QList<int> myViewsMode;
187 OCCViewer_ViewWindow* myPopupRequestedView;