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_ViewPort.h"
34 #include "QAD_Popup.h"
35 #include "QAD_ViewFrame.h"
36 #include "SALOME_InteractiveObject.hxx"
38 // Open CASCADE Includes
39 #include <AIS_InteractiveContext.hxx>
40 #include <AIS_Trihedron.hxx>
42 class OCCViewer_ViewFrame;
43 class OCCViewer_AISSelector;
45 class QAD_EXPORT OCCViewer_Viewer3d : public QObject, public QAD_PopupClientServer
50 OCCViewer_Viewer3d(OCCViewer_ViewFrame* vf);
51 ~OCCViewer_Viewer3d();
54 void vwKeyPress( QKeyEvent* );
55 void vwKeyRelease( QKeyEvent* );
56 void vwDrawExternal( QPainter* );
59 void onKeyPress(QKeyEvent*);
61 void onMouseMove(QMouseEvent*);
62 void onMousePress(QMouseEvent*);
63 void onMouseRelease(QMouseEvent*);
64 void onMouseDoubleClick(QMouseEvent*);
66 void onSelectionDone( bool bAdded );
67 void onSelectionCancel( bool bAdded );
69 void onTransformationStarted( OCCViewer_ViewPort::OperationType );
70 void onTransformationFinished( OCCViewer_ViewPort::OperationType );
73 void vw3dSelectionDone (bool added);
74 void vw3dSelectionCancel();
75 void vw3dSelectionEnabled( bool );
78 void createViewer3d();
79 Handle(V3d_Viewer) getViewer3d() const;
81 void setTrihedronSize(float size);
82 bool isTrihedronDisplayed();
84 /* popup management */
87 void setCursor( const QCursor& cursor);
88 const QCursor& cursor() const;
89 void setIcon( const QPixmap& icon);
90 const QPixmap& icon() const;
91 void setBackgroundColor( const QColor& aColor);
92 const QColor& backgroundColor() const;
94 /* Selection management */
95 bool highlight( const Handle(SALOME_InteractiveObject)& IObject,
96 bool highlight, bool update=true);
97 bool unHighlightAll();
98 bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject,
99 bool onlyInViewer = false );
100 bool isVisible( const Handle(SALOME_InteractiveObject)& IObject );
101 void rename( const Handle(SALOME_InteractiveObject)& IObject,
104 bool enabledSelection() const;
105 void enableSelection( bool );
106 void enableMultipleSelection( bool );
108 void SetColor(const Handle(SALOME_InteractiveObject)& IObject,
110 void SwitchRepresentation(const Handle(SALOME_InteractiveObject)& IObject,
112 void SetTransparency(const Handle(SALOME_InteractiveObject)& IObject,
115 /* interactive context */
116 Handle (AIS_InteractiveContext) getAISContext() const;
117 OCCViewer_AISSelector* getAISSelector() const;
120 Handle(AIS_Trihedron) getTrihedron() const;
123 bool eventFilter( QObject *, QEvent * );
126 OCCViewer_ViewFrame* myViewFrame;
130 void globalSelectionDone( const bool );
131 void localSelectionDone ( const bool );
133 Handle (AIS_InteractiveContext) myAISContext;
134 OCCViewer_AISSelector* myAISSelector;
135 bool myEnableSelection;
136 Handle(AIS_Trihedron) myTrihedron;
137 Handle(V3d_Viewer) myV3dViewer;
138 Handle(V3d_Viewer) myV3dCollector;
140 /* attributes for all the views */
141 QPixmap myIcon; /* icon */
142 QCursor myCursor; /* current cursor */
143 QColor myBackColor; /* background */