1 // Created on: 2016-08-24
2 // Created by: Varvara POSKONINA
3 // Copyright (c) 2016 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _Graphic3d_PresentationAttributes_HeaderFile
17 #define _Graphic3d_PresentationAttributes_HeaderFile
19 #include <Aspect_TypeOfHighlightMethod.hxx>
20 #include <Graphic3d_AspectFillArea3d.hxx>
21 #include <Graphic3d_ZLayerId.hxx>
22 #include <Standard_Transient.hxx>
23 #include <Standard_Type.hxx>
24 #include <Quantity_ColorRGBA.hxx>
26 //! Class defines presentation properties.
27 class Graphic3d_PresentationAttributes : public Standard_Transient
29 DEFINE_STANDARD_RTTIEXT(Graphic3d_PresentationAttributes, Standard_Transient)
32 //! Empty constructor.
33 Graphic3d_PresentationAttributes()
34 : myBasicColor (Quantity_NOC_WHITE),
35 myHiMethod (Aspect_TOHM_COLOR),
36 myZLayer (Graphic3d_ZLayerId_Default),
43 virtual ~Graphic3d_PresentationAttributes() {}
45 //! Returns highlight method, Aspect_TOHM_COLOR by default.
46 Aspect_TypeOfHighlightMethod Method() const { return myHiMethod; }
48 //! Changes highlight method to the given one.
49 virtual void SetMethod (const Aspect_TypeOfHighlightMethod theMethod) { myHiMethod = theMethod; }
51 //! Returns basic presentation color (including alpha channel).
52 const Quantity_ColorRGBA& ColorRGBA() const { return myBasicColor; }
54 //! Returns basic presentation color, Quantity_NOC_WHITE by default.
55 const Quantity_Color& Color() const { return myBasicColor.GetRGB(); }
57 //! Sets basic presentation color (RGB components, does not modifies transparency).
58 virtual void SetColor (const Quantity_Color& theColor)
60 myBasicColor.ChangeRGB() = theColor;
63 //! Returns basic presentation transparency (0 - opaque, 1 - fully transparent), 0 by default (opaque).
64 Standard_ShortReal Transparency() const { return 1.0f - myBasicColor.Alpha(); }
66 //! Sets basic presentation transparency (0 - opaque, 1 - fully transparent).
67 virtual void SetTransparency (const Standard_ShortReal theTranspCoef)
69 myBasicColor.SetAlpha (1.0f - theTranspCoef);
72 //! Returns presentation Zlayer, Graphic3d_ZLayerId_Default by default.
73 //! Graphic3d_ZLayerId_UNKNOWN means undefined (a layer of main presentation to be used).
74 Graphic3d_ZLayerId ZLayer() const { return myZLayer; }
76 //! Sets presentation Zlayer.
77 virtual void SetZLayer (const Graphic3d_ZLayerId theLayer) { myZLayer = theLayer; }
79 //! Returns display mode, 0 by default.
80 //! -1 means undefined (main display mode of presentation to be used).
81 Standard_Integer DisplayMode() const { return myDispMode; }
83 //! Sets display mode.
84 virtual void SetDisplayMode (const Standard_Integer theMode) { myDispMode = theMode; }
86 //! Return basic presentation fill area aspect, NULL by default.
87 //! When set, might be used instead of Color() property.
88 const Handle(Graphic3d_AspectFillArea3d)& BasicFillAreaAspect() const { return myBasicFillAreaAspect; }
90 //! Sets basic presentation fill area aspect.
91 virtual void SetBasicFillAreaAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect) { myBasicFillAreaAspect = theAspect; }
93 //! Dumps the content of me into the stream
94 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
98 Handle(Graphic3d_AspectFillArea3d) myBasicFillAreaAspect; //!< presentation fill area aspect
99 Quantity_ColorRGBA myBasicColor; //!< presentation color
100 Aspect_TypeOfHighlightMethod myHiMethod; //!< box or color highlighting
101 Graphic3d_ZLayerId myZLayer; //!< Z-layer
102 Standard_Integer myDispMode; //!< display mode
106 DEFINE_STANDARD_HANDLE (Graphic3d_PresentationAttributes, Standard_Transient)
108 #endif // _Graphic3d_PresentationAttributes_HeaderFile