1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
27 #define PRS_EXPORT __declspec(dllexport)
29 #define PRS_EXPORT __declspec(dllimport)
36 class SALOME_Displayer;
37 class Handle_SALOME_InteractiveObject;
41 Base class for SALOME graphic object wrappers - presentations.
42 Presentations are temporary objects, so they can be created on the stack.
45 class PRS_EXPORT SALOME_Prs
49 virtual ~SALOME_Prs() {}
51 //! Key method for double dispatch of display operation
52 virtual void DisplayIn( SALOME_View* ) const = 0;
54 //! Key method for double dispatch of erase operation
55 virtual void EraseIn( SALOME_View*, const bool = false ) const = 0;
57 //! Key method for double dispatch of update operation
58 virtual void Update( SALOME_Displayer* ) = 0;
60 //! Should return true, if this presentation contains a graphic object
61 virtual bool IsNull() const = 0;
63 //! Key method for double dispatch of activation of subshapes selection
64 virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
69 Base class for OpenCASCADE graphic object (AIS_InteractiveObject) wrappers.
70 This intermediate class is necessary to avoid dependencies from OCC libs.
73 class PRS_EXPORT SALOME_OCCPrs : public SALOME_Prs
76 //! It uses double dispatch in order to \n
77 //! invoke Display() method corresponding to the actual type of presentation.
78 virtual void DisplayIn( SALOME_View* ) const;
80 //! It uses double dispatch in order to \n
81 //! invoke Erase() method corresponding to the actual type of presentation.
82 virtual void EraseIn( SALOME_View*, const bool = false ) const;
84 //! It uses double dispatch in order to \n
85 //! invoke Update() method corresponding to the actual type of presentation.
86 virtual void Update( SALOME_Displayer* );
88 //! Key method for double dispatch of activation of subshapes selection
89 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
94 Base class for VTK graphic object (vtkActor) wrappers.
95 This intermediate class is necessary to avoid dependencies from VTK libs.
97 class PRS_EXPORT SALOME_VTKPrs : public SALOME_Prs
100 //! It uses double dispatch in order to \n
101 //! invoke Display() method corresponding to the actual type of presentation.
102 virtual void DisplayIn( SALOME_View* ) const;
104 //! It uses double dispatch in order to \n
105 //! invoke Erase() method corresponding to the actual type of presentation.
106 virtual void EraseIn( SALOME_View*, const bool = false ) const;
108 //! It uses double dispatch in order to \n
109 //! invoke Update() method corresponding to the actual type of presentation.
110 virtual void Update( SALOME_Displayer* );
112 //! Key method for double dispatch of activation of subshapes selection
113 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
118 Base class for Plot2d graphic object (Plot2d_Curve) wrappers.
120 class PRS_EXPORT SALOME_Prs2d : public SALOME_Prs
123 //! It uses double dispatch in order to
124 //! invoke Display() method corresponding to the actual type of presentation.
125 virtual void DisplayIn( SALOME_View* ) const;
127 //! It uses double dispatch in order to
128 //! invoke Erase() method corresponding to the actual type of presentation.
129 virtual void EraseIn( SALOME_View*, const bool = false ) const;
131 //! It uses double dispatch in order to
132 //! invoke Update() method corresponding to the actual type of presentation.
133 virtual void Update( SALOME_Displayer* );
135 //! Key method for double dispatch of activation of subshapes selection
136 virtual void LocalSelectionIn( SALOME_View*, const int ) const;
140 Base classes for object wrappers for any other visualization libraries should be added here!
144 Base class for SALOME views (or view frames)
146 class PRS_EXPORT SALOME_View
150 virtual ~SALOME_View() {}
152 //! This Display() method should be called to display given presentation \n
153 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
154 //! so that it could perform double dispatch.
155 void Display( const SALOME_Prs* );
157 //! This Erase() method should be called to erase given presentation \n
158 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
159 //! so that it could perform double dispatch.
160 void Erase( const SALOME_Prs*, const bool = false );
162 //! This LocalSelection() method should be called to activate sub-shapes selection \n
163 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
164 //! so that it could perform double dispatch.
165 void LocalSelection( const SALOME_Prs*, const int );
167 // Interface for derived views
169 // Display() methods for ALL kinds of presentation should appear here
170 virtual void Display( const SALOME_OCCPrs* );//!< Display SALOME_OCCPrs presentation.
171 virtual void Display( const SALOME_VTKPrs* );//!< Display SALOME_VTKPrs presentation.
172 virtual void Display( const SALOME_Prs2d* );//!< Display SALOME_Prs2d presentation.
173 // Add new Display() methods here...
175 // Erase() methods for ALL kinds of presentation should appear here
176 virtual void Erase( const SALOME_OCCPrs*, const bool = false );//!< Erase SALOME_OCCPrs
177 virtual void Erase( const SALOME_VTKPrs*, const bool = false );//!< Erase SALOME_VTKPrs
178 virtual void Erase( const SALOME_Prs2d*, const bool = false );//!< Erase SALOME_Prs2d
179 virtual void EraseAll( const bool = false );
180 // Add new Erase() methods here...
182 // LocalSelection() methods for ALL kinds of presentation should appear here
183 virtual void LocalSelection( const SALOME_OCCPrs*, const int );//!< Local selection SALOME_OCCPrs
184 virtual void LocalSelection( const SALOME_VTKPrs*, const int );//!< Local selection SALOME_VTKPrs
185 virtual void LocalSelection( const SALOME_Prs2d* , const int );//!< Local selection SALOME_Prs2d
187 //! Deactivates selection of sub-shapes (must be redefined with OCC viewer)
188 virtual void GlobalSelection( const bool = false ) const;
190 //! Creates empty presenation of corresponding type
191 virtual SALOME_Prs* CreatePrs( const char* /*entry*/ = 0 ) { return 0; }
193 // Axiluary methods called before and after displaying of objects
194 virtual void BeforeDisplay( SALOME_Displayer* ) {} //!< Null body here
195 virtual void AfterDisplay ( SALOME_Displayer* ) {} //!< Null body here
198 //! \retval Return false.
199 virtual bool isVisible( const Handle_SALOME_InteractiveObject& ){ return false; }
200 virtual void Repaint() {} //!< Null body here.
204 \class SALOME_Displayer
205 These classes are used to specify type of view VTK, OCC or Plot2d
207 class PRS_EXPORT SALOME_OCCViewType {};
208 class PRS_EXPORT SALOME_VTKViewType {};
209 class PRS_EXPORT SALOME_Plot2dViewType {};
212 \class SALOME_Displayer
213 Base class for SALOME displayers
215 class PRS_EXPORT SALOME_Displayer
219 virtual ~SALOME_Displayer() {/*! Null body here*/}
221 //! This Update() method should be called to update given presentation \n
222 //! created anywhere by anybody. It simply passes control to SALOME_Prs object \n
223 //! so that it could perform double dispatch.
224 void UpdatePrs( SALOME_Prs* );
226 // Interface for derived displayers
228 // Update() methods for ALL kinds of presentation should appear here
229 virtual void Update( SALOME_OCCPrs* );//!< Update SALOME_OCCPrs presentation.
230 virtual void Update( SALOME_VTKPrs* );//!< Update SALOME_VTKPrs presentation.
231 virtual void Update( SALOME_Prs2d* );//!< Update SALOME_Prs2d presentation.
232 // Add new Update() methods here...
234 // Axiluary methods called before and after displaying of objects
235 virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCViewType& ){/*! Null body here*/};
236 virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCViewType& ){/*! Null body here*/};
237 virtual void BeforeDisplay( SALOME_View*, const SALOME_VTKViewType& ){/*! Null body here*/};
238 virtual void AfterDisplay ( SALOME_View*, const SALOME_VTKViewType& ){/*! Null body here*/};
239 virtual void BeforeDisplay( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};
240 virtual void AfterDisplay ( SALOME_View*, const SALOME_Plot2dViewType& ){/*! Null body here*/};