1 // Created on: 1997-12-16
2 // Created by: Jean Louis Frenkel
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <PrsMgr_PresentableObject.hxx>
19 #include <Graphic3d_AspectFillArea3d.hxx>
20 #include <Prs3d_Drawer.hxx>
21 #include <Prs3d_LineAspect.hxx>
22 #include <Prs3d_PointAspect.hxx>
23 #include <Prs3d_Presentation.hxx>
24 #include <Prs3d_ShadingAspect.hxx>
25 #include <PrsMgr_Presentation.hxx>
26 #include <PrsMgr_PresentationManager.hxx>
27 #include <Standard_NotImplemented.hxx>
28 #include <TColStd_MapOfInteger.hxx>
30 IMPLEMENT_STANDARD_RTTIEXT(PrsMgr_PresentableObject, Standard_Transient)
32 //=======================================================================
33 //function : getIdentityTrsf
35 //=======================================================================
36 const gp_Trsf& PrsMgr_PresentableObject::getIdentityTrsf()
38 static const gp_Trsf THE_IDENTITY_TRSF;
39 return THE_IDENTITY_TRSF;
42 //=======================================================================
43 //function : PrsMgr_PresentableObject
45 //=======================================================================
46 PrsMgr_PresentableObject::PrsMgr_PresentableObject (const PrsMgr_TypeOfPresentation3d theType)
48 myDrawer (new Prs3d_Drawer()),
49 myTypeOfPresentation3d (theType),
51 myCurrentFacingModel (Aspect_TOFM_BOTH_SIDE),
53 hasOwnColor (Standard_False),
54 hasOwnMaterial (Standard_False),
56 myInfiniteState (Standard_False),
57 myIsMutable (Standard_False),
58 myHasOwnPresentations (Standard_True),
59 myToPropagateVisualState (Standard_True)
61 myDrawer->SetDisplayMode (-1);
64 //=======================================================================
65 //function : ~PrsMgr_PresentableObject
66 //purpose : destructor
67 //=======================================================================
68 PrsMgr_PresentableObject::~PrsMgr_PresentableObject()
70 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
72 // should never happen - assertion can be used
73 const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.Value();
75 aPrs3d->myPresentableObject = NULL;
78 for (PrsMgr_ListOfPresentableObjectsIter anIter (myChildren); anIter.More(); anIter.Next())
80 anIter.Value()->SetCombinedParentTransform (Handle(TopLoc_Datum3D)());
81 anIter.Value()->myParent = NULL;
85 //=======================================================================
88 //=======================================================================
89 void PrsMgr_PresentableObject::Fill (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
90 const Handle(PrsMgr_Presentation)& thePrs,
91 const Standard_Integer theMode)
93 const Handle(Prs3d_Presentation)& aStruct3d = thePrs;
94 Compute (thePrsMgr, aStruct3d, theMode);
95 aStruct3d->SetTransformation (myTransformation);
96 aStruct3d->SetClipPlanes (myClipPlanes);
97 aStruct3d->SetTransformPersistence (TransformPersistence());
100 //=======================================================================
101 //function : computeHLR
103 //=======================================================================
104 void PrsMgr_PresentableObject::computeHLR (const Handle(Graphic3d_Camera)& ,
105 const Handle(TopLoc_Datum3D)& ,
106 const Handle(Prs3d_Presentation)& )
108 throw Standard_NotImplemented("cannot compute under a specific projector");
111 //=======================================================================
112 //function : ToBeUpdated
114 //=======================================================================
115 Standard_Boolean PrsMgr_PresentableObject::ToBeUpdated (Standard_Boolean theToIncludeHidden) const
117 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
119 const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value();
120 if (aModedPrs->MustBeUpdated())
122 if (theToIncludeHidden)
124 return Standard_True;
127 Handle(PrsMgr_PresentationManager) aPrsMgr = aModedPrs->PresentationManager();
128 if (aPrsMgr->IsDisplayed (this, aModedPrs->Mode())
129 || aPrsMgr->IsHighlighted(this, aModedPrs->Mode()))
131 return Standard_True;
135 return Standard_False;
138 //=======================================================================
139 //function : UpdatePresentations
141 //=======================================================================
142 Standard_Boolean PrsMgr_PresentableObject::UpdatePresentations (Standard_Boolean theToIncludeHidden)
144 Standard_Boolean hasUpdates = Standard_False;
145 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
147 const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value();
148 if (aModedPrs->MustBeUpdated())
150 Handle(PrsMgr_PresentationManager) aPrsMgr = aModedPrs->PresentationManager();
151 if (theToIncludeHidden
152 || aPrsMgr->IsDisplayed (this, aModedPrs->Mode())
153 || aPrsMgr->IsHighlighted(this, aModedPrs->Mode()))
155 hasUpdates = Standard_True;
156 aPrsMgr->Update (this, aModedPrs->Mode());
163 //=======================================================================
166 //=======================================================================
167 void PrsMgr_PresentableObject::Update (Standard_Integer theMode, Standard_Boolean theToClearOther)
169 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More();)
171 if (aPrsIter.Value()->Mode() == theMode)
173 Handle(PrsMgr_PresentationManager) aPrsMgr = aPrsIter.Value()->PresentationManager();
174 if (aPrsMgr->IsDisplayed (this, theMode)
175 || aPrsMgr->IsHighlighted(this, theMode))
177 aPrsMgr->Update (this, theMode);
178 aPrsIter.Value()->SetUpdateStatus (Standard_False);
182 SetToUpdate (aPrsIter.Value()->Mode());
185 else if (theToClearOther)
187 myPresentations.Remove (aPrsIter);
194 //=======================================================================
195 //function : SetToUpdate
197 //=======================================================================
198 void PrsMgr_PresentableObject::SetToUpdate (Standard_Integer theMode)
200 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
203 || aPrsIter.Value()->Mode() == theMode)
205 aPrsIter.ChangeValue()->SetUpdateStatus (Standard_True);
210 //=======================================================================
211 //function : ToBeUpdated
212 //purpose : gets the list of modes to be updated
213 //=======================================================================
214 void PrsMgr_PresentableObject::ToBeUpdated (TColStd_ListOfInteger& theOutList) const
217 TColStd_MapOfInteger MI(myPresentations.Length());
218 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
220 const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value();
221 if (aModedPrs->MustBeUpdated()
222 && MI.Add (aModedPrs->Mode()))
224 theOutList.Append (aModedPrs->Mode());
229 //=======================================================================
230 //function : SetTypeOfPresentation
232 //=======================================================================
233 void PrsMgr_PresentableObject::SetTypeOfPresentation (const PrsMgr_TypeOfPresentation3d theType)
235 myTypeOfPresentation3d = theType;
236 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
238 const Handle(PrsMgr_Presentation)& aPrs = aPrsIter.Value();
239 aPrs->SetVisual (myTypeOfPresentation3d == PrsMgr_TOP_ProjectorDependant
240 ? Graphic3d_TOS_COMPUTED
241 : Graphic3d_TOS_ALL);
245 //=======================================================================
246 //function : setLocalTransformation
248 //=======================================================================
249 void PrsMgr_PresentableObject::setLocalTransformation (const Handle(TopLoc_Datum3D)& theTransformation)
251 myLocalTransformation = theTransformation;
252 UpdateTransformation();
255 //=======================================================================
256 //function : ResetTransformation
258 //=======================================================================
259 void PrsMgr_PresentableObject::ResetTransformation()
261 setLocalTransformation (Handle(TopLoc_Datum3D)());
264 //=======================================================================
265 //function : SetCombinedParentTransform
267 //=======================================================================
268 void PrsMgr_PresentableObject::SetCombinedParentTransform (const Handle(TopLoc_Datum3D)& theTrsf)
270 myCombinedParentTransform = theTrsf;
271 UpdateTransformation();
274 //=======================================================================
275 //function : UpdateTransformation
277 //=======================================================================
278 void PrsMgr_PresentableObject::UpdateTransformation()
280 myTransformation.Nullify();
281 myInvTransformation = gp_Trsf();
282 if (!myCombinedParentTransform.IsNull() && myCombinedParentTransform->Form() != gp_Identity)
284 if (!myLocalTransformation.IsNull() && myLocalTransformation->Form() != gp_Identity)
286 const gp_Trsf aTrsf = myCombinedParentTransform->Trsf() * myLocalTransformation->Trsf();
287 myTransformation = new TopLoc_Datum3D (aTrsf);
288 myInvTransformation = aTrsf.Inverted();
292 myTransformation = myCombinedParentTransform;
293 myInvTransformation = myCombinedParentTransform->Trsf().Inverted();
296 else if (!myLocalTransformation.IsNull() && myLocalTransformation->Form() != gp_Identity)
298 myTransformation = myLocalTransformation;
299 myInvTransformation = myLocalTransformation->Trsf().Inverted();
302 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
304 aPrsIter.ChangeValue()->SetTransformation (myTransformation);
307 for (PrsMgr_ListOfPresentableObjectsIter aChildIter (myChildren); aChildIter.More(); aChildIter.Next())
309 aChildIter.Value()->SetCombinedParentTransform (myTransformation);
313 //=======================================================================
314 //function : recomputeComputed
316 //=======================================================================
317 void PrsMgr_PresentableObject::recomputeComputed() const
319 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
321 const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.Value();
326 //=======================================================================
327 //function : SetTransformPersistence
329 //=======================================================================
330 void PrsMgr_PresentableObject::SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers)
332 myTransformPersistence = theTrsfPers;
333 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
335 const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.Value();
336 aPrs3d->SetTransformPersistence (myTransformPersistence);
341 //=======================================================================
342 //function : GetTransformPersistence
344 //=======================================================================
345 gp_Pnt PrsMgr_PresentableObject::GetTransformPersistencePoint() const
347 if (myTransformPersistence.IsNull())
351 else if (myTransformPersistence->IsZoomOrRotate())
353 return myTransformPersistence->AnchorPoint();
355 else if (!myTransformPersistence->IsTrihedronOr2d())
360 Standard_Real anX = 0.0;
361 if ((myTransformPersistence->Corner2d() & Aspect_TOTP_RIGHT) != 0)
365 else if ((myTransformPersistence->Corner2d() & Aspect_TOTP_LEFT) != 0)
370 Standard_Real anY = 0.0;
371 if ((myTransformPersistence->Corner2d() & Aspect_TOTP_TOP) != 0)
375 else if ((myTransformPersistence->Corner2d() & Aspect_TOTP_BOTTOM) != 0)
380 return gp_Pnt (anX, anY, myTransformPersistence->Offset2d().x());
383 //=======================================================================
384 //function : AddChild
386 //=======================================================================
387 void PrsMgr_PresentableObject::AddChild (const Handle(PrsMgr_PresentableObject)& theObject)
389 Handle(PrsMgr_PresentableObject) aHandleGuard = theObject;
390 if (theObject->myParent != NULL)
392 theObject->myParent->RemoveChild (aHandleGuard);
395 myChildren.Append (theObject);
396 theObject->myParent = this;
397 theObject->SetCombinedParentTransform (myTransformation);
400 //=======================================================================
401 //function : AddChildWithCurrentTransformation
403 //=======================================================================
404 void PrsMgr_PresentableObject::AddChildWithCurrentTransformation(const Handle(PrsMgr_PresentableObject)& theObject)
406 gp_Trsf aTrsf = Transformation().Inverted() * theObject->Transformation();
407 theObject->SetLocalTransformation(aTrsf);
411 //=======================================================================
412 //function : RemoveChild
414 //=======================================================================
415 void PrsMgr_PresentableObject::RemoveChild (const Handle(PrsMgr_PresentableObject)& theObject)
417 PrsMgr_ListOfPresentableObjectsIter anIter (myChildren);
418 for (; anIter.More(); anIter.Next())
420 if (anIter.Value() == theObject)
422 theObject->myParent = NULL;
423 theObject->SetCombinedParentTransform (Handle(TopLoc_Datum3D)());
424 myChildren.Remove (anIter);
430 //=======================================================================
431 //function : RemoveChildWithRestoreTransformation
433 //=======================================================================
434 void PrsMgr_PresentableObject::RemoveChildWithRestoreTransformation(const Handle(PrsMgr_PresentableObject)& theObject)
436 gp_Trsf aTrsf = theObject->Transformation();
437 RemoveChild(theObject);
438 theObject->SetLocalTransformation(aTrsf);
441 //=======================================================================
442 //function : SetZLayer
444 //=======================================================================
445 void PrsMgr_PresentableObject::SetZLayer (const Graphic3d_ZLayerId theLayerId)
447 if (myDrawer->ZLayer() == theLayerId)
452 myDrawer->SetZLayer (theLayerId);
453 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
455 const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value();
456 aModedPrs->SetZLayer (theLayerId);
460 // =======================================================================
461 // function : AddClipPlane
463 // =======================================================================
464 void PrsMgr_PresentableObject::AddClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane)
466 // add to collection and process changes
467 if (myClipPlanes.IsNull())
469 myClipPlanes = new Graphic3d_SequenceOfHClipPlane();
472 myClipPlanes->Append (thePlane);
476 // =======================================================================
477 // function : RemoveClipPlane
479 // =======================================================================
480 void PrsMgr_PresentableObject::RemoveClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane)
482 if (myClipPlanes.IsNull())
487 // remove from collection and process changes
488 for (Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (*myClipPlanes); aPlaneIt.More(); aPlaneIt.Next())
490 const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIt.Value();
491 if (aPlane != thePlane)
494 myClipPlanes->Remove (aPlaneIt);
500 // =======================================================================
501 // function : SetClipPlanes
503 // =======================================================================
504 void PrsMgr_PresentableObject::SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes)
506 // change collection and process changes
507 myClipPlanes = thePlanes;
511 // =======================================================================
512 // function : UpdateClipping
514 // =======================================================================
515 void PrsMgr_PresentableObject::UpdateClipping()
517 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
519 const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value();
520 aModedPrs->SetClipPlanes (myClipPlanes);
524 //=======================================================================
525 //function : SetInfiniteState
527 //=======================================================================
528 void PrsMgr_PresentableObject::SetInfiniteState (const Standard_Boolean theFlag)
530 if (myInfiniteState == theFlag)
535 myInfiniteState = theFlag;
536 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
538 const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value();
539 aModedPrs->SetInfiniteState (theFlag);
543 // =======================================================================
544 // function : SetMutable
546 // =======================================================================
547 void PrsMgr_PresentableObject::SetMutable (const Standard_Boolean theIsMutable)
549 if (myIsMutable == theIsMutable)
554 myIsMutable = theIsMutable;
555 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
557 const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value();
558 aModedPrs->SetMutable (theIsMutable);
562 // =======================================================================
563 // function : UnsetAttributes
565 // =======================================================================
566 void PrsMgr_PresentableObject::UnsetAttributes()
568 Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer();
569 if (myDrawer->HasLink())
571 aDrawer->Link(myDrawer->Link());
575 hasOwnColor = Standard_False;
576 hasOwnMaterial = Standard_False;
578 myDrawer->SetTransparency (0.0f);
581 //=======================================================================
582 //function : SetHilightMode
584 //=======================================================================
585 void PrsMgr_PresentableObject::SetHilightMode (const Standard_Integer theMode)
587 if (myHilightDrawer.IsNull())
589 myHilightDrawer = new Prs3d_Drawer();
590 myHilightDrawer->Link (myDrawer);
591 myHilightDrawer->SetAutoTriangulation (Standard_False);
592 myHilightDrawer->SetColor (Quantity_NOC_GRAY80);
593 myHilightDrawer->SetZLayer(Graphic3d_ZLayerId_UNKNOWN);
595 if (myDynHilightDrawer.IsNull())
597 myDynHilightDrawer = new Prs3d_Drawer();
598 myDynHilightDrawer->Link (myDrawer);
599 myDynHilightDrawer->SetColor (Quantity_NOC_CYAN1);
600 myDynHilightDrawer->SetAutoTriangulation (Standard_False);
601 myDynHilightDrawer->SetZLayer(Graphic3d_ZLayerId_Top);
603 myHilightDrawer ->SetDisplayMode (theMode);
604 myDynHilightDrawer->SetDisplayMode (theMode);
607 //=======================================================================
608 //function : SynchronizeAspects
610 //=======================================================================
611 void PrsMgr_PresentableObject::SynchronizeAspects()
613 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
615 const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue();
616 for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPrs3d->Groups()); aGroupIter.More(); aGroupIter.Next())
618 if (!aGroupIter.Value().IsNull())
620 aGroupIter.ChangeValue()->SynchronizeAspects();
626 //=======================================================================
627 //function : replaceAspects
629 //=======================================================================
630 void PrsMgr_PresentableObject::replaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap)
632 if (theMap.IsEmpty())
637 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
639 const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue();
640 for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPrs3d->Groups()); aGroupIter.More(); aGroupIter.Next())
642 if (!aGroupIter.Value().IsNull())
644 aGroupIter.ChangeValue()->ReplaceAspects (theMap);
650 //=======================================================================
651 //function : BoundingBox
653 //=======================================================================
654 void PrsMgr_PresentableObject::BoundingBox (Bnd_Box& theBndBox)
656 if (myDrawer->DisplayMode() == -1)
658 if (!myPresentations.IsEmpty())
660 const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations.First();
661 const Graphic3d_BndBox3d& aBndBox = aPrs3d->CStructure()->BoundingBox();
662 if (aBndBox.IsValid())
664 theBndBox.Update (aBndBox.CornerMin().x(), aBndBox.CornerMin().y(), aBndBox.CornerMin().z(),
665 aBndBox.CornerMax().x(), aBndBox.CornerMax().y(), aBndBox.CornerMax().z());
674 for (PrsMgr_ListOfPresentableObjectsIter aPrsIter (myChildren); aPrsIter.More(); aPrsIter.Next())
676 if (const Handle(PrsMgr_PresentableObject)& aChild = aPrsIter.Value())
679 aChild->BoundingBox (aBox);
680 theBndBox.Add (aBox);
686 for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next())
688 const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue();
689 if (aPrs3d->Mode() == myDrawer->DisplayMode())
691 const Graphic3d_BndBox3d& aBndBox = aPrs3d->CStructure()->BoundingBox();
692 if (aBndBox.IsValid())
694 theBndBox.Update (aBndBox.CornerMin().x(), aBndBox.CornerMin().y(), aBndBox.CornerMin().z(),
695 aBndBox.CornerMax().x(), aBndBox.CornerMax().y(), aBndBox.CornerMax().z());
706 //=======================================================================
707 //function : Material
709 //=======================================================================
710 Graphic3d_NameOfMaterial PrsMgr_PresentableObject::Material() const
712 return myDrawer->ShadingAspect()->Material().Name();
715 //=======================================================================
716 //function : SetMaterial
718 //=======================================================================
719 void PrsMgr_PresentableObject::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
721 myDrawer->SetupOwnShadingAspect();
722 myDrawer->ShadingAspect()->SetMaterial (theMaterial);
723 hasOwnMaterial = Standard_True;
726 //=======================================================================
727 //function : UnsetMaterial
729 //=======================================================================
730 void PrsMgr_PresentableObject::UnsetMaterial()
737 if (HasColor() || IsTransparent())
739 if (myDrawer->HasLink())
741 myDrawer->ShadingAspect()->SetMaterial (myDrawer->Link()->ShadingAspect()->Aspect()->BackMaterial());
746 SetColor (myDrawer->Color());
751 SetTransparency (myDrawer->Transparency());
756 myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
759 hasOwnMaterial = Standard_False;
762 //=======================================================================
763 //function : SetTransparency
765 //=======================================================================
766 void PrsMgr_PresentableObject::SetTransparency (const Standard_Real theValue)
768 myDrawer->SetupOwnShadingAspect();
769 myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (Standard_ShortReal(theValue));
770 myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (Standard_ShortReal(theValue));
771 myDrawer->SetTransparency (Standard_ShortReal(theValue));
774 //=======================================================================
775 //function : UnsetTransparency
777 //=======================================================================
778 void PrsMgr_PresentableObject::UnsetTransparency()
780 if (HasColor() || HasMaterial())
782 myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (0.0f);
783 myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (0.0f);
787 myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
789 myDrawer->SetTransparency (0.0f);
792 //=======================================================================
793 //function : SetPolygonOffsets
795 //=======================================================================
796 void PrsMgr_PresentableObject::SetPolygonOffsets (const Standard_Integer theMode,
797 const Standard_ShortReal theFactor,
798 const Standard_ShortReal theUnits)
800 myDrawer->SetupOwnShadingAspect();
801 myDrawer->ShadingAspect()->Aspect()->SetPolygonOffsets (theMode, theFactor, theUnits);
802 SynchronizeAspects();
805 //=======================================================================
806 //function : HasPolygonOffsets
808 //=======================================================================
809 Standard_Boolean PrsMgr_PresentableObject::HasPolygonOffsets() const
811 return !(myDrawer->HasOwnShadingAspect()
812 || (myDrawer->HasLink()
813 && myDrawer->ShadingAspect() == myDrawer->Link()->ShadingAspect()));
816 //=======================================================================
817 //function : PolygonOffsets
819 //=======================================================================
820 void PrsMgr_PresentableObject::PolygonOffsets (Standard_Integer& theMode,
821 Standard_ShortReal& theFactor,
822 Standard_ShortReal& theUnits) const
824 if (HasPolygonOffsets())
826 myDrawer->ShadingAspect()->Aspect()->PolygonOffsets (theMode, theFactor, theUnits);
830 // =======================================================================
831 // function : DumpJson
833 // =======================================================================
834 void PrsMgr_PresentableObject::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
836 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
838 OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myParent)
840 for (PrsMgr_Presentations::Iterator anIterator (myPresentations); anIterator.More(); anIterator.Next())
842 const Handle(PrsMgr_Presentation)& aPresentation = anIterator.Value();
843 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aPresentation.get())
846 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myClipPlanes.get())
848 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDrawer.get())
849 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myHilightDrawer.get())
850 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDynHilightDrawer.get())
852 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTransformPersistence.get())
854 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myLocalTransformation.get())
855 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTransformation.get())
856 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myCombinedParentTransform.get())
858 for (PrsMgr_ListOfPresentableObjects::Iterator anIterator (myChildren); anIterator.More(); anIterator.Next())
860 const Handle(PrsMgr_PresentableObject)& aChildObject = anIterator.Value();
861 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aChildObject.get())
864 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myInvTransformation)
866 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTypeOfPresentation3d)
867 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurrentFacingModel)
869 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myOwnWidth)
870 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, hasOwnColor)
871 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, hasOwnMaterial)
873 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myInfiniteState)
874 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsMutable)
875 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnPresentations)
877 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToPropagateVisualState)