1 // Copyright (C) 2007-2015 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, 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_Prs2d::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_Prs2d::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_Prs2d::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_Prs2d::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_Prs2d::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_Prs2d::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_Prs2d::LocalSelectionIn( SALOME_View* v, const int mode ) const
243 if ( v ) v->LocalSelection( this, mode );
247 Dispatches update operation to proper Update() method of SALOME_Displayer
249 void SALOME_Prs2d::Update( SALOME_Displayer* d )
251 if ( d ) d->Update( this );
255 Gives control to SALOME_Prs object, so that it could perform double dispatch
257 void SALOME_View::Display( SALOME_Displayer* d, const SALOME_Prs* prs )
259 prs->DisplayIn( this );
260 if ( d ) d->UpdateVisibility( this, prs, true );
264 Gives control to SALOME_Prs object, so that it could perform double dispatch
266 void SALOME_View::Erase( SALOME_Displayer* d, const SALOME_Prs* prs, const bool forced )
268 prs->EraseIn( this, forced );
269 if ( d ) d->UpdateVisibility( this, prs, false );
273 Gives control to SALOME_Prs object, so that it could perform double dispatch
275 void SALOME_View::LocalSelection( const SALOME_Prs* prs, const int mode )
277 std::list<int> modes;
278 modes.push_back( mode );
279 LocalSelection( prs, modes );
283 Gives control to SALOME_Prs object, so that it could perform double dispatch
285 void SALOME_View::LocalSelection( const SALOME_Prs* prs, const std::list<int> modes )
287 prs->LocalSelectionIn( this, modes );
291 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
293 void SALOME_View::Display( const SALOME_OCCPrs* )
295 // MESSAGE( "SALOME_View::Display( const SALOME_OCCPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
299 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
301 void SALOME_View::Display( const SALOME_VTKPrs* )
303 // MESSAGE( "SALOME_View::Display( const SALOME_VTKPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
307 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
309 void SALOME_View::Display( const SALOME_Prs2d* )
311 // MESSAGE( "SALOME_View::Display( const SALOME_Prs2d& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
315 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
317 void SALOME_View::Erase( const SALOME_OCCPrs*, const bool )
319 // MESSAGE( "SALOME_View::Erase( const SALOME_OCCPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
323 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
325 void SALOME_View::Erase( const SALOME_VTKPrs*, const bool )
327 // MESSAGE( "SALOME_View::Erase( const SALOME_VTKPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
331 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
333 void SALOME_View::Erase( const SALOME_Prs2d*, const bool )
335 // MESSAGE( "SALOME_View::Erase( const SALOME_Prs2d& ) called! Probably, presentation is being erased in uncompatible viewframe." );
339 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
341 void SALOME_View::EraseAll( SALOME_Displayer* d, const bool )
343 // MESSAGE( "SALOME_View::EraseAll() called!" );
344 if ( d ) d->UpdateVisibility( this, 0, false );
348 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
350 void SALOME_View::LocalSelection( const SALOME_OCCPrs*, const int )
352 // MESSAGE( "SALOME_View::LocalSelection( const SALOME_OCCPrs* ) called!
353 // Probably, selection is being activated in uncompatible viewframe." );
357 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
359 void SALOME_View::LocalSelection( const SALOME_OCCPrs*, const std::list<int> )
361 // MESSAGE( "SALOME_View::LocalSelection( const SALOME_OCCPrs* ) called!
362 // Probably, selection is being activated in uncompatible viewframe." );
366 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
368 void SALOME_View::LocalSelection( const SALOME_VTKPrs*, const int )
370 // MESSAGE( "SALOME_View::LocalSelection( const SALOME_VTKPrs* ) called!
371 // Probably, selection is being activated in uncompatible viewframe." );
375 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
377 void SALOME_View::LocalSelection( const SALOME_Prs2d*, const int )
379 // MESSAGE( "SALOME_View::LocalSelection( const SALOME_Prs2d* ) called!
380 // Probably, selection is being activated in uncompatible viewframe." );
384 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
386 void SALOME_View::GlobalSelection( const bool ) const
388 // MESSAGE( "SALOME_View::GlobalSelection() called!
389 // Probably, selection is being activated in uncompatible viewframe." );
392 void SALOME_View::BeforeDisplay( SALOME_Displayer* d, const SALOME_Prs* p )
394 p->BeforeDisplayIn( d, this );
397 void SALOME_View::AfterDisplay( SALOME_Displayer* d, const SALOME_Prs* p )
399 p->AfterDisplayIn( d, this );
402 void SALOME_View::BeforeErase( SALOME_Displayer* d, const SALOME_Prs* p )
404 p->BeforeEraseIn( d, this );
407 void SALOME_View::AfterErase ( SALOME_Displayer* d, const SALOME_Prs* p )
409 p->AfterEraseIn( d, this );
413 Gives control to SALOME_Prs object, so that it could perform double dispatch
415 void SALOME_Displayer::UpdatePrs( SALOME_Prs* prs )
421 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
423 void SALOME_Displayer::Update( SALOME_OCCPrs* )
425 // MESSAGE( "SALOME_Displayer::Update( SALOME_OCCPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
429 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
431 void SALOME_Displayer::Update( SALOME_VTKPrs* )
433 // MESSAGE( "SALOME_Displayer::Update( SALOME_VTKPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
437 Virtual method, should be reimplemented in successors, by default issues a warning and does nothing.
439 void SALOME_Displayer::Update( SALOME_Prs2d* )
441 // MESSAGE( "SALOME_Displayer::Update( SALOME_Prs2d* ) called! Probably, presentation is being updated in uncompatible viewframe." );
445 Virtual method, should be reimplemented in successors, by default does nothing.
447 void SALOME_Displayer::UpdateVisibility( SALOME_View*, const SALOME_Prs*, bool )