IMPLEMENT_STANDARD_RTTIEXT(Prs3d_Drawer, Graphic3d_PresentationAttributes)
+namespace
+{
+ static const Quantity_NameOfColor THE_DEF_COLOR_FreeBoundary = Quantity_NOC_GREEN;
+ static const Quantity_NameOfColor THE_DEF_COLOR_UnFreeBoundary = Quantity_NOC_YELLOW;
+ static const Quantity_NameOfColor THE_DEF_COLOR_FaceBoundary = Quantity_NOC_BLACK;
+ static const Quantity_NameOfColor THE_DEF_COLOR_Wire = Quantity_NOC_RED;
+ static const Quantity_NameOfColor THE_DEF_COLOR_Line = Quantity_NOC_YELLOW;
+ static const Quantity_NameOfColor THE_DEF_COLOR_SeenLine = Quantity_NOC_YELLOW;
+ static const Quantity_NameOfColor THE_DEF_COLOR_HiddenLine = Quantity_NOC_YELLOW;
+ static const Quantity_NameOfColor THE_DEF_COLOR_Vector = Quantity_NOC_SKYBLUE;
+ static const Quantity_NameOfColor THE_DEF_COLOR_Section = Quantity_NOC_ORANGE;
+}
+
// =======================================================================
// function : Prs3d_Drawer
// purpose :
}
if (myFreeBoundaryAspect.IsNull())
{
- myFreeBoundaryAspect = new Prs3d_LineAspect (Quantity_NOC_GREEN, Aspect_TOL_SOLID, 1.0);
+ myFreeBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FreeBoundary, Aspect_TOL_SOLID, 1.0);
}
}
return myFreeBoundaryAspect;
}
if (myUnFreeBoundaryAspect.IsNull())
{
- myUnFreeBoundaryAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1.0);
+ myUnFreeBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_UnFreeBoundary, Aspect_TOL_SOLID, 1.0);
}
}
return myUnFreeBoundaryAspect;
}
if (myFaceBoundaryAspect.IsNull())
{
- myFaceBoundaryAspect = new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0);
+ myFaceBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FaceBoundary, Aspect_TOL_SOLID, 1.0);
}
}
return myFaceBoundaryAspect;
}
if (myWireAspect.IsNull())
{
- myWireAspect = new Prs3d_LineAspect (Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0);
+ myWireAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Wire, Aspect_TOL_SOLID, 1.0);
}
}
return myWireAspect;
return myPointAspect;
}
+// =======================================================================
+// function : SetupOwnPointAspect
+// purpose :
+// =======================================================================
+Standard_Boolean Prs3d_Drawer::SetupOwnPointAspect (const Handle(Prs3d_Drawer)& theDefaults)
+{
+ if (myHasOwnPointAspect)
+ {
+ 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())
+ {
+ *myPointAspect->Aspect() = *myLink->PointAspect()->Aspect();
+ }
+ myHasOwnPointAspect = Standard_True;
+ return Standard_True;
+}
+
// =======================================================================
// function : SetPointAspect
// purpose :
}
if (myLineAspect.IsNull())
{
- myLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1.0);
+ myLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Line, Aspect_TOL_SOLID, 1.0);
}
}
return myLineAspect;
return myShadingAspect;
}
+// =======================================================================
+// function : SetupOwnShadingAspect
+// purpose :
+// =======================================================================
+Standard_Boolean Prs3d_Drawer::SetupOwnShadingAspect (const Handle(Prs3d_Drawer)& theDefaults)
+{
+ if (myHasOwnShadingAspect)
+ {
+ return Standard_False;
+ }
+
+ myShadingAspect = new Prs3d_ShadingAspect();
+ if (!theDefaults.IsNull() && theDefaults != this)
+ {
+ *myShadingAspect->Aspect() = *theDefaults->ShadingAspect()->Aspect();
+ }
+ else if (!myLink.IsNull())
+ {
+ *myShadingAspect->Aspect() = *myLink->ShadingAspect()->Aspect();
+ }
+ myHasOwnShadingAspect = Standard_True;
+ return Standard_True;
+}
+
// =======================================================================
// function : SetShadingAspect
// purpose :
}
if (mySeenLineAspect.IsNull())
{
- mySeenLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1.0);
+ mySeenLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_SeenLine, Aspect_TOL_SOLID, 1.0);
}
}
return mySeenLineAspect;
}
if (myHiddenLineAspect.IsNull())
{
- myHiddenLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_DASH, 1.0);
+ myHiddenLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_HiddenLine, Aspect_TOL_DASH, 1.0);
}
}
return myHiddenLineAspect;
}
if (myVectorAspect.IsNull())
{
- myVectorAspect = new Prs3d_LineAspect (Quantity_NOC_SKYBLUE, Aspect_TOL_SOLID, 1.0);
+ myVectorAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Vector, Aspect_TOL_SOLID, 1.0);
}
}
return myVectorAspect;
}
if (mySectionAspect.IsNull())
{
- mySectionAspect = new Prs3d_LineAspect (Quantity_NOC_ORANGE, Aspect_TOL_SOLID, 1.0);
+ mySectionAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Section, Aspect_TOL_SOLID, 1.0);
}
}
return mySectionAspect;
myTypeOfHLR = Prs3d_TOH_NotSet;
}
-//! Copy line aspect defaults from the Link.
-inline void copyLineAspect (const Handle(Prs3d_Drawer)& theLink,
- Handle(Prs3d_LineAspect)& theAspect,
- const Handle(Prs3d_LineAspect)& theBaseAspect)
+// =======================================================================
+// function : SetOwnLineAspects
+// purpose :
+// =======================================================================
+Standard_Boolean Prs3d_Drawer::SetOwnLineAspects (const Handle(Prs3d_Drawer)& theDefaults)
+{
+ bool isUpdateNeeded = false;
+ const Handle(Prs3d_Drawer)& aLink = (!theDefaults.IsNull() && theDefaults != this) ? theDefaults : myLink;
+ if (!myHasOwnUIsoAspect)
+ {
+ isUpdateNeeded = true;
+ myUIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1);
+ if (!aLink.IsNull())
+ {
+ *myUIsoAspect->Aspect() = *aLink->UIsoAspect()->Aspect();
+ myUIsoAspect->SetNumber (aLink->UIsoAspect()->Number());
+ }
+ myHasOwnUIsoAspect = true;
+ }
+ if (!myHasOwnVIsoAspect)
+ {
+ isUpdateNeeded = true;
+ myVIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1);
+ if (!aLink.IsNull())
+ {
+ *myVIsoAspect->Aspect() = *aLink->VIsoAspect()->Aspect();
+ myUIsoAspect->SetNumber (aLink->VIsoAspect()->Number());
+ }
+ myHasOwnVIsoAspect = true;
+ }
+ if (!myHasOwnWireAspect)
+ {
+ isUpdateNeeded = true;
+ myWireAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Wire, Aspect_TOL_SOLID, 1.0);
+ myHasOwnWireAspect = true;
+ if (!aLink.IsNull())
+ {
+ *myWireAspect->Aspect() = *aLink->WireAspect()->Aspect();
+ }
+ }
+ if (!myHasOwnLineAspect)
+ {
+ isUpdateNeeded = true;
+ myLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Line, Aspect_TOL_SOLID, 1.0);
+ myHasOwnLineAspect = true;
+ if (!aLink.IsNull())
+ {
+ *myLineAspect->Aspect() = *aLink->LineAspect()->Aspect();
+ }
+ }
+ if (!myHasOwnSeenLineAspect)
+ {
+ isUpdateNeeded = true;
+ mySeenLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_SeenLine, Aspect_TOL_SOLID, 1.0);
+ myHasOwnSeenLineAspect = true;
+ if (!aLink.IsNull())
+ {
+ *mySeenLineAspect->Aspect() = *aLink->SeenLineAspect()->Aspect();
+ }
+ }
+ if (!myHasOwnHiddenLineAspect)
+ {
+ isUpdateNeeded = true;
+ myHiddenLineAspect = new Prs3d_LineAspect (THE_DEF_COLOR_HiddenLine, Aspect_TOL_DASH, 1.0);
+ myHasOwnHiddenLineAspect = true;
+ if (!aLink.IsNull())
+ {
+ *myHiddenLineAspect->Aspect() = *aLink->HiddenLineAspect()->Aspect();
+ }
+ }
+ if (!myHasOwnFreeBoundaryAspect)
+ {
+ isUpdateNeeded = true;
+ myFreeBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FreeBoundary, Aspect_TOL_SOLID, 1.0);
+ myHasOwnFreeBoundaryAspect = true;
+ if (!aLink.IsNull())
+ {
+ *myFreeBoundaryAspect->Aspect() = *aLink->FreeBoundaryAspect()->Aspect();
+ }
+ }
+ if (!myHasOwnUnFreeBoundaryAspect)
+ {
+ isUpdateNeeded = true;
+ myUnFreeBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_UnFreeBoundary, Aspect_TOL_SOLID, 1.0);
+ myHasOwnUnFreeBoundaryAspect = true;
+ if (!aLink.IsNull())
+ {
+ *myUnFreeBoundaryAspect->Aspect() = *aLink->UnFreeBoundaryAspect()->Aspect();
+ }
+ }
+ if (!myHasOwnFaceBoundaryAspect)
+ {
+ isUpdateNeeded = true;
+ myFaceBoundaryAspect = new Prs3d_LineAspect (THE_DEF_COLOR_FaceBoundary, Aspect_TOL_SOLID, 1.0);
+ myHasOwnFaceBoundaryAspect = true;
+ if (!aLink.IsNull())
+ {
+ *myFaceBoundaryAspect->Aspect() = *aLink->FaceBoundaryAspect()->Aspect();
+ }
+ }
+ return isUpdateNeeded;
+}
+
+// =======================================================================
+// function : SetOwnDatumAspects
+// purpose :
+// =======================================================================
+Standard_Boolean Prs3d_Drawer::SetOwnDatumAspects (const Handle(Prs3d_Drawer)& theDefaults)
{
- Handle(Prs3d_LineAspect) aBaseAspect = theBaseAspect;
- if (!theLink.IsNull())
+ bool isUpdateNeeded = false;
+ const Handle(Prs3d_Drawer)& aLink = (!theDefaults.IsNull() && theDefaults != this) ? theDefaults : myLink;
+ if (!myHasOwnVectorAspect)
+ {
+ isUpdateNeeded = true;
+ myVectorAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Vector, Aspect_TOL_SOLID, 1.0);
+ myHasOwnVectorAspect = true;
+ if (!aLink.IsNull())
+ {
+ *myVectorAspect->Aspect() = *aLink->VectorAspect()->Aspect();
+ }
+ }
+ if (!myHasOwnSectionAspect)
+ {
+ isUpdateNeeded = true;
+ mySectionAspect = new Prs3d_LineAspect (THE_DEF_COLOR_Section, Aspect_TOL_SOLID, 1.0);
+ myHasOwnSectionAspect = true;
+ if (!aLink.IsNull())
+ {
+ *mySectionAspect->Aspect() = *aLink->SectionAspect()->Aspect();
+ }
+ }
+ if (!myHasOwnPlaneAspect)
+ {
+ isUpdateNeeded = true;
+ myPlaneAspect = new Prs3d_PlaneAspect();
+ myHasOwnPlaneAspect = true;
+ }
+ if (!myHasOwnArrowAspect)
+ {
+ isUpdateNeeded = true;
+ myArrowAspect = new Prs3d_ArrowAspect();
+ myHasOwnArrowAspect = true;
+ }
+ if (!myHasOwnDatumAspect)
{
- theAspect = new Prs3d_LineAspect (Quantity_NOC_WHITE, Aspect_TOL_SOLID, 1.0);
- *theAspect->Aspect() = *aBaseAspect->Aspect();
+ isUpdateNeeded = true;
+ myDatumAspect = new Prs3d_DatumAspect();
+ myHasOwnDatumAspect = true;
}
+ return isUpdateNeeded;
}
//! Assign the shader program.
{
if (theToOverrideDefaults)
{
- if (!myHasOwnUIsoAspect)
- {
- isUpdateNeeded = true;
- Handle(Prs3d_IsoAspect) anAspect = UIsoAspect();
- if (!myLink.IsNull())
- {
- myUIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1);
- *myUIsoAspect->Aspect() = *anAspect->Aspect();
- myUIsoAspect->SetNumber (anAspect->Number());
- }
- myHasOwnUIsoAspect = true;
- }
- if (!myHasOwnVIsoAspect)
- {
- isUpdateNeeded = true;
- Handle(Prs3d_IsoAspect) anAspect = VIsoAspect();
- if (!myLink.IsNull())
- {
- myVIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1);
- *myVIsoAspect->Aspect() = *anAspect->Aspect();
- myUIsoAspect->SetNumber (anAspect->Number());
- }
- myHasOwnVIsoAspect = true;
- }
- if (!myHasOwnWireAspect)
- {
- isUpdateNeeded = true;
- copyLineAspect (myLink, myWireAspect, WireAspect());
- myHasOwnWireAspect = true;
- }
- if (!myHasOwnLineAspect)
- {
- isUpdateNeeded = true;
- copyLineAspect (myLink, myLineAspect, LineAspect());
- myHasOwnLineAspect = true;
- }
- if (!myHasOwnSeenLineAspect)
- {
- isUpdateNeeded = true;
- copyLineAspect (myLink, mySeenLineAspect, SeenLineAspect());
- myHasOwnSeenLineAspect = true;
- }
- if (!myHasOwnHiddenLineAspect)
- {
- isUpdateNeeded = true;
- copyLineAspect (myLink, myHiddenLineAspect, HiddenLineAspect());
- myHasOwnHiddenLineAspect = true;
- }
- if (!myHasOwnVectorAspect)
- {
- isUpdateNeeded = true;
- copyLineAspect (myLink, myVectorAspect, VectorAspect());
- myHasOwnVectorAspect = true;
- }
- if (!myHasOwnSectionAspect)
- {
- isUpdateNeeded = true;
- copyLineAspect (myLink, mySectionAspect, SectionAspect());
- myHasOwnSectionAspect = true;
- }
- if (!myHasOwnFreeBoundaryAspect)
- {
- isUpdateNeeded = true;
- copyLineAspect (myLink, myFreeBoundaryAspect, FreeBoundaryAspect());
- myHasOwnFreeBoundaryAspect = true;
- }
- if (!myHasOwnUnFreeBoundaryAspect)
- {
- isUpdateNeeded = true;
- copyLineAspect (myLink, myUnFreeBoundaryAspect, UnFreeBoundaryAspect());
- myHasOwnUnFreeBoundaryAspect = true;
- }
- if (!myHasOwnFaceBoundaryAspect)
- {
- isUpdateNeeded = true;
- copyLineAspect (myLink, myFaceBoundaryAspect, FaceBoundaryAspect());
- myHasOwnFaceBoundaryAspect = true;
- }
-
- if (!myHasOwnPlaneAspect)
- {
- isUpdateNeeded = true;
- myPlaneAspect = new Prs3d_PlaneAspect();
- myHasOwnPlaneAspect = true;
- }
- if (!myHasOwnArrowAspect)
- {
- isUpdateNeeded = true;
- myArrowAspect = new Prs3d_ArrowAspect();
- myHasOwnArrowAspect = true;
- }
- if (!myHasOwnDatumAspect)
- {
- isUpdateNeeded = true;
- myDatumAspect = new Prs3d_DatumAspect();
- myHasOwnDatumAspect = true;
- }
+ isUpdateNeeded = SetOwnLineAspects() || isUpdateNeeded;
+ isUpdateNeeded = SetOwnDatumAspects() || isUpdateNeeded;
}
setAspectProgram (theProgram, myHasOwnUIsoAspect, myUIsoAspect);
case Graphic3d_ASPECT_MARKER:
{
if (theToOverrideDefaults
- && !myHasOwnPointAspect)
+ && SetupOwnPointAspect())
{
isUpdateNeeded = true;
- myPointAspect = new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.0);
- myHasOwnPointAspect = true;
- if (!myLink.IsNull())
- {
- *myPointAspect->Aspect() = *myLink->PointAspect()->Aspect();
- }
}
setAspectProgram (theProgram, myHasOwnPointAspect, myPointAspect);
case Graphic3d_ASPECT_FILL_AREA:
{
if (theToOverrideDefaults
- && !myHasOwnShadingAspect)
+ && SetupOwnShadingAspect())
{
isUpdateNeeded = true;
- myShadingAspect = new Prs3d_ShadingAspect();
- myHasOwnShadingAspect = true;
- if (!myLink.IsNull())
- {
- *myShadingAspect->Aspect() = *myLink->ShadingAspect()->Aspect();
- }
}
setAspectProgram (theProgram, myHasOwnShadingAspect, myShadingAspect);
return isUpdateNeeded;
bool isUpdateNeeded = false;
if (theToOverrideDefaults
- && !myHasOwnShadingAspect)
+ && SetupOwnShadingAspect())
{
isUpdateNeeded = true;
- myShadingAspect = new Prs3d_ShadingAspect();
- myHasOwnShadingAspect = true;
- if (!myLink.IsNull())
- {
- *myShadingAspect->Aspect() = *myLink->ShadingAspect()->Aspect();
- }
}
if (!myShadingAspect.IsNull()