6 #define PRS_EXPORT __declspec(dllexport)
8 #define PRS_EXPORT __declspec(dllimport)
15 class SALOME_Displayer;
16 class Handle_SALOME_InteractiveObject;
18 //===========================================================
21 * Description: Base class for SALOME graphic object wrappers - presentations.
22 * Presentations are temporary objects, so they can be created on the stack.
24 //===========================================================
26 class PRS_EXPORT SALOME_Prs
29 virtual ~SALOME_Prs() {}
32 virtual void DisplayIn( SALOME_View* ) const = 0;
33 // Key method for double dispatch of display operation
35 virtual void EraseIn( SALOME_View*, const bool = false ) const = 0;
36 // Key method for double dispatch of erase operation
38 virtual void Update( SALOME_Displayer* ) = 0;
39 // Key method for double dispatch of update operation
41 virtual bool IsNull() const = 0;
42 // Should return true, if this presentation contains a graphic object
44 virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
45 // Key method for double dispatch of activation of subshapes selection
48 //===========================================================
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.
54 //===========================================================
56 class PRS_EXPORT SALOME_OCCPrs : public SALOME_Prs
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.
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.
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.
71 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
72 // Key method for double dispatch of activation of subshapes selection
75 //===========================================================
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.
81 //===========================================================
83 class PRS_EXPORT SALOME_VTKPrs : public SALOME_Prs
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.
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.
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.
98 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
99 // Key method for double dispatch of activation of subshapes selection
102 //===========================================================
104 * Class: SALOME_Prs2d
105 * Description: Base class for Plot2d graphic object (Plot2d_Curve) wrappers.
107 //===========================================================
109 class PRS_EXPORT SALOME_Prs2d : public SALOME_Prs
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.
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.
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.
124 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
125 // Key method for double dispatch of activation of subshapes selection
128 /////////////////////////////////////////////////////////////////////////
129 // Base classes for object wrappers for any other visualization libraries
130 // should be added here!
131 /////////////////////////////////////////////////////////////////////////
133 //===========================================================
136 * Description: Base class for SALOME views (or view frames)
138 //===========================================================
140 class PRS_EXPORT SALOME_View
143 virtual ~SALOME_View() {}
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.
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.
160 // Interface for derived views
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...
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...
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 );
180 virtual void GlobalSelection( const bool = false ) const;
181 // Deactivates selection of sub-shapes (must be redefined with OCC viewer)
183 // Creates empty presenation of corresponding type
184 virtual SALOME_Prs* CreatePrs( const char* entry = 0 ) { return 0; }
186 // Axiluary methods called before and after displaying of objects
187 virtual void BeforeDisplay( SALOME_Displayer* d ) {}
188 virtual void AfterDisplay ( SALOME_Displayer* d ) {}
191 virtual bool isVisible( const Handle_SALOME_InteractiveObject& ) { return false; }
192 virtual void Repaint() {}
195 //===========================================================
197 * Classes: SALOME_Displayer
198 * Description: These classes are used to specify type of view
201 //===========================================================
203 class PRS_EXPORT SALOME_OCCViewType {};
204 class PRS_EXPORT SALOME_VTKViewType {};
205 class PRS_EXPORT SALOME_Plot2dViewType {};
207 //===========================================================
209 * Class: SALOME_Displayer
210 * Description: Base class for SALOME displayers
212 //===========================================================
214 class PRS_EXPORT SALOME_Displayer
217 virtual ~SALOME_Displayer() {}
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.
225 // Interface for derived displayers
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...
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& ) {};