#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
-#include <Quantity_Length.hxx>
#include <Aspect_TypeOfDeflection.hxx>
+#include <Graphic3d_GroupAspect.hxx>
+#include <Graphic3d_PresentationAttributes.hxx>
+#include <Graphic3d_ShaderProgram.hxx>
#include <Standard_Real.hxx>
#include <Prs3d_VertexDrawMode.hxx>
#include <Prs3d_DimensionUnits.hxx>
#include <Prs3d_TypeOfHLR.hxx>
-#include <MMgt_TShared.hxx>
+#include <Standard_Transient.hxx>
+#include <GeomAbs_Shape.hxx>
class Prs3d_IsoAspect;
class Prs3d_LineAspect;
class Prs3d_DimensionAspect;
class TCollection_AsciiString;
-class Prs3d_Drawer;
-DEFINE_STANDARD_HANDLE(Prs3d_Drawer, MMgt_TShared)
+DEFINE_STANDARD_HANDLE(Prs3d_Drawer, Graphic3d_PresentationAttributes)
//! A graphic attribute manager which governs how
//! objects such as color, width, line thickness and deflection are displayed.
//! A drawer includes an instance of the Aspect classes with particular default values.
-class Prs3d_Drawer : public MMgt_TShared
+class Prs3d_Drawer : public Graphic3d_PresentationAttributes
{
-
+ DEFINE_STANDARD_RTTIEXT(Prs3d_Drawer, Graphic3d_PresentationAttributes)
public:
//! Default constructor.
//! Prs3d_DeflectionCurve
//! Prs3d_WFDeflectionSurface
//! Prs3d_WFDeflectionRestrictedFace
- Standard_EXPORT void SetMaximalChordialDeviation (const Quantity_Length theChordialDeviation);
+ Standard_EXPORT void SetMaximalChordialDeviation (const Standard_Real theChordialDeviation);
//! Returns the maximal chordal deviation. The default value is 0.1.
//! Drawings of curves or patches are made with respect to an absolute maximal chordal deviation.
- Quantity_Length MaximalChordialDeviation() const
+ Standard_Real MaximalChordialDeviation() const
{
return HasOwnMaximalChordialDeviation() || myLink.IsNull()
? myChordialDeviation
//! point aspect that overrides the one in the link.
Standard_Boolean HasOwnPointAspect() const { return myHasOwnPointAspect; }
+ //! Sets own point aspect.
+ //! 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
//! line aspect that overrides the one in the link.
Standard_Boolean HasOwnLineAspect() const { return myHasOwnLineAspect; }
+ //! Sets own line aspects.
+ //! Returns FALSE if own line aspect are already set.
+ Standard_EXPORT Standard_Boolean SetOwnLineAspects (const Handle(Prs3d_Drawer)& theDefaults = Handle(Prs3d_Drawer)());
+
+ //! Sets own line aspects for datums.
+ //! 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
//! shading aspect that overrides the one in the link.
Standard_Boolean HasOwnShadingAspect() const { return myHasOwnShadingAspect; }
- //! Returns True if the ShadingAspect is applied
- //! to the whole presentation.
- Standard_Boolean ShadingAspectGlobal() const
- {
- return HasOwnShadingAspectGlobal() || myLink.IsNull()
- ? myShadingAspectGlobal
- : myLink->ShadingAspectGlobal();
- }
-
- //! Indicates that the ShadingAspect will be apply
- //! to the whole presentation. This allows to modify
- //! the aspect without recomputing the content of the presentation.
- Standard_EXPORT void SetShadingAspectGlobal (const Standard_Boolean theValue);
-
- //! Returns true if the drawer has its own attribute for
- //! ShadingAspectGlobal flag that overrides the one in the link.
- Standard_Boolean HasOwnShadingAspectGlobal() const { return myHasOwnShadingAspectGlobal; }
+ //! Sets own shading aspect.
+ //! 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:
//! face boundaries aspect that overrides the one in the link.
Standard_Boolean HasOwnFaceBoundaryAspect() const { return myHasOwnFaceBoundaryAspect; }
+ //! Sets own face boundary aspect.
+ //! 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)());
+
//! Enables or disables face boundary drawing for shading presentations.
//! The method sets drawing flag owned by the drawer that will be used during
//! visualization instead of the one set in link.
//! "draw face boundaries" flag that overrides the one in the link.
Standard_Boolean HasOwnFaceBoundaryDraw() const { return myHasOwnFaceBoundaryDraw; }
+ //! Returns true if the drawer has its own attribute for face boundaries upper edge continuity class that overrides the one in the link.
+ Standard_Boolean HasOwnFaceBoundaryUpperContinuity() const { return myFaceBoundaryUpperContinuity != -1; }
+
+ //! Get the most edge continuity class; GeomAbs_CN by default (all edges).
+ GeomAbs_Shape FaceBoundaryUpperContinuity() const
+ {
+ return HasOwnFaceBoundaryUpperContinuity()
+ ? (GeomAbs_Shape )myFaceBoundaryUpperContinuity
+ : (!myLink.IsNull()
+ ? myLink->FaceBoundaryUpperContinuity()
+ : GeomAbs_CN);
+ }
+
+ //! Set the most edge continuity class for face boundaries.
+ void SetFaceBoundaryUpperContinuity (GeomAbs_Shape theMostAllowedEdgeClass) { myFaceBoundaryUpperContinuity = theMostAllowedEdgeClass; }
+
+ //! 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();
Standard_Boolean HasLink() const { return !myLink.IsNull(); }
//! Sets theDrawer as a link to which the current object references.
- void Link (const Handle(Prs3d_Drawer)& theDrawer)
- {
- myLink = theDrawer;
- }
+ void Link (const Handle(Prs3d_Drawer)& theDrawer) { SetLink (theDrawer); }
+
+ //! Sets theDrawer as a link to which the current object references.
+ void SetLink (const Handle(Prs3d_Drawer)& theDrawer) { myLink = theDrawer; }
//! Removes local attributes.
Standard_EXPORT void ClearLocalAttributes();
+ //! Assign shader program for specified type of primitives.
+ //! @param theProgram new program to set (might be NULL)
+ //! @param theAspect the type of primitives
+ //! @param theToOverrideDefaults if true then non-overridden attributes using defaults will be allocated and copied from the Link;
+ //! otherwise, only already customized attributes will be changed
+ //! @return TRUE if presentation should be recomputed after creating aspects not previously customized (if theToOverrideDefaults is also TRUE)
+ Standard_EXPORT bool SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theProgram,
+ const Graphic3d_GroupAspect theAspect,
+ const bool theToOverrideDefaults = false);
+
+ //! Sets Shading Model type for the shading aspect.
+ Standard_EXPORT bool SetShadingModel (Graphic3d_TypeOfShadingModel theModel,
+ bool theToOverrideDefaults = false);
+
+ //! Dumps the content of me into the stream
+ Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
+
protected:
Handle(Prs3d_Drawer) myLink;
Standard_Boolean myHasOwnNbPoints;
Standard_Real myMaximalParameterValue;
Standard_Boolean myHasOwnMaximalParameterValue;
- Quantity_Length myChordialDeviation;
+ Standard_Real myChordialDeviation;
Standard_Boolean myHasOwnChordialDeviation;
Aspect_TypeOfDeflection myTypeOfDeflection;
Standard_Boolean myHasOwnTypeOfDeflection;
Standard_Boolean myHasOwnTextAspect;
Handle(Prs3d_ShadingAspect) myShadingAspect;
Standard_Boolean myHasOwnShadingAspect;
- Standard_Boolean myShadingAspectGlobal;
- Standard_Boolean myHasOwnShadingAspectGlobal;
Handle(Prs3d_PlaneAspect) myPlaneAspect;
Standard_Boolean myHasOwnPlaneAspect;
Handle(Prs3d_LineAspect) mySeenLineAspect;
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;
Prs3d_DimensionUnits myDimensionDisplayUnits;
Standard_Boolean myHasOwnDimLengthDisplayUnits;
Standard_Boolean myHasOwnDimAngleDisplayUnits;
-
-public:
-
- DEFINE_STANDARD_RTTIEXT(Prs3d_Drawer,MMgt_TShared)
-
};
+Standard_DEPRECATED("Class name is deprecated - use Prs3d_Drawer instead")
+typedef Prs3d_Drawer Graphic3d_HighlightStyle;
+
#endif // _Prs3d_Drawer_HeaderFile