Version: 9.15.0
SALOME_Prs.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, 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 <Standard_DefineHandle.hxx>
40 
41 class SALOME_View;
42 class SALOME_Displayer;
43 class SALOME_ListIO;
45 
53 {
54 public:
56  explicit SALOME_Prs( const char* );
57 
59  virtual ~SALOME_Prs() {}
60 
62  const char* GetEntry() const;
63 
65  virtual void DisplayIn( SALOME_View* ) const = 0;
66 
68  virtual void EraseIn( SALOME_View*, const bool = false ) const = 0;
69 
71  virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const = 0;
72 
74  virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const = 0;
75 
77  virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const = 0;
78 
80  virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const = 0;
81 
83  virtual void Update( SALOME_Displayer* ) = 0;
84 
86  virtual bool IsNull() const = 0;
87 
89  virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
90  virtual void LocalSelectionIn( SALOME_View*, const std::list<int> ) const;
91 
92  // checks if shape is clippable
93  inline bool IsClippable() const
94  {
95  return myIsClippable;
96  }
97 
98  // makes shape clippable/not clippable
99  inline void SetClippable (bool isClippable)
100  {
101  myIsClippable = isClippable;
102  }
103 
104 protected:
105  std::string myEntry;
107 };
108 
116 {
117 public:
119  explicit SALOME_OCCPrs(const char* e) : SALOME_Prs(e) {}
120 
123  virtual void DisplayIn( SALOME_View* ) const;
124 
127  virtual void EraseIn( SALOME_View*, const bool = false ) const;
128 
131  virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
132 
135  virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
136 
139  virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const;
140 
143  virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const;
144 
147  virtual void Update( SALOME_Displayer* );
148 
150  virtual void LocalSelectionIn( SALOME_View*, const int ) const;
151  virtual void LocalSelectionIn( SALOME_View*, const std::list<int> ) const;
152 };
153 
160 {
161 public:
163  explicit SALOME_VTKPrs(const char* e) : SALOME_Prs(e) {}
164 
167  virtual void DisplayIn( SALOME_View* ) const;
168 
171  virtual void EraseIn( SALOME_View*, const bool = false ) const;
172 
175  virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
176 
179  virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
180 
183  virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const;
184 
187  virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const;
188 
191  virtual void Update( SALOME_Displayer* );
192 
194  virtual void LocalSelectionIn( SALOME_View*, const int ) const;
195 };
196 
204 {
205 public:
207  explicit SALOME_PV3DPrs(const char* e) : SALOME_Prs(e) {}
208 
211  virtual void DisplayIn( SALOME_View* ) const;
212 
215  virtual void EraseIn( SALOME_View*, const bool = false ) const;
216 
219  virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
220 
223  virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
224 
227  virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const;
228 
231  virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const;
232 
235  virtual void Update( SALOME_Displayer* );
236 
238  virtual void LocalSelectionIn( SALOME_View*, const int ) const;
239  virtual void LocalSelectionIn( SALOME_View*, const std::list<int> ) const;
240 };
241 
247 {
248 public:
250  explicit SALOME_Prs2d(const char* e) : SALOME_Prs(e) {}
251 
254  virtual void DisplayIn( SALOME_View* ) const;
255 
258  virtual void EraseIn( SALOME_View*, const bool = false ) const;
259 
262  virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
263 
266  virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
267 
270  virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const;
271 
274  virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const;
275 
278  virtual void Update( SALOME_Displayer* );
279 
281  virtual void LocalSelectionIn( SALOME_View*, const int ) const;
282 };
283 
292 {
293 public:
295  virtual ~SALOME_View() {}
296 
300  void Display( SALOME_Displayer*, const SALOME_Prs* );
301 
305  void Erase( SALOME_Displayer*, const SALOME_Prs*, const bool = false );
306 
309  virtual void EraseAll( SALOME_Displayer*, const bool = false );
310 
314  void LocalSelection( const SALOME_Prs*, const int );
315  void LocalSelection( const SALOME_Prs*, const std::list<int> );
316 
317  // Interface for derived views
318 
319  // Display() methods for ALL kinds of presentation should appear here
320  virtual void Display( const SALOME_OCCPrs* );
321  virtual void Display( const SALOME_VTKPrs* );
322  virtual void Display( const SALOME_PV3DPrs* );
323  virtual void Display( const SALOME_Prs2d* );
324  // Add new Display() methods here...
325 
326  // Erase() methods for ALL kinds of presentation should appear here
327  virtual void Erase( const SALOME_OCCPrs*, const bool = false );
328  virtual void Erase( const SALOME_VTKPrs*, const bool = false );
329  virtual void Erase( const SALOME_PV3DPrs*, const bool = false );
330  virtual void Erase( const SALOME_Prs2d*, const bool = false );
331  // Add new Erase() methods here...
332 
333  // LocalSelection() methods for ALL kinds of presentation should appear here
334  virtual void LocalSelection( const SALOME_OCCPrs*, const int );
335  virtual void LocalSelection( const SALOME_OCCPrs*, const std::list<int> );
336  virtual void LocalSelection( const SALOME_VTKPrs*, const int );
337  virtual void LocalSelection( const SALOME_PV3DPrs*, const int );
338  virtual void LocalSelection( const SALOME_Prs2d* , const int );
339 
341  virtual void GlobalSelection( const bool = false ) const;
342 
344  virtual SALOME_Prs* CreatePrs( const char* /*entry*/ = 0 ) { return 0; }
345 
346  // Axiluary methods called before and after displaying of objects
347  virtual void BeforeDisplay( SALOME_Displayer*, const SALOME_Prs* );
348  virtual void AfterDisplay ( SALOME_Displayer*, const SALOME_Prs* );
349 
350  // Axiluary methods called before and after erasing of objects
351  virtual void BeforeErase( SALOME_Displayer*, const SALOME_Prs* );
352  virtual void AfterErase ( SALOME_Displayer*, const SALOME_Prs* );
353 
354  // New methods (asv)
356  virtual bool isVisible( const Handle(SALOME_InteractiveObject)& ){ return false; }
357  virtual void Repaint() {}
358  virtual void GetVisible( SALOME_ListIO& /*theList*/ ) {}
359 };
360 
366 {
367 public:
369  virtual ~SALOME_Displayer() {}
370 
374  void UpdatePrs( SALOME_Prs* );
375 
376  // Interface for derived displayers
377 
378  // Update() methods for ALL kinds of presentation should appear here
379  virtual void Update( SALOME_OCCPrs* );
380  virtual void Update( SALOME_VTKPrs* );
381  virtual void Update( SALOME_PV3DPrs* );
382  virtual void Update( SALOME_Prs2d* );
383  // Add new Update() methods here...
384 
385  // Auxiliary methods called before and after displaying of objects
386  virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCPrs* ) {}
387  virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCPrs* ) {}
388  virtual void BeforeDisplay( SALOME_View*, const SALOME_VTKPrs* ) {}
389  virtual void AfterDisplay ( SALOME_View*, const SALOME_VTKPrs* ) {}
390  virtual void BeforeDisplay( SALOME_View*, const SALOME_PV3DPrs* ) {}
391  virtual void AfterDisplay ( SALOME_View*, const SALOME_PV3DPrs* ) {}
392  virtual void BeforeDisplay( SALOME_View*, const SALOME_Prs2d* ) {}
393  virtual void AfterDisplay ( SALOME_View*, const SALOME_Prs2d* ) {}
394 
395  // Auxiliary methods called before and after erasing of objects
396  virtual void BeforeErase( SALOME_View*, const SALOME_OCCPrs* ) {}
397  virtual void AfterErase ( SALOME_View*, const SALOME_OCCPrs* ) {}
398  virtual void BeforeErase( SALOME_View*, const SALOME_VTKPrs* ) {}
399  virtual void AfterErase ( SALOME_View*, const SALOME_VTKPrs* ) {}
400  virtual void BeforeErase( SALOME_View*, const SALOME_PV3DPrs* ) {}
401  virtual void AfterErase ( SALOME_View*, const SALOME_PV3DPrs* ) {}
402  virtual void BeforeErase( SALOME_View*, const SALOME_Prs2d* ) {}
403  virtual void AfterErase ( SALOME_View*, const SALOME_Prs2d* ) {}
404 
405  // Auxiliary method called to update visibility state of presentation
406  virtual void UpdateVisibility( SALOME_View*, const SALOME_Prs*, bool );
407 };
408 
409 #endif
Handle(TDocStd_Application) CAF_Application
Get OCAF application.
Definition: CAF_Application.cxx:97
#define PRS_EXPORT
Definition: SALOME_Prs.h:33
Definition: SALOME_Prs.h:366
virtual void AfterDisplay(SALOME_View *, const SALOME_PV3DPrs *)
Null body here.
Definition: SALOME_Prs.h:391
virtual void AfterErase(SALOME_View *, const SALOME_VTKPrs *)
Null body here.
Definition: SALOME_Prs.h:399
virtual void AfterDisplay(SALOME_View *, const SALOME_VTKPrs *)
Null body here.
Definition: SALOME_Prs.h:389
virtual void AfterErase(SALOME_View *, const SALOME_OCCPrs *)
Null body here.
Definition: SALOME_Prs.h:397
virtual void BeforeErase(SALOME_View *, const SALOME_OCCPrs *)
Null body here.
Definition: SALOME_Prs.h:396
virtual ~SALOME_Displayer()
Destructor.
Definition: SALOME_Prs.h:369
virtual void BeforeErase(SALOME_View *, const SALOME_PV3DPrs *)
Null body here.
Definition: SALOME_Prs.h:400
virtual void AfterErase(SALOME_View *, const SALOME_Prs2d *)
Null body here.
Definition: SALOME_Prs.h:403
virtual void AfterErase(SALOME_View *, const SALOME_PV3DPrs *)
Null body here.
Definition: SALOME_Prs.h:401
virtual void BeforeErase(SALOME_View *, const SALOME_VTKPrs *)
Null body here.
Definition: SALOME_Prs.h:398
virtual void BeforeErase(SALOME_View *, const SALOME_Prs2d *)
Null body here.
Definition: SALOME_Prs.h:402
virtual void AfterDisplay(SALOME_View *, const SALOME_Prs2d *)
Null body here.
Definition: SALOME_Prs.h:393
virtual void AfterDisplay(SALOME_View *, const SALOME_OCCPrs *)
Null body here.
Definition: SALOME_Prs.h:387
virtual void BeforeDisplay(SALOME_View *, const SALOME_VTKPrs *)
Null body here.
Definition: SALOME_Prs.h:388
virtual void BeforeDisplay(SALOME_View *, const SALOME_Prs2d *)
Null body here.
Definition: SALOME_Prs.h:392
virtual void BeforeDisplay(SALOME_View *, const SALOME_PV3DPrs *)
Null body here.
Definition: SALOME_Prs.h:390
virtual void BeforeDisplay(SALOME_View *, const SALOME_OCCPrs *)
Definition: SALOME_Prs.h:386
Definition: SALOME_ListIO.hxx:29
Definition: SALOME_Prs.h:116
SALOME_OCCPrs(const char *e)
Constructor.
Definition: SALOME_Prs.h:119
Definition: SALOME_Prs.h:204
SALOME_PV3DPrs(const char *e)
Constructor.
Definition: SALOME_Prs.h:207
Definition: SALOME_Prs.h:247
SALOME_Prs2d(const char *e)
Constructor.
Definition: SALOME_Prs.h:250
Definition: SALOME_Prs.h:53
virtual void EraseIn(SALOME_View *, const bool=false) const =0
Key method for double dispatch of erase operation.
bool myIsClippable
Definition: SALOME_Prs.h:106
virtual void AfterEraseIn(SALOME_Displayer *, SALOME_View *) const =0
Key method for double dispatch of post-erase operation.
void SetClippable(bool isClippable)
Definition: SALOME_Prs.h:99
virtual void DisplayIn(SALOME_View *) const =0
Key method for double dispatch of display operation.
virtual void BeforeEraseIn(SALOME_Displayer *, SALOME_View *) const =0
Key method for double dispatch of pre-erase operation.
virtual void Update(SALOME_Displayer *)=0
Key method for double dispatch of update operation.
virtual ~SALOME_Prs()
Destructor.
Definition: SALOME_Prs.h:59
bool IsClippable() const
Definition: SALOME_Prs.h:93
virtual void AfterDisplayIn(SALOME_Displayer *, SALOME_View *) const =0
Key method for double dispatch of post-display operation.
std::string myEntry
Definition: SALOME_Prs.h:105
virtual void LocalSelectionIn(SALOME_View *, const int) const =0
Key method for double dispatch of activation of sub-shapes selection.
virtual void BeforeDisplayIn(SALOME_Displayer *, SALOME_View *) const =0
Key method for double dispatch of pre-display operation.
virtual bool IsNull() const =0
Should return true, if this presentation contains a graphic object.
Definition: SALOME_Prs.h:160
SALOME_VTKPrs(const char *e)
Constructor.
Definition: SALOME_Prs.h:163
Definition: SALOME_Prs.h:292
virtual bool isVisible(const Handle(SALOME_InteractiveObject)&)
Definition: SALOME_Prs.h:356
virtual SALOME_Prs * CreatePrs(const char *=0)
Creates empty presentation of corresponding type.
Definition: SALOME_Prs.h:344
virtual void GetVisible(SALOME_ListIO &)
Definition: SALOME_Prs.h:358
virtual ~SALOME_View()
Destructor.
Definition: SALOME_Prs.h:295
virtual void Repaint()
Null body here.
Definition: SALOME_Prs.h:357