From: Roman Lygin Date: Wed, 28 Nov 2012 09:50:28 +0000 (+0400) Subject: 0023596: Extending XCAFPrs_AISObject to enable customization of default color X-Git-Tag: V6_6_0_beta~192 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=576ab3945d002d5cf620ebd14ee26e5bea120515 0023596: Extending XCAFPrs_AISObject to enable customization of default color --- diff --git a/src/XCAFPrs/XCAFPrs_AISObject.cdl b/src/XCAFPrs/XCAFPrs_AISObject.cdl index fc4aa1008e..df286265e9 100755 --- a/src/XCAFPrs/XCAFPrs_AISObject.cdl +++ b/src/XCAFPrs/XCAFPrs_AISObject.cdl @@ -64,9 +64,16 @@ is aPresentationManager : PresentationManager3d from PrsMgr; aPresentation : mutable Presentation from Prs3d; aMode : Integer from Standard = 0) - is redefined virtual private; + is redefined virtual protected; ---Purpose: Redefined method to compute presentation + DefaultStyle (me; + aStyle: out Style from XCAFPrs) + is virtual protected; + ---Purpose: Fills out a default style object which is used when styles are + -- not explicitly defined in the document. + -- By default, the style uses white color for curves and surfaces. + fields myLabel : Label from TDF; diff --git a/src/XCAFPrs/XCAFPrs_AISObject.cxx b/src/XCAFPrs/XCAFPrs_AISObject.cxx index b3d2a3cc2f..60d430fc56 100755 --- a/src/XCAFPrs/XCAFPrs_AISObject.cxx +++ b/src/XCAFPrs/XCAFPrs_AISObject.cxx @@ -434,9 +434,7 @@ void XCAFPrs_AISObject::Compute (const Handle(PrsMgr_PresentationManager3d)& aPr // dispatch (sub)shapes by their styles XCAFPrs_DataMapOfStyleShape items; XCAFPrs_Style DefStyle; - Quantity_Color White ( Quantity_NOC_WHITE ); - DefStyle.SetColorSurf ( White ); - DefStyle.SetColorCurv ( White ); + DefaultStyle (DefStyle); XCAFPrs::DispatchStyles ( shape, settings, items, DefStyle ); #ifdef DEB //cout << "Dispatch done" << endl; @@ -475,3 +473,14 @@ void XCAFPrs_AISObject::Compute (const Handle(PrsMgr_PresentationManager3d)& aPr aPrs->ReCompute(); // for hidden line recomputation if necessary... } + +//======================================================================= +//function : DefaultStyle +//purpose : DefaultStyle() can be redefined by subclasses in order to set custom default style +//======================================================================= +void XCAFPrs_AISObject::DefaultStyle (XCAFPrs_Style& aStyle) const +{ + static const Quantity_Color White ( Quantity_NOC_WHITE ); + aStyle.SetColorSurf ( White ); + aStyle.SetColorCurv ( White ); +}