Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SALOME_Prs.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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, or (at your option) any later version.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 #ifndef SALOME_PRS_H
24 #define SALOME_PRS_H
25 
26 #ifdef WIN32
27 #if defined PRS_EXPORTS || defined SalomePrs_EXPORTS
28 #define PRS_EXPORT __declspec(dllexport)
29 #else
30 #define PRS_EXPORT __declspec(dllimport)
31 #endif
32 #else
33 #define PRS_EXPORT
34 #endif
35 
36 #include <string>
37 #include <list>
38 
39 #include <Basics_OCCTVersion.hxx>
40 
41 class SALOME_View;
42 class SALOME_Displayer;
43 class SALOME_ListIO;
44 #if OCC_VERSION_MAJOR >= 7
46 #else
47  class Handle_SALOME_InteractiveObject;
48 #endif
49 
57 {
58 public:
60  explicit SALOME_Prs( const char* );
61 
63  virtual ~SALOME_Prs() {}
64 
66  const char* GetEntry() const;
67 
69  virtual void DisplayIn( SALOME_View* ) const = 0;
70 
72  virtual void EraseIn( SALOME_View*, const bool = false ) const = 0;
73 
75  virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const = 0;
76 
78  virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const = 0;
79 
81  virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const = 0;
82 
84  virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const = 0;
85 
87  virtual void Update( SALOME_Displayer* ) = 0;
88 
90  virtual bool IsNull() const = 0;
91 
93  virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
94  virtual void LocalSelectionIn( SALOME_View*, const std::list<int> ) const;
95 
96  // checks if shape is clippable
97  inline bool IsClippable() const
98  {
99  return myIsClippable;
100  }
101 
102  // makes shape clippable/not clippable
103  inline void SetClippable (bool isClippable)
104  {
105  myIsClippable = isClippable;
106  }
107 
108 protected:
109  std::string myEntry;
111 };
112 
120 {
121 public:
123  explicit SALOME_OCCPrs(const char* e) : SALOME_Prs(e) {}
124 
127  virtual void DisplayIn( SALOME_View* ) const;
128 
131  virtual void EraseIn( SALOME_View*, const bool = false ) const;
132 
135  virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
136 
139  virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
140 
143  virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const;
144 
147  virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const;
148 
151  virtual void Update( SALOME_Displayer* );
152 
154  virtual void LocalSelectionIn( SALOME_View*, const int ) const;
155  virtual void LocalSelectionIn( SALOME_View*, const std::list<int> ) const;
156 };
157 
164 {
165 public:
167  explicit SALOME_VTKPrs(const char* e) : SALOME_Prs(e) {}
168 
171  virtual void DisplayIn( SALOME_View* ) const;
172 
175  virtual void EraseIn( SALOME_View*, const bool = false ) const;
176 
179  virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
180 
183  virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
184 
187  virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const;
188 
191  virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const;
192 
195  virtual void Update( SALOME_Displayer* );
196 
198  virtual void LocalSelectionIn( SALOME_View*, const int ) const;
199 };
200 
206 {
207 public:
209  explicit SALOME_Prs2d(const char* e) : SALOME_Prs(e) {}
210 
213  virtual void DisplayIn( SALOME_View* ) const;
214 
217  virtual void EraseIn( SALOME_View*, const bool = false ) const;
218 
221  virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
222 
225  virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
226 
229  virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const;
230 
233  virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const;
234 
237  virtual void Update( SALOME_Displayer* );
238 
240  virtual void LocalSelectionIn( SALOME_View*, const int ) const;
241 };
242 
251 {
252 public:
254  virtual ~SALOME_View() {}
255 
259  void Display( SALOME_Displayer*, const SALOME_Prs* );
260 
264  void Erase( SALOME_Displayer*, const SALOME_Prs*, const bool = false );
265 
268  virtual void EraseAll( SALOME_Displayer*, const bool = false );
269 
273  void LocalSelection( const SALOME_Prs*, const int );
274  void LocalSelection( const SALOME_Prs*, const std::list<int> );
275 
276  // Interface for derived views
277 
278  // Display() methods for ALL kinds of presentation should appear here
279  virtual void Display( const SALOME_OCCPrs* );
280  virtual void Display( const SALOME_VTKPrs* );
281  virtual void Display( const SALOME_Prs2d* );
282  // Add new Display() methods here...
283 
284  // Erase() methods for ALL kinds of presentation should appear here
285  virtual void Erase( const SALOME_OCCPrs*, const bool = false );
286  virtual void Erase( const SALOME_VTKPrs*, const bool = false );
287  virtual void Erase( const SALOME_Prs2d*, const bool = false );
288  // Add new Erase() methods here...
289 
290  // LocalSelection() methods for ALL kinds of presentation should appear here
291  virtual void LocalSelection( const SALOME_OCCPrs*, const int );
292  virtual void LocalSelection( const SALOME_OCCPrs*, const std::list<int> );
293  virtual void LocalSelection( const SALOME_VTKPrs*, const int );
294  virtual void LocalSelection( const SALOME_Prs2d* , const int );
295 
297  virtual void GlobalSelection( const bool = false ) const;
298 
300  virtual SALOME_Prs* CreatePrs( const char* /*entry*/ = 0 ) { return 0; }
301 
302  // Axiluary methods called before and after displaying of objects
303  virtual void BeforeDisplay( SALOME_Displayer*, const SALOME_Prs* );
304  virtual void AfterDisplay ( SALOME_Displayer*, const SALOME_Prs* );
305 
306  // Axiluary methods called before and after erasing of objects
307  virtual void BeforeErase( SALOME_Displayer*, const SALOME_Prs* );
308  virtual void AfterErase ( SALOME_Displayer*, const SALOME_Prs* );
309 
310  // New methods (asv)
312  virtual bool isVisible( const Handle(SALOME_InteractiveObject)& ){ return false; }
313  virtual void Repaint() {}
314  virtual void GetVisible( SALOME_ListIO& theList ) {}
315 };
316 
322 {
323 public:
325  virtual ~SALOME_Displayer() {}
326 
330  void UpdatePrs( SALOME_Prs* );
331 
332  // Interface for derived displayers
333 
334  // Update() methods for ALL kinds of presentation should appear here
335  virtual void Update( SALOME_OCCPrs* );
336  virtual void Update( SALOME_VTKPrs* );
337  virtual void Update( SALOME_Prs2d* );
338  // Add new Update() methods here...
339 
340  // Axiluary methods called before and after displaying of objects
341  virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCPrs* ) {}
342  virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCPrs* ) {}
343  virtual void BeforeDisplay( SALOME_View*, const SALOME_VTKPrs* ) {}
344  virtual void AfterDisplay ( SALOME_View*, const SALOME_VTKPrs* ) {}
345  virtual void BeforeDisplay( SALOME_View*, const SALOME_Prs2d* ) {}
346  virtual void AfterDisplay ( SALOME_View*, const SALOME_Prs2d* ) {}
347 
348  // Axiluary methods called before and after erasing of objects
349  virtual void BeforeErase( SALOME_View*, const SALOME_OCCPrs* ) {}
350  virtual void AfterErase ( SALOME_View*, const SALOME_OCCPrs* ) {}
351  virtual void BeforeErase( SALOME_View*, const SALOME_VTKPrs* ) {}
352  virtual void AfterErase ( SALOME_View*, const SALOME_VTKPrs* ) {}
353  virtual void BeforeErase( SALOME_View*, const SALOME_Prs2d* ) {}
354  virtual void AfterErase ( SALOME_View*, const SALOME_Prs2d* ) {}
355 
356  // Axiluary method called to update visibility state of presentation
357  virtual void UpdateVisibility( SALOME_View*, const SALOME_Prs*, bool );
358 };
359 
360 #endif