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_Viewer3d.h
25 // Author : Nicolas REJNERI
29 #ifndef OCCVIEWER_VIEWER3D_H
30 #define OCCVIEWER_VIEWER3D_H
32 #include "OCCViewer_ViewFrame.h"
33 #include "OCCViewer_AISSelector.h"
36 #include "QAD_Popup.h"
37 #include "QAD_ViewFrame.h"
38 #include "SALOME_InteractiveObject.hxx"
40 // Open CASCADE Includes
41 #include <AIS_InteractiveContext.hxx>
42 #include <AIS_Trihedron.hxx>
44 class QAD_EXPORT OCCViewer_Viewer3d : public QObject, public QAD_PopupClientServer
49 OCCViewer_Viewer3d(OCCViewer_ViewFrame* vf);
50 ~OCCViewer_Viewer3d();
53 void vwKeyPress( QKeyEvent* );
54 void vwKeyRelease( QKeyEvent* );
55 void vwDrawExternal( QPainter* );
58 void onKeyPress(QKeyEvent*);
60 void onMouseMove(QMouseEvent*);
61 void onMousePress(QMouseEvent*);
62 void onMouseRelease(QMouseEvent*);
63 void onMouseDoubleClick(QMouseEvent*);
65 void onSelectionDone( bool bAdded );
66 void onSelectionCancel( bool bAdded );
68 void onTransformationStarted( OCCViewer_ViewPort::OperationType );
69 void onTransformationFinished( OCCViewer_ViewPort::OperationType );
72 void vw3dSelectionDone (bool added);
73 void vw3dSelectionCancel();
74 void vw3dSelectionEnabled( bool );
77 void createViewer3d();
78 Handle(V3d_Viewer) getViewer3d() const;
80 void setTrihedronSize(float size);
81 bool isTrihedronDisplayed();
83 /* popup management */
86 void setCursor( const QCursor& cursor);
87 const QCursor& cursor() const;
88 void setIcon( const QPixmap& icon);
89 const QPixmap& icon() const;
90 void setBackgroundColor( const QColor& aColor);
91 const QColor& backgroundColor() const;
93 /* Selection management */
94 bool highlight( const Handle(SALOME_InteractiveObject)& IObject,
95 bool highlight, bool update=true);
96 bool unHighlightAll();
97 bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject,
98 bool onlyInViewer = false );
99 bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
100 void rename( const Handle(SALOME_InteractiveObject)& IObject,
103 bool enabledSelection() const;
104 void enableSelection( bool );
105 void enableMultipleSelection( bool );
107 void SetColor(const Handle(SALOME_InteractiveObject)& IObject,
109 void SwitchRepresentation(const Handle(SALOME_InteractiveObject)& IObject,
111 void SetTransparency(const Handle(SALOME_InteractiveObject)& IObject,
114 /* interactive context */
115 Handle (AIS_InteractiveContext) getAISContext() const;
116 OCCViewer_AISSelector* getAISSelector() const;
119 Handle(AIS_Trihedron) getTrihedron() const;
122 bool eventFilter( QObject *, QEvent * );
125 OCCViewer_ViewFrame* myViewFrame;
129 void globalSelectionDone( const bool );
130 void localSelectionDone ( const bool );
132 Handle (AIS_InteractiveContext) myAISContext;
133 OCCViewer_AISSelector* myAISSelector;
134 bool myEnableSelection;
135 Handle(AIS_Trihedron) myTrihedron;
136 Handle(V3d_Viewer) myV3dViewer;
137 Handle(V3d_Viewer) myV3dCollector;
139 /* attributes for all the views */
140 QPixmap myIcon; /* icon */
141 QCursor myCursor; /* current cursor */
142 QColor myBackColor; /* background */