6 #define PRS_EXPORT __declspec(dllexport)
8 #define PRS_EXPORT __declspec(dllimport)
15 class SALOME_Displayer;
16 class Handle_SALOME_InteractiveObject;
18 //===========================================================
20 * Class: SALOME_Prs \n
21 * Description: Base class for SALOME graphic object wrappers - presentations.\n
22 * Presentations are temporary objects, so they can be created on the stack.
24 //===========================================================
26 class PRS_EXPORT SALOME_Prs
30 virtual ~SALOME_Prs() {}
32 //! Key method for double dispatch of display operation
33 virtual void DisplayIn( SALOME_View* ) const = 0;
35 //! Key method for double dispatch of erase operation
36 virtual void EraseIn( SALOME_View*, const bool = false ) const = 0;
38 //! Key method for double dispatch of update operation
39 virtual void Update( SALOME_Displayer* ) = 0;
41 //! Should return true, if this presentation contains a graphic object
42 virtual bool IsNull() const = 0;
44 //! Key method for double dispatch of activation of subshapes selection
45 virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
48 //===========================================================
50 * Class: SALOME_OCCPrs \n
51 * Description: Base class for OpenCASCADE graphic object (AIS_InteractiveObject) wrappers.\n
52 * This intermediate class is necessary to avoid dependencies from OCC libs.
54 //===========================================================
56 class PRS_EXPORT SALOME_OCCPrs : public SALOME_Prs
59 //! It uses double dispatch in order to \n
60 //! invoke Display() method corresponding to the actual type of presentation.
61 virtual void DisplayIn( SALOME_View* ) const;
63 //! It uses double dispatch in order to \n
64 //! invoke Erase() method corresponding to the actual type of presentation.
65 virtual void EraseIn( SALOME_View*, const bool = false ) const;
67 //! It uses double dispatch in order to \n
68 //! invoke Update() method corresponding to the actual type of presentation.
69 virtual void Update( SALOME_Displayer* );
71 //! Key method for double dispatch of activation of subshapes selection
72 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
75 //===========================================================
77 * Class: SALOME_VTKPrs \n
78 * Description: Base class for VTK graphic object (vtkActor) wrappers \n
79 * This intermediate class is necessary to avoid dependencies from VTK libs.
81 //===========================================================
82 class PRS_EXPORT SALOME_VTKPrs : public SALOME_Prs
85 //! It uses double dispatch in order to \n
86 //! invoke Display() method corresponding to the actual type of presentation.
87 virtual void DisplayIn( SALOME_View* ) const;
89 //! It uses double dispatch in order to \n
90 //! invoke Erase() method corresponding to the actual type of presentation.
91 virtual void EraseIn( SALOME_View*, const bool = false ) const;
93 //! It uses double dispatch in order to \n
94 //! invoke Update() method corresponding to the actual type of presentation.
95 virtual void Update( SALOME_Displayer* );
97 //! Key method for double dispatch of activation of subshapes selection
98 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
101 //===========================================================
103 * Class: SALOME_Prs2d \n
104 * Description: Base class for Plot2d graphic object (Plot2d_Curve) wrappers.
106 //===========================================================
108 class PRS_EXPORT SALOME_Prs2d : public SALOME_Prs
111 //! It uses double dispatch in order to
112 //! invoke Display() method corresponding to the actual type of presentation.
113 virtual void DisplayIn( SALOME_View* ) const;
115 //! It uses double dispatch in order to
116 //! invoke Erase() method corresponding to the actual type of presentation.
117 virtual void EraseIn( SALOME_View*, const bool = false ) const;
119 //! It uses double dispatch in order to
120 //! invoke Update() method corresponding to the actual type of presentation.
121 virtual void Update( SALOME_Displayer* );
123 //! Key method for double dispatch of activation of subshapes selection
124 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
127 /////////////////////////////////////////////////////////////////////////
128 // Base classes for object wrappers for any other visualization libraries
129 // should be added here!
130 /////////////////////////////////////////////////////////////////////////
132 //===========================================================
134 * Class: SALOME_View \n
135 * Description: Base class for SALOME views (or view frames)
137 //===========================================================
139 class PRS_EXPORT SALOME_View
143 virtual ~SALOME_View() {}
145 //! This Display() method should be called to display given presentation \n
146 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
147 //! so that it could perform double dispatch.
148 void Display( const SALOME_Prs* );
150 //! This Erase() method should be called to erase given presentation \n
151 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
152 //! so that it could perform double dispatch.
153 void Erase( const SALOME_Prs*, const bool = false );
155 //! This LocalSelection() method should be called to activate sub-shapes selection \n
156 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
157 //! so that it could perform double dispatch.
158 void LocalSelection( const SALOME_Prs*, const int );
160 // Interface for derived views
162 // Display() methods for ALL kinds of presentation should appear here
163 virtual void Display( const SALOME_OCCPrs* );//!< Display SALOME_OCCPrs presentation.
164 virtual void Display( const SALOME_VTKPrs* );//!< Display SALOME_VTKPrs presentation.
165 virtual void Display( const SALOME_Prs2d* );//!< Display SALOME_Prs2d presentation.
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 );//!< Erase SALOME_OCCPrs
170 virtual void Erase( const SALOME_VTKPrs*, const bool = false );//!< Erase SALOME_VTKPrs
171 virtual void Erase( const SALOME_Prs2d*, const bool = false );//!< Erase SALOME_Prs2d
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 );//!< Local selection SALOME_OCCPrs
177 virtual void LocalSelection( const SALOME_VTKPrs*, const int );//!< Local selection SALOME_VTKPrs
178 virtual void LocalSelection( const SALOME_Prs2d* , const int );//!< Local selection SALOME_Prs2d
180 //! Deactivates selection of sub-shapes (must be redefined with OCC viewer)
181 virtual void GlobalSelection( const bool = false ) const;
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 ) {} //!< Null body here
188 virtual void AfterDisplay ( SALOME_Displayer* d ) {} //!< Null body here
191 //! \retval Return false.
192 virtual bool isVisible( const Handle_SALOME_InteractiveObject& ){ return false; }
193 virtual void Repaint() {} //!< Null body here.
196 //===========================================================
198 * Classes: SALOME_Displayer
199 * Description: These classes are used to specify type of view
202 //===========================================================
203 class PRS_EXPORT SALOME_OCCViewType {};
204 class PRS_EXPORT SALOME_VTKViewType {};
205 class PRS_EXPORT SALOME_Plot2dViewType {};
207 //===========================================================
209 * Class: SALOME_Displayer \n
210 * Description: Base class for SALOME displayers
212 //===========================================================
214 class PRS_EXPORT SALOME_Displayer
218 virtual ~SALOME_Displayer() {/*! Null body here*/}
220 //! This Update() method should be called to update given presentation \n
221 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
222 //! so that it could perform double dispatch.
223 void UpdatePrs( SALOME_Prs* );
225 // Interface for derived displayers
227 // Update() methods for ALL kinds of presentation should appear here
228 virtual void Update( SALOME_OCCPrs* );//!< Update SALOME_OCCPrs presentation.
229 virtual void Update( SALOME_VTKPrs* );//!< Update SALOME_VTKPrs presentation.
230 virtual void Update( SALOME_Prs2d* );//!< Update SALOME_Prs2d presentation.
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& ){/*! Null body here*/};
235 virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCViewType& ){/*! Null body here*/};
236 virtual void BeforeDisplay( SALOME_View*, const SALOME_VTKViewType& ){/*! Null body here*/};
237 virtual void AfterDisplay ( SALOME_View*, const SALOME_VTKViewType& ){/*! Null body here*/};
238 virtual void BeforeDisplay( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};
239 virtual void AfterDisplay ( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};