Salome HOME
977436de881e2aad55d8125531d5114eafb6ddc1
[modules/gui.git] / src / OCCViewer / OCCViewer_ViewFrame.h
1 // Copyright (C) 2007-2014  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
31 class SUIT_Desktop;
32 class OCCViewer_Viewer;
33 class QGridLayout;
34
35 class OCCVIEWER_EXPORT OCCViewer_ViewFrame : public OCCViewer_ViewWindow  
36 {
37   Q_OBJECT
38 public:
39   enum { MAIN_VIEW, BOTTOM_RIGHT=MAIN_VIEW, BOTTOM_LEFT, TOP_LEFT, TOP_RIGHT };
40
41   OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel);
42   virtual ~OCCViewer_ViewFrame();
43
44   bool event( QEvent* e );
45
46   OCCViewer_ViewWindow*   getView( const int ) const;
47
48   virtual OCCViewer_ViewPort3d* getViewPort() { return getView(MAIN_VIEW)->getViewPort(); }
49   OCCViewer_ViewPort3d* getViewPort(int theView);
50
51   virtual void performRestoring( const viewAspect& theAspect) { getView(MAIN_VIEW)->performRestoring(theAspect); }
52   virtual void initLayout() {}
53
54   virtual void updateEnabledDrawMode();
55   virtual void setCuttingPlane( bool on, const double x = 0 , const double y = 0 , const double z = 0,
56                                 const double dx = 0, const double dy = 0, const double dz = 1);
57
58   virtual void setCuttingPlane( bool on, const gp_Pln thePln );
59
60   virtual bool isCuttingPlane() { return getView(MAIN_VIEW)->isCuttingPlane(); }
61
62   virtual QString getVisualParameters();
63   virtual void setVisualParameters( const QString& parameters );
64
65   virtual void initSketchers() { getView(MAIN_VIEW)->initSketchers(); }
66   virtual OCCViewer_ViewSketcher* getSketcher( const int i)  { return getView(MAIN_VIEW)->getSketcher(i); }
67   virtual void activateSketching( int i ) { getView(MAIN_VIEW)->activateSketching(i); }
68
69   virtual int  interactionStyle() const { return getView(MAIN_VIEW)->interactionStyle(); }
70   virtual void setInteractionStyle( const int i );
71
72   virtual int  zoomingStyle() const { return getView(MAIN_VIEW)->zoomingStyle(); }
73   virtual void setZoomingStyle( const int );
74
75   virtual bool isSelectionEnabled() const { return getView(MAIN_VIEW)->isSelectionEnabled(); }
76   virtual void enableSelection( bool );
77
78   virtual bool isPreselectionEnabled() const { return getView(MAIN_VIEW)->isPreselectionEnabled(); }
79   virtual void enablePreselection( bool );
80
81   virtual void setViewManager( SUIT_ViewManager* );
82
83   virtual bool eventFilter(QObject* watched, QEvent* e) { return SUIT_ViewWindow::eventFilter(watched, e); }
84
85   virtual QColor backgroundColor() const;                 // obsolete
86   virtual void   setBackgroundColor( const QColor& );     // obsolete
87
88   virtual Qtx::BackgroundData background() const;
89   virtual void                setBackground( const Qtx::BackgroundData& );
90
91   virtual void   setDropDownButtons( bool );
92
93   virtual SUIT_CameraProperties cameraProperties();
94
95 public slots:
96   virtual void onFrontView() { getView(MAIN_VIEW)->onFrontView(); }
97   virtual void onViewFitAll();
98   virtual void onBackView() { getView(MAIN_VIEW)->onBackView(); }
99   virtual void onTopView() { getView(MAIN_VIEW)->onTopView(); }
100   virtual void onBottomView() { getView(MAIN_VIEW)->onBottomView(); }
101   virtual void onLeftView() { getView(MAIN_VIEW)->onLeftView(); }
102   virtual void onRightView() { getView(MAIN_VIEW)->onRightView(); }
103   virtual void onClockWiseView() { getView(MAIN_VIEW)->onClockWiseView(); }
104   virtual void onAntiClockWiseView() { getView(MAIN_VIEW)->onAntiClockWiseView(); }
105   virtual void onResetView() { getView(MAIN_VIEW)->onResetView(); }
106   virtual void onFitAll();
107   virtual void activateZoom() {}
108   virtual void activateWindowFit() {}
109   virtual void activateRotation() {}
110   virtual void activatePanning() {}
111   virtual void activateGlobalPanning() {}
112   virtual void onSetRotationPoint( bool on ) {}
113   virtual void onAxialScale() {}
114   virtual void onAmbientToogle() {}
115   virtual void onMemorizeView() {}
116   virtual void onRestoreView() {}
117   virtual void onSwitchInteractionStyle( bool on ) {}
118
119   virtual void activateSetRotationGravity() {}
120   virtual void activateSetRotationSelected( double theX, double theY, double theZ ) {}
121   virtual void activateStartPointSelection() {}
122   virtual void updateGravityCoords() {}
123    
124   void onMaximizedView( OCCViewer_ViewWindow*, bool );
125   void returnTo3dView();
126
127   virtual void onDumpView();
128
129 protected:
130   virtual QImage dumpView();
131   virtual bool   dumpViewToFormat( const QImage&, const QString&, const QString& );
132
133 private slots:
134   void onContextMenuRequested(QContextMenuEvent*);
135
136 private:
137   void connectViewSignals( OCCViewer_ViewWindow* theView );
138   void updateWindowTitle( OCCViewer_ViewWindow* theView );
139   void createSubViews();
140   void splitSubViews();
141
142   QList<OCCViewer_ViewWindow*> myViews;
143   QGridLayout* myLayout;
144   OCCViewer_ViewWindow* myMaximizedView;
145   int mySplitMode;
146   QList<int> myViewsMode;
147
148   OCCViewer_ViewWindow* myPopupRequestedView;
149 };
150
151 #endif