Salome HOME
Removed an update of Cut tool bar button.
[modules/gui.git] / src / Prs / SALOME_Prs.h
1 #ifndef SALOME_PRS_H
2 #define SALOME_PRS_H
3
4 #ifdef WNT
5 #ifdef PRS_EXPORTS
6 #define PRS_EXPORT __declspec(dllexport)
7 #else
8 #define PRS_EXPORT __declspec(dllimport)
9 #endif
10 #else
11 #define PRS_EXPORT
12 #endif
13
14 class SALOME_View;
15 class SALOME_Displayer;
16 class Handle_SALOME_InteractiveObject;
17
18 //===========================================================
19 /*!
20  *  Class:       SALOME_Prs
21  *  Description: Base class for SALOME graphic object wrappers - presentations.
22  *               Presentations are temporary objects, so they can be created on the stack.
23  */
24 //===========================================================
25
26 class PRS_EXPORT SALOME_Prs
27 {
28 public:
29   virtual ~SALOME_Prs() {}
30   // Destructor
31
32   virtual void DisplayIn( SALOME_View* ) const = 0;
33   // Key method for double dispatch of display operation
34
35   virtual void EraseIn( SALOME_View*, const bool = false ) const = 0;
36   // Key method for double dispatch of erase operation
37
38   virtual void Update( SALOME_Displayer* ) = 0;
39   // Key method for double dispatch of update operation
40
41   virtual bool IsNull() const = 0;
42   // Should return true, if this presentation contains a graphic object
43
44   virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
45   // Key method for double dispatch of activation of subshapes selection
46 };
47
48 //===========================================================
49 /*!
50  *  Class:       SALOME_OCCPrs
51  *  Description: Base class for OpenCASCADE graphic object (AIS_InteractiveObject) wrappers.
52  *               This intermediate class is necessary to avoid dependencies from OCC libs.
53  */
54 //===========================================================
55
56 class PRS_EXPORT SALOME_OCCPrs : public SALOME_Prs
57 {
58 public:
59   virtual void DisplayIn( SALOME_View* ) const;
60   // It uses double dispatch in order to
61   // invoke Display() method corresponding to the actual type of presentation.
62
63   virtual void EraseIn( SALOME_View*, const bool = false ) const;
64   // It uses double dispatch in order to
65   // invoke Erase() method corresponding to the actual type of presentation.
66
67   virtual void Update( SALOME_Displayer* );
68   // It uses double dispatch in order to
69   // invoke Update() method corresponding to the actual type of presentation.
70
71   virtual void LocalSelectionIn( SALOME_View*, const int ) const;
72   // Key method for double dispatch of activation of subshapes selection
73 };
74
75 //===========================================================
76 /*!
77  *  Class:       SALOME_VTKPrs
78  *  Description: Base class for VTK graphic object (vtkActor) wrappers
79  *               This intermediate class is necessary to avoid dependencies from VTK libs.
80  */
81 //===========================================================
82
83 class PRS_EXPORT SALOME_VTKPrs : public SALOME_Prs
84 {
85 public:
86   virtual void DisplayIn( SALOME_View* ) const;
87   // It uses double dispatch in order to
88   // invoke Display() method corresponding to the actual type of presentation.
89
90   virtual void EraseIn( SALOME_View*, const bool = false ) const;
91   // It uses double dispatch in order to
92   // invoke Erase() method corresponding to the actual type of presentation.
93
94   virtual void Update( SALOME_Displayer* );
95   // It uses double dispatch in order to
96   // invoke Update() method corresponding to the actual type of presentation.
97
98   virtual void LocalSelectionIn( SALOME_View*, const int ) const;
99   // Key method for double dispatch of activation of subshapes selection
100 };
101
102 //===========================================================
103 /*!
104  *  Class:       SALOME_Prs2d
105  *  Description: Base class for Plot2d graphic object (Plot2d_Curve) wrappers.
106  */
107 //===========================================================
108
109 class PRS_EXPORT SALOME_Prs2d : public SALOME_Prs
110 {
111 public:
112   virtual void DisplayIn( SALOME_View* ) const;
113   // It uses double dispatch in order to
114   // invoke Display() method corresponding to the actual type of presentation.
115
116   virtual void EraseIn( SALOME_View*, const bool = false ) const;
117   // It uses double dispatch in order to
118   // invoke Erase() method corresponding to the actual type of presentation.
119
120   virtual void Update( SALOME_Displayer* );
121   // It uses double dispatch in order to
122   // invoke Update() method corresponding to the actual type of presentation.
123
124   virtual void LocalSelectionIn( SALOME_View*, const int ) const;
125   // Key method for double dispatch of activation of subshapes selection
126 };
127
128 /////////////////////////////////////////////////////////////////////////
129 // Base classes for object wrappers for any other visualization libraries
130 // should be added here!
131 /////////////////////////////////////////////////////////////////////////
132
133 //===========================================================
134 /*!
135  *  Class:       SALOME_View
136  *  Description: Base class for SALOME views (or view frames)
137  */
138 //===========================================================
139
140 class PRS_EXPORT SALOME_View
141 {
142 public:
143   virtual ~SALOME_View() {}
144   // Destructor
145
146   void Display( const SALOME_Prs* );
147   // This Display() method should be called to display given presentation
148   // created anywhere by anybody. It simply passes control to SALOME_Prs object
149   // so that it could perform double dispatch.
150   void Erase( const SALOME_Prs*, const bool = false );
151   // This Erase() method should be called to erase given presentation
152   // created anywhere by anybody. It simply passes control to SALOME_Prs object
153   // so that it could perform double dispatch.
154
155   void LocalSelection( const SALOME_Prs*, const int );
156   // This LocalSelection() method should be called to activate sub-shapes selection
157   // created anywhere by anybody. It simply passes control to SALOME_Prs object
158   // so that it could perform double dispatch.
159
160   // Interface for derived views
161
162   // Display() methods for ALL kinds of presentation should appear here
163   virtual void Display( const SALOME_OCCPrs* );
164   virtual void Display( const SALOME_VTKPrs* );
165   virtual void Display( const SALOME_Prs2d* );
166   // Add new Display() methods here...
167
168   // Erase() methods for ALL kinds of presentation should appear here
169   virtual void Erase( const SALOME_OCCPrs*, const bool = false );
170   virtual void Erase( const SALOME_VTKPrs*, const bool = false );
171   virtual void Erase( const SALOME_Prs2d*, const bool = false );
172   virtual void EraseAll( const bool = false );
173   // Add new Erase() methods here...
174
175   // LocalSelection() methods for ALL kinds of presentation should appear here
176   virtual void LocalSelection( const SALOME_OCCPrs*, const int );
177   virtual void LocalSelection( const SALOME_VTKPrs*, const int );
178   virtual void LocalSelection( const SALOME_Prs2d* , const int );  
179
180   virtual void GlobalSelection( const bool = false ) const;
181   // Deactivates selection of sub-shapes (must be redefined with OCC viewer)
182
183   // Creates empty presenation of corresponding type
184   virtual SALOME_Prs* CreatePrs( const char* entry = 0 ) { return 0; }
185
186   // Axiluary methods called before and after displaying of objects
187   virtual void BeforeDisplay( SALOME_Displayer* d ) {}
188   virtual void AfterDisplay ( SALOME_Displayer* d ) {}
189
190   // New methods (asv)
191   virtual bool isVisible( const Handle_SALOME_InteractiveObject& ) { return false; }
192   virtual void Repaint() {}
193 };
194
195 //===========================================================
196 /*!
197  *  Classes:     SALOME_Displayer
198  *  Description: These classes are used to specify type of view
199  *               VTK, OCC or Plot2d
200  */
201 //===========================================================
202
203 class PRS_EXPORT SALOME_OCCViewType    {};
204 class PRS_EXPORT SALOME_VTKViewType    {};
205 class PRS_EXPORT SALOME_Plot2dViewType {};
206
207 //===========================================================
208 /*!
209  *  Class:       SALOME_Displayer
210  *  Description: Base class for SALOME displayers
211  */
212 //===========================================================
213
214 class PRS_EXPORT SALOME_Displayer
215 {
216 public:
217   virtual ~SALOME_Displayer() {}
218   // Destructor
219
220   void UpdatePrs( SALOME_Prs* );
221   // This Update() method should be called to update given presentation
222   // created anywhere by anybody. It simply passes control to SALOME_Prs object
223   // so that it could perform double dispatch.
224
225   // Interface for derived displayers
226
227   // Update() methods for ALL kinds of presentation should appear here
228   virtual void Update( SALOME_OCCPrs* );
229   virtual void Update( SALOME_VTKPrs* );
230   virtual void Update( SALOME_Prs2d* );
231   // Add new Update() methods here...
232
233   // Axiluary methods called before and after displaying of objects
234   virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCViewType&    ) {};
235   virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCViewType&    ) {};
236   virtual void BeforeDisplay( SALOME_View*, const SALOME_VTKViewType&    ) {};
237   virtual void AfterDisplay ( SALOME_View*, const SALOME_VTKViewType&    ) {};
238   virtual void BeforeDisplay( SALOME_View*, const SALOME_Plot2dViewType& ) {};
239   virtual void AfterDisplay ( SALOME_View*, const SALOME_Plot2dViewType& ) {};
240 };
241
242 #endif