b311480e |
1 | // Created on: 1997-12-16 |
2 | // Created by: Jean Louis Frenkel |
3 | // Copyright (c) 1997-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
b311480e |
16 | |
778cd667 |
17 | #include <PrsMgr_PresentableObject.hxx> |
42cf5bc1 |
18 | |
f838dac4 |
19 | #include <Prs3d_Drawer.hxx> |
42cf5bc1 |
20 | #include <Prs3d_Presentation.hxx> |
21 | #include <Prs3d_Projector.hxx> |
7fd59977 |
22 | #include <PrsMgr_ModedPresentation.hxx> |
42cf5bc1 |
23 | #include <Standard_NotImplemented.hxx> |
7fd59977 |
24 | #include <TColStd_ListIteratorOfListOfInteger.hxx> |
25 | #include <TColStd_MapOfInteger.hxx> |
7fd59977 |
26 | |
f838dac4 |
27 | IMPLEMENT_STANDARD_RTTIEXT(PrsMgr_PresentableObject, Standard_Transient) |
92efcf78 |
28 | |
1f7f5a90 |
29 | namespace |
30 | { |
31 | static const gp_Trsf THE_IDENTITY_TRSF; |
32 | } |
33 | |
34 | //======================================================================= |
35 | //function : getIdentityTrsf |
36 | //purpose : |
37 | //======================================================================= |
38 | const gp_Trsf& PrsMgr_PresentableObject::getIdentityTrsf() |
39 | { |
40 | return THE_IDENTITY_TRSF; |
41 | } |
42 | |
7fd59977 |
43 | //======================================================================= |
44 | //function : PrsMgr_PresentableObject |
b7cd4ba7 |
45 | //purpose : |
7fd59977 |
46 | //======================================================================= |
b7cd4ba7 |
47 | PrsMgr_PresentableObject::PrsMgr_PresentableObject (const PrsMgr_TypeOfPresentation3d theType) |
f838dac4 |
48 | : myDrawer (new Prs3d_Drawer()), |
49 | myTypeOfPresentation3d (theType), |
0717ddc1 |
50 | myIsMutable (Standard_False), |
51 | myHasOwnPresentations (Standard_True), |
52 | myParent (NULL) |
7fd59977 |
53 | { |
f838dac4 |
54 | myDrawer->SetDisplayMode (-1); |
7fd59977 |
55 | } |
56 | |
0717ddc1 |
57 | //======================================================================= |
58 | //function : ~PrsMgr_PresentableObject |
59 | //purpose : destructor |
60 | //======================================================================= |
61 | PrsMgr_PresentableObject::~PrsMgr_PresentableObject() |
62 | { |
0717ddc1 |
63 | for (PrsMgr_ListOfPresentableObjectsIter anIter (myChildren); anIter.More(); anIter.Next()) |
64 | { |
1f7f5a90 |
65 | anIter.Value()->SetCombinedParentTransform (Handle(Geom_Transformation)()); |
0717ddc1 |
66 | anIter.Value()->myParent = NULL; |
67 | } |
68 | } |
69 | |
7fd59977 |
70 | //======================================================================= |
71 | //function : Fill |
72 | //purpose : |
73 | //======================================================================= |
af324faa |
74 | void PrsMgr_PresentableObject::Fill (const Handle(PrsMgr_PresentationManager)& thePrsMgr, |
75 | const Handle(PrsMgr_Presentation)& thePrs, |
76 | const Standard_Integer theMode) |
4269bd1b |
77 | { |
af324faa |
78 | Handle(Prs3d_Presentation) aStruct3d = thePrs->Presentation(); |
79 | Compute (thePrsMgr, aStruct3d, theMode); |
0717ddc1 |
80 | UpdateTransformation (aStruct3d); |
af324faa |
81 | aStruct3d->SetClipPlanes (myClipPlanes); |
778cd667 |
82 | aStruct3d->SetTransformPersistence (TransformPersistence()); |
7fd59977 |
83 | } |
84 | |
7fd59977 |
85 | //======================================================================= |
86 | //function : Compute |
af324faa |
87 | //purpose : |
7fd59977 |
88 | //======================================================================= |
af324faa |
89 | void PrsMgr_PresentableObject::Compute (const Handle(PrsMgr_PresentationManager)& /*aPresentationManager*/, |
90 | const Handle(Prs3d_Presentation)& /*aPresentation*/, |
91 | const Standard_Integer /*aMode*/) |
7fd59977 |
92 | { |
93 | Standard_NotImplemented::Raise("cannot compute in a 3d visualizer"); |
94 | } |
4269bd1b |
95 | |
7fd59977 |
96 | //======================================================================= |
97 | //function : Compute |
98 | //purpose : |
99 | //======================================================================= |
100 | void PrsMgr_PresentableObject::Compute(const Handle(Prs3d_Projector)& /*aProjector*/, |
101 | const Handle(Prs3d_Presentation)& /*aPresentation*/) |
102 | { |
103 | Standard_NotImplemented::Raise("cannot compute under a specific projector"); |
104 | } |
4269bd1b |
105 | |
7fd59977 |
106 | //======================================================================= |
107 | //function : Compute |
108 | //purpose : |
109 | //======================================================================= |
110 | void PrsMgr_PresentableObject::Compute(const Handle(Prs3d_Projector)& /* aProjector*/, |
111 | const Handle(Geom_Transformation)& /*aTrsf*/, |
112 | const Handle(Prs3d_Presentation)& /*aPresentation*/) |
113 | { |
114 | Standard_NotImplemented::Raise("cannot compute under a specific projector"); |
115 | } |
116 | |
117 | //======================================================================= |
118 | //function : Update |
119 | //purpose : |
120 | //======================================================================= |
121 | void PrsMgr_PresentableObject::Update (const Standard_Boolean AllModes) { |
122 | Standard_Integer l = myPresentations.Length(); |
123 | Handle(PrsMgr_PresentationManager) PM; |
124 | for (Standard_Integer i=1; i <= l; i++) { |
125 | PM = myPresentations(i).Presentation()->PresentationManager(); |
126 | if(AllModes) |
127 | PM->Update(this,myPresentations(i).Mode()); |
128 | else{ |
129 | if(PM->IsDisplayed(this,myPresentations(i).Mode()) || |
130 | PM->IsHighlighted(this,myPresentations(i).Mode())){ |
131 | PM->Update(this,myPresentations(i).Mode()); |
132 | } |
133 | else |
134 | SetToUpdate(myPresentations(i).Mode()); |
135 | } |
136 | } |
137 | } |
4269bd1b |
138 | |
7fd59977 |
139 | //======================================================================= |
140 | //function : Update |
141 | //purpose : |
142 | //======================================================================= |
7fd59977 |
143 | void PrsMgr_PresentableObject::Update (const Standard_Integer aMode, const Standard_Boolean ClearOther) { |
144 | Standard_Integer l = myPresentations.Length(); |
145 | for (Standard_Integer i=1; i <= l; i++) { |
146 | if( myPresentations(i).Mode() == aMode){ |
147 | Handle(PrsMgr_PresentationManager) PM= |
148 | myPresentations(i).Presentation()->PresentationManager(); |
149 | |
150 | if(PM->IsDisplayed(this,aMode) || |
151 | PM->IsHighlighted(this,aMode)){ |
152 | PM->Update(this,aMode); |
153 | myPresentations(i).Presentation()->SetUpdateStatus(Standard_False); |
154 | |
155 | } |
156 | else |
157 | SetToUpdate(myPresentations(i).Mode()); |
158 | } |
159 | |
160 | } |
161 | if(ClearOther) { |
162 | PrsMgr_Presentations save; |
163 | save = myPresentations; |
164 | myPresentations.Clear(); |
165 | for (Standard_Integer i=1; i <= l; i++) { |
166 | if( save(i).Mode() == aMode) myPresentations.Append(save(i)); |
167 | } |
168 | } |
169 | |
170 | } |
4269bd1b |
171 | |
7fd59977 |
172 | //======================================================================= |
173 | //function : SetToUpdate |
174 | //purpose : |
175 | //======================================================================= |
7fd59977 |
176 | void PrsMgr_PresentableObject::SetToUpdate(const Standard_Integer aMode) |
177 | { |
178 | for(Standard_Integer IP =1; IP<=myPresentations.Length();IP++){ |
179 | if(myPresentations(IP).Mode()==aMode) |
180 | myPresentations(IP).Presentation()->SetUpdateStatus(Standard_True); |
181 | } |
182 | } |
4269bd1b |
183 | |
184 | //======================================================================= |
185 | //function : SetToUpdate |
186 | //purpose : |
187 | //======================================================================= |
7fd59977 |
188 | void PrsMgr_PresentableObject::SetToUpdate() |
189 | { |
190 | for(Standard_Integer IP =1; IP<=myPresentations.Length();IP++){ |
191 | myPresentations(IP).Presentation()->SetUpdateStatus(Standard_True); |
192 | } |
193 | } |
194 | |
195 | //======================================================================= |
196 | //function : ToBeUpdated |
197 | //purpose : gets the list of modes to be updated |
198 | //======================================================================= |
199 | void PrsMgr_PresentableObject::ToBeUpdated(TColStd_ListOfInteger& OutList) const |
200 | { |
201 | OutList.Clear(); |
202 | // on dimensionne les buckets a la taille de la seq. |
016e5959 |
203 | TColStd_MapOfInteger MI(myPresentations.Length()); |
7fd59977 |
204 | |
205 | for(Standard_Integer IP =1; IP<=myPresentations.Length();IP++){ |
206 | const PrsMgr_ModedPresentation& MP = myPresentations(IP); |
207 | if(MP.Presentation()->MustBeUpdated()) |
208 | if(!MI.Contains(MP.Mode())){ |
016e5959 |
209 | OutList.Append(MP.Mode()); |
210 | MI.Add(MP.Mode()); |
7fd59977 |
211 | } |
212 | } |
7fd59977 |
213 | } |
214 | |
215 | //======================================================================= |
216 | //function : SetTypeOfPresentation |
af324faa |
217 | //purpose : |
7fd59977 |
218 | //======================================================================= |
af324faa |
219 | void PrsMgr_PresentableObject::SetTypeOfPresentation (const PrsMgr_TypeOfPresentation3d theType) |
7fd59977 |
220 | { |
af324faa |
221 | myTypeOfPresentation3d = theType; |
222 | for(Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter) |
223 | { |
224 | const Handle(PrsMgr_Presentation)& aPrs = myPresentations (aPrsIter).Presentation(); |
225 | aPrs->Presentation()->SetVisual (myTypeOfPresentation3d == PrsMgr_TOP_ProjectorDependant |
226 | ? Graphic3d_TOS_COMPUTED |
227 | : Graphic3d_TOS_ALL); |
7fd59977 |
228 | } |
229 | } |
230 | |
231 | //======================================================================= |
1f7f5a90 |
232 | //function : setLocalTransformation |
233 | //purpose : |
7fd59977 |
234 | //======================================================================= |
1f7f5a90 |
235 | void PrsMgr_PresentableObject::setLocalTransformation (const Handle(Geom_Transformation)& theTransformation) |
7fd59977 |
236 | { |
0717ddc1 |
237 | myLocalTransformation = theTransformation; |
238 | UpdateTransformation(); |
7fd59977 |
239 | } |
240 | |
241 | //======================================================================= |
0717ddc1 |
242 | //function : ResetTransformation |
7fd59977 |
243 | //purpose : |
244 | //======================================================================= |
0717ddc1 |
245 | void PrsMgr_PresentableObject::ResetTransformation() |
7fd59977 |
246 | { |
1f7f5a90 |
247 | setLocalTransformation (Handle(Geom_Transformation)()); |
7fd59977 |
248 | } |
249 | |
4269bd1b |
250 | //======================================================================= |
0717ddc1 |
251 | //function : SetCombinedParentTransform |
252 | //purpose : |
253 | //======================================================================= |
1f7f5a90 |
254 | void PrsMgr_PresentableObject::SetCombinedParentTransform (const Handle(Geom_Transformation)& theTrsf) |
0717ddc1 |
255 | { |
1f7f5a90 |
256 | myCombinedParentTransform = theTrsf; |
0717ddc1 |
257 | UpdateTransformation(); |
258 | } |
259 | |
260 | //======================================================================= |
261 | //function : UpdateTransformation |
4269bd1b |
262 | //purpose : |
263 | //======================================================================= |
0717ddc1 |
264 | void PrsMgr_PresentableObject::UpdateTransformation() |
7fd59977 |
265 | { |
1f7f5a90 |
266 | myTransformation.Nullify(); |
267 | myInvTransformation = gp_Trsf(); |
268 | if (!myCombinedParentTransform.IsNull() && myCombinedParentTransform->Form() != gp_Identity) |
269 | { |
270 | if (!myLocalTransformation.IsNull() && myLocalTransformation->Form() != gp_Identity) |
271 | { |
272 | const gp_Trsf aTrsf = myCombinedParentTransform->Trsf() * myLocalTransformation->Trsf(); |
273 | myTransformation = new Geom_Transformation (aTrsf); |
274 | myInvTransformation = aTrsf.Inverted(); |
275 | } |
276 | else |
277 | { |
278 | myTransformation = myCombinedParentTransform; |
279 | myInvTransformation = myCombinedParentTransform->Trsf().Inverted(); |
280 | } |
281 | } |
282 | else if (!myLocalTransformation.IsNull() && myLocalTransformation->Form() != gp_Identity) |
283 | { |
284 | myTransformation = myLocalTransformation; |
285 | myInvTransformation = myLocalTransformation->Trsf().Inverted(); |
286 | } |
af324faa |
287 | |
0717ddc1 |
288 | for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter) |
af324faa |
289 | { |
1f7f5a90 |
290 | myPresentations (aPrsIter).Presentation()->SetTransformation (myTransformation); |
af324faa |
291 | } |
292 | |
1f7f5a90 |
293 | for (PrsMgr_ListOfPresentableObjectsIter aChildIter (myChildren); aChildIter.More(); aChildIter.Next()) |
af324faa |
294 | { |
1f7f5a90 |
295 | aChildIter.Value()->SetCombinedParentTransform (myTransformation); |
7fd59977 |
296 | } |
297 | } |
298 | |
7fd59977 |
299 | //======================================================================= |
0717ddc1 |
300 | //function : UpdateTransformation |
7fd59977 |
301 | //purpose : |
302 | //======================================================================= |
0717ddc1 |
303 | void PrsMgr_PresentableObject::UpdateTransformation(const Handle(Prs3d_Presentation)& P) |
7fd59977 |
304 | { |
1f7f5a90 |
305 | P->SetTransformation (myTransformation); |
7fd59977 |
306 | } |
307 | |
308 | //======================================================================= |
309 | //function : SetTransformPersistence |
af324faa |
310 | //purpose : |
7fd59977 |
311 | //======================================================================= |
778cd667 |
312 | void PrsMgr_PresentableObject::SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers) |
7fd59977 |
313 | { |
778cd667 |
314 | myTransformPersistence = theTrsfPers; |
af324faa |
315 | for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter) |
316 | { |
317 | const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation(); |
318 | if (!aPrs3d.IsNull() |
319 | && !aPrs3d->Presentation().IsNull()) |
7fd59977 |
320 | { |
778cd667 |
321 | aPrs3d->Presentation()->SetTransformPersistence (myTransformPersistence); |
b7cd4ba7 |
322 | aPrs3d->Presentation()->ReCompute(); |
7fd59977 |
323 | } |
af324faa |
324 | } |
7fd59977 |
325 | } |
326 | |
7fd59977 |
327 | //======================================================================= |
328 | //function : GetTransformPersistence |
778cd667 |
329 | //purpose : |
7fd59977 |
330 | //======================================================================= |
825aa485 |
331 | gp_Pnt PrsMgr_PresentableObject::GetTransformPersistencePoint() const |
7fd59977 |
332 | { |
778cd667 |
333 | if (myTransformPersistence.IsNull()) |
334 | { |
335 | return gp_Pnt(); |
336 | } |
337 | else if (myTransformPersistence->IsZoomOrRotate()) |
338 | { |
339 | return myTransformPersistence->AnchorPoint(); |
340 | } |
341 | else if (!myTransformPersistence->IsTrihedronOr2d()) |
342 | { |
343 | return gp_Pnt(); |
344 | } |
345 | |
346 | Standard_Real anX = 0.0; |
347 | if ((myTransformPersistence->Corner2d() & Aspect_TOTP_RIGHT) != 0) |
348 | { |
349 | anX = 1.0; |
350 | } |
351 | else if ((myTransformPersistence->Corner2d() & Aspect_TOTP_LEFT) != 0) |
352 | { |
353 | anX = -1.0; |
354 | } |
355 | |
356 | Standard_Real anY = 0.0; |
357 | if ((myTransformPersistence->Corner2d() & Aspect_TOTP_TOP) != 0) |
358 | { |
359 | anY = 1.0; |
360 | } |
361 | else if ((myTransformPersistence->Corner2d() & Aspect_TOTP_BOTTOM) != 0) |
362 | { |
363 | anY = -1.0; |
364 | } |
365 | |
366 | return gp_Pnt (anX, anY, myTransformPersistence->Offset2d().x()); |
7fd59977 |
367 | } |
59f45b7c |
368 | |
0717ddc1 |
369 | //======================================================================= |
370 | //function : AddChild |
371 | //purpose : |
372 | //======================================================================= |
373 | void PrsMgr_PresentableObject::AddChild (const Handle(PrsMgr_PresentableObject)& theObject) |
374 | { |
375 | Handle(PrsMgr_PresentableObject) aHandleGuard = theObject; |
376 | if (theObject->myParent != NULL) |
377 | { |
378 | theObject->myParent->RemoveChild (aHandleGuard); |
379 | } |
380 | |
381 | myChildren.Append (theObject); |
382 | theObject->myParent = this; |
383 | theObject->SetCombinedParentTransform (myTransformation); |
384 | } |
385 | |
386 | //======================================================================= |
387 | //function : RemoveChild |
388 | //purpose : |
389 | //======================================================================= |
390 | void PrsMgr_PresentableObject::RemoveChild (const Handle(PrsMgr_PresentableObject)& theObject) |
391 | { |
392 | PrsMgr_ListOfPresentableObjectsIter anIter (myChildren); |
393 | for (; anIter.More(); anIter.Next()) |
394 | { |
395 | if (anIter.Value() == theObject) |
396 | { |
397 | theObject->myParent = NULL; |
1f7f5a90 |
398 | theObject->SetCombinedParentTransform (Handle(Geom_Transformation)()); |
0717ddc1 |
399 | myChildren.Remove (anIter); |
400 | break; |
401 | } |
402 | } |
403 | } |
404 | |
59f45b7c |
405 | //======================================================================= |
406 | //function : SetZLayer |
407 | //purpose : |
408 | //======================================================================= |
a1954302 |
409 | void PrsMgr_PresentableObject::SetZLayer (const Graphic3d_ZLayerId theLayerId) |
59f45b7c |
410 | { |
f838dac4 |
411 | if (myDrawer->ZLayer() == theLayerId) |
a1954302 |
412 | { |
413 | return; |
414 | } |
415 | |
f838dac4 |
416 | myDrawer->SetZLayer (theLayerId); |
a1954302 |
417 | for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter) |
418 | { |
419 | const PrsMgr_ModedPresentation& aModedPrs = myPresentations (aPrsIter); |
420 | if (aModedPrs.Presentation().IsNull() |
421 | || aModedPrs.Presentation()->Presentation().IsNull()) |
422 | { |
423 | continue; |
424 | } |
425 | |
426 | aModedPrs.Presentation()->Presentation()->SetZLayer (theLayerId); |
427 | } |
59f45b7c |
428 | } |
429 | |
430 | //======================================================================= |
a1954302 |
431 | //function : ZLayer |
59f45b7c |
432 | //purpose : |
433 | //======================================================================= |
a1954302 |
434 | Graphic3d_ZLayerId PrsMgr_PresentableObject::ZLayer() const |
59f45b7c |
435 | { |
f838dac4 |
436 | return myDrawer->ZLayer(); |
59f45b7c |
437 | } |
4269bd1b |
438 | |
439 | // ======================================================================= |
440 | // function : AddClipPlane |
441 | // purpose : |
442 | // ======================================================================= |
443 | void PrsMgr_PresentableObject::AddClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane) |
444 | { |
51b10cd4 |
445 | // add to collection and process changes |
3202bf1e |
446 | if (myClipPlanes.IsNull()) |
447 | { |
448 | myClipPlanes = new Graphic3d_SequenceOfHClipPlane(); |
449 | } |
450 | |
451 | myClipPlanes->Append (thePlane); |
51b10cd4 |
452 | UpdateClipping(); |
4269bd1b |
453 | } |
454 | |
455 | // ======================================================================= |
456 | // function : RemoveClipPlane |
457 | // purpose : |
458 | // ======================================================================= |
459 | void PrsMgr_PresentableObject::RemoveClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane) |
460 | { |
3202bf1e |
461 | if (myClipPlanes.IsNull()) |
462 | { |
463 | return; |
464 | } |
465 | |
51b10cd4 |
466 | // remove from collection and process changes |
3202bf1e |
467 | for (Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (*myClipPlanes); aPlaneIt.More(); aPlaneIt.Next()) |
51b10cd4 |
468 | { |
469 | const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIt.Value(); |
470 | if (aPlane != thePlane) |
471 | continue; |
4269bd1b |
472 | |
3202bf1e |
473 | myClipPlanes->Remove (aPlaneIt); |
51b10cd4 |
474 | UpdateClipping(); |
475 | return; |
476 | } |
4269bd1b |
477 | } |
478 | |
479 | // ======================================================================= |
480 | // function : SetClipPlanes |
481 | // purpose : |
482 | // ======================================================================= |
3202bf1e |
483 | void PrsMgr_PresentableObject::SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) |
4269bd1b |
484 | { |
51b10cd4 |
485 | // change collection and process changes |
4269bd1b |
486 | myClipPlanes = thePlanes; |
4269bd1b |
487 | UpdateClipping(); |
488 | } |
489 | |
490 | // ======================================================================= |
491 | // function : UpdateClipping |
492 | // purpose : |
493 | // ======================================================================= |
494 | void PrsMgr_PresentableObject::UpdateClipping() |
495 | { |
496 | // affect generated structures |
497 | for (Standard_Integer aPrsIt = 1; aPrsIt <= myPresentations.Length(); ++aPrsIt) |
498 | { |
499 | // pass over presentation manager 3d mechanism right to the structures - |
500 | // we do not interested in display mode collections. |
501 | const PrsMgr_ModedPresentation& aModedPrs = myPresentations (aPrsIt); |
af324faa |
502 | if (aModedPrs.Presentation().IsNull() |
503 | || aModedPrs.Presentation()->Presentation().IsNull()) |
504 | { |
4269bd1b |
505 | continue; |
af324faa |
506 | } |
4269bd1b |
507 | |
af324faa |
508 | aModedPrs.Presentation()->Presentation()->SetClipPlanes (myClipPlanes); |
4269bd1b |
509 | } |
510 | } |
b7cd4ba7 |
511 | |
512 | // ======================================================================= |
513 | // function : SetMutable |
514 | // purpose : |
515 | // ======================================================================= |
516 | void PrsMgr_PresentableObject::SetMutable (const Standard_Boolean theIsMutable) |
517 | { |
518 | if (myIsMutable == theIsMutable) |
519 | { |
520 | return; |
521 | } |
522 | |
523 | myIsMutable = theIsMutable; |
524 | for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter) |
525 | { |
526 | const PrsMgr_ModedPresentation& aModedPrs = myPresentations (aPrsIter); |
527 | if (aModedPrs.Presentation().IsNull() |
528 | || aModedPrs.Presentation()->Presentation().IsNull()) |
529 | { |
530 | continue; |
531 | } |
532 | |
533 | aModedPrs.Presentation()->Presentation()->SetMutable (theIsMutable); |
534 | } |
535 | } |
f838dac4 |
536 | |
537 | // ======================================================================= |
538 | // function : SetAttributes |
539 | // purpose : |
540 | // ======================================================================= |
541 | void PrsMgr_PresentableObject::SetAttributes (const Handle(Prs3d_Drawer)& theDrawer) |
542 | { |
543 | myDrawer = theDrawer; |
544 | } |
545 | |
546 | // ======================================================================= |
547 | // function : UnsetAttributes |
548 | // purpose : |
549 | // ======================================================================= |
550 | void PrsMgr_PresentableObject::UnsetAttributes() |
551 | { |
552 | Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer(); |
553 | if (myDrawer->HasLink()) |
554 | { |
555 | aDrawer->Link(myDrawer->Link()); |
556 | } |
557 | myDrawer = aDrawer; |
558 | } |