Salome HOME
Initialisation de la base KERNEL avec la version operationnelle de KERNEL_SRC issue...
[modules/kernel.git] / src / OCCViewer / OCCViewer_Viewer3d.h
1 //  File      : OCCViewer_Viewer3d.h
2 //  Created   : Wed Mar 20 11:00:02 2002
3 //  Author    : Nicolas REJNERI
4 //  Project   : SALOME
5 //  Module    : OCCViewer
6 //  Copyright : Open CASCADE 2002
7 //  $Header$
8
9
10 #ifndef OCCVIEWER_VIEWER3D_H
11 #define OCCVIEWER_VIEWER3D_H
12
13 #include "OCCViewer_ViewFrame.h"
14 #include "OCCViewer_AISSelector.h"
15
16 #include "QAD.h"
17 #include "QAD_Popup.h"
18 #include "QAD_ViewFrame.h"
19 #include "SALOME_InteractiveObject.hxx"
20
21 // Open CASCADE Includes
22 #include <AIS_InteractiveContext.hxx>
23 #include <AIS_Trihedron.hxx>
24
25 class QAD_EXPORT OCCViewer_Viewer3d : public QObject, public QAD_PopupClientServer
26 {
27   Q_OBJECT
28
29 public:
30   OCCViewer_Viewer3d(OCCViewer_ViewFrame* vf);
31   ~OCCViewer_Viewer3d();
32
33 signals:
34   void          vwKeyPress( QKeyEvent* );
35   void          vwKeyRelease( QKeyEvent* );
36   void          vwDrawExternal( QPainter* );
37
38 public slots:
39  void           onKeyPress(QKeyEvent*);
40
41  void           onMouseMove(QMouseEvent*);
42  void           onMousePress(QMouseEvent*);
43  void           onMouseRelease(QMouseEvent*);
44  void           onMouseDoubleClick(QMouseEvent*);
45
46  void           onSelectionDone( bool bAdded );
47  void           onSelectionCancel( bool bAdded );
48
49  void           onTransformationStarted( OCCViewer_ViewPort::OperationType );
50  void           onTransformationFinished( OCCViewer_ViewPort::OperationType );
51
52 signals:
53  void           vw3dSelectionDone (bool added);
54  void           vw3dSelectionCancel();
55  void           vw3dSelectionEnabled( bool );
56
57 public:
58  void               createViewer3d();
59  Handle(V3d_Viewer) getViewer3d() const;
60
61  void               setTrihedronSize(float size);
62  bool               isTrihedronDisplayed();
63
64   /* popup management */
65   void              onCreatePopup();
66
67   void              setCursor( const QCursor& cursor);
68   const QCursor&    cursor() const;
69   void              setIcon( const QPixmap& icon);
70   const QPixmap&    icon() const;
71   void              setBackgroundColor( const QColor& aColor);
72   const QColor&     backgroundColor() const;
73
74   /* Selection management */
75   bool          highlight( const Handle(SALOME_InteractiveObject)& IObject,
76                            bool highlight, bool update=true); 
77   bool          unHighlightAll(); 
78   bool          isInViewer( const Handle(SALOME_InteractiveObject)& IObject,
79                             bool onlyInViewer = false );
80   bool          isVisible( const Handle(SALOME_InteractiveObject)& IObject );
81   void          rename( const Handle(SALOME_InteractiveObject)& IObject,
82                         QString newName );
83
84   bool          enabledSelection() const;
85   void          enableSelection( bool );
86   void          enableMultipleSelection( bool );
87
88   void          SetColor(const Handle(SALOME_InteractiveObject)& IObject,
89                          QColor thecolor);
90   void          SwitchRepresentation(const Handle(SALOME_InteractiveObject)& IObject,
91                                      int mode);
92   void          SetTransparency(const Handle(SALOME_InteractiveObject)& IObject,
93                                 float transp);
94
95   /* interactive context */
96   Handle (AIS_InteractiveContext) getAISContext() const;
97   OCCViewer_AISSelector*          getAISSelector() const;
98
99   /* trihedron */
100   Handle(AIS_Trihedron)           getTrihedron() const;
101
102 protected:
103  bool        eventFilter( QObject *, QEvent * );
104
105 protected:
106  OCCViewer_ViewFrame*            myViewFrame;
107
108  Handle (AIS_InteractiveContext) myAISContext;
109  OCCViewer_AISSelector*          myAISSelector;
110  bool                            myEnableSelection;
111  Handle(AIS_Trihedron)           myTrihedron;
112  Handle(V3d_Viewer)              myV3dViewer;
113  Handle(V3d_Viewer)              myV3dCollector;
114
115  /* attributes for all the views */
116  QPixmap                         myIcon;        /* icon */
117  QCursor                         myCursor;      /* current cursor */
118  QColor                          myBackColor;   /* background */
119
120 };
121
122 #endif
123