1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
24 #define PRS_EXPORT __declspec(dllexport)
26 #define PRS_EXPORT __declspec(dllimport)
33 class SALOME_Displayer;
34 class Handle_SALOME_InteractiveObject;
36 //===========================================================
38 * Class: SALOME_Prs \n
39 * Description: Base class for SALOME graphic object wrappers - presentations.\n
40 * Presentations are temporary objects, so they can be created on the stack.
42 //===========================================================
44 class PRS_EXPORT SALOME_Prs
48 virtual ~SALOME_Prs() {}
50 //! Key method for double dispatch of display operation
51 virtual void DisplayIn( SALOME_View* ) const = 0;
53 //! Key method for double dispatch of erase operation
54 virtual void EraseIn( SALOME_View*, const bool = false ) const = 0;
56 //! Key method for double dispatch of update operation
57 virtual void Update( SALOME_Displayer* ) = 0;
59 //! Should return true, if this presentation contains a graphic object
60 virtual bool IsNull() const = 0;
62 //! Key method for double dispatch of activation of subshapes selection
63 virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
66 //===========================================================
68 * Class: SALOME_OCCPrs \n
69 * Description: Base class for OpenCASCADE graphic object (AIS_InteractiveObject) wrappers.\n
70 * This intermediate class is necessary to avoid dependencies from OCC libs.
72 //===========================================================
74 class PRS_EXPORT SALOME_OCCPrs : public SALOME_Prs
77 //! It uses double dispatch in order to \n
78 //! invoke Display() method corresponding to the actual type of presentation.
79 virtual void DisplayIn( SALOME_View* ) const;
81 //! It uses double dispatch in order to \n
82 //! invoke Erase() method corresponding to the actual type of presentation.
83 virtual void EraseIn( SALOME_View*, const bool = false ) const;
85 //! It uses double dispatch in order to \n
86 //! invoke Update() method corresponding to the actual type of presentation.
87 virtual void Update( SALOME_Displayer* );
89 //! Key method for double dispatch of activation of subshapes selection
90 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
93 //===========================================================
95 * Class: SALOME_VTKPrs \n
96 * Description: Base class for VTK graphic object (vtkActor) wrappers \n
97 * This intermediate class is necessary to avoid dependencies from VTK libs.
99 //===========================================================
100 class PRS_EXPORT SALOME_VTKPrs : public SALOME_Prs
103 //! It uses double dispatch in order to \n
104 //! invoke Display() method corresponding to the actual type of presentation.
105 virtual void DisplayIn( SALOME_View* ) const;
107 //! It uses double dispatch in order to \n
108 //! invoke Erase() method corresponding to the actual type of presentation.
109 virtual void EraseIn( SALOME_View*, const bool = false ) const;
111 //! It uses double dispatch in order to \n
112 //! invoke Update() method corresponding to the actual type of presentation.
113 virtual void Update( SALOME_Displayer* );
115 //! Key method for double dispatch of activation of subshapes selection
116 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
119 //===========================================================
121 * Class: SALOME_Prs2d \n
122 * Description: Base class for Plot2d graphic object (Plot2d_Curve) wrappers.
124 //===========================================================
126 class PRS_EXPORT SALOME_Prs2d : public SALOME_Prs
129 //! It uses double dispatch in order to
130 //! invoke Display() method corresponding to the actual type of presentation.
131 virtual void DisplayIn( SALOME_View* ) const;
133 //! It uses double dispatch in order to
134 //! invoke Erase() method corresponding to the actual type of presentation.
135 virtual void EraseIn( SALOME_View*, const bool = false ) const;
137 //! It uses double dispatch in order to
138 //! invoke Update() method corresponding to the actual type of presentation.
139 virtual void Update( SALOME_Displayer* );
141 //! Key method for double dispatch of activation of subshapes selection
142 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
145 /////////////////////////////////////////////////////////////////////////
146 // Base classes for object wrappers for any other visualization libraries
147 // should be added here!
148 /////////////////////////////////////////////////////////////////////////
150 //===========================================================
152 * Class: SALOME_View \n
153 * Description: Base class for SALOME views (or view frames)
155 //===========================================================
157 class PRS_EXPORT SALOME_View
161 virtual ~SALOME_View() {}
163 //! This Display() method should be called to display given presentation \n
164 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
165 //! so that it could perform double dispatch.
166 void Display( const SALOME_Prs* );
168 //! This Erase() method should be called to erase given presentation \n
169 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
170 //! so that it could perform double dispatch.
171 void Erase( const SALOME_Prs*, const bool = false );
173 //! This LocalSelection() method should be called to activate sub-shapes selection \n
174 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
175 //! so that it could perform double dispatch.
176 void LocalSelection( const SALOME_Prs*, const int );
178 // Interface for derived views
180 // Display() methods for ALL kinds of presentation should appear here
181 virtual void Display( const SALOME_OCCPrs* );//!< Display SALOME_OCCPrs presentation.
182 virtual void Display( const SALOME_VTKPrs* );//!< Display SALOME_VTKPrs presentation.
183 virtual void Display( const SALOME_Prs2d* );//!< Display SALOME_Prs2d presentation.
184 // Add new Display() methods here...
186 // Erase() methods for ALL kinds of presentation should appear here
187 virtual void Erase( const SALOME_OCCPrs*, const bool = false );//!< Erase SALOME_OCCPrs
188 virtual void Erase( const SALOME_VTKPrs*, const bool = false );//!< Erase SALOME_VTKPrs
189 virtual void Erase( const SALOME_Prs2d*, const bool = false );//!< Erase SALOME_Prs2d
190 virtual void EraseAll( const bool = false );
191 // Add new Erase() methods here...
193 // LocalSelection() methods for ALL kinds of presentation should appear here
194 virtual void LocalSelection( const SALOME_OCCPrs*, const int );//!< Local selection SALOME_OCCPrs
195 virtual void LocalSelection( const SALOME_VTKPrs*, const int );//!< Local selection SALOME_VTKPrs
196 virtual void LocalSelection( const SALOME_Prs2d* , const int );//!< Local selection SALOME_Prs2d
198 //! Deactivates selection of sub-shapes (must be redefined with OCC viewer)
199 virtual void GlobalSelection( const bool = false ) const;
201 //! Creates empty presenation of corresponding type
202 virtual SALOME_Prs* CreatePrs( const char* entry = 0 ) { return 0; }
204 // Axiluary methods called before and after displaying of objects
205 virtual void BeforeDisplay( SALOME_Displayer* d ) {} //!< Null body here
206 virtual void AfterDisplay ( SALOME_Displayer* d ) {} //!< Null body here
209 //! \retval Return false.
210 virtual bool isVisible( const Handle_SALOME_InteractiveObject& ){ return false; }
211 virtual void Repaint() {} //!< Null body here.
214 //===========================================================
216 * Classes: SALOME_Displayer
217 * Description: These classes are used to specify type of view
220 //===========================================================
221 class PRS_EXPORT SALOME_OCCViewType {};
222 class PRS_EXPORT SALOME_VTKViewType {};
223 class PRS_EXPORT SALOME_Plot2dViewType {};
225 //===========================================================
227 * Class: SALOME_Displayer \n
228 * Description: Base class for SALOME displayers
230 //===========================================================
232 class PRS_EXPORT SALOME_Displayer
236 virtual ~SALOME_Displayer() {/*! Null body here*/}
238 //! This Update() method should be called to update given presentation \n
239 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
240 //! so that it could perform double dispatch.
241 void UpdatePrs( SALOME_Prs* );
243 // Interface for derived displayers
245 // Update() methods for ALL kinds of presentation should appear here
246 virtual void Update( SALOME_OCCPrs* );//!< Update SALOME_OCCPrs presentation.
247 virtual void Update( SALOME_VTKPrs* );//!< Update SALOME_VTKPrs presentation.
248 virtual void Update( SALOME_Prs2d* );//!< Update SALOME_Prs2d presentation.
249 // Add new Update() methods here...
251 // Axiluary methods called before and after displaying of objects
252 virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCViewType& ){/*! Null body here*/};
253 virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCViewType& ){/*! Null body here*/};
254 virtual void BeforeDisplay( SALOME_View*, const SALOME_VTKViewType& ){/*! Null body here*/};
255 virtual void AfterDisplay ( SALOME_View*, const SALOME_VTKViewType& ){/*! Null body here*/};
256 virtual void BeforeDisplay( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};
257 virtual void AfterDisplay ( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};