Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/gui.git] / src / OCCViewer / OCCViewer_ViewFrame.h
1 // Copyright (C) 2007-2012  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.
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   OCCViewer_ViewWindow*   getView( const int ) const;
45
46   virtual OCCViewer_ViewPort3d* getViewPort() { return getView(MAIN_VIEW)->getViewPort(); }
47   OCCViewer_ViewPort3d* getViewPort(int theView);
48
49   virtual void performRestoring( const viewAspect& theAspect) { getView(MAIN_VIEW)->performRestoring(theAspect); }
50   virtual void initLayout() {}
51
52   virtual void updateEnabledDrawMode();
53   virtual void setCuttingPlane( bool on, const double x = 0 , const double y = 0 , const double z = 0,
54                                 const double dx = 0, const double dy = 0, const double dz = 1);
55
56   virtual void setCuttingPlane( bool on, const gp_Pln thePln );
57
58   virtual bool isCuttingPlane() { return getView(MAIN_VIEW)->isCuttingPlane(); }
59
60   virtual QString getVisualParameters();
61   virtual void setVisualParameters( const QString& parameters );
62
63   virtual void initSketchers() { getView(MAIN_VIEW)->initSketchers(); }
64   virtual OCCViewer_ViewSketcher* getSketcher( const int i)  { return getView(MAIN_VIEW)->getSketcher(i); }
65   virtual void activateSketching( int i ) { getView(MAIN_VIEW)->activateSketching(i); }
66
67   virtual int  interactionStyle() const { return getView(MAIN_VIEW)->interactionStyle(); }
68   virtual void setInteractionStyle( const int i );
69
70   virtual int  zoomingStyle() const { return getView(MAIN_VIEW)->zoomingStyle(); }
71   virtual void setZoomingStyle( const int );
72
73   virtual void setViewManager( SUIT_ViewManager* );
74
75   virtual bool eventFilter(QObject* watched, QEvent* e) { return SUIT_ViewWindow::eventFilter(watched, e); }
76
77   virtual QColor backgroundColor() const;                 // obsolete
78   virtual void   setBackgroundColor( const QColor& );     // obsolete
79
80   virtual Qtx::BackgroundData background() const;
81   virtual void                setBackground( const Qtx::BackgroundData& );
82
83   virtual void   setDropDownButtons( bool );
84
85 public slots:
86   virtual void onFrontView() { getView(MAIN_VIEW)->onFrontView(); }
87   virtual void onViewFitAll();
88   virtual void onBackView() { getView(MAIN_VIEW)->onBackView(); }
89   virtual void onTopView() { getView(MAIN_VIEW)->onTopView(); }
90   virtual void onBottomView() { getView(MAIN_VIEW)->onBottomView(); }
91   virtual void onLeftView() { getView(MAIN_VIEW)->onLeftView(); }
92   virtual void onRightView() { getView(MAIN_VIEW)->onRightView(); }
93   virtual void onClockWiseView() { getView(MAIN_VIEW)->onClockWiseView(); }
94   virtual void onAntiClockWiseView() { getView(MAIN_VIEW)->onAntiClockWiseView(); }
95   virtual void onResetView() { getView(MAIN_VIEW)->onResetView(); }
96   virtual void onFitAll();
97   virtual void activateZoom() {}
98   virtual void activateWindowFit() {}
99   virtual void activateRotation() {}
100   virtual void activatePanning() {}
101   virtual void activateGlobalPanning() {}
102   virtual void onSetRotationPoint( bool on ) {}
103   virtual void onAxialScale() {}
104   virtual void onAmbientToogle() {}
105   virtual void onMemorizeView() {}
106   virtual void onRestoreView() {}
107   virtual void onSwitchInteractionStyle( bool on ) {}
108
109   virtual void activateSetRotationGravity() {}
110   virtual void activateSetRotationSelected( double theX, double theY, double theZ ) {}
111   virtual void activateStartPointSelection() {}
112   virtual void updateGravityCoords() {}
113    
114   void onMaximizedView( OCCViewer_ViewWindow*, bool );
115
116   virtual void onDumpView();
117
118 protected:
119   virtual QImage dumpView();
120   virtual bool   dumpViewToFormat( const QImage&, const QString&, const QString& );
121
122 private slots:
123   void onContextMenuRequested(QContextMenuEvent*);
124
125 private:
126   void connectViewSignals(OCCViewer_ViewWindow* theView);
127
128
129   QList<OCCViewer_ViewWindow*> myViews;
130   QGridLayout* myLayout;
131
132   OCCViewer_ViewWindow* myPopupRequestedView;
133 };
134
135 #endif