1 // Copyright (C) 2007-2024 CEA, EDF, 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, or (at your option) any later version.
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
23 // File: SALOME_Prs.cxx
24 // Author: Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
26 #include "SALOME_Prs.h"
31 SALOME_Prs::SALOME_Prs(const char* e) : myIsClippable(true)
33 myEntry = std::string( e ? e : "" );
39 const char* SALOME_Prs::GetEntry() const
41 return myEntry.c_str();
45 Dispatches operation of activation of sub-shapes selection
47 void SALOME_Prs::LocalSelectionIn( SALOME_View*, const std::list<int> ) const
49 // base implementation does nothing
53 Dispatches display operation to proper Display() method of SALOME_View
55 void SALOME_OCCPrs::DisplayIn( SALOME_View* v ) const
57 if ( v ) v->Display( this );
61 Dispatches display operation to proper Erase() method of SALOME_View
63 void SALOME_OCCPrs::EraseIn( SALOME_View* v, const bool forced ) const
65 if ( v ) v->Erase( this, forced );
69 Dispatches display operation to proper BeforeDisplay() method of SALOME_Displayer
71 void SALOME_OCCPrs::BeforeDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
73 d->BeforeDisplay( v, this );
77 Dispatches display operation to proper AfterDisplay() method of SALOME_Displayer
79 void SALOME_OCCPrs::AfterDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
81 d->AfterDisplay( v, this );
85 Dispatches display operation to proper BeforeErase() method of SALOME_Displayer
87 void SALOME_OCCPrs::BeforeEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
89 d->BeforeErase( v, this );
93 Dispatches display operation to proper AfterErase() method of SALOME_Displayer
95 void SALOME_OCCPrs::AfterEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
97 d->AfterErase( v, this );
101 Dispatches operation to proper LocalSelectionIn() method of SALOME_View
103 void SALOME_OCCPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
105 std::list<int> modes;
106 modes.push_back( mode );
107 LocalSelectionIn( v, modes );
111 Dispatches operation to proper LocalSelectionIn() method of SALOME_View
113 void SALOME_OCCPrs::LocalSelectionIn( SALOME_View* v, const std::list<int> modes ) const
115 if ( v && !modes.empty() ) v->LocalSelection( this, modes );
119 Dispatches update operation to proper Update() method of SALOME_Displayer
121 void SALOME_OCCPrs::Update( SALOME_Displayer* d )
123 if ( d ) d->Update( this );
127 Dispatches display operation to proper Display() method of SALOME_View
129 void SALOME_VTKPrs::DisplayIn( SALOME_View* v ) const
131 if ( v ) v->Display( this );
135 Dispatches display operation to proper Erase() method of SALOME_View
137 void SALOME_VTKPrs::EraseIn( SALOME_View* v, const bool forced ) const
139 if ( v ) v->Erase( this, forced );
143 Dispatches display operation to proper BeforeDisplay() method of SALOME_Displayer
145 void SALOME_VTKPrs::BeforeDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
147 d->BeforeDisplay( v, this );
151 Dispatches display operation to proper AfterDisplay() method of SALOME_Displayer
153 void SALOME_VTKPrs::AfterDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
155 d->AfterDisplay( v, this );
159 Dispatches display operation to proper BeforeErase() method of SALOME_Displayer
161 void SALOME_VTKPrs::BeforeEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
163 d->BeforeErase( v, this );
167 Dispatches display operation to proper AfterErase() method of SALOME_Displayer
169 void SALOME_VTKPrs::AfterEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
171 d->AfterErase( v, this );
175 Dispatches operation to proper LocalSelectionIn() method of SALOME_View
177 void SALOME_VTKPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
179 if ( v ) v->LocalSelection( this, mode );
183 Dispatches update operation to proper Update() method of SALOME_Displayer
185 void SALOME_VTKPrs::Update( SALOME_Displayer* d )
187 if ( d ) d->Update( this );
191 Dispatches display operation to proper Display() method of SALOME_View
193 void SALOME_PV3DPrs::DisplayIn( SALOME_View* v ) const
195 if ( v ) v->Display( this );
199 Dispatches display operation to proper Erase() method of SALOME_View
201 void SALOME_PV3DPrs::EraseIn( SALOME_View* v, const bool forced ) const
203 if ( v ) v->Erase( this, forced );
207 Dispatches display operation to proper BeforeDisplay() method of SALOME_Displayer
209 void SALOME_PV3DPrs::BeforeDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
211 d->BeforeDisplay( v, this );
215 Dispatches display operation to proper AfterDisplay() method of SALOME_Displayer
217 void SALOME_PV3DPrs::AfterDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
219 d->AfterDisplay( v, this );
223 Dispatches display operation to proper BeforeErase() method of SALOME_Displayer
225 void SALOME_PV3DPrs::BeforeEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
227 d->BeforeErase( v, this );
231 Dispatches display operation to proper AfterErase() method of SALOME_Displayer
233 void SALOME_PV3DPrs::AfterEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
235 d->AfterErase( v, this );
239 Dispatches operation to proper LocalSelectionIn() method of SALOME_View
241 void SALOME_PV3DPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
243 std::list<int> modes;
244 modes.push_back( mode );
245 LocalSelectionIn( v, modes );
249 Dispatches operation to proper LocalSelectionIn() method of SALOME_View
251 void SALOME_PV3DPrs::LocalSelectionIn( SALOME_View* v, const std::list<int> modes ) const
253 if ( v && !modes.empty() ) v->LocalSelection( this, modes );
257 Dispatches update operation to proper Update() method of SALOME_Displayer
259 void SALOME_PV3DPrs::Update( SALOME_Displayer* d )
261 if ( d ) d->Update( this );
265 Dispatches display operation to proper Display() method of SALOME_View
267 void SALOME_Prs2d::DisplayIn( SALOME_View* v ) const
269 if ( v ) v->Display( this );
273 Dispatches display operation to proper Erase() method of SALOME_View
275 void SALOME_Prs2d::EraseIn( SALOME_View* v, const bool forced ) const
277 if ( v ) v->Erase( this, forced );
281 Dispatches display operation to proper BeforeDisplay() method of SALOME_Displayer
283 void SALOME_Prs2d::BeforeDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
285 d->BeforeDisplay( v, this );
289 Dispatches display operation to proper AfterDisplay() method of SALOME_Displayer
291 void SALOME_Prs2d::AfterDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
293 d->AfterDisplay( v, this );
297 Dispatches display operation to proper BeforeErase() method of SALOME_Displayer
299 void SALOME_Prs2d::BeforeEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
301 d->BeforeErase( v, this );
305 Dispatches display operation to proper AfterErase() method of SALOME_Displayer
307 void SALOME_Prs2d::AfterEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
309 d->AfterErase( v, this );
313 Dispatches operation to proper LocalSelectionIn() method of SALOME_View
315 void SALOME_Prs2d::LocalSelectionIn( SALOME_View* v, const int mode ) const
317 if ( v ) v->LocalSelection( this, mode );
321 Dispatches update operation to proper Update() method of SALOME_Displayer
323 void SALOME_Prs2d::Update( SALOME_Displayer* d )
325 if ( d ) d->Update( this );
329 Gives control to SALOME_Prs object, so that it could perform double dispatch
331 void SALOME_View::Display( SALOME_Displayer* d, const SALOME_Prs* prs )
333 prs->DisplayIn( this );
334 if ( d ) d->UpdateVisibility( this, prs, true );
338 Gives control to SALOME_Prs object, so that it could perform double dispatch
340 void SALOME_View::Erase( SALOME_Displayer* d, const SALOME_Prs* prs, const bool forced )
342 prs->EraseIn( this, forced );
343 if ( d ) d->UpdateVisibility( this, prs, false );
347 Gives control to SALOME_Prs object, so that it could perform double dispatch
349 void SALOME_View::LocalSelection( const SALOME_Prs* prs, const int mode )
351 std::list<int> modes;
352 modes.push_back( mode );
353 LocalSelection( prs, modes );
357 Gives control to SALOME_Prs object, so that it could perform double dispatch
359 void SALOME_View::LocalSelection( const SALOME_Prs* prs, const std::list<int> modes )
361 prs->LocalSelectionIn( this, modes );
365 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
367 void SALOME_View::Display( const SALOME_OCCPrs* )
369 // MESSAGE( "SALOME_View::Display( const SALOME_OCCPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
373 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
375 void SALOME_View::Display( const SALOME_VTKPrs* )
377 // MESSAGE( "SALOME_View::Display( const SALOME_VTKPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
381 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
383 void SALOME_View::Display( const SALOME_PV3DPrs* )
385 // MESSAGE( "SALOME_View::Display( const SALOME_PV3DPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
389 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
391 void SALOME_View::Display( const SALOME_Prs2d* )
393 // MESSAGE( "SALOME_View::Display( const SALOME_Prs2d& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
397 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
399 void SALOME_View::Erase( const SALOME_OCCPrs*, const bool )
401 // MESSAGE( "SALOME_View::Erase( const SALOME_OCCPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
405 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
407 void SALOME_View::Erase( const SALOME_VTKPrs*, const bool )
409 // MESSAGE( "SALOME_View::Erase( const SALOME_VTKPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
413 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
415 void SALOME_View::Erase( const SALOME_PV3DPrs*, const bool )
417 // MESSAGE( "SALOME_View::Erase( const SALOME_PV3DPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
421 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
423 void SALOME_View::Erase( const SALOME_Prs2d*, const bool )
425 // MESSAGE( "SALOME_View::Erase( const SALOME_Prs2d& ) called! Probably, presentation is being erased in uncompatible viewframe." );
429 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
431 void SALOME_View::EraseAll( SALOME_Displayer* d, const bool )
433 // MESSAGE( "SALOME_View::EraseAll() called!" );
434 if ( d ) d->UpdateVisibility( this, 0, false );
438 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
440 void SALOME_View::LocalSelection( const SALOME_OCCPrs*, const int )
442 // MESSAGE( "SALOME_View::LocalSelection( const SALOME_OCCPrs* ) called!
443 // Probably, selection is being activated in uncompatible viewframe." );
447 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
449 void SALOME_View::LocalSelection( const SALOME_OCCPrs*, const std::list<int> )
451 // MESSAGE( "SALOME_View::LocalSelection( const SALOME_OCCPrs* ) called!
452 // Probably, selection is being activated in uncompatible viewframe." );
456 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
458 void SALOME_View::LocalSelection( const SALOME_VTKPrs*, const int )
460 // MESSAGE( "SALOME_View::LocalSelection( const SALOME_VTKPrs* ) called!
461 // Probably, selection is being activated in uncompatible viewframe." );
465 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
467 void SALOME_View::LocalSelection( const SALOME_PV3DPrs*, const int )
469 // MESSAGE( "SALOME_View::LocalSelection( const SALOME_PV3DPrs* ) called!
470 // Probably, selection is being activated in uncompatible viewframe." );
474 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
476 void SALOME_View::LocalSelection( const SALOME_Prs2d*, const int )
478 // MESSAGE( "SALOME_View::LocalSelection( const SALOME_Prs2d* ) called!
479 // Probably, selection is being activated in uncompatible viewframe." );
483 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
485 void SALOME_View::GlobalSelection( const bool ) const
487 // MESSAGE( "SALOME_View::GlobalSelection() called!
488 // Probably, selection is being activated in uncompatible viewframe." );
491 void SALOME_View::BeforeDisplay( SALOME_Displayer* d, const SALOME_Prs* p )
493 p->BeforeDisplayIn( d, this );
496 void SALOME_View::AfterDisplay( SALOME_Displayer* d, const SALOME_Prs* p )
498 p->AfterDisplayIn( d, this );
501 void SALOME_View::BeforeErase( SALOME_Displayer* d, const SALOME_Prs* p )
503 p->BeforeEraseIn( d, this );
506 void SALOME_View::AfterErase ( SALOME_Displayer* d, const SALOME_Prs* p )
508 p->AfterEraseIn( d, this );
512 Gives control to SALOME_Prs object, so that it could perform double dispatch
514 void SALOME_Displayer::UpdatePrs( SALOME_Prs* prs )
520 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
522 void SALOME_Displayer::Update( SALOME_OCCPrs* )
524 // MESSAGE( "SALOME_Displayer::Update( SALOME_OCCPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
528 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
530 void SALOME_Displayer::Update( SALOME_VTKPrs* )
532 // MESSAGE( "SALOME_Displayer::Update( SALOME_VTKPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
536 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
538 void SALOME_Displayer::Update( SALOME_PV3DPrs* )
540 // MESSAGE( "SALOME_Displayer::Update( SALOME_PV3DPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
544 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
546 void SALOME_Displayer::Update( SALOME_Prs2d* )
548 // MESSAGE( "SALOME_Displayer::Update( SALOME_Prs2d* ) called! Probably, presentation is being updated in uncompatible viewframe." );
552 Virtual method, should be reimplemented in successors, by default does nothing.
554 void SALOME_Displayer::UpdateVisibility( SALOME_View*, const SALOME_Prs*, bool )