]> OCCT Git - occt.git/commitdiff
0032704: Visualization, Prs3d_Drawer - do not implicitly create aspects within getters
authorkgv <kgv@opencascade.com>
Wed, 1 Dec 2021 08:58:39 +0000 (11:58 +0300)
committersmoskvin <smoskvin@opencascade.com>
Fri, 3 Dec 2021 14:56:37 +0000 (17:56 +0300)
Prs3d_Drawer getters now return NULL instead of implicitly creating "default" aspects.
Added missing initialization of default properties in AIS_InteractiveContext.
AIS_InteractiveContext::setContextToObject() - added missing propagation of Context to child presentations.

14 files changed:
dox/upgrade/upgrade.md
samples/mfc/standard/01_Geometry/src/GeomSources.cpp
samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Direction.cpp
samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp
src/AIS/AIS_InteractiveContext.cxx
src/AIS/AIS_InteractiveContext.hxx
src/AIS/AIS_Shape.cxx
src/IVtkDraw/IVtkDraw.cxx
src/IVtkOCC/IVtkOCC_Shape.cxx
src/Prs3d/Prs3d_Drawer.cxx
src/Prs3d/Prs3d_Drawer.hxx
src/QABugs/QABugs_17.cxx
src/ViewerTest/ViewerTest_ObjectCommands.cxx
tests/v3d/bugs/bug1174 [deleted file]

index ffa19e9390360a238628260551f58efb74eb49ce..6e4a60b47e2b0c1c07be812103293821cd85193c 100644 (file)
@@ -2297,7 +2297,7 @@ void Perform(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface,
 @section upgrade_occt770 Upgrade to OCCT 7.7.0
 
 @subsection upgrade_occt770_parallel_flag_removed Removed parameter theIsParallel from Put/Compute/Perform
+
 theIsParallel parameter has been removed from Put/Compute/Perform from the next classes:
  - BRepCheck_Analyzer
  - BRepCheck_Edge
@@ -2311,4 +2311,10 @@ For example:
 BRepLib_ValidateEdge aValidateEdge(myHCurve, ACS, SameParameter);
 aValidateEdge.SetParallel(toRunParallel);
 aValidateEdge.Process();
-~~~~ 
\ No newline at end of file
+~~~~
+
+@subsection upgrade_occt770_drawer_aspects Prs3d_Drawer aspects
+
+`Prs3d_Drawer` getters no more implicitly create "default" aspects.
+If specific property has not been set before to this drawer instance nor to linked drawer instance, then NULL property will be returned.
+Make sure to set property beforehand or to call `SetOwn*` / `SetupOwn*` methods to derive from defaults.
index c59e5bd1569665f0c842ded4b1525f59ebcbf2c8..eab054b3a9d99a5f745fe0d9576a017c2ca34e3c 100755 (executable)
@@ -983,6 +983,7 @@ if(NbResults>0){                                          \n\
 
  Handle(ISession_Surface) aSurface = new ISession_Surface(SP);
  Handle(Prs3d_Drawer) CurDrawer = aSurface->Attributes();
+ CurDrawer->SetOwnLineAspects();
  CurDrawer->UIsoAspect()->SetNumber(10);
  CurDrawer->VIsoAspect()->SetNumber(10);
  aDoc->GetAISContext()->SetLocalAttributes(aSurface, CurDrawer, Standard_False);
index 042576946b516b21f5174aa0e40ed7b50b60626f..fa7bea1218c5185b123b6e3e92a6952284c60cd7 100755 (executable)
@@ -51,7 +51,7 @@ ISession_Direction::ISession_Direction (const gp_Pnt2d& aPnt2d,
   myDir (gp_Dir(aDir2d.X(),aDir2d.Y(),0.0)),
   myLength (aLength)
 {
-  myArrowLength = myDrawer->ArrowAspect()->Length();
+  myArrowLength = 1.0;
 }
 
 ISession_Direction::ISession_Direction (const gp_Pnt2d& aPnt2d,
@@ -60,7 +60,7 @@ ISession_Direction::ISession_Direction (const gp_Pnt2d& aPnt2d,
   myDir (gp_Dir(aVec2d.X(), aVec2d.Y(), 0.0))
 {
   myLength = aVec2d.Magnitude();
-  myArrowLength = myDrawer->ArrowAspect()->Length();
+  myArrowLength = 1.0;
 }
 
 
index 81868ae0b058d36ed3abd68bc27c76092ed7faf9..ecf15e537337dd4d27c81441233e12730d511b74 100755 (executable)
@@ -26,6 +26,7 @@ void ISession_Surface::Compute (const Handle(PrsMgr_PresentationManager)& ,
   Handle(GeomAdaptor_Surface) anAdaptorHSurface = new GeomAdaptor_Surface (mySurface);
 
   Handle(Prs3d_Drawer) aPoleDrawer = new Prs3d_Drawer();
+  aPoleDrawer->SetOwnLineAspects();
   aPoleDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_YELLOW3, Aspect_TOL_SOLID, 1.0));
   switch (theMode)
   {
index 0f712b50e2481674ea3c5493b5fd2b5777363dda..ae54206b1618a7003e17f6632f4aae54c2cbfc58 100644 (file)
@@ -128,6 +128,7 @@ myIsAutoActivateSelMode(Standard_True)
   myStyles[Prs3d_TypeOfHighlight_LocalDynamic]  = new Prs3d_Drawer();
   myStyles[Prs3d_TypeOfHighlight_SubIntensity]  = new Prs3d_Drawer();
 
+  myDefaultDrawer->SetupOwnDefaults();
   myDefaultDrawer->SetZLayer(Graphic3d_ZLayerId_Default);
   myDefaultDrawer->SetDisplayMode(0);
   {
@@ -704,11 +705,15 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
                                               const Standard_Boolean theIsToUpdate)
 {
   if (theObj.IsNull())
+  {
     return;
+  }
 
   setContextToObject (theObj);
   if (!myObjects.IsBound (theObj))
+  {
     return;
+  }
 
   const Handle(AIS_GlobalStatus)& aStatus = myObjects (theObj);
   aStatus->SetHilightStatus (Standard_True);
@@ -720,7 +725,9 @@ void AIS_InteractiveContext::HilightWithColor(const Handle(AIS_InteractiveObject
   }
 
   if (theIsToUpdate)
+  {
     myMainVwr->Update();
+  }
 }
 
 //=======================================================================
@@ -2300,6 +2307,33 @@ gp_Pnt AIS_InteractiveContext::GravityPoint (const Handle(V3d_View)& theView) co
   return theView->GravityPoint();
 }
 
+//=======================================================================
+//function : setContextToObject
+//purpose  :
+//=======================================================================
+void AIS_InteractiveContext::setContextToObject (const Handle(AIS_InteractiveObject)& theObj)
+{
+  if (theObj->HasInteractiveContext())
+  {
+    if (theObj->myCTXPtr != this)
+    {
+      throw Standard_ProgramError("AIS_InteractiveContext - object has been already displayed in another context!");
+    }
+  }
+  else
+  {
+    theObj->SetContext (this);
+  }
+
+  for (PrsMgr_ListOfPresentableObjectsIter aPrsIter (theObj->Children()); aPrsIter.More(); aPrsIter.Next())
+  {
+    if (Handle(AIS_InteractiveObject) aChild = Handle(AIS_InteractiveObject)::DownCast (aPrsIter.Value()))
+    {
+      setContextToObject (aChild);
+    }
+  }
+}
+
 //=======================================================================
 //function : setObjectStatus
 //purpose  :
index fe47b0c889312b79f4d97be270de82b0ded4276a..8faa035d4feea70927bc4653e6c1792a5a3fe31e 100644 (file)
@@ -1395,20 +1395,7 @@ protected: //! @name internal methods
   }
 
   //! Assign the context to the object or throw exception if object was already assigned to another context.
-  void setContextToObject (const Handle(AIS_InteractiveObject)& theObj)
-  {
-    if (theObj->HasInteractiveContext())
-    {
-      if (theObj->myCTXPtr != this)
-      {
-        throw Standard_ProgramError("AIS_InteractiveContext - object has been already displayed in another context!");
-      }
-    }
-    else
-    {
-      theObj->SetContext (this);
-    }
-  }
+  Standard_EXPORT void setContextToObject (const Handle(AIS_InteractiveObject)& theObj);
 
   //! Return display mode for highlighting.
   Standard_Integer getHilightMode (const Handle(AIS_InteractiveObject)& theObj,
index 076a8887109083293245d316e9ff26e2627535d3..746db59025a429e94f3f66e8ab4f4417e7e049f3 100644 (file)
@@ -355,16 +355,28 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
   StdSelect::SetDrawerForBRepOwner(aSelection,myDrawer);
 }
 
-void AIS_Shape::Color( Quantity_Color& aColor ) const {
-  aColor = myDrawer->ShadingAspect()->Color(myCurrentFacingModel);
+void AIS_Shape::Color (Quantity_Color& theColor) const
+{
+  if (const Handle(Prs3d_ShadingAspect)& aShading = myDrawer->ShadingAspect())
+  {
+    theColor = myDrawer->ShadingAspect()->Color(myCurrentFacingModel);
+  }
 }
 
-Graphic3d_NameOfMaterial AIS_Shape::Material() const {
-  return (myDrawer->ShadingAspect()->Material(myCurrentFacingModel)).Name();
+Graphic3d_NameOfMaterial AIS_Shape::Material() const
+{
+  const Handle(Prs3d_ShadingAspect)& aShading = myDrawer->ShadingAspect();
+  return !aShading.IsNull()
+        ? aShading->Material(myCurrentFacingModel).Name()
+        : Graphic3d_NameOfMaterial_DEFAULT;
 }
 
-Standard_Real AIS_Shape::Transparency() const {
-  return myDrawer->ShadingAspect()->Transparency(myCurrentFacingModel);
+Standard_Real AIS_Shape::Transparency() const
+{
+  const Handle(Prs3d_ShadingAspect)& aShading = myDrawer->ShadingAspect();
+  return !aShading.IsNull()
+        ? aShading->Transparency(myCurrentFacingModel)
+        : 0.0;
 }
 
 //=======================================================================
@@ -639,9 +651,10 @@ void AIS_Shape::setMaterial (const Handle(Prs3d_Drawer)&     theDrawer,
                              const Standard_Boolean          theToKeepColor,
                              const Standard_Boolean          theToKeepTransp) const
 {
+  theDrawer->SetupOwnShadingAspect();
+
   const Quantity_Color aColor  = theDrawer->ShadingAspect()->Color (myCurrentFacingModel);
   const Standard_Real  aTransp = theDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
-  theDrawer->SetupOwnShadingAspect();
   theDrawer->ShadingAspect()->SetMaterial (theMaterial, myCurrentFacingModel);
 
   if (theToKeepColor)
index 4f54a5976275cbe5e93fe24b832499c7777faf9f..a81e03b64bdd7e900662dd274401f8609fe5a575 100644 (file)
@@ -171,6 +171,7 @@ static Handle(PipelinePtr) PipelineByActorName (const TCollection_AsciiString& t
 static Handle(Prs3d_Drawer) createDefaultDrawer()
 {
   Handle(Prs3d_Drawer) aGlobalDrawer = new Prs3d_Drawer();
+  aGlobalDrawer->SetupOwnDefaults();
   aGlobalDrawer->SetTypeOfDeflection (Aspect_TOD_RELATIVE);
   aGlobalDrawer->SetDeviationCoefficient (0.0001);
   return aGlobalDrawer;
index 1d9a065fdb5c113b2fdadc57d63a9af32dfca265..60fd4bcb06508a336103a7b71249fb81990608dd 100644 (file)
@@ -36,6 +36,7 @@ IVtkOCC_Shape::IVtkOCC_Shape (const TopoDS_Shape& theShape,
   {
     // these old defaults have been moved from IVtkOCC_ShapeMesher constructor
     myOCCTDrawer->SetDeviationCoefficient (0.0001); // Aspect_TOD_RELATIVE
+    myOCCTDrawer->SetupOwnDefaults();
   }
   buildSubShapeIdMap();
 }
index d8b54cf2f63cdbd1586beca382a8773529db63ac..7b9b9260968603897e62efab2660ae0165bdcd1f 100644 (file)
@@ -48,19 +48,14 @@ namespace
 // purpose  :
 // =======================================================================
 Prs3d_Drawer::Prs3d_Drawer()
-: myNbPoints                      (30),
-  myHasOwnNbPoints                (Standard_False),
-  myMaximalParameterValue         (500000.),
-  myHasOwnMaximalParameterValue   (Standard_False),
-  myChordialDeviation             (0.0001),
-  myHasOwnChordialDeviation       (Standard_False),
+: myNbPoints                      (-1),
+  myMaximalParameterValue         (-1.0),
+  myChordialDeviation             (-1.0),
   myTypeOfDeflection              (Aspect_TOD_RELATIVE),
   myHasOwnTypeOfDeflection        (Standard_False),
   myTypeOfHLR                     (Prs3d_TOH_NotSet),
-  myDeviationCoefficient          (0.001),
-  myHasOwnDeviationCoefficient    (Standard_False),
-  myDeviationAngle                (20.0 * M_PI / 180.0),
-  myHasOwnDeviationAngle          (Standard_False),
+  myDeviationCoefficient          (-1.0),
+  myDeviationAngle                (-1.0),
   myIsoOnPlane                    (Standard_False),
   myHasOwnIsoOnPlane              (Standard_False),
   myIsoOnTriangulation            (Standard_False),
@@ -68,40 +63,22 @@ Prs3d_Drawer::Prs3d_Drawer()
   myIsAutoTriangulated            (Standard_True),
   myHasOwnIsAutoTriangulated      (Standard_False),
 
-  myHasOwnUIsoAspect          (Standard_False),
-  myHasOwnVIsoAspect          (Standard_False),
-  myHasOwnWireAspect          (Standard_False),
   myWireDraw                  (Standard_True),
   myHasOwnWireDraw            (Standard_False),
-  myHasOwnPointAspect         (Standard_False),
-  myHasOwnLineAspect          (Standard_False),
-  myHasOwnTextAspect          (Standard_False),
-  myHasOwnShadingAspect       (Standard_False),
-  myHasOwnPlaneAspect         (Standard_False),
-  myHasOwnSeenLineAspect      (Standard_False),
-  myHasOwnArrowAspect         (Standard_False),
   myLineArrowDraw             (Standard_False),
   myHasOwnLineArrowDraw       (Standard_False),
-  myHasOwnHiddenLineAspect    (Standard_False),
   myDrawHiddenLine            (Standard_False),
   myHasOwnDrawHiddenLine      (Standard_False),
-  myHasOwnVectorAspect        (Standard_False),
   myVertexDrawMode            (Prs3d_VDM_Inherited),
-  myHasOwnDatumAspect         (Standard_False),
-  myHasOwnSectionAspect       (Standard_False),
 
-  myHasOwnFreeBoundaryAspect   (Standard_False),
   myFreeBoundaryDraw           (Standard_True),
   myHasOwnFreeBoundaryDraw     (Standard_False),
-  myHasOwnUnFreeBoundaryAspect (Standard_False),
   myUnFreeBoundaryDraw         (Standard_True),
   myHasOwnUnFreeBoundaryDraw   (Standard_False),
   myFaceBoundaryUpperContinuity(-1),
-  myHasOwnFaceBoundaryAspect   (Standard_False),
   myFaceBoundaryDraw           (Standard_False),
   myHasOwnFaceBoundaryDraw     (Standard_False),
 
-  myHasOwnDimensionAspect       (Standard_False),
   myHasOwnDimLengthModelUnits   (Standard_False),
   myHasOwnDimAngleModelUnits    (Standard_False),
   myHasOwnDimLengthDisplayUnits (Standard_False),
@@ -114,25 +91,33 @@ Prs3d_Drawer::Prs3d_Drawer()
 }
 
 // =======================================================================
-// function : SetTypeOfDeflection
+// function : SetupOwnDefaults
 // purpose  :
 // =======================================================================
-
-void Prs3d_Drawer::SetTypeOfDeflection (const Aspect_TypeOfDeflection theTypeOfDeflection)
+void Prs3d_Drawer::SetupOwnDefaults()
 {
-  myHasOwnTypeOfDeflection = Standard_True;
-  myTypeOfDeflection       = theTypeOfDeflection;
+  myNbPoints = 30;
+  myMaximalParameterValue = 500000.0;
+  myChordialDeviation    = 0.0001;
+  myDeviationCoefficient = 0.001;
+  myDeviationAngle       = 20.0 * M_PI / 180.0;
+  SetupOwnShadingAspect();
+  SetupOwnPointAspect();
+  SetOwnDatumAspects();
+  SetOwnLineAspects();
+  SetTextAspect (new Prs3d_TextAspect());
+  SetDimensionAspect (new Prs3d_DimensionAspect());
 }
 
 // =======================================================================
-// function : SetMaximalChordialDeviation
+// function : SetTypeOfDeflection
 // purpose  :
 // =======================================================================
 
-void Prs3d_Drawer::SetMaximalChordialDeviation (const Standard_Real theChordialDeviation)
+void Prs3d_Drawer::SetTypeOfDeflection (const Aspect_TypeOfDeflection theTypeOfDeflection)
 {
-  myHasOwnChordialDeviation = Standard_True;
-  myChordialDeviation       = theChordialDeviation;
+  myHasOwnTypeOfDeflection = Standard_True;
+  myTypeOfDeflection       = theTypeOfDeflection;
 }
 
 // =======================================================================
@@ -150,18 +135,17 @@ void Prs3d_Drawer::SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR)
 // purpose  : gets type of HLR algorithm
 // =======================================================================
 
-Prs3d_TypeOfHLR Prs3d_Drawer::TypeOfHLR()
+Prs3d_TypeOfHLR Prs3d_Drawer::TypeOfHLR() const
 {
-  if (!HasOwnTypeOfHLR())
+  if (HasOwnTypeOfHLR())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->TypeOfHLR();
-    }
-    // Prs3d_TOH_PolyAlgo is default value for this setting.
-    myTypeOfHLR = Prs3d_TOH_PolyAlgo;
+    return myTypeOfHLR;
+  }
+  else if (!myLink.IsNull())
+  {
+    return myLink->TypeOfHLR();
   }
-  return myTypeOfHLR;
+  return Prs3d_TOH_PolyAlgo;
 }
 
 // =======================================================================
@@ -174,17 +158,6 @@ void Prs3d_Drawer::SetIsoOnTriangulation (const Standard_Boolean theToEnable)
   myIsoOnTriangulation = theToEnable;
 }
 
-// =======================================================================
-// function : SetMaximalParameterValue
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetMaximalParameterValue (const Standard_Real theValue)
-{
-  myHasOwnMaximalParameterValue = Standard_True;
-  myMaximalParameterValue       = theValue;
-}
-
 // =======================================================================
 // function : SetIsoOnPlane
 // purpose  :
@@ -196,17 +169,6 @@ void Prs3d_Drawer::SetIsoOnPlane (const Standard_Boolean theIsEnabled)
   myIsoOnPlane       = theIsEnabled;
 }
 
-// =======================================================================
-// function : SetDiscretisation
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetDiscretisation (const Standard_Integer theValue) 
-{
-  myHasOwnNbPoints = Standard_True;
-  myNbPoints       = theValue;
-}
-
 //=======================================================================
 //function : SetDeviationCoefficient
 //purpose  : 
@@ -216,7 +178,6 @@ void Prs3d_Drawer::SetDeviationCoefficient (const Standard_Real theCoefficient)
 {
   myPreviousDeviationCoefficient = DeviationCoefficient();
   myDeviationCoefficient         = theCoefficient;
-  myHasOwnDeviationCoefficient   = Standard_True;
 }
 
 //=======================================================================
@@ -228,7 +189,6 @@ void Prs3d_Drawer::SetDeviationAngle (const Standard_Real theAngle)
 {
   myPreviousDeviationAngle = DeviationAngle();
   myDeviationAngle         = theAngle;
-  myHasOwnDeviationAngle   = Standard_True;
 }
 
 // =======================================================================
@@ -247,33 +207,16 @@ void Prs3d_Drawer::SetAutoTriangulation (const Standard_Boolean theIsEnabled)
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_LineAspect)& Prs3d_Drawer::FreeBoundaryAspect()
+const Handle(Prs3d_LineAspect)& Prs3d_Drawer::FreeBoundaryAspect() const
 {
-  if (!HasOwnFreeBoundaryAspect())
+  if (myFreeBoundaryAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->FreeBoundaryAspect();
-    }
-    if (myFreeBoundaryAspect.IsNull())
-    {
-      myFreeBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FreeBoundary, Aspect_TOL_SOLID, 1.0);
-    }
+    return myLink->FreeBoundaryAspect();
   }
   return myFreeBoundaryAspect;
 }
 
-// =======================================================================
-// function : FreeBoundaryAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect)
-{
-  myFreeBoundaryAspect = theAspect;
-  myHasOwnFreeBoundaryAspect = !myFreeBoundaryAspect.IsNull();
-}
-
 // =======================================================================
 // function : SetFreeBoundaryDraw
 // purpose  :
@@ -290,33 +233,16 @@ void Prs3d_Drawer::SetFreeBoundaryDraw (const Standard_Boolean theIsEnabled)
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_LineAspect)& Prs3d_Drawer::UnFreeBoundaryAspect()
+const Handle(Prs3d_LineAspect)& Prs3d_Drawer::UnFreeBoundaryAspect() const
 {
-  if (!HasOwnUnFreeBoundaryAspect())
+  if (myUnFreeBoundaryAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->UnFreeBoundaryAspect();
-    }
-    if (myUnFreeBoundaryAspect.IsNull())
-    {
-      myUnFreeBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_UnFreeBoundary, Aspect_TOL_SOLID, 1.0);
-    }
+    return myLink->UnFreeBoundaryAspect();
   }
   return myUnFreeBoundaryAspect;
 }
 
-// =======================================================================
-// function : SetUnFreeBoundaryAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetUnFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect)
-{
-  myUnFreeBoundaryAspect = theAspect;
-  myHasOwnUnFreeBoundaryAspect = !myUnFreeBoundaryAspect.IsNull();
-}
-
 // =======================================================================
 // function : SetUnFreeBoundaryDraw
 // purpose  :
@@ -333,33 +259,16 @@ void Prs3d_Drawer::SetUnFreeBoundaryDraw (const Standard_Boolean theIsEnabled)
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_LineAspect)& Prs3d_Drawer::FaceBoundaryAspect()
+const Handle(Prs3d_LineAspect)& Prs3d_Drawer::FaceBoundaryAspect() const
 {
-  if (!HasOwnFaceBoundaryAspect())
+  if (myFaceBoundaryAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->FaceBoundaryAspect();
-    }
-    if (myFaceBoundaryAspect.IsNull())
-    {
-      myFaceBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FaceBoundary, Aspect_TOL_SOLID, 1.0);
-    }
+    return myLink->FaceBoundaryAspect();
   }
   return myFaceBoundaryAspect;
 }
 
-// =======================================================================
-// function : SetFaceBoundaryAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect)
-{
-  myFaceBoundaryAspect = theAspect;
-  myHasOwnFaceBoundaryAspect = !myFaceBoundaryAspect.IsNull();
-}
-
 // =======================================================================
 // function : SetFaceBoundaryDraw
 // purpose  :
@@ -376,33 +285,16 @@ void Prs3d_Drawer::SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled)
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_DimensionAspect)& Prs3d_Drawer::DimensionAspect()
+const Handle(Prs3d_DimensionAspect)& Prs3d_Drawer::DimensionAspect() const
 {
-  if (!HasOwnDimensionAspect())
+  if (myDimensionAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->DimensionAspect();
-    }
-    if (myDimensionAspect.IsNull())
-    {
-      myDimensionAspect = new Prs3d_DimensionAspect;
-    }
+    return myLink->DimensionAspect();
   }
   return myDimensionAspect;
 }
 
-// =======================================================================
-// function : SetDimensionAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect)
-{
-  myDimensionAspect = theAspect;
-  myHasOwnDimensionAspect = !myDimensionAspect.IsNull();
-}
-
 // =======================================================================
 // function : SetDimLengthModelUnits
 // purpose  :
@@ -452,97 +344,46 @@ void Prs3d_Drawer::SetDimAngleDisplayUnits (const TCollection_AsciiString& theUn
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::UIsoAspect()
+const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::UIsoAspect() const
 {
-  if (!HasOwnUIsoAspect())
+  if (myUIsoAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->UIsoAspect();
-    }
-    if (myUIsoAspect.IsNull())
-    {
-      myUIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1);
-    }
+    return myLink->UIsoAspect();
   }
   return myUIsoAspect;
 }
 
-// =======================================================================
-// function : SetUIsoAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect)
-{
-  myUIsoAspect = theAspect;
-  myHasOwnUIsoAspect = !myUIsoAspect.IsNull();
-}
-
 // =======================================================================
 // function : VIsoAspect
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::VIsoAspect()
+const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::VIsoAspect() const
 {
-  if (!HasOwnVIsoAspect())
+  if (myVIsoAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->VIsoAspect();
-    }
-    if (myVIsoAspect.IsNull())
-    {
-      myVIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1);
-    }
+    return myLink->VIsoAspect();
   }
   return myVIsoAspect;
 }
 
-// =======================================================================
-// function : SetVIsoAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect)
-{
-  myVIsoAspect = theAspect;
-  myHasOwnVIsoAspect= !myVIsoAspect.IsNull();
-}
-
 // =======================================================================
 // function : WireAspect
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_LineAspect)& Prs3d_Drawer::WireAspect()
+const Handle(Prs3d_LineAspect)& Prs3d_Drawer::WireAspect() const
 {
-  if (!HasOwnWireAspect())
+  if (myWireAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->WireAspect();
-    }
-    if (myWireAspect.IsNull())
-    {
-      myWireAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Wire, Aspect_TOL_SOLID, 1.0);
-    }
+    return myLink->WireAspect();
   }
   return myWireAspect;
 }
 
-// =======================================================================
-// function : SetWireAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect)
-{
-  myWireAspect = theAspect;
-  myHasOwnWireAspect = !myWireAspect.IsNull();
-}
-
 // =======================================================================
 // function : SetWireDraw
 // purpose  :
@@ -559,18 +400,12 @@ void Prs3d_Drawer::SetWireDraw (const Standard_Boolean theIsEnabled)
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_PointAspect)& Prs3d_Drawer::PointAspect()
+const Handle(Prs3d_PointAspect)& Prs3d_Drawer::PointAspect() const
 {
-  if (!HasOwnPointAspect())
+  if (myPointAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->PointAspect();
-    }
-    if (myPointAspect.IsNull())
-    {
-      myPointAspect = new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.0);
-    }
+    return myLink->PointAspect();
   }
   return myPointAspect;
 }
@@ -581,33 +416,19 @@ const Handle(Prs3d_PointAspect)& Prs3d_Drawer::PointAspect()
 // =======================================================================
 Standard_Boolean Prs3d_Drawer::SetupOwnPointAspect (const Handle(Prs3d_Drawer)& theDefaults)
 {
-  if (myHasOwnPointAspect)
+  if (!myPointAspect.IsNull())
   {
     return Standard_False;
   }
 
   myPointAspect = new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.0);
-  if (!theDefaults.IsNull() && theDefaults != this)
-  {
-    *myPointAspect->Aspect() = *theDefaults->PointAspect()->Aspect();
-  }
-  else if (!myLink.IsNull())
+  const Handle(Prs3d_Drawer)& aLink = (!theDefaults.IsNull() && theDefaults != this) ? theDefaults : myLink;
+  if (const Prs3d_PointAspect* aLinked = !aLink.IsNull() ? aLink->PointAspect().get() : NULL)
   {
-    *myPointAspect->Aspect() = *myLink->PointAspect()->Aspect();
+    *myPointAspect->Aspect() = *aLinked->Aspect();
   }
-  myHasOwnPointAspect = Standard_True;
-  return Standard_True;
-}
-
-// =======================================================================
-// function : SetPointAspect
-// purpose  :
-// =======================================================================
 
-void Prs3d_Drawer::SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect)
-{
-  myPointAspect = theAspect;
-  myHasOwnPointAspect = !myPointAspect.IsNull();
+  return Standard_True;
 }
 
 // =======================================================================
@@ -615,82 +436,42 @@ void Prs3d_Drawer::SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect)
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_LineAspect)& Prs3d_Drawer::LineAspect()
+const Handle(Prs3d_LineAspect)& Prs3d_Drawer::LineAspect() const
 {
-  if (!HasOwnLineAspect())
+  if (myLineAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->LineAspect();
-    }
-    if (myLineAspect.IsNull())
-    {
-      myLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Line, Aspect_TOL_SOLID, 1.0);
-    }
+    return myLink->LineAspect();
   }
   return myLineAspect;
 }
 
-// =======================================================================
-// function : SetLineAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
-{
-  myLineAspect = theAspect;
-  myHasOwnLineAspect = !myLineAspect.IsNull();
-}
-
 // =======================================================================
 // function : TextAspect
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_TextAspect)& Prs3d_Drawer::TextAspect()
+const Handle(Prs3d_TextAspect)& Prs3d_Drawer::TextAspect() const
 {
-  if (!HasOwnTextAspect())
+  if (myTextAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->TextAspect();
-    }
-    if (myTextAspect.IsNull())
-    {
-      myTextAspect = new Prs3d_TextAspect();
-    }
+    return myLink->TextAspect();
   }
   return myTextAspect;
 }
 
-// =======================================================================
-// function : SetTextAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect)
-{
-  myTextAspect = theAspect;
-  myHasOwnTextAspect = !myTextAspect.IsNull();
-}
-
 // =======================================================================
 // function : ShadingAspect
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_ShadingAspect)& Prs3d_Drawer::ShadingAspect()
+const Handle(Prs3d_ShadingAspect)& Prs3d_Drawer::ShadingAspect() const
 {
-  if (!HasOwnShadingAspect())
+  if (myShadingAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->ShadingAspect();
-    }
-    if (myShadingAspect.IsNull())
-    {
-      myShadingAspect = new Prs3d_ShadingAspect();
-    }
+    return myLink->ShadingAspect();
   }
   return myShadingAspect;
 }
@@ -701,131 +482,65 @@ const Handle(Prs3d_ShadingAspect)& Prs3d_Drawer::ShadingAspect()
 // =======================================================================
 Standard_Boolean Prs3d_Drawer::SetupOwnShadingAspect (const Handle(Prs3d_Drawer)& theDefaults)
 {
-  if (myHasOwnShadingAspect)
+  if (!myShadingAspect.IsNull())
   {
     return Standard_False;
   }
 
   myShadingAspect = new Prs3d_ShadingAspect();
-  if (!theDefaults.IsNull() && theDefaults != this)
-  {
-    *myShadingAspect->Aspect() = *theDefaults->ShadingAspect()->Aspect();
-  }
-  else if (!myLink.IsNull())
+  const Handle(Prs3d_Drawer)& aLink = (!theDefaults.IsNull() && theDefaults != this) ? theDefaults : myLink;
+  if (const Prs3d_ShadingAspect* aLinked = !aLink.IsNull() ? aLink->ShadingAspect().get() : NULL)
   {
-    *myShadingAspect->Aspect() = *myLink->ShadingAspect()->Aspect();
+    *myShadingAspect->Aspect() = *aLinked->Aspect();
   }
-  myHasOwnShadingAspect = Standard_True;
   return Standard_True;
 }
 
-// =======================================================================
-// function : SetShadingAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect)
-{
-  myShadingAspect = theAspect;
-  myHasOwnShadingAspect = !myShadingAspect.IsNull();
-}
-
 // =======================================================================
 // function : PlaneAspect
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_PlaneAspect)& Prs3d_Drawer::PlaneAspect()
+const Handle(Prs3d_PlaneAspect)& Prs3d_Drawer::PlaneAspect() const
 {
-  if (!HasOwnPlaneAspect())
+  if (myPlaneAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->PlaneAspect();
-    }
-    if (myPlaneAspect.IsNull())
-    {
-      myPlaneAspect = new Prs3d_PlaneAspect();
-    }
+    return myLink->PlaneAspect();
   }
   return myPlaneAspect;
 }
 
-// =======================================================================
-// function : SetPlaneAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetPlaneAspect (const Handle(Prs3d_PlaneAspect)& theAspect)
-{
-  myPlaneAspect = theAspect;
-  myHasOwnPlaneAspect = !myPlaneAspect.IsNull();
-}
-
 // =======================================================================
 // function : SeenLineAspect
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SeenLineAspect()
+const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SeenLineAspect() const
 {
-  if (!HasOwnSeenLineAspect())
+  if (mySeenLineAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->SeenLineAspect();
-    }
-    if (mySeenLineAspect.IsNull())
-    {
-      mySeenLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_SeenLine, Aspect_TOL_SOLID, 1.0);
-    }
+    return myLink->SeenLineAspect();
   }
   return mySeenLineAspect;
 }
 
-// =======================================================================
-// function : SetSeenLineAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetSeenLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
-{
-  mySeenLineAspect = theAspect;
-  myHasOwnSeenLineAspect = !mySeenLineAspect.IsNull();
-}
-
 // =======================================================================
 // function : ArrowAspect
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_ArrowAspect)& Prs3d_Drawer::ArrowAspect()
+const Handle(Prs3d_ArrowAspect)& Prs3d_Drawer::ArrowAspect() const
 {
-  if (!HasOwnArrowAspect())
+  if (myArrowAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->ArrowAspect();
-    }
-    if (myArrowAspect.IsNull())
-    {
-      myArrowAspect = new Prs3d_ArrowAspect();
-    }
+    return myLink->ArrowAspect();
   }
   return myArrowAspect;
 }
 
-// =======================================================================
-// function : SetArrowAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect)
-{
-  myArrowAspect = theAspect;
-  myHasOwnArrowAspect = !myArrowAspect.IsNull();
-}
-
 // =======================================================================
 // function : SetLineArrowDraw
 // purpose  :
@@ -842,33 +557,16 @@ void Prs3d_Drawer::SetLineArrowDraw (const Standard_Boolean theIsEnabled)
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_LineAspect)& Prs3d_Drawer::HiddenLineAspect()
+const Handle(Prs3d_LineAspect)& Prs3d_Drawer::HiddenLineAspect() const
 {
-  if (!HasOwnHiddenLineAspect())
+  if (myHiddenLineAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->HiddenLineAspect();
-    }
-    if (myHiddenLineAspect.IsNull())
-    {
-      myHiddenLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_HiddenLine, Aspect_TOL_DASH, 1.0);
-    }
+    return myLink->HiddenLineAspect();
   }
   return myHiddenLineAspect;
 }
 
-// =======================================================================
-// function : SetHiddenLineAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
-{
-  myHiddenLineAspect = theAspect;
-  myHasOwnHiddenLineAspect = !myHiddenLineAspect.IsNull();
-}
-
 // =======================================================================
 // function : EnableDrawHiddenLineDraw
 // purpose  :
@@ -896,33 +594,16 @@ void Prs3d_Drawer::DisableDrawHiddenLine()
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_LineAspect)& Prs3d_Drawer::VectorAspect()
+const Handle(Prs3d_LineAspect)& Prs3d_Drawer::VectorAspect() const
 {
-  if (!HasOwnVectorAspect())
+  if (myVectorAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->VectorAspect();
-    }
-    if (myVectorAspect.IsNull())
-    {
-      myVectorAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Vector, Aspect_TOL_SOLID, 1.0);
-    }
+    return myLink->VectorAspect();
   }
   return myVectorAspect;
 }
 
-// =======================================================================
-// function : SetVectorAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect)
-{
-  myVectorAspect = theAspect;
-  myHasOwnVectorAspect = !myVectorAspect.IsNull();
-}
-
 // =======================================================================
 // function : SetVertexDrawMode
 // purpose  :
@@ -940,18 +621,17 @@ void Prs3d_Drawer::SetVertexDrawMode (const Prs3d_VertexDrawMode theMode)
 // purpose  :
 // =======================================================================
 
-Prs3d_VertexDrawMode Prs3d_Drawer::VertexDrawMode()
+Prs3d_VertexDrawMode Prs3d_Drawer::VertexDrawMode() const
 {
-  if (!HasOwnVertexDrawMode())
+  if (HasOwnVertexDrawMode())
   {
-      if (!myLink.IsNull())
-      {
-          return myLink->VertexDrawMode();
-      }
-      // Prs3d_VDM_Isolated is default value for this setting.
-      myVertexDrawMode = Prs3d_VDM_Isolated;
+    return myVertexDrawMode;
+  }
+  else if (!myLink.IsNull())
+  {
+    return myLink->VertexDrawMode();
   }
-  return myVertexDrawMode;
+  return Prs3d_VDM_Isolated;
 }
 
 // =======================================================================
@@ -959,50 +639,27 @@ Prs3d_VertexDrawMode Prs3d_Drawer::VertexDrawMode()
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_DatumAspect)& Prs3d_Drawer::DatumAspect()
+const Handle(Prs3d_DatumAspect)& Prs3d_Drawer::DatumAspect() const
 {
-  if (!HasOwnDatumAspect())
+  if (myDatumAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->DatumAspect();
-    }
-    if (myDatumAspect.IsNull())
-    {
-      myDatumAspect = new Prs3d_DatumAspect();
-    }
+    return myLink->DatumAspect();
   }
   return myDatumAspect;
 }
 
-// =======================================================================
-// function : SetDatumAspect
-// purpose  :
-// =======================================================================
-
-void Prs3d_Drawer::SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect)
-{
-  myDatumAspect = theAspect;
-  myHasOwnDatumAspect = !myDatumAspect.IsNull();
-}
-
 // =======================================================================
 // function : SectionAspect
 // purpose  :
 // =======================================================================
 
-const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SectionAspect()
+const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SectionAspect() const
 {
-  if (!HasOwnSectionAspect())
+  if (mySectionAspect.IsNull()
+  && !myLink.IsNull())
   {
-    if (!myLink.IsNull())
-    {
-      return myLink->SectionAspect();
-    }
-    if (mySectionAspect.IsNull())
-    {
-      mySectionAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Section, Aspect_TOL_SOLID, 1.0);
-    }
+    return myLink->SectionAspect();
   }
   return mySectionAspect;
 }
@@ -1012,17 +669,6 @@ const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SectionAspect()
 // purpose  :
 // =======================================================================
 
-void Prs3d_Drawer::SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect)
-{
-  mySectionAspect = theAspect;
-  myHasOwnSectionAspect = !mySectionAspect.IsNull();
-}
-
-// =======================================================================
-// function : SetSectionAspect
-// purpose  :
-// =======================================================================
-
 void Prs3d_Drawer::ClearLocalAttributes()
 {
   if (myLink.IsNull())
@@ -1049,25 +695,6 @@ void Prs3d_Drawer::ClearLocalAttributes()
   myDimensionAspect.Nullify();
   mySectionAspect.Nullify();
 
-  myHasOwnUIsoAspect           = Standard_False;
-  myHasOwnVIsoAspect           = Standard_False;
-  myHasOwnWireAspect           = Standard_False;
-  myHasOwnPointAspect          = Standard_False;
-  myHasOwnLineAspect           = Standard_False;
-  myHasOwnTextAspect           = Standard_False;
-  myHasOwnShadingAspect        = Standard_False;
-  myHasOwnPlaneAspect          = Standard_False;
-  myHasOwnSeenLineAspect       = Standard_False;
-  myHasOwnArrowAspect          = Standard_False;
-  myHasOwnHiddenLineAspect     = Standard_False;
-  myHasOwnVectorAspect         = Standard_False;
-  myHasOwnDatumAspect          = Standard_False;
-  myHasOwnSectionAspect        = Standard_False;
-  myHasOwnFreeBoundaryAspect   = Standard_False;
-  myHasOwnUnFreeBoundaryAspect = Standard_False;
-  myHasOwnFaceBoundaryAspect   = Standard_False;
-  myHasOwnDimensionAspect      = Standard_False;
-
   UnsetOwnDiscretisation();
   UnsetOwnMaximalParameterValue();
   UnsetOwnTypeOfDeflection();
@@ -1098,18 +725,17 @@ void Prs3d_Drawer::ClearLocalAttributes()
 // =======================================================================
 Standard_Boolean Prs3d_Drawer::SetupOwnFaceBoundaryAspect (const Handle(Prs3d_Drawer)& theDefaults)
 {
-  if (myHasOwnFaceBoundaryAspect)
+  if (!myFaceBoundaryAspect.IsNull())
   {
     return false;
   }
 
   myFaceBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FaceBoundary, Aspect_TOL_SOLID, 1.0);
-  myHasOwnFaceBoundaryAspect = true;
 
   const Handle(Prs3d_Drawer)& aLink = (!theDefaults.IsNull() && theDefaults != this) ? theDefaults : myLink;
-  if (!aLink.IsNull())
+  if (const Prs3d_LineAspect* aLinked = !aLink.IsNull() ? aLink->FaceBoundaryAspect().get() : NULL)
   {
-    *myFaceBoundaryAspect->Aspect() = *aLink->FaceBoundaryAspect()->Aspect();
+    *myFaceBoundaryAspect->Aspect() = *aLinked->Aspect();
   }
   return true;
 }
@@ -1122,86 +748,78 @@ Standard_Boolean Prs3d_Drawer::SetOwnLineAspects (const Handle(Prs3d_Drawer)& th
 {
   bool isUpdateNeeded = false;
   const Handle(Prs3d_Drawer)& aLink = (!theDefaults.IsNull() && theDefaults != this) ? theDefaults : myLink;
-  if (!myHasOwnUIsoAspect)
+  if (myUIsoAspect.IsNull())
   {
     isUpdateNeeded = true;
     myUIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1);
-    if (!aLink.IsNull())
+    if (const Prs3d_IsoAspect* aLinked = !aLink.IsNull() ? aLink->UIsoAspect().get() : NULL)
     {
-      *myUIsoAspect->Aspect() = *aLink->UIsoAspect()->Aspect();
-      myUIsoAspect->SetNumber (aLink->UIsoAspect()->Number());
+      *myUIsoAspect->Aspect() = *aLinked->Aspect();
+      myUIsoAspect->SetNumber (aLinked->Number());
     }
-    myHasOwnUIsoAspect = true;
   }
-  if (!myHasOwnVIsoAspect)
+  if (myVIsoAspect.IsNull())
   {
     isUpdateNeeded = true;
     myVIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1);
-    if (!aLink.IsNull())
+    if (const Prs3d_IsoAspect* aLinked = !aLink.IsNull() ? aLink->VIsoAspect().get() : NULL)
     {
-      *myVIsoAspect->Aspect() = *aLink->VIsoAspect()->Aspect();
-      myVIsoAspect->SetNumber (aLink->VIsoAspect()->Number());
+      *myVIsoAspect->Aspect() = *aLinked->Aspect();
+      myVIsoAspect->SetNumber (aLinked->Number());
     }
-    myHasOwnVIsoAspect = true;
   }
-  if (!myHasOwnWireAspect)
+  if (myWireAspect.IsNull())
   {
     isUpdateNeeded = true;
     myWireAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Wire, Aspect_TOL_SOLID, 1.0);
-    myHasOwnWireAspect = true;
-    if (!aLink.IsNull())
+    if (const Prs3d_LineAspect* aLinked = !aLink.IsNull() ? aLink->WireAspect().get() : NULL)
     {
-      *myWireAspect->Aspect() = *aLink->WireAspect()->Aspect();
+      *myWireAspect->Aspect() = *aLinked->Aspect();
     }
   }
-  if (!myHasOwnLineAspect)
+  if (myLineAspect.IsNull())
   {
     isUpdateNeeded = true;
     myLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Line, Aspect_TOL_SOLID, 1.0);
-    myHasOwnLineAspect = true;
-    if (!aLink.IsNull())
+    if (const Prs3d_LineAspect* aLinked = !aLink.IsNull() ? aLink->LineAspect().get() : NULL)
     {
-      *myLineAspect->Aspect() = *aLink->LineAspect()->Aspect();
+      *myLineAspect->Aspect() = *aLinked->Aspect();
     }
   }
-  if (!myHasOwnSeenLineAspect)
+  if (mySeenLineAspect.IsNull())
   {
     isUpdateNeeded = true;
     mySeenLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_SeenLine, Aspect_TOL_SOLID, 1.0);
-    myHasOwnSeenLineAspect = true;
-    if (!aLink.IsNull())
+    if (const Prs3d_LineAspect* aLinked = !aLink.IsNull() ? aLink->SeenLineAspect().get() : NULL)
     {
-      *mySeenLineAspect->Aspect() = *aLink->SeenLineAspect()->Aspect();
+      *mySeenLineAspect->Aspect() = *aLinked->Aspect();
     }
   }
-  if (!myHasOwnHiddenLineAspect)
+  if (myHiddenLineAspect.IsNull())
   {
     isUpdateNeeded = true;
     myHiddenLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_HiddenLine, Aspect_TOL_DASH, 1.0);
-    myHasOwnHiddenLineAspect = true;
-    if (!aLink.IsNull())
+    if (const Prs3d_LineAspect* aLinked = !aLink.IsNull() ? aLink->HiddenLineAspect().get() : NULL)
     {
-      *myHiddenLineAspect->Aspect() = *aLink->HiddenLineAspect()->Aspect();
+      *myHiddenLineAspect->Aspect() = *aLinked->Aspect();
     }
   }
-  if (!myHasOwnFreeBoundaryAspect)
+  if (myFreeBoundaryAspect.IsNull())
   {
     isUpdateNeeded = true;
     myFreeBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FreeBoundary, Aspect_TOL_SOLID, 1.0);
-    myHasOwnFreeBoundaryAspect = true;
-    if (!aLink.IsNull())
+    if (const Prs3d_LineAspect* aLinked = !aLink.IsNull() ? aLink->FreeBoundaryAspect().get() : NULL)
     {
-      *myFreeBoundaryAspect->Aspect() = *aLink->FreeBoundaryAspect()->Aspect();
+      *myFreeBoundaryAspect->Aspect() = *aLinked->Aspect();
     }
   }
-  if (!myHasOwnUnFreeBoundaryAspect)
+  if (myUnFreeBoundaryAspect.IsNull())
   {
     isUpdateNeeded = true;
     myUnFreeBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_UnFreeBoundary, Aspect_TOL_SOLID, 1.0);
-    myHasOwnUnFreeBoundaryAspect = true;
-    if (!aLink.IsNull())
+    if (const Prs3d_LineAspect* aLinked = !aLink.IsNull() ? aLink->UnFreeBoundaryAspect().get() : NULL)
     {
-      *myUnFreeBoundaryAspect->Aspect() = *aLink->UnFreeBoundaryAspect()->Aspect();
+      *myUnFreeBoundaryAspect->Aspect() = *aLinked->Aspect();
     }
   }
   isUpdateNeeded = SetupOwnFaceBoundaryAspect (theDefaults) || isUpdateNeeded;
@@ -1216,48 +834,42 @@ Standard_Boolean Prs3d_Drawer::SetOwnDatumAspects (const Handle(Prs3d_Drawer)& t
 {
   bool isUpdateNeeded = false;
   const Handle(Prs3d_Drawer)& aLink = (!theDefaults.IsNull() && theDefaults != this) ? theDefaults : myLink;
-  if (!myHasOwnVectorAspect)
+  if (myVectorAspect.IsNull())
   {
     isUpdateNeeded = true;
     myVectorAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Vector, Aspect_TOL_SOLID, 1.0);
-    myHasOwnVectorAspect = true;
-    if (!aLink.IsNull())
+    if (const Prs3d_LineAspect* aLinked = !aLink.IsNull() ? aLink->VectorAspect().get() : NULL)
     {
-      *myVectorAspect->Aspect() = *aLink->VectorAspect()->Aspect();
+      *myVectorAspect->Aspect() = *aLinked->Aspect();
     }
   }
-  if (!myHasOwnSectionAspect)
+  if (mySectionAspect.IsNull())
   {
     isUpdateNeeded = true;
     mySectionAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Section, Aspect_TOL_SOLID, 1.0);
-    myHasOwnSectionAspect = true;
-    if (!aLink.IsNull())
+    if (const Prs3d_LineAspect* aLinked = !aLink.IsNull() ? aLink->SectionAspect().get() : NULL)
     {
-      *mySectionAspect->Aspect() = *aLink->SectionAspect()->Aspect();
+      *mySectionAspect->Aspect() = *aLinked->Aspect();
     }
   }
-  if (!myHasOwnPlaneAspect)
+  if (myPlaneAspect.IsNull())
   {
     isUpdateNeeded = true;
     myPlaneAspect = new Prs3d_PlaneAspect();
-    myHasOwnPlaneAspect = true;
   }
-  if (!myHasOwnArrowAspect)
+  if (myArrowAspect.IsNull())
   {
     isUpdateNeeded = true;
     myArrowAspect = new Prs3d_ArrowAspect();
-    myHasOwnArrowAspect = true;
   }
-  if (!myHasOwnDatumAspect)
+  if (myDatumAspect.IsNull())
   {
     isUpdateNeeded = true;
     myDatumAspect = new Prs3d_DatumAspect();
-    if (!aLink.IsNull()
-      && aLink->HasOwnDatumAspect())
+    if (const Prs3d_DatumAspect* aLinked = !aLink.IsNull() ? aLink->DatumAspect().get() : NULL)
     {
-      myDatumAspect->CopyAspectsFrom (aLink->DatumAspect());
+      myDatumAspect->CopyAspectsFrom (aLinked);
     }
-    myHasOwnDatumAspect = true;
   }
   return isUpdateNeeded;
 }
@@ -1265,11 +877,9 @@ Standard_Boolean Prs3d_Drawer::SetOwnDatumAspects (const Handle(Prs3d_Drawer)& t
 //! Assign the shader program.
 template <typename T>
 inline void setAspectProgram (const Handle(Graphic3d_ShaderProgram)& theProgram,
-                              bool theHasAspect,
                               T thePrsAspect)
 {
-  if (!thePrsAspect.IsNull()
-    && theHasAspect)
+  if (!thePrsAspect.IsNull())
   {
     thePrsAspect->Aspect()->SetShaderProgram (theProgram);
   }
@@ -1294,47 +904,46 @@ bool Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theP
         isUpdateNeeded = SetOwnDatumAspects() || isUpdateNeeded;
       }
 
-      setAspectProgram (theProgram, myHasOwnUIsoAspect, myUIsoAspect);
-      setAspectProgram (theProgram, myHasOwnVIsoAspect, myVIsoAspect);
-      setAspectProgram (theProgram, myHasOwnWireAspect, myWireAspect);
-      setAspectProgram (theProgram, myHasOwnLineAspect, myLineAspect);
-      setAspectProgram (theProgram, myHasOwnSeenLineAspect,       mySeenLineAspect);
-      setAspectProgram (theProgram, myHasOwnHiddenLineAspect,     myHiddenLineAspect);
-      setAspectProgram (theProgram, myHasOwnVectorAspect,         myVectorAspect);
-      setAspectProgram (theProgram, myHasOwnSectionAspect,        mySectionAspect);
-      setAspectProgram (theProgram, myHasOwnFreeBoundaryAspect,   myFreeBoundaryAspect);
-      setAspectProgram (theProgram, myHasOwnUnFreeBoundaryAspect, myUnFreeBoundaryAspect);
-      setAspectProgram (theProgram, myHasOwnFaceBoundaryAspect,   myFaceBoundaryAspect);
-      if (myHasOwnPlaneAspect)
+      setAspectProgram (theProgram, myUIsoAspect);
+      setAspectProgram (theProgram, myVIsoAspect);
+      setAspectProgram (theProgram, myWireAspect);
+      setAspectProgram (theProgram, myLineAspect);
+      setAspectProgram (theProgram, mySeenLineAspect);
+      setAspectProgram (theProgram, myHiddenLineAspect);
+      setAspectProgram (theProgram, myVectorAspect);
+      setAspectProgram (theProgram, mySectionAspect);
+      setAspectProgram (theProgram, myFreeBoundaryAspect);
+      setAspectProgram (theProgram, myUnFreeBoundaryAspect);
+      setAspectProgram (theProgram, myFaceBoundaryAspect);
+      if (!myPlaneAspect.IsNull())
       {
-        setAspectProgram (theProgram, true, myPlaneAspect->EdgesAspect());
-        setAspectProgram (theProgram, true, myPlaneAspect->IsoAspect());
-        setAspectProgram (theProgram, true, myPlaneAspect->ArrowAspect());
+        setAspectProgram (theProgram, myPlaneAspect->EdgesAspect());
+        setAspectProgram (theProgram, myPlaneAspect->IsoAspect());
+        setAspectProgram (theProgram, myPlaneAspect->ArrowAspect());
       }
-      if (myHasOwnDatumAspect)
+      if (!myDatumAspect.IsNull())
       {
-        setAspectProgram (theProgram, true, myDatumAspect->LineAspect(Prs3d_DatumParts_XAxis));
-        setAspectProgram (theProgram, true, myDatumAspect->LineAspect(Prs3d_DatumParts_YAxis));
-        setAspectProgram (theProgram, true, myDatumAspect->LineAspect(Prs3d_DatumParts_ZAxis));
+        setAspectProgram (theProgram, myDatumAspect->LineAspect (Prs3d_DatumParts_XAxis));
+        setAspectProgram (theProgram, myDatumAspect->LineAspect (Prs3d_DatumParts_YAxis));
+        setAspectProgram (theProgram, myDatumAspect->LineAspect (Prs3d_DatumParts_ZAxis));
       }
-      setAspectProgram (theProgram, myHasOwnArrowAspect, myArrowAspect);
+      setAspectProgram (theProgram, myArrowAspect);
       return isUpdateNeeded;
     }
     case Graphic3d_ASPECT_TEXT:
     {
       if (theToOverrideDefaults
-      && !myHasOwnTextAspect)
+       && myTextAspect.IsNull())
       {
         isUpdateNeeded = true;
         myTextAspect = new Prs3d_TextAspect();
-        myHasOwnTextAspect = true;
-        if (!myLink.IsNull())
+        if (const Prs3d_TextAspect* aLinked = !myLink.IsNull() ? myLink->TextAspect().get() : NULL)
         {
-          *myTextAspect->Aspect() = *myLink->TextAspect()->Aspect();
+          *myTextAspect->Aspect() = *aLinked->Aspect();
         }
       }
 
-      setAspectProgram (theProgram, myHasOwnTextAspect, myTextAspect);
+      setAspectProgram (theProgram, myTextAspect);
       return isUpdateNeeded;
     }
     case Graphic3d_ASPECT_MARKER:
@@ -1345,7 +954,7 @@ bool Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theP
         isUpdateNeeded = true;
       }
 
-      setAspectProgram (theProgram, myHasOwnPointAspect, myPointAspect);
+      setAspectProgram (theProgram, myPointAspect);
       return isUpdateNeeded;
     }
     case Graphic3d_ASPECT_FILL_AREA:
@@ -1355,7 +964,7 @@ bool Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theP
       {
         isUpdateNeeded = true;
       }
-      setAspectProgram (theProgram, myHasOwnShadingAspect, myShadingAspect);
+      setAspectProgram (theProgram, myShadingAspect);
       return isUpdateNeeded;
     }
   }
@@ -1377,8 +986,7 @@ bool Prs3d_Drawer::SetShadingModel (Graphic3d_TypeOfShadingModel theModel,
     isUpdateNeeded  = true;
   }
 
-  if (!myShadingAspect.IsNull()
-    && myHasOwnShadingAspect)
+  if (!myShadingAspect.IsNull())
   {
     myShadingAspect->Aspect()->SetShadingModel (theModel);
   }
@@ -1396,19 +1004,14 @@ void Prs3d_Drawer::DumpJson (Standard_OStream& theOStream, Standard_Integer theD
 
   OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myLink.get())
 
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnNbPoints)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaximalParameterValue)
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnMaximalParameterValue)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myChordialDeviation)
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnChordialDeviation)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTypeOfDeflection)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnTypeOfDeflection)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTypeOfHLR)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDeviationCoefficient)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPreviousDeviationCoefficient)
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDeviationCoefficient)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDeviationAngle)
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDeviationAngle)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPreviousDeviationAngle)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsoOnPlane)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnIsoOnPlane)
@@ -1417,56 +1020,30 @@ void Prs3d_Drawer::DumpJson (Standard_OStream& theOStream, Standard_Integer theD
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsAutoTriangulated)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnIsAutoTriangulated)
 
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnUIsoAspect)
-
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnVIsoAspect)
-
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnWireAspect)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myWireDraw)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnWireDraw)
 
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnPointAspect)
-
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnLineAspect)
-
-  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTextAspect.get())
-
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myShadingAspect.get())
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnShadingAspect)
-
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnPlaneAspect)
-
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnSeenLineAspect)
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTextAspect.get())
 
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnArrowAspect)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLineArrowDraw)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnLineArrowDraw)
 
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnHiddenLineAspect)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDrawHiddenLine)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDrawHiddenLine)
 
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnVectorAspect)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVertexDrawMode)
 
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDatumAspect)
-
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnSectionAspect)
-
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFreeBoundaryAspect)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFreeBoundaryDraw)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFreeBoundaryDraw)
 
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnUnFreeBoundaryAspect)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUnFreeBoundaryDraw)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnUnFreeBoundaryDraw)
 
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFaceBoundaryUpperContinuity)
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFaceBoundaryAspect)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFaceBoundaryDraw)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnFaceBoundaryDraw)
 
-  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimensionAspect)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimLengthModelUnits)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimAngleModelUnits)
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDimLengthDisplayUnits)
index e5b383e71f43b46389230f75574ee8fc8dc29db3..2ed3fc3ba9091f0b4498a43fa0585035b980f71e 100644 (file)
@@ -55,6 +55,9 @@ public:
   //! Default constructor.
   Standard_EXPORT Prs3d_Drawer();
 
+  //! Setup all own aspects with default values.
+  Standard_EXPORT void SetupOwnDefaults();
+
   //! Sets the type of chordal deflection.
   //! This indicates whether the deflection value is absolute or relative to the size of the object.
   Standard_EXPORT void SetTypeOfDeflection (const Aspect_TypeOfDeflection theTypeOfDeflection);
@@ -83,58 +86,66 @@ public:
   //!   Prs3d_DeflectionCurve
   //!   Prs3d_WFDeflectionSurface
   //!   Prs3d_WFDeflectionRestrictedFace
-  Standard_EXPORT void SetMaximalChordialDeviation (const Standard_Real theChordialDeviation);
+  void SetMaximalChordialDeviation (const Standard_Real theChordialDeviation)
+  {
+    myChordialDeviation = theChordialDeviation;
+  }
 
-  //! Returns the maximal chordal deviation. The default value is 0.1.
+  //! Returns the maximal chordal deviation. The default value is 0.0001.
   //! Drawings of curves or patches are made with respect to an absolute maximal chordal deviation.
   Standard_Real MaximalChordialDeviation() const
   {
-    return myHasOwnChordialDeviation || myLink.IsNull()
+    return myChordialDeviation > 0.0
          ? myChordialDeviation
-         : myLink->MaximalChordialDeviation();
+         : (!myLink.IsNull()
+           ? myLink->MaximalChordialDeviation()
+           : 0.0001);
   }
 
   //! Returns true if the drawer has a maximal chordial deviation setting active.
-  Standard_Boolean HasOwnMaximalChordialDeviation() const { return myHasOwnChordialDeviation; }
+  Standard_Boolean HasOwnMaximalChordialDeviation() const { return myChordialDeviation > 0.0; }
 
   //! Resets HasOwnMaximalChordialDeviation() flag, e.g. undoes SetMaximalChordialDeviation().
   void UnsetOwnMaximalChordialDeviation()
   {
-    myHasOwnChordialDeviation = false;
-    myChordialDeviation = 0.0001;
+    myChordialDeviation = -1.0;
   }
 
   //! Sets the type of HLR algorithm used by drawer's interactive objects
   Standard_EXPORT void SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR);
 
   //! Returns the type of HLR algorithm currently in use.
-  Standard_EXPORT Prs3d_TypeOfHLR TypeOfHLR();
+  Standard_EXPORT Prs3d_TypeOfHLR TypeOfHLR() const;
 
   //! Returns true if the type of HLR is not equal to Prs3d_TOH_NotSet.
   Standard_Boolean HasOwnTypeOfHLR() const { return (myTypeOfHLR != Prs3d_TOH_NotSet); }
 
   //! Defines the maximum value allowed for the first and last
   //! parameters of an infinite curve.
-  Standard_EXPORT void SetMaximalParameterValue (const Standard_Real theValue);
+  void SetMaximalParameterValue (const Standard_Real theValue)
+  {
+    myMaximalParameterValue = theValue;
+  }
 
-  //! Sets the maximum value allowed for the first and last
-  //! parameters of an infinite curve. By default, this value is 500000.
+  //! Sets the maximum value allowed for the first and last parameters of an infinite curve.
+  //! By default, this value is 500000.
   Standard_Real MaximalParameterValue() const
   {
-    return myHasOwnMaximalParameterValue || myLink.IsNull()
+    return myMaximalParameterValue > 0.0
          ? myMaximalParameterValue
-         : myLink->MaximalParameterValue();
+         : (!myLink.IsNull()
+           ? myLink->MaximalParameterValue()
+           : 500000.0);
   }
 
   //! Returns true if the drawer has a maximum value allowed for the first and last
   //! parameters of an infinite curve setting active.
-  Standard_Boolean HasOwnMaximalParameterValue() const { return myHasOwnMaximalParameterValue; }
+  Standard_Boolean HasOwnMaximalParameterValue() const { return myMaximalParameterValue > 0.0; }
 
   //! Resets HasOwnMaximalParameterValue() flag, e.g. undoes SetMaximalParameterValue().
   void UnsetOwnMaximalParameterValue()
   {
-    myHasOwnMaximalParameterValue = false;
-    myMaximalParameterValue = 500000.0;
+    myMaximalParameterValue = -1.0;
   }
 
   //! Sets IsoOnPlane on or off by setting the parameter theIsEnabled to true or false.
@@ -180,24 +191,28 @@ public:
   Standard_EXPORT void SetIsoOnTriangulation (const Standard_Boolean theToEnable);
 
   //! Sets the discretisation parameter theValue.
-  Standard_EXPORT void SetDiscretisation (const Standard_Integer theValue);
+  void SetDiscretisation (const Standard_Integer theValue)
+  {
+    myNbPoints = theValue;
+  }
 
   //! Returns the discretisation setting. 
   Standard_Integer Discretisation() const
   {
-    return myHasOwnNbPoints || myLink.IsNull()
+    return myNbPoints != -1
          ? myNbPoints
-         : myLink->Discretisation();
+         : (!myLink.IsNull()
+           ? myLink->Discretisation()
+           : 30);
   }
 
   //! Returns true if the drawer has discretisation setting active.
-  Standard_Boolean HasOwnDiscretisation() const { return myHasOwnNbPoints; }
+  Standard_Boolean HasOwnDiscretisation() const { return myNbPoints != -1; }
 
   //! Resets HasOwnDiscretisation() flag, e.g. undoes SetDiscretisation().
   void UnsetOwnDiscretisation()
   {
-    myHasOwnNbPoints = false;
-    myNbPoints = 30;
+    myNbPoints = -1;
   }
 
   //! Sets the deviation coefficient theCoefficient.
@@ -222,27 +237,28 @@ public:
   //! SizeOfObject * DeviationCoefficient.
   Standard_Real DeviationCoefficient() const
   {
-    return HasOwnDeviationCoefficient() || myLink.IsNull()
+    return myDeviationCoefficient > 0.0
          ? myDeviationCoefficient
-         : myLink->DeviationCoefficient();
+         : (!myLink.IsNull()
+           ? myLink->DeviationCoefficient()
+           : 0.001);
   }
 
   //! Resets HasOwnDeviationCoefficient() flag, e.g. undoes previous SetDeviationCoefficient().
   void SetDeviationCoefficient()
   {
-    myHasOwnDeviationCoefficient = Standard_False;
-    myDeviationCoefficient = 0.001;
+    myDeviationCoefficient = -1.0;
   }
 
   //! Returns true if there is a local setting for deviation
   //! coefficient in this framework for a specific interactive object.
-  Standard_Boolean HasOwnDeviationCoefficient() const { return myHasOwnDeviationCoefficient; }
+  Standard_Boolean HasOwnDeviationCoefficient() const { return myDeviationCoefficient > 0.0; }
 
   //! Saves the previous value used for the chordal
   //! deviation coefficient. 
   Standard_Real PreviousDeviationCoefficient() const
   {
-    return myHasOwnDeviationCoefficient
+    return HasOwnDeviationCoefficient()
          ? myPreviousDeviationCoefficient
          : 0.0;
   }
@@ -250,7 +266,7 @@ public:
   //! Updates the previous value used for the chordal deviation coefficient to the current state.
   void UpdatePreviousDeviationCoefficient()
   {
-    if (myHasOwnDeviationCoefficient)
+    if (HasOwnDeviationCoefficient())
     {
       myPreviousDeviationCoefficient = DeviationCoefficient();
     }
@@ -263,26 +279,27 @@ public:
   //! Returns the value for deviation angle in radians, 20 * M_PI / 180 by default.
   Standard_Real DeviationAngle() const
   {
-    return HasOwnDeviationAngle() || myLink.IsNull()
+    return myDeviationAngle > 0.0
          ? myDeviationAngle
-         : myLink->DeviationAngle();
+         : (!myLink.IsNull()
+           ? myLink->DeviationAngle()
+           : 20.0 * M_PI / 180.0);
   }
 
   //! Resets HasOwnDeviationAngle() flag, e.g. undoes previous SetDeviationAngle().
   void SetDeviationAngle()
   {
-    myHasOwnDeviationAngle = Standard_False;
-    myDeviationAngle = 20.0 * M_PI / 180.0;
+    myDeviationAngle = -1.0;
   }
 
   //! Returns true if there is a local setting for deviation
   //! angle in this framework for a specific interactive object.
-  Standard_Boolean HasOwnDeviationAngle() const { return myHasOwnDeviationAngle; }
+  Standard_Boolean HasOwnDeviationAngle() const { return myDeviationAngle > 0.0; }
 
   //! Returns the previous deviation angle
   Standard_Real PreviousDeviationAngle() const
   {
-    return myHasOwnDeviationAngle
+    return HasOwnDeviationAngle()
          ? myPreviousDeviationAngle
          : 0.0;
   }
@@ -290,7 +307,7 @@ public:
   //! Updates the previous deviation angle to the current value
   void UpdatePreviousDeviationAngle()
   {
-    if (myHasOwnDeviationAngle)
+    if (HasOwnDeviationAngle())
     {
       myPreviousDeviationAngle = DeviationAngle();
     }
@@ -320,64 +337,54 @@ public:
     myIsAutoTriangulated = true;
   }
 
-  //! Defines the attributes which are used when drawing an
-  //! U isoparametric curve of a face. Defines the number
-  //! of U isoparametric curves to be drawn for a single face.
-  //! The LineAspect for U isoparametric lines can be edited
-  //! (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
-  //! The default values are:
-  //!   COLOR       : Quantity_NOC_GRAY75
-  //!   TYPE OF LINE: Aspect_TOL_SOLID
-  //!   WIDTH       : 0.5
+  //! Defines own attributes for drawing an U isoparametric curve of a face,
+  //! settings from linked Drawer or NULL if neither was set.
   //!
   //! These attributes are used by the following algorithms:
   //!   Prs3d_WFDeflectionSurface
   //!   Prs3d_WFDeflectionRestrictedFace
-  Standard_EXPORT const Handle(Prs3d_IsoAspect)& UIsoAspect();
+  Standard_EXPORT const Handle(Prs3d_IsoAspect)& UIsoAspect() const;
 
-  Standard_EXPORT void SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect);
+  void SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect)
+  {
+    myUIsoAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! UIso aspect that overrides the one in the link.
-  Standard_Boolean HasOwnUIsoAspect() const { return myHasOwnUIsoAspect; }
-
-  //! Defines the attributes which are used when drawing an
-  //! V isoparametric curve of a face. Defines the number
-  //! of V isoparametric curves to be drawn for a single face.
-  //! The LineAspect for V isoparametric lines can be edited
-  //! (methods SetColor, SetTypeOfLine, SetWidth, SetNumber)
-  //! The default values are:
-  //!   COLOR       : Quantity_NOC_GRAY82
-  //!   TYPE OF LINE: Aspect_TOL_SOLID
-  //!   WIDTH       : 0.5
+  Standard_Boolean HasOwnUIsoAspect() const { return !myUIsoAspect.IsNull(); }
+
+  //! Defines own attributes for drawing an V isoparametric curve of a face,
+  //! settings from linked Drawer or NULL if neither was set.
   //!
   //! These attributes are used by the following algorithms:
   //!   Prs3d_WFDeflectionSurface
   //!   Prs3d_WFDeflectionRestrictedFace
-  Standard_EXPORT const Handle(Prs3d_IsoAspect)& VIsoAspect();
+  Standard_EXPORT const Handle(Prs3d_IsoAspect)& VIsoAspect() const;
 
   //! Sets the appearance of V isoparameters - theAspect.
-  Standard_EXPORT void SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect);
+  void SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect)
+  {
+    myVIsoAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! VIso aspect that overrides the one in the link.
-  Standard_Boolean HasOwnVIsoAspect() const { return myHasOwnVIsoAspect; }
-
-  //! Returns wire aspect settings.
-  //! The LineAspect for the free boundaries can be edited.
-  //! The default values are:
-  //!   Color: Quantity_NOC_GREEN
-  //!   Type of line: Aspect_TOL_SOLID
-  //!   Width: 1.0
+  Standard_Boolean HasOwnVIsoAspect() const { return !myVIsoAspect.IsNull(); }
+
+  //! Returns own wire aspect settings, settings from linked Drawer or NULL if neither was set.
   //! These attributes are used by the algorithm Prs3d_WFShape.
-  Standard_EXPORT const Handle(Prs3d_LineAspect)& WireAspect();
+  Standard_EXPORT const Handle(Prs3d_LineAspect)& WireAspect() const;
 
   //! Sets the parameter theAspect for display of wires.
-  Standard_EXPORT void SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect);
+  void SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect)
+  {
+    myWireAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! wire aspect that overrides the one in the link.
-  Standard_Boolean HasOwnWireAspect() const { return myHasOwnWireAspect; }
+  Standard_Boolean HasOwnWireAspect() const { return !myWireAspect.IsNull(); }
 
   //! Sets WireDraw on or off by setting the parameter theIsEnabled to true or false.
   Standard_EXPORT void SetWireDraw(const Standard_Boolean theIsEnabled);
@@ -401,43 +408,46 @@ public:
     myWireDraw = true;
   }
 
-  //! Returns the point aspect setting. The default values are
-  //!   Color: Quantity_NOC_YELLOW
-  //!   Type of marker: Aspect_TOM_PLUS
-  //!   Scale: 1.0
+  //! Returns own point aspect setting, settings from linked Drawer or NULL if neither was set.
   //! These attributes are used by the algorithms Prs3d_Point.
-  Standard_EXPORT const Handle(Prs3d_PointAspect)& PointAspect();
+  Standard_EXPORT const Handle(Prs3d_PointAspect)& PointAspect() const;
 
   //! Sets the parameter theAspect for display attributes of points
-  Standard_EXPORT void SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect);
+  void SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect)
+  {
+    myPointAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! point aspect that overrides the one in the link.
-  Standard_Boolean HasOwnPointAspect() const { return myHasOwnPointAspect; }
+  Standard_Boolean HasOwnPointAspect() const { return !myPointAspect.IsNull(); }
 
-  //! Sets own point aspect.
+  //! Sets own point aspect, which is a yellow Aspect_TOM_PLUS marker by default.
   //! Returns FALSE if the drawer already has its own attribute for point aspect.
   Standard_EXPORT Standard_Boolean SetupOwnPointAspect (const Handle(Prs3d_Drawer)& theDefaults = Handle(Prs3d_Drawer)());
 
-  //! Returns settings for line aspects.
-  //! These settings can be edited. The default values are:
-  //!   Color: Quantity_NOC_YELLOW
-  //!   Type of line: Aspect_TOL_SOLID
-  //!   Width: 1.0
+  //! Returns own settings for line aspects, settings from linked Drawer or NULL if neither was set.
   //! These attributes are used by the following algorithms:
   //!   Prs3d_Curve
   //!   Prs3d_Line
   //!   Prs3d_HLRShape
-  Standard_EXPORT const Handle(Prs3d_LineAspect)& LineAspect();
+  Standard_EXPORT const Handle(Prs3d_LineAspect)& LineAspect() const;
 
   //! Sets the parameter theAspect for display attributes of lines.
-  Standard_EXPORT void SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
+  void SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
+  {
+    myLineAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! line aspect that overrides the one in the link.
-  Standard_Boolean HasOwnLineAspect() const { return myHasOwnLineAspect; }
+  Standard_Boolean HasOwnLineAspect() const { return !myLineAspect.IsNull(); }
 
-  //! Sets own line aspects.
+  //! Sets own line aspects, which are
+  //! single U and single V gray75 solid isolines (::UIsoAspect(), ::VIsoAspect()),
+  //! red wire (::WireAspect()), yellow line (::LineAspect()),
+  //! yellow seen line (::SeenLineAspect()), dashed yellow hidden line (::HiddenLineAspect()),
+  //! green free boundary (::FreeBoundaryAspect()), yellow unfree boundary (::UnFreeBoundaryAspect()).
   //! Returns FALSE if own line aspect are already set.
   Standard_EXPORT Standard_Boolean SetOwnLineAspects (const Handle(Prs3d_Drawer)& theDefaults = Handle(Prs3d_Drawer)());
 
@@ -445,73 +455,74 @@ public:
   //! Returns FALSE if own line for datums are already set.
   Standard_EXPORT Standard_Boolean SetOwnDatumAspects (const Handle(Prs3d_Drawer)& theDefaults = Handle(Prs3d_Drawer)());
 
-  //! Returns settings for text aspect.
-  //! These settings can be edited. The default value is:
-  //! - Color: Quantity_NOC_YELLOW
-  Standard_EXPORT const Handle(Prs3d_TextAspect)& TextAspect();
+  //! Returns own settings for text aspect, settings from linked Drawer or NULL if neither was set.
+  Standard_EXPORT const Handle(Prs3d_TextAspect)& TextAspect() const;
 
   //! Sets the parameter theAspect for display attributes of text.
-  Standard_EXPORT void SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect);
+  void SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect)
+  {
+    myTextAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! text aspect that overrides the one in the link.
-  Standard_Boolean HasOwnTextAspect() const { return myHasOwnTextAspect; }
-
-  //! Returns settings for shading aspects.
-  //! These settings can be edited. The default values are:
-  //! -   Color: Quantity_NOC_YELLOW
-  //! -   Material: Graphic3d_NameOfMaterial_Brass
-  //! Shading aspect is obtained through decomposition of
-  //! 3d faces into triangles, each side of each triangle
-  //! being a chord of the corresponding curved edge in the face.
-  //! Reflection of light in each projector perspective is then calculated for each of the
-  //! resultant triangular planes.
-  Standard_EXPORT const Handle(Prs3d_ShadingAspect)& ShadingAspect();
+  Standard_Boolean HasOwnTextAspect() const { return !myTextAspect.IsNull(); }
+
+  //! Returns own settings for shading aspects, settings from linked Drawer or NULL if neither was set.
+  Standard_EXPORT const Handle(Prs3d_ShadingAspect)& ShadingAspect() const;
 
   //! Sets the parameter theAspect for display attributes of shading.
-  Standard_EXPORT  void SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect);
+  void SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect)
+  {
+    myShadingAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! shading aspect that overrides the one in the link.
-  Standard_Boolean HasOwnShadingAspect() const { return myHasOwnShadingAspect; }
+  Standard_Boolean HasOwnShadingAspect() const { return !myShadingAspect.IsNull(); }
 
-  //! Sets own shading aspect.
+  //! Sets own shading aspect, which is Graphic3d_NameOfMaterial_Brass material by default.
   //! Returns FALSE if the drawer already has its own attribute for shading aspect.
   Standard_EXPORT Standard_Boolean SetupOwnShadingAspect (const Handle(Prs3d_Drawer)& theDefaults = Handle(Prs3d_Drawer)());
 
-  //! Returns settings for seen line aspects.
-  //! These settings can be edited. The default values are:
-  //!   Color: Quantity_NOC_YELLOW
-  //!   Type of line: Aspect_TOL_SOLID
-  //!   Width: 1.0
-  Standard_EXPORT const Handle(Prs3d_LineAspect)& SeenLineAspect();
+  //! Returns own settings for seen line aspects, settings of linked Drawer or NULL if neither was set.
+  Standard_EXPORT const Handle(Prs3d_LineAspect)& SeenLineAspect() const;
 
   //! Sets the parameter theAspect for the display of seen lines in hidden line removal mode.
-  Standard_EXPORT void SetSeenLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
+  void SetSeenLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
+  {
+    mySeenLineAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! seen line aspect that overrides the one in the link.
-  Standard_Boolean HasOwnSeenLineAspect() const { return myHasOwnSeenLineAspect; }
+  Standard_Boolean HasOwnSeenLineAspect() const { return !mySeenLineAspect.IsNull(); }
 
-  //! Returns settings for the appearance of planes.
-  Standard_EXPORT const Handle(Prs3d_PlaneAspect)& PlaneAspect();
+  //! Returns own settings for the appearance of planes, settings from linked Drawer or NULL if neither was set.
+  Standard_EXPORT const Handle(Prs3d_PlaneAspect)& PlaneAspect() const;
 
   //! Sets the parameter theAspect for the display of planes. 
-  Standard_EXPORT void SetPlaneAspect (const Handle(Prs3d_PlaneAspect)& theAspect);
+  void SetPlaneAspect (const Handle(Prs3d_PlaneAspect)& theAspect)
+  {
+    myPlaneAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! plane aspect that overrides the one in the link.
-  Standard_Boolean HasOwnPlaneAspect() const { return myHasOwnPlaneAspect; }
+  Standard_Boolean HasOwnPlaneAspect() const { return !myPlaneAspect.IsNull(); }
 
-  //! Returns the attributes for display of arrows.
-  Standard_EXPORT const Handle(Prs3d_ArrowAspect)& ArrowAspect();
+  //! Returns own attributes for display of arrows, settings from linked Drawer or NULL if neither was set.
+  Standard_EXPORT const Handle(Prs3d_ArrowAspect)& ArrowAspect() const;
 
   //! Sets the parameter theAspect for display attributes of arrows.
-  Standard_EXPORT void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect);
+  void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect)
+  {
+    myArrowAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! arrow aspect that overrides the one in the link.
-  Standard_Boolean HasOwnArrowAspect() const { return myHasOwnArrowAspect; }
+  Standard_Boolean HasOwnArrowAspect() const { return !myArrowAspect.IsNull(); }
 
   //! Enables the drawing of an arrow at the end of each line.
   //! By default the arrows are not drawn.
@@ -537,19 +548,18 @@ public:
     myLineArrowDraw = false;
   }
 
-  //! Returns settings for hidden line aspects.
-  //! These settings can be edited. The default values are:
-  //!   Color: Quantity_NOC_YELLOW
-  //!   Type of line: Aspect_TOL_DASH
-  //!   Width: 1.0
-  Standard_EXPORT const Handle(Prs3d_LineAspect)& HiddenLineAspect();
+  //! Returns own settings for hidden line aspects, settings from linked Drawer or NULL if neither was set.
+  Standard_EXPORT const Handle(Prs3d_LineAspect)& HiddenLineAspect() const;
 
   //! Sets the parameter theAspect for the display of hidden lines in hidden line removal mode.
-  Standard_EXPORT void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
+  void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect)
+  {
+    myHiddenLineAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! hidden lines aspect that overrides the one in the link.
-  Standard_Boolean HasOwnHiddenLineAspect() const { return myHasOwnHiddenLineAspect; }
+  Standard_Boolean HasOwnHiddenLineAspect() const { return !myHiddenLineAspect.IsNull(); }
 
   //! Returns Standard_True if the hidden lines are to be drawn.
   //! By default the hidden lines are not drawn.
@@ -577,19 +587,18 @@ public:
     myDrawHiddenLine = false;
   }
 
-  //! Returns settings for the appearance of vectors.
-  //! These settings can be edited. The default values are:
-  //!   Color: Quantity_NOC_SKYBLUE
-  //!   Type of line: Aspect_TOL_SOLID
-  //!   Width: 1.0
-  Standard_EXPORT const Handle(Prs3d_LineAspect)& VectorAspect();
+  //! Returns own settings for the appearance of vectors, settings from linked Drawer or NULL if neither was set.
+  Standard_EXPORT const Handle(Prs3d_LineAspect)& VectorAspect() const;
 
   //! Sets the modality theAspect for the display of vectors.
-  Standard_EXPORT void SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect);
+  void SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect)
+  {
+    myVectorAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! vector aspect that overrides the one in the link.
-  Standard_Boolean HasOwnVectorAspect() const { return myHasOwnVectorAspect; }
+  Standard_Boolean HasOwnVectorAspect() const { return !myVectorAspect.IsNull(); }
 
   //! Sets the mode of visualization of vertices of a TopoDS_Shape instance.
   //! By default, only stand-alone vertices (not belonging topologically to an edge) are drawn,
@@ -600,60 +609,56 @@ public:
   Standard_EXPORT void SetVertexDrawMode (const Prs3d_VertexDrawMode theMode);
 
   //! Returns the current mode of visualization of vertices of a TopoDS_Shape instance.
-  Standard_EXPORT Prs3d_VertexDrawMode VertexDrawMode();
+  Standard_EXPORT Prs3d_VertexDrawMode VertexDrawMode() const;
 
   //! Returns true if the vertex draw mode is not equal to <b>Prs3d_VDM_Inherited</b>. 
   //! This means that individual vertex draw mode value (i.e. not inherited from the global 
   //! drawer) is used for a specific interactive object.
   Standard_Boolean HasOwnVertexDrawMode() const { return (myVertexDrawMode != Prs3d_VDM_Inherited); }
 
-  //! Returns settings for the appearance of datums.
-  //! These settings can be edited. The default values for the three axes are:
-  //!   Color: Quantity_NOC_PEACHPUFF
-  //!   Type of line: Aspect_TOL_SOLID
-  //!   Width: 1.0
-  Standard_EXPORT const Handle(Prs3d_DatumAspect)& DatumAspect();
+  //! Returns own settings for the appearance of datums, settings from linked Drawer or NULL if neither was set.
+  Standard_EXPORT const Handle(Prs3d_DatumAspect)& DatumAspect() const;
 
   //! Sets the modality theAspect for the display of datums.
-  Standard_EXPORT void SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect);
+  void SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect)
+  {
+    myDatumAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! datum aspect that overrides the one in the link.
-  Standard_Boolean HasOwnDatumAspect() const { return myHasOwnDatumAspect; }
+  Standard_Boolean HasOwnDatumAspect() const { return !myDatumAspect.IsNull(); }
 
-  //! The LineAspect for the wire can be edited.
-  //! The default values are:
-  //!   Color: Quantity_NOC_ORANGE
-  //!   Type of line: Aspect_TOL_SOLID
-  //!   Width: 1.0
+  //! Returns own LineAspect for section wire, settings from linked Drawer or NULL if neither was set.
   //! These attributes are used by the algorithm Prs3d_WFShape.
-  Standard_EXPORT const Handle(Prs3d_LineAspect)& SectionAspect();
+  Standard_EXPORT const Handle(Prs3d_LineAspect)& SectionAspect() const;
 
   //! Sets the parameter theAspect for display attributes of sections. 
-  Standard_EXPORT void SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect);
+  void SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect)
+  {
+    mySectionAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! section aspect that overrides the one in the link.
-  Standard_Boolean HasOwnSectionAspect() const { return myHasOwnSectionAspect; }
+  Standard_Boolean HasOwnSectionAspect() const { return !mySectionAspect.IsNull(); }
 
   //! Sets the parameter theAspect for the display of free boundaries.
   //! The method sets aspect owned by the drawer that will be used during
   //! visualization instead of the one set in link.
-  Standard_EXPORT void SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
-
-  //! Returns the values for presentation of free boundaries,
-  //! in other words, boundaries which are not shared.
-  //! The LineAspect for the  free boundaries can be edited.
-  //! The default values are:
-  //!   Color: Quantity_NOC_GREEN
-  //!   Type of line: Aspect_TOL_SOLID
-  //!   Width: 1.0
+  void SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect)
+  {
+    myFreeBoundaryAspect = theAspect;
+  }
+
+  //! Returns own settings for presentation of free boundaries, settings from linked Drawer or NULL if neither was set.
+  //! In other words, this settings affect boundaries which are not shared.
   //! These attributes are used by the algorithm Prs3d_WFShape
-  Standard_EXPORT const Handle(Prs3d_LineAspect)& FreeBoundaryAspect();
+  Standard_EXPORT const Handle(Prs3d_LineAspect)& FreeBoundaryAspect() const;
 
   //! Returns true if the drawer has its own attribute for
   //! free boundaries aspect that overrides the one in the link.
-  Standard_Boolean HasOwnFreeBoundaryAspect() const { return myHasOwnFreeBoundaryAspect; }
+  Standard_Boolean HasOwnFreeBoundaryAspect() const { return !myFreeBoundaryAspect.IsNull(); }
 
   //! Enables or disables drawing of free boundaries for shading presentations.
   //! The method sets drawing flag owned by the drawer that will be used during
@@ -685,20 +690,18 @@ public:
   //! Sets the parameter theAspect for the display of shared boundaries.
   //! The method sets aspect owned by the drawer that will be used during
   //! visualization instead of the one set in link.
-  Standard_EXPORT void SetUnFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
-
-  //! Returns settings for shared boundary line aspects.
-  //! The LineAspect for the unfree boundaries can be edited.
-  //! The default values are:
-  //! Color: Quantity_NOC_YELLOW
-  //! Type of line: Aspect_TOL_SOLID
-  //! Width: 1.
+  void SetUnFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect)
+  {
+    myUnFreeBoundaryAspect = theAspect;
+  }
+
+  //! Returns own settings for shared boundary line aspects, settings from linked Drawer or NULL if neither was set.
   //! These attributes are used by the algorithm Prs3d_WFShape
-  Standard_EXPORT const Handle(Prs3d_LineAspect)& UnFreeBoundaryAspect();
+  Standard_EXPORT const Handle(Prs3d_LineAspect)& UnFreeBoundaryAspect() const;
 
   //! Returns true if the drawer has its own attribute for
   //! unfree boundaries aspect that overrides the one in the link.
-  Standard_Boolean HasOwnUnFreeBoundaryAspect() const { return myHasOwnUnFreeBoundaryAspect; }
+  Standard_Boolean HasOwnUnFreeBoundaryAspect() const { return !myUnFreeBoundaryAspect.IsNull(); }
 
   //! Enables or disables drawing of shared boundaries for shading presentations.
   //! The method sets drawing flag owned by the drawer that will be used during
@@ -730,16 +733,19 @@ public:
   //! The method sets line aspect owned by the drawer that will be used during
   //! visualization instead of the one set in link.
   //! theAspect is the line aspect that determines the look of the face boundaries.
-  Standard_EXPORT void SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect);
+  void SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect)
+  {
+    myFaceBoundaryAspect = theAspect;
+  }
 
-  //! Returns line aspect of face boundaries.
-  Standard_EXPORT const Handle(Prs3d_LineAspect)& FaceBoundaryAspect();
+  //! Returns own line aspect of face boundaries, settings from linked Drawer or NULL if neither was set.
+  Standard_EXPORT const Handle(Prs3d_LineAspect)& FaceBoundaryAspect() const;
 
   //! Returns true if the drawer has its own attribute for
   //! face boundaries aspect that overrides the one in the link.
-  Standard_Boolean HasOwnFaceBoundaryAspect() const { return myHasOwnFaceBoundaryAspect; }
+  Standard_Boolean HasOwnFaceBoundaryAspect() const { return !myFaceBoundaryAspect.IsNull(); }
 
-  //! Sets own face boundary aspect.
+  //! Sets own face boundary aspect, which is a black solid line by default.
   //! Returns FALSE if the drawer already has its own attribute for face boundary aspect.
   Standard_EXPORT Standard_Boolean SetupOwnFaceBoundaryAspect (const Handle(Prs3d_Drawer)& theDefaults = Handle(Prs3d_Drawer)());
 
@@ -787,17 +793,20 @@ public:
   //! Unset the most edge continuity class for face boundaries.
   void UnsetFaceBoundaryUpperContinuity() { myFaceBoundaryUpperContinuity = -1; }
 
-  //! Returns settings for the appearance of dimensions. 
-  Standard_EXPORT const Handle(Prs3d_DimensionAspect)& DimensionAspect();
+  //! Returns own settings for the appearance of dimensions, settings from linked Drawer or NULL if neither was set.
+  Standard_EXPORT const Handle(Prs3d_DimensionAspect)& DimensionAspect() const;
 
   //! Sets the settings for the appearance of dimensions.
   //! The method sets aspect owned by the drawer that will be used during
   //! visualization instead of the one set in link.
-  Standard_EXPORT void SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect);
+  void SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect)
+  {
+    myDimensionAspect = theAspect;
+  }
 
   //! Returns true if the drawer has its own attribute for
   //! the appearance of dimensions that overrides the one in the link.
-  Standard_Boolean HasOwnDimensionAspect() const { return myHasOwnDimensionAspect; }
+  Standard_Boolean HasOwnDimensionAspect() const { return !myDimensionAspect.IsNull(); }
 
   //! Sets dimension length model units for computing of dimension presentation.
   //! The method sets value owned by the drawer that will be used during
@@ -900,7 +909,7 @@ public:
 public:
 
   //! Returns the drawer to which the current object references.
-  const Handle(Prs3d_Drawer)& Link() { return myLink; }
+  const Handle(Prs3d_Drawer)& Link() const { return myLink; }
 
   //! Returns true if the current object has a link on the other drawer.
   Standard_Boolean HasLink() const { return !myLink.IsNull(); }
@@ -953,19 +962,14 @@ protected:
   Handle(Prs3d_Drawer)          myLink;
 
   Standard_Integer              myNbPoints;
-  Standard_Boolean              myHasOwnNbPoints;
   Standard_Real                 myMaximalParameterValue;
-  Standard_Boolean              myHasOwnMaximalParameterValue;
   Standard_Real                 myChordialDeviation;
-  Standard_Boolean              myHasOwnChordialDeviation;
   Aspect_TypeOfDeflection       myTypeOfDeflection;
   Standard_Boolean              myHasOwnTypeOfDeflection;
   Prs3d_TypeOfHLR               myTypeOfHLR;
   Standard_Real                 myDeviationCoefficient;
   Standard_Real                 myPreviousDeviationCoefficient;
-  Standard_Boolean              myHasOwnDeviationCoefficient;
   Standard_Real                 myDeviationAngle;
-  Standard_Boolean              myHasOwnDeviationAngle;
   Standard_Real                 myPreviousDeviationAngle;
   Standard_Boolean              myIsoOnPlane;
   Standard_Boolean              myHasOwnIsoOnPlane;
@@ -975,57 +979,39 @@ protected:
   Standard_Boolean              myHasOwnIsAutoTriangulated;
 
   Handle(Prs3d_IsoAspect)       myUIsoAspect;
-  Standard_Boolean              myHasOwnUIsoAspect;
   Handle(Prs3d_IsoAspect)       myVIsoAspect;
-  Standard_Boolean              myHasOwnVIsoAspect;
   Handle(Prs3d_LineAspect)      myWireAspect;
-  Standard_Boolean              myHasOwnWireAspect;
   Standard_Boolean              myWireDraw;
   Standard_Boolean              myHasOwnWireDraw;
   Handle(Prs3d_PointAspect)     myPointAspect;
-  Standard_Boolean              myHasOwnPointAspect;
   Handle(Prs3d_LineAspect)      myLineAspect;
-  Standard_Boolean              myHasOwnLineAspect;
   Handle(Prs3d_TextAspect)      myTextAspect;
-  Standard_Boolean              myHasOwnTextAspect;
   Handle(Prs3d_ShadingAspect)   myShadingAspect;
-  Standard_Boolean              myHasOwnShadingAspect;
   Handle(Prs3d_PlaneAspect)     myPlaneAspect;
-  Standard_Boolean              myHasOwnPlaneAspect;
   Handle(Prs3d_LineAspect)      mySeenLineAspect;
-  Standard_Boolean              myHasOwnSeenLineAspect;
   Handle(Prs3d_ArrowAspect)     myArrowAspect;
-  Standard_Boolean              myHasOwnArrowAspect;
   Standard_Boolean              myLineArrowDraw;
   Standard_Boolean              myHasOwnLineArrowDraw;
   Handle(Prs3d_LineAspect)      myHiddenLineAspect;
-  Standard_Boolean              myHasOwnHiddenLineAspect;
   Standard_Boolean              myDrawHiddenLine;
   Standard_Boolean              myHasOwnDrawHiddenLine;
   Handle(Prs3d_LineAspect)      myVectorAspect;
-  Standard_Boolean              myHasOwnVectorAspect;
   Prs3d_VertexDrawMode          myVertexDrawMode;
   Handle(Prs3d_DatumAspect)     myDatumAspect;
-  Standard_Boolean              myHasOwnDatumAspect;
   Handle(Prs3d_LineAspect)      mySectionAspect;
-  Standard_Boolean              myHasOwnSectionAspect;
 
   Handle(Prs3d_LineAspect)      myFreeBoundaryAspect;
-  Standard_Boolean              myHasOwnFreeBoundaryAspect;
   Standard_Boolean              myFreeBoundaryDraw;
   Standard_Boolean              myHasOwnFreeBoundaryDraw;
   Handle(Prs3d_LineAspect)      myUnFreeBoundaryAspect;
-  Standard_Boolean              myHasOwnUnFreeBoundaryAspect;
   Standard_Boolean              myUnFreeBoundaryDraw;
   Standard_Boolean              myHasOwnUnFreeBoundaryDraw;
   Handle(Prs3d_LineAspect)      myFaceBoundaryAspect;
   Standard_Integer              myFaceBoundaryUpperContinuity; //!< the most edge continuity class (GeomAbs_Shape) to be included to face boundaries presentation, or -1 if undefined
-  Standard_Boolean              myHasOwnFaceBoundaryAspect;
   Standard_Boolean              myFaceBoundaryDraw;
   Standard_Boolean              myHasOwnFaceBoundaryDraw;
 
   Handle(Prs3d_DimensionAspect) myDimensionAspect;
-  Standard_Boolean              myHasOwnDimensionAspect;
   Prs3d_DimensionUnits          myDimensionModelUnits;
   Standard_Boolean              myHasOwnDimLengthModelUnits;
   Standard_Boolean              myHasOwnDimAngleModelUnits;
index a3b0ec864858ec0fe5ff9fe540b49acf1733af55..9b406467de34a72d30020c287d1a3b70c9287ee9 100644 (file)
@@ -1033,117 +1033,6 @@ static Standard_Integer OCC884 (Draw_Interpretor& di, Standard_Integer argc, con
   return 0;
 }
 
-#include <Graphic3d_MaterialAspect.hxx>
-#include <Prs3d_Drawer.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-//=======================================================================
-//function : OCC1174_1
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC1174_1 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 2)
-  {
-    di << "Usage : " << argv[0] << " shape\n";
-    return 1;
-  }
-
-  Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
-  if(anAISContext.IsNull())
-  {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  TopoDS_Shape aShape = DBRep::Get(argv[1]);
-
-  Handle(AIS_Shape) anAisIO = new AIS_Shape(aShape);
-
-  Quantity_Color aColF(0.0, 0.4, 0.0, Quantity_TOC_sRGB);
-  Quantity_Color aColB(0.0, 0.0, 0.6, Quantity_TOC_sRGB);
-
-  Handle(Prs3d_Drawer) aDrawer = anAisIO->Attributes();
-  Handle(Prs3d_ShadingAspect) aShadingAspect = aDrawer->ShadingAspect();
-
-  Graphic3d_MaterialAspect aFront = aShadingAspect->Material(Aspect_TOFM_FRONT_SIDE);
-  aFront.SetAmbientColor(aColF);
-  aFront.SetDiffuseColor(aColF);
-  aFront.SetSpecularColor(aColF);
-  aFront.SetEmissiveColor(Quantity_NOC_BLACK);
-  aFront.SetTransparency(0.0);
-  aShadingAspect->SetMaterial(aFront,Aspect_TOFM_FRONT_SIDE);
-
-  Graphic3d_MaterialAspect aBack = aShadingAspect->Material(Aspect_TOFM_BACK_SIDE);
-  aBack.SetAmbientColor(aColB);
-  aBack.SetDiffuseColor(aColB);
-  aBack.SetSpecularColor(aColB);
-  aBack.SetEmissiveColor(Quantity_NOC_BLACK);
-  aBack.SetTransparency(0.0);
-  aShadingAspect->SetMaterial(aBack,Aspect_TOFM_BACK_SIDE);
-
-  aDrawer->SetShadingAspect (aShadingAspect);
-
-  anAISContext->Display (anAisIO, 1, 0, Standard_True);
-
-  Standard_Real r, g, b; 
-  aShadingAspect->Color(Aspect_TOFM_FRONT_SIDE).Values(r,g,b, Quantity_TOC_sRGB);
-  di << "Info: color on front side (" << r << "," << g << "," << b << ")\n";
-  aShadingAspect->Color(Aspect_TOFM_BACK_SIDE).Values(r,g,b, Quantity_TOC_sRGB);
-  di << "Info: color on back side (" << r << "," << g << "," << b << ")\n";
-
-  return 0;
-}
-
-//=======================================================================
-//function : OCC1174_2
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC1174_2 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 2)
-  {
-    di << "Usage : " << argv[0] << " shape\n";
-    return 1;
-  }
-
-  Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
-  if(AISContext.IsNull()) 
-  {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  TopoDS_Shape sh = DBRep::Get(argv[1]);
-
-  Handle(AIS_Shape) ais = new AIS_Shape(sh); 
-  AISContext->Display (ais, 1, 0, Standard_False);
-  AISContext->SetMaterial (ais, Graphic3d_NameOfMaterial_ShinyPlastified, Standard_False);
-
-  Quantity_Color colf(0.0, 0.4, 0.0, Quantity_TOC_sRGB);
-  Quantity_Color colb(0.0, 0.0, 0.6, Quantity_TOC_sRGB);
-  Handle(Prs3d_ShadingAspect) sa = ais->Attributes()->ShadingAspect(); 
-
-  Graphic3d_MaterialAspect front = sa->Material(Aspect_TOFM_FRONT_SIDE); 
-  front.SetAmbientColor(colf); 
-  front.SetDiffuseColor(colf); 
-  front.SetSpecularColor(colf); 
-  front.SetEmissiveColor(Quantity_NOC_BLACK);
-  front.SetTransparency (0.4f);
-  sa->SetMaterial(front,Aspect_TOFM_FRONT_SIDE); 
-
-  Graphic3d_MaterialAspect back = sa->Material(Aspect_TOFM_BACK_SIDE); 
-  back.SetAmbientColor(colb); 
-  back.SetDiffuseColor(colb); 
-  back.SetSpecularColor(colb); 
-  back.SetEmissiveColor(Quantity_NOC_BLACK);
-  back.SetTransparency (0.2f);
-  sa->SetMaterial(back,Aspect_TOFM_BACK_SIDE); 
-
-  AISContext->Redisplay (ais, 1, 0);
-
-  return 0;
-}
-
 #include <TopoDS_Solid.hxx>
 #include <BRepFeat_MakeDPrism.hxx>
 //=======================================================================
@@ -1503,9 +1392,6 @@ void QABugs::Commands_17(Draw_Interpretor& theCommands) {
   theCommands.Add ("OCC814", "OCC814", __FILE__, OCC814, group);
   theCommands.Add ("OCC884", "OCC884 result shape [toler [maxtoler]]", __FILE__, OCC884, group);
 
-  theCommands.Add ("OCC1174_1", "OCC1174_1 shape", __FILE__, OCC1174_1, group);
-  theCommands.Add ("OCC1174_2", "OCC1174_2 shape", __FILE__, OCC1174_2, group);
-
   theCommands.Add ("OCCN1", "OCCN1 angle fuse(1 for boss / 0 for slot) length", __FILE__, OCCN1, group);
   theCommands.Add ("OCCN2", "OCCN2", __FILE__, OCCN2, group);
 
index 6fb51fff2d581bc94048bc14341eb675e87d368e..7e38bbf50b253ac5a448de04dcc8e7cc3a9ee667 100644 (file)
@@ -5026,7 +5026,7 @@ static Standard_Integer VTriangle (Draw_Interpretor& /*di*/,
   if (!isTri)
   {
     aPrs->Attributes()->SetupOwnShadingAspect();
-    aPrs->Attributes()->ShadingAspect()->Aspect()->SetColor (aPrs->Attributes()->LineAspect()->Aspect()->Color());
+    aPrs->Attributes()->ShadingAspect()->Aspect()->SetColor (Quantity_NOC_YELLOW);
   }
   ViewerTest::Display (argv[1], aPrs);
   return 0;
diff --git a/tests/v3d/bugs/bug1174 b/tests/v3d/bugs/bug1174
deleted file mode 100644 (file)
index 8d47754..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-puts "================"
-puts "OCC1174: Impossible to set different properties for different sides of a (sur)face"
-puts "================"
-puts ""
-
-pload MODELING VISUALIZATION QAcommands
-
-set x 200
-set y 200
-
-set Black_R 0
-set Black_G 0
-set Black_B 0
-
-restore [locate_data_file OCC1174.brep] a
-vinit View1
-OCC1174_1 a
-vdisplay a
-vfit
-
-set scale    2.50501
-set proj_X   0.672033
-set proj_Y   -0.721033
-set proj_Z   0.168771
-set up_X     -0.131494
-set up_Y     0.108095
-set up_Z     0.985406
-set at_X     102.061817325836
-set at_Y     169.436979868935
-set at_Z     70.7572056943368
-
-vviewparams -scale ${scale} -proj ${proj_X} ${proj_Y} ${proj_Z} -up ${up_X} ${up_Y} ${up_Z} -at ${at_X} ${at_Y} ${at_Z}
-
-set x_GREEN 300
-set y_GREEN 180
-
-set x_BLUE 180
-set y_BLUE 250
-
-set ColorList1 [vreadpixel ${x_GREEN} ${y_GREEN} rgb]
-set RED_1   [lindex $ColorList1 0]
-set GREEN_1 [lindex $ColorList1 1]
-set BLUE_1  [lindex $ColorList1 2]
-
-set ColorList2 [vreadpixel ${x_BLUE} ${y_BLUE} rgb]
-set RED_2   [lindex $ColorList2 0]
-set GREEN_2 [lindex $ColorList2 1]
-set BLUE_2  [lindex $ColorList2 2]
-
-if {${RED_1} == 0 && ${GREEN_1} > 0 && ${BLUE_1} == 0} {
-  set IsGreen 1
-} else {
-  set IsGreen 0
-}
-
-if {${RED_2} == 0 && ${GREEN_2} == 0 && ${BLUE_2} > 0} {
-  set IsBlue 1
-} else {
-  set IsBlue 0
-}
-
-if {${IsGreen} == 1 && ${IsBlue} == 1} {
-  puts "OCC1174: OK"
-} else {
-  puts "OCC1174: Error"
-}
-
-vdump $imagedir/${casename}.png