b311480e |
1 | // Copyright (c) 1998-1999 Matra Datavision |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
b311480e |
5 | // |
d5f74e42 |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
b311480e |
14 | |
7fd59977 |
15 | #include <PrsMgr_PresentationManager.ixx> |
679ecdee |
16 | |
17 | #include <Graphic3d_GraphicDriver.hxx> |
18 | #include <Prs3d_PresentationShadow.hxx> |
7fd59977 |
19 | #include <PrsMgr_PresentableObject.hxx> |
20 | #include <PrsMgr_Presentation.hxx> |
21 | #include <PrsMgr_Presentations.hxx> |
22 | #include <PrsMgr_ModedPresentation.hxx> |
23 | #include <TColStd_ListIteratorOfListOfTransient.hxx> |
679ecdee |
24 | #include <V3d_View.hxx> |
25 | #include <Visual3d_View.hxx> |
26 | #include <Visual3d_Layer.hxx> |
27 | |
28 | // ======================================================================= |
29 | // function : PrsMgr_PresentationManager |
30 | // purpose : |
31 | // ======================================================================= |
32 | PrsMgr_PresentationManager::PrsMgr_PresentationManager (const Handle(Graphic3d_StructureManager)& theStructureManager) |
33 | : myStructureManager (theStructureManager), |
34 | myImmediateModeOn (0) |
35 | { |
36 | // |
37 | } |
7fd59977 |
38 | |
679ecdee |
39 | // ======================================================================= |
40 | // function : Display |
41 | // purpose : |
42 | // ======================================================================= |
43 | void PrsMgr_PresentationManager::Display (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
44 | const Standard_Integer theMode) |
7fd59977 |
45 | { |
679ecdee |
46 | if (!HasPresentation (thePrsObj, theMode)) |
47 | { |
48 | AddPresentation (thePrsObj, theMode); |
7fd59977 |
49 | } |
679ecdee |
50 | |
af324faa |
51 | Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode); |
679ecdee |
52 | if (aPrs->MustBeUpdated()) |
53 | { |
54 | Update (thePrsObj, theMode); |
55 | } |
56 | |
57 | if (myImmediateModeOn > 0) |
58 | { |
59 | AddToImmediateList (aPrs->Presentation()); |
7fd59977 |
60 | } |
7fd59977 |
61 | else |
679ecdee |
62 | { |
63 | aPrs->Display(); |
64 | } |
7fd59977 |
65 | } |
66 | |
679ecdee |
67 | // ======================================================================= |
68 | // function : Erase |
69 | // purpose : |
70 | // ======================================================================= |
71 | void PrsMgr_PresentationManager::Erase (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
72 | const Standard_Integer theMode) |
7fd59977 |
73 | { |
679ecdee |
74 | if (HasPresentation (thePrsObj, theMode)) |
eef7fc64 |
75 | { |
679ecdee |
76 | Presentation (thePrsObj, theMode)->Erase(); |
77 | RemovePresentation (thePrsObj, theMode); |
eef7fc64 |
78 | } |
7fd59977 |
79 | } |
80 | |
679ecdee |
81 | // ======================================================================= |
82 | // function : Clear |
83 | // purpose : |
84 | // ======================================================================= |
85 | void PrsMgr_PresentationManager::Clear (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
86 | const Standard_Integer theMode) |
7fd59977 |
87 | { |
679ecdee |
88 | if (HasPresentation (thePrsObj, theMode)) |
89 | { |
90 | Presentation (thePrsObj, theMode)->Clear(); |
91 | } |
7fd59977 |
92 | } |
93 | |
679ecdee |
94 | // ======================================================================= |
95 | // function : SetVisibility |
96 | // purpose : |
97 | // ======================================================================= |
eb4320f2 |
98 | void PrsMgr_PresentationManager::SetVisibility (const Handle(PrsMgr_PresentableObject)& thePresentableObject, |
99 | const Standard_Integer theMode, |
100 | const Standard_Boolean theValue) |
101 | { |
102 | Presentation(thePresentableObject, theMode)->SetVisible (theValue); |
103 | } |
7fd59977 |
104 | |
679ecdee |
105 | // ======================================================================= |
106 | // function : Highlight |
107 | // purpose : |
108 | // ======================================================================= |
109 | void PrsMgr_PresentationManager::Highlight (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
110 | const Standard_Integer theMode) |
7fd59977 |
111 | { |
679ecdee |
112 | if (!HasPresentation (thePrsObj, theMode)) |
113 | { |
114 | AddPresentation (thePrsObj, theMode); |
7fd59977 |
115 | } |
679ecdee |
116 | |
af324faa |
117 | Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode); |
679ecdee |
118 | if (aPrs->MustBeUpdated()) |
119 | { |
120 | Update (thePrsObj, theMode); |
7fd59977 |
121 | } |
7fd59977 |
122 | |
679ecdee |
123 | if (myImmediateModeOn > 0) |
124 | { |
125 | Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs->Presentation()); |
126 | aShadow->Highlight(); |
127 | AddToImmediateList (aShadow); |
128 | } |
129 | else |
130 | { |
131 | aPrs->Highlight(); |
132 | } |
7fd59977 |
133 | } |
134 | |
679ecdee |
135 | // ======================================================================= |
136 | // function : Unhighlight |
137 | // purpose : |
138 | // ======================================================================= |
139 | void PrsMgr_PresentationManager::Unhighlight (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
140 | const Standard_Integer theMode) |
7fd59977 |
141 | { |
679ecdee |
142 | if (HasPresentation (thePrsObj, theMode)) |
143 | { |
144 | Presentation (thePrsObj, theMode)->Unhighlight(); |
7fd59977 |
145 | } |
146 | } |
147 | |
679ecdee |
148 | // ======================================================================= |
149 | // function : SetDisplayPriority |
150 | // purpose : |
151 | // ======================================================================= |
152 | void PrsMgr_PresentationManager::SetDisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
153 | const Standard_Integer theMode, |
154 | const Standard_Integer theNewPrior) const |
155 | { |
156 | if (HasPresentation (thePrsObj, theMode)) |
157 | { |
158 | Presentation (thePrsObj, theMode)->SetDisplayPriority (theNewPrior); |
159 | } |
160 | } |
7fd59977 |
161 | |
679ecdee |
162 | // ======================================================================= |
163 | // function : DisplayPriority |
164 | // purpose : |
165 | // ======================================================================= |
166 | Standard_Integer PrsMgr_PresentationManager::DisplayPriority (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
167 | const Standard_Integer theMode) const |
7fd59977 |
168 | { |
679ecdee |
169 | return HasPresentation (thePrsObj, theMode) |
170 | ? Presentation (thePrsObj, theMode)->DisplayPriority() |
171 | : 0; |
7fd59977 |
172 | } |
173 | |
679ecdee |
174 | // ======================================================================= |
175 | // function : IsDisplayed |
176 | // purpose : |
177 | // ======================================================================= |
178 | Standard_Boolean PrsMgr_PresentationManager::IsDisplayed (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
179 | const Standard_Integer theMode) const |
7fd59977 |
180 | { |
679ecdee |
181 | return HasPresentation (thePrsObj, theMode) |
182 | && Presentation (thePrsObj, theMode)->IsDisplayed(); |
7fd59977 |
183 | } |
184 | |
679ecdee |
185 | // ======================================================================= |
186 | // function : IsHighlighted |
187 | // purpose : |
188 | // ======================================================================= |
189 | Standard_Boolean PrsMgr_PresentationManager::IsHighlighted (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
190 | const Standard_Integer theMode) const |
191 | { |
192 | return HasPresentation (thePrsObj, theMode) |
193 | && Presentation (thePrsObj, theMode)->IsHighlighted(); |
194 | } |
7fd59977 |
195 | |
679ecdee |
196 | // ======================================================================= |
197 | // function : Update |
198 | // purpose : |
199 | // ======================================================================= |
200 | void PrsMgr_PresentationManager::Update (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
201 | const Standard_Integer theMode) const |
202 | { |
203 | if (!HasPresentation(thePrsObj, theMode)) |
204 | { |
205 | return; |
206 | } |
7fd59977 |
207 | |
679ecdee |
208 | Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode); |
209 | if (!aPrs.IsNull()) |
210 | { |
211 | aPrs->Clear(); |
212 | thePrsObj->Fill (this, aPrs, theMode); |
213 | aPrs->SetUpdateStatus (Standard_False); |
214 | } |
215 | } |
7fd59977 |
216 | |
679ecdee |
217 | // ======================================================================= |
218 | // function : BeginImmediateDraw |
219 | // purpose : |
220 | // ======================================================================= |
221 | void PrsMgr_PresentationManager::BeginImmediateDraw() |
222 | { |
223 | if (++myImmediateModeOn > 1) |
224 | { |
225 | return; |
7fd59977 |
226 | } |
679ecdee |
227 | |
228 | ClearImmediateDraw(); |
7fd59977 |
229 | } |
679ecdee |
230 | |
231 | // ======================================================================= |
232 | // function : ClearImmediateDraw |
233 | // purpose : |
234 | // ======================================================================= |
235 | void PrsMgr_PresentationManager::ClearImmediateDraw() |
236 | { |
237 | if (myImmediateView.IsNull()) |
238 | { |
239 | myImmediateList.Clear(); |
240 | return; |
241 | } |
242 | |
243 | for (PrsMgr_ListOfPresentations::Iterator anIter (myImmediateList); anIter.More(); anIter.Next()) |
244 | { |
245 | myImmediateView->View()->EraseImmediate (anIter.Value()); |
246 | } |
247 | |
7fd59977 |
248 | myImmediateList.Clear(); |
679ecdee |
249 | myImmediateView.Nullify(); |
7fd59977 |
250 | } |
251 | |
679ecdee |
252 | // ======================================================================= |
253 | // function : EndImmediateDraw |
254 | // purpose : |
255 | // ======================================================================= |
256 | void PrsMgr_PresentationManager::EndImmediateDraw (const Handle(V3d_View)& theView) |
257 | { |
258 | if (--myImmediateModeOn > 0) |
259 | { |
260 | return; |
261 | } |
262 | |
263 | for (PrsMgr_ListOfPresentations::Iterator anIter (myImmediateList); anIter.More(); anIter.Next()) |
264 | { |
265 | theView->View()->DisplayImmediate (anIter.Value(), Standard_True); |
266 | } |
267 | if (!myImmediateList.IsEmpty()) |
268 | { |
269 | myImmediateView = theView; |
270 | } |
271 | } |
7fd59977 |
272 | |
679ecdee |
273 | // ======================================================================= |
274 | // function : AddToImmediateList |
275 | // purpose : |
276 | //======================================================================= |
277 | void PrsMgr_PresentationManager::AddToImmediateList (const Handle(Prs3d_Presentation)& thePrs) |
278 | { |
279 | if (myImmediateModeOn < 1) |
280 | { |
281 | return; |
282 | } |
283 | |
284 | for (PrsMgr_ListOfPresentations::Iterator anIter (myImmediateList); anIter.More(); anIter.Next()) |
285 | { |
286 | if (anIter.Value() == thePrs) |
287 | { |
288 | return; |
7fd59977 |
289 | } |
679ecdee |
290 | } |
291 | |
292 | myImmediateList.Append (thePrs); |
293 | } |
294 | |
295 | // ======================================================================= |
296 | // function : HasPresentation |
297 | // purpose : |
298 | // ======================================================================= |
299 | Standard_Boolean PrsMgr_PresentationManager::HasPresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
300 | const Standard_Integer theMode) const |
301 | { |
302 | const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations(); |
303 | for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter) |
304 | { |
305 | const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter); |
306 | const Handle(PrsMgr_PresentationManager)& aPrsMgr = aModedPrs.Presentation()->PresentationManager(); |
307 | if (theMode == aModedPrs.Mode() |
308 | && this == aPrsMgr) |
309 | { |
310 | return Standard_True; |
7fd59977 |
311 | } |
312 | } |
679ecdee |
313 | return Standard_False; |
7fd59977 |
314 | } |
315 | |
679ecdee |
316 | // ======================================================================= |
317 | // function : Presentation |
318 | // purpose : |
319 | // ======================================================================= |
320 | Handle(PrsMgr_Presentation) PrsMgr_PresentationManager::Presentation (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
321 | const Standard_Integer theMode) const |
322 | { |
323 | const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations(); |
324 | if (aPrsList.IsEmpty()) |
325 | { |
326 | return Handle(PrsMgr_Presentation)(); |
327 | } |
7fd59977 |
328 | |
679ecdee |
329 | for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter) |
330 | { |
331 | const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter); |
332 | const Handle(PrsMgr_PresentationManager)& aPrsMgr = aModedPrs.Presentation()->PresentationManager(); |
333 | if (theMode == aModedPrs.Mode() |
334 | && this == aPrsMgr) |
335 | { |
336 | return aModedPrs.Presentation(); |
337 | } |
338 | } |
7fd59977 |
339 | |
679ecdee |
340 | // To be changed within dedicated patch |
341 | ///return Handle(PrsMgr_Presentation)(); |
342 | return aPrsList.Last().Presentation(); |
343 | } |
7fd59977 |
344 | |
679ecdee |
345 | // ======================================================================= |
346 | // function : AddPresentation |
347 | // purpose : |
348 | // ======================================================================= |
349 | void PrsMgr_PresentationManager::AddPresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
350 | const Standard_Integer theMode) |
351 | { |
af324faa |
352 | Handle(PrsMgr_Presentation) aPrs = new PrsMgr_Presentation (this, thePrsObj); |
679ecdee |
353 | thePrsObj->Presentations().Append (PrsMgr_ModedPresentation (aPrs, theMode)); |
354 | thePrsObj->Fill (this, aPrs, theMode); |
7fd59977 |
355 | |
679ecdee |
356 | // set layer index accordingly to object's presentations |
357 | const Standard_Integer aZLayerId = GetZLayer (thePrsObj); |
358 | if (aZLayerId >= 0) |
359 | { |
360 | aPrs->SetZLayer (aZLayerId); |
361 | } |
362 | aPrs->SetUpdateStatus (Standard_False); |
363 | } |
7fd59977 |
364 | |
679ecdee |
365 | // ======================================================================= |
366 | // function : RemovePresentation |
367 | // purpose : |
368 | // ======================================================================= |
369 | void PrsMgr_PresentationManager::RemovePresentation (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
370 | const Standard_Integer theMode) |
7fd59977 |
371 | { |
679ecdee |
372 | PrsMgr_Presentations& aPrsList = thePrsObj->Presentations(); |
373 | for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter) |
374 | { |
375 | if (theMode == aPrsList (aPrsIter).Mode()) |
376 | // && this == aPrsMgr) ?? |
377 | { |
378 | aPrsList.Remove (aPrsIter); |
379 | break; |
380 | } |
381 | } |
382 | } |
7fd59977 |
383 | |
679ecdee |
384 | // ======================================================================= |
385 | // function : SetZLayer |
386 | // purpose : |
387 | // ======================================================================= |
388 | void PrsMgr_PresentationManager::SetZLayer (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
389 | const Standard_Integer theLayerId) |
390 | { |
391 | PrsMgr_Presentations& aPrsList = thePrsObj->Presentations(); |
392 | for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter) |
393 | { |
394 | Handle(PrsMgr_Presentation) aPrs = aPrsList.ChangeValue (aPrsIter).Presentation(); |
395 | if (aPrs->PresentationManager() == this) |
396 | { |
397 | aPrs->SetZLayer (theLayerId); |
398 | } |
399 | } |
400 | } |
7fd59977 |
401 | |
679ecdee |
402 | // ======================================================================= |
403 | // function : GetZLayer |
404 | // purpose : |
405 | // ======================================================================= |
406 | Standard_Integer PrsMgr_PresentationManager::GetZLayer (const Handle(PrsMgr_PresentableObject)& thePrsObj) const |
407 | { |
408 | const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations(); |
409 | for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter) |
410 | { |
411 | Handle(PrsMgr_Presentation) aPrs = aPrsList.Value (aPrsIter).Presentation(); |
412 | if (aPrs->PresentationManager() == this) |
413 | { |
414 | return aPrs->GetZLayer(); |
7fd59977 |
415 | } |
7fd59977 |
416 | } |
679ecdee |
417 | return -1; |
418 | } |
7fd59977 |
419 | |
679ecdee |
420 | // ======================================================================= |
421 | // function : Connect |
422 | // purpose : |
423 | // ======================================================================= |
424 | void PrsMgr_PresentationManager::Connect (const Handle(PrsMgr_PresentableObject)& thePrsObject, |
425 | const Handle(PrsMgr_PresentableObject)& theOtherObject, |
426 | const Standard_Integer theMode, |
427 | const Standard_Integer theOtherMode) |
428 | { |
429 | if (!HasPresentation (thePrsObject, theMode)) |
430 | { |
431 | AddPresentation (thePrsObject, theMode); |
432 | } |
433 | if (!HasPresentation (theOtherObject, theOtherMode)) |
434 | { |
435 | AddPresentation (theOtherObject, theOtherMode); |
436 | } |
af324faa |
437 | Presentation (thePrsObject, theMode)->Connect (Presentation (theOtherObject, theMode)); |
7fd59977 |
438 | } |
439 | |
679ecdee |
440 | // ======================================================================= |
441 | // function : Transform |
442 | // purpose : |
443 | // ======================================================================= |
444 | void PrsMgr_PresentationManager::Transform (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
445 | const Handle(Geom_Transformation)& theTransformation, |
446 | const Standard_Integer theMode) |
447 | { |
af324faa |
448 | Presentation (thePrsObj, theMode)->Transform (theTransformation); |
679ecdee |
449 | } |
7fd59977 |
450 | |
679ecdee |
451 | // ======================================================================= |
452 | // function : Place |
453 | // purpose : |
454 | // ======================================================================= |
455 | void PrsMgr_PresentationManager::Place (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
456 | const Quantity_Length theX, |
457 | const Quantity_Length theY, |
458 | const Quantity_Length theZ, |
459 | const Standard_Integer theMode) |
460 | { |
af324faa |
461 | Presentation (thePrsObj, theMode)->Place (theX, theY, theZ); |
679ecdee |
462 | } |
59f45b7c |
463 | |
679ecdee |
464 | // ======================================================================= |
465 | // function : Multiply |
466 | // purpose : |
467 | // ======================================================================= |
468 | void PrsMgr_PresentationManager::Multiply (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
469 | const Handle(Geom_Transformation)& theTransformation, |
470 | const Standard_Integer theMode) |
471 | { |
af324faa |
472 | Presentation (thePrsObj, theMode)->Multiply (theTransformation); |
679ecdee |
473 | } |
59f45b7c |
474 | |
679ecdee |
475 | // ======================================================================= |
476 | // function : Move |
477 | // purpose : |
478 | // ======================================================================= |
479 | void PrsMgr_PresentationManager::Move (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
480 | const Quantity_Length theX, |
481 | const Quantity_Length theY, |
482 | const Quantity_Length theZ, |
483 | const Standard_Integer theMode) |
484 | { |
af324faa |
485 | Presentation (thePrsObj, theMode)->Move (theX, theY, theZ); |
7fd59977 |
486 | } |
487 | |
679ecdee |
488 | // ======================================================================= |
489 | // function : Color |
490 | // purpose : |
491 | // ======================================================================= |
492 | void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)& thePrsObj, |
493 | const Quantity_NameOfColor theColor, |
494 | const Standard_Integer theMode) |
7fd59977 |
495 | { |
679ecdee |
496 | if (!HasPresentation (thePrsObj, theMode)) |
497 | { |
498 | AddPresentation (thePrsObj, theMode); |
7fd59977 |
499 | } |
7fd59977 |
500 | |
af324faa |
501 | Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObj, theMode); |
679ecdee |
502 | if (aPrs->MustBeUpdated()) |
503 | { |
504 | Update (thePrsObj, theMode); |
505 | } |
59f45b7c |
506 | |
679ecdee |
507 | if (myImmediateModeOn > 0) |
508 | { |
509 | Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs->Presentation()); |
510 | aShadow->Color (theColor); |
511 | AddToImmediateList (aShadow); |
512 | } |
513 | else |
514 | { |
515 | aPrs->Color (theColor); |
516 | } |
517 | } |
518 | |
519 | // ======================================================================= |
520 | // function : BoundBox |
521 | // purpose : |
522 | // ======================================================================= |
523 | void PrsMgr_PresentationManager::BoundBox (const Handle(PrsMgr_PresentableObject)& thePrsObject, |
524 | const Standard_Integer theMode) |
59f45b7c |
525 | { |
679ecdee |
526 | if (!HasPresentation (thePrsObject, theMode)) |
59f45b7c |
527 | { |
679ecdee |
528 | AddPresentation (thePrsObject, theMode); |
529 | } |
530 | else if (Presentation (thePrsObject, theMode)->MustBeUpdated()) |
531 | { |
532 | Update (thePrsObject, theMode); |
59f45b7c |
533 | } |
af324faa |
534 | Presentation (thePrsObject, theMode)->BoundBox(); |
59f45b7c |
535 | } |
536 | |
679ecdee |
537 | // ======================================================================= |
538 | // function : SetShadingAspect |
539 | // purpose : |
540 | // ======================================================================= |
541 | void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_PresentableObject)& thePrsObject, |
542 | const Quantity_NameOfColor theColor, |
543 | const Graphic3d_NameOfMaterial theMaterial, |
544 | const Standard_Integer theMode) |
545 | { |
546 | Handle(Prs3d_ShadingAspect) anAspect = new Prs3d_ShadingAspect(); |
547 | anAspect->SetColor (theColor); |
548 | anAspect->SetMaterial (theMaterial); |
549 | SetShadingAspect (thePrsObject, anAspect, theMode); |
550 | } |
59f45b7c |
551 | |
679ecdee |
552 | // ======================================================================= |
553 | // function : SetShadingAspect |
554 | // purpose : |
555 | // ======================================================================= |
556 | void PrsMgr_PresentationManager::SetShadingAspect (const Handle(PrsMgr_PresentableObject)& thePrsObject, |
557 | const Handle(Prs3d_ShadingAspect)& theShadingAspect, |
558 | const Standard_Integer theMode) |
59f45b7c |
559 | { |
679ecdee |
560 | if (HasPresentation (thePrsObject, theMode)) |
59f45b7c |
561 | { |
af324faa |
562 | Presentation (thePrsObject, theMode)->SetShadingAspect (theShadingAspect); |
59f45b7c |
563 | } |
679ecdee |
564 | } |