1 // SALOME OCCViewer : build OCC Viewer into Salome desktop
3 // Copyright (C) 2003 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.
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : OCCViewer_ViewFrame.h
25 // Author : Nicolas REJNERI
29 #ifndef OCCViewer_ViewFrame_H
30 #define OCCViewer_ViewFrame_H
32 #include "OCCViewer_ViewPort.h"
33 #include "QAD_ViewFrame.h"
34 #include "SALOME_Selection.h"
36 class OCCViewer_Viewer3d;
39 Class : OCCViewer_ViewFrame
40 Description : View frame for Open CASCADE view
43 class QAD_EXPORT OCCViewer_ViewFrame : public QAD_ViewFrame
49 OCCViewer_ViewFrame( QWidget* parent, const QString& title );
50 OCCViewer_ViewFrame( QWidget* parent = 0 );
51 virtual ~OCCViewer_ViewFrame();
54 Reimplemented from QAD_ViewFrame
57 virtual ViewType getTypeView() const { return VIEW_OCC; }
58 virtual QWidget* getViewWidget();
59 virtual void setBackgroundColor( const QColor& );
60 virtual QColor backgroundColor() const;
61 virtual void SetSelectionMode( Selection_Mode mode ) {};
63 /* popup management */
65 virtual void setPopupServer( QAD_Application* );
67 /* interactive object management */
69 virtual void highlight( const Handle(SALOME_InteractiveObject)&,
71 const bool update = true );
72 virtual void unHighlightAll();
73 virtual void rename( const Handle(SALOME_InteractiveObject)&,
75 virtual bool isInViewer( const Handle(SALOME_InteractiveObject)& );
76 virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
78 /* undo/redo management */
80 void undo( QAD_Study* aStudy, const char* StudyFrameEntry );
81 void redo( QAD_Study* aStudy, const char* StudyFrameEntry );
85 virtual Handle(SALOME_InteractiveObject) FindIObject( const char* Entry );
88 virtual void Display( const Handle(SALOME_InteractiveObject)&,
90 virtual void DisplayOnly( const Handle(SALOME_InteractiveObject)& );
91 virtual void Erase( const Handle(SALOME_InteractiveObject)&,
93 virtual void DisplayAll();
94 virtual void EraseAll();
95 virtual void Repaint();
97 void AdjustTrihedrons( const bool forced = false );
99 /* Reimplemented from SALOME_View */
101 virtual void Display( const SALOME_OCCPrs* );
102 virtual void Erase( const SALOME_OCCPrs*, const bool = false );
103 virtual SALOME_Prs* CreatePrs( const char* entry = 0 );
104 virtual void BeforeDisplay( SALOME_Displayer* d );
105 virtual void AfterDisplay ( SALOME_Displayer* d );
106 virtual void LocalSelection( const SALOME_OCCPrs*, const int );
107 virtual void GlobalSelection( const bool = false ) const;
109 /* Own public methods */
111 void setViewPort( OCCViewer_ViewPort* );
112 OCCViewer_ViewPort* getViewPort() const;
114 void setViewer( OCCViewer_Viewer3d* );
115 OCCViewer_Viewer3d* getViewer() const;
117 void setVisible( const bool isVisible = true );
119 void setCursor( const QCursor& );
120 QCursor cursor() const;
124 void vfTransformationStarted ( OCCViewer_ViewPort::OperationType );
125 void vfTransformationFinished( OCCViewer_ViewPort::OperationType );
126 void vfDrawExternal( QPainter* painter );
127 void vfMousePress( QMouseEvent* );
128 void vfMouseRelease( QMouseEvent* );
129 void vfMouseMove( QMouseEvent* );
130 void vfMouseDoubleClick( QMouseEvent* );
131 void vfKeyPress( QKeyEvent* );
132 void vfKeyRelease( QKeyEvent* );
133 void vfResize( QResizeEvent* );
134 void vfPrint( QPaintEvent* );
135 void vfViewClosing( QCloseEvent* );
136 void vfMoved ( QMoveEvent* );
143 void onViewFitArea();
144 void onViewGlobalPan();
153 void onViewTrihedron();
154 void onAdjustTrihedron();
163 void onRotateRight();
172 void closeEvent( QCloseEvent* );
173 void resizeEvent( QResizeEvent* );
174 void keyPressEvent( QKeyEvent * );
177 bool getTrihedronSize( double& theNewSize, double& theSize );
178 void redisplayAll( QAD_Study*, const bool = true );
182 OCCViewer_Viewer3d* myViewer; // my owner
183 OCCViewer_ViewPort* myViewPort; // child viewport