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;
38 Base class for SALOME graphic object wrappers - presentations.
39 Presentations are temporary objects, so they can be created on the stack.
42 class PRS_EXPORT SALOME_Prs
46 virtual ~SALOME_Prs() {}
48 //! Key method for double dispatch of display operation
49 virtual void DisplayIn( SALOME_View* ) const = 0;
51 //! Key method for double dispatch of erase operation
52 virtual void EraseIn( SALOME_View*, const bool = false ) const = 0;
54 //! Key method for double dispatch of update operation
55 virtual void Update( SALOME_Displayer* ) = 0;
57 //! Should return true, if this presentation contains a graphic object
58 virtual bool IsNull() const = 0;
60 //! Key method for double dispatch of activation of subshapes selection
61 virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
66 Base class for OpenCASCADE graphic object (AIS_InteractiveObject) wrappers.
67 This intermediate class is necessary to avoid dependencies from OCC libs.
70 class PRS_EXPORT SALOME_OCCPrs : public SALOME_Prs
73 //! It uses double dispatch in order to \n
74 //! invoke Display() method corresponding to the actual type of presentation.
75 virtual void DisplayIn( SALOME_View* ) const;
77 //! It uses double dispatch in order to \n
78 //! invoke Erase() method corresponding to the actual type of presentation.
79 virtual void EraseIn( SALOME_View*, const bool = false ) const;
81 //! It uses double dispatch in order to \n
82 //! invoke Update() method corresponding to the actual type of presentation.
83 virtual void Update( SALOME_Displayer* );
85 //! Key method for double dispatch of activation of subshapes selection
86 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
91 Base class for VTK graphic object (vtkActor) wrappers.
92 This intermediate class is necessary to avoid dependencies from VTK libs.
94 class PRS_EXPORT SALOME_VTKPrs : public SALOME_Prs
97 //! It uses double dispatch in order to \n
98 //! invoke Display() method corresponding to the actual type of presentation.
99 virtual void DisplayIn( SALOME_View* ) const;
101 //! It uses double dispatch in order to \n
102 //! invoke Erase() method corresponding to the actual type of presentation.
103 virtual void EraseIn( SALOME_View*, const bool = false ) const;
105 //! It uses double dispatch in order to \n
106 //! invoke Update() method corresponding to the actual type of presentation.
107 virtual void Update( SALOME_Displayer* );
109 //! Key method for double dispatch of activation of subshapes selection
110 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
115 Base class for Plot2d graphic object (Plot2d_Curve) wrappers.
117 class PRS_EXPORT SALOME_Prs2d : public SALOME_Prs
120 //! It uses double dispatch in order to
121 //! invoke Display() method corresponding to the actual type of presentation.
122 virtual void DisplayIn( SALOME_View* ) const;
124 //! It uses double dispatch in order to
125 //! invoke Erase() method corresponding to the actual type of presentation.
126 virtual void EraseIn( SALOME_View*, const bool = false ) const;
128 //! It uses double dispatch in order to
129 //! invoke Update() method corresponding to the actual type of presentation.
130 virtual void Update( SALOME_Displayer* );
132 //! Key method for double dispatch of activation of subshapes selection
133 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
137 Base classes for object wrappers for any other visualization libraries should be added here!
141 Base class for SALOME views (or view frames)
143 class PRS_EXPORT SALOME_View
147 virtual ~SALOME_View() {}
149 //! This Display() method should be called to display given presentation \n
150 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
151 //! so that it could perform double dispatch.
152 void Display( const SALOME_Prs* );
154 //! This Erase() method should be called to erase given presentation \n
155 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
156 //! so that it could perform double dispatch.
157 void Erase( const SALOME_Prs*, const bool = false );
159 //! This LocalSelection() method should be called to activate sub-shapes selection \n
160 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
161 //! so that it could perform double dispatch.
162 void LocalSelection( const SALOME_Prs*, const int );
164 // Interface for derived views
166 // Display() methods for ALL kinds of presentation should appear here
167 virtual void Display( const SALOME_OCCPrs* );//!< Display SALOME_OCCPrs presentation.
168 virtual void Display( const SALOME_VTKPrs* );//!< Display SALOME_VTKPrs presentation.
169 virtual void Display( const SALOME_Prs2d* );//!< Display SALOME_Prs2d presentation.
170 // Add new Display() methods here...
172 // Erase() methods for ALL kinds of presentation should appear here
173 virtual void Erase( const SALOME_OCCPrs*, const bool = false );//!< Erase SALOME_OCCPrs
174 virtual void Erase( const SALOME_VTKPrs*, const bool = false );//!< Erase SALOME_VTKPrs
175 virtual void Erase( const SALOME_Prs2d*, const bool = false );//!< Erase SALOME_Prs2d
176 virtual void EraseAll( const bool = false );
177 // Add new Erase() methods here...
179 // LocalSelection() methods for ALL kinds of presentation should appear here
180 virtual void LocalSelection( const SALOME_OCCPrs*, const int );//!< Local selection SALOME_OCCPrs
181 virtual void LocalSelection( const SALOME_VTKPrs*, const int );//!< Local selection SALOME_VTKPrs
182 virtual void LocalSelection( const SALOME_Prs2d* , const int );//!< Local selection SALOME_Prs2d
184 //! Deactivates selection of sub-shapes (must be redefined with OCC viewer)
185 virtual void GlobalSelection( const bool = false ) const;
187 //! Creates empty presenation of corresponding type
188 virtual SALOME_Prs* CreatePrs( const char* entry = 0 ) { return 0; }
190 // Axiluary methods called before and after displaying of objects
191 virtual void BeforeDisplay( SALOME_Displayer* d ) {} //!< Null body here
192 virtual void AfterDisplay ( SALOME_Displayer* d ) {} //!< Null body here
195 //! \retval Return false.
196 virtual bool isVisible( const Handle_SALOME_InteractiveObject& ){ return false; }
197 virtual void Repaint() {} //!< Null body here.
201 \class SALOME_Displayer
202 These classes are used to specify type of view VTK, OCC or Plot2d
204 class PRS_EXPORT SALOME_OCCViewType {};
205 class PRS_EXPORT SALOME_VTKViewType {};
206 class PRS_EXPORT SALOME_Plot2dViewType {};
209 \class SALOME_Displayer
210 Base class for SALOME displayers
212 class PRS_EXPORT SALOME_Displayer
216 virtual ~SALOME_Displayer() {/*! Null body here*/}
218 //! This Update() method should be called to update given presentation \n
219 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
220 //! so that it could perform double dispatch.
221 void UpdatePrs( SALOME_Prs* );
223 // Interface for derived displayers
225 // Update() methods for ALL kinds of presentation should appear here
226 virtual void Update( SALOME_OCCPrs* );//!< Update SALOME_OCCPrs presentation.
227 virtual void Update( SALOME_VTKPrs* );//!< Update SALOME_VTKPrs presentation.
228 virtual void Update( SALOME_Prs2d* );//!< Update SALOME_Prs2d presentation.
229 // Add new Update() methods here...
231 // Axiluary methods called before and after displaying of objects
232 virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCViewType& ){/*! Null body here*/};
233 virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCViewType& ){/*! Null body here*/};
234 virtual void BeforeDisplay( SALOME_View*, const SALOME_VTKViewType& ){/*! Null body here*/};
235 virtual void AfterDisplay ( SALOME_View*, const SALOME_VTKViewType& ){/*! Null body here*/};
236 virtual void BeforeDisplay( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};
237 virtual void AfterDisplay ( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};