0029915: Porting to VC 2017 : Regressions in Modeling Algorithms on VC 2017
[occt.git] / src / Graphic3d / Graphic3d_PresentationAttributes.hxx
CommitLineData
f838dac4 1// Created on: 2016-08-24
2// Created by: Varvara POSKONINA
3// Copyright (c) 2016 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _Graphic3d_PresentationAttributes_HeaderFile
17#define _Graphic3d_PresentationAttributes_HeaderFile
18
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>
25
26//! Class defines presentation properties.
27class Graphic3d_PresentationAttributes : public Standard_Transient
28{
29 DEFINE_STANDARD_RTTIEXT(Graphic3d_PresentationAttributes, Standard_Transient)
30public:
31
32 //! Empty constructor.
33 Graphic3d_PresentationAttributes()
34 : myBasicColor (Quantity_NOC_WHITE),
35 myHiMethod (Aspect_TOHM_COLOR),
36 myZLayer (Graphic3d_ZLayerId_Default),
37 myDispMode (0)
38 {
39 //
40 }
41
42 //! Destructor.
43 virtual ~Graphic3d_PresentationAttributes() {}
44
45 //! Returns highlight method, Aspect_TOHM_COLOR by default.
46 Aspect_TypeOfHighlightMethod Method() const { return myHiMethod; }
47
48 //! Changes highlight method to the given one.
49 virtual void SetMethod (const Aspect_TypeOfHighlightMethod theMethod) { myHiMethod = theMethod; }
50
51 //! Returns basic presentation color (including alpha channel).
52 const Quantity_ColorRGBA& ColorRGBA() const { return myBasicColor; }
53
54 //! Returns basic presentation color, Quantity_NOC_WHITE by default.
55 const Quantity_Color& Color() const { return myBasicColor.GetRGB(); }
56
57 //! Sets basic presentation color (RGB components, does not modifies transparency).
58 virtual void SetColor (const Quantity_Color& theColor)
59 {
60 myBasicColor.ChangeRGB() = theColor;
61 }
62
63 //! Returns basic presentation transparency (0 - opaque, 1 - fully transparent), 0 by default (opaque).
64 Standard_ShortReal Transparency() const { return 1.0f - myBasicColor.Alpha(); }
65
66 //! Sets basic presentation transparency (0 - opaque, 1 - fully transparent).
67 virtual void SetTransparency (const Standard_ShortReal theTranspCoef)
68 {
69 myBasicColor.SetAlpha (1.0f - theTranspCoef);
70 }
71
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; }
75
76 //! Sets presentation Zlayer.
77 virtual void SetZLayer (const Graphic3d_ZLayerId theLayer) { myZLayer = theLayer; }
78
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; }
82
83 //! Sets display mode.
84 virtual void SetDisplayMode (const Standard_Integer theMode) { myDispMode = theMode; }
85
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; }
89
90 //! Sets basic presentation fill area aspect.
91 virtual void SetBasicFillAreaAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect) { myBasicFillAreaAspect = theAspect; }
92
93protected:
94
95 Handle(Graphic3d_AspectFillArea3d) myBasicFillAreaAspect; //!< presentation fill area aspect
96 Quantity_ColorRGBA myBasicColor; //!< presentation color
97 Aspect_TypeOfHighlightMethod myHiMethod; //!< box or color highlighting
98 Graphic3d_ZLayerId myZLayer; //!< Z-layer
99 Standard_Integer myDispMode; //!< display mode
100
101};
102
103DEFINE_STANDARD_HANDLE (Graphic3d_PresentationAttributes, Standard_Transient)
104
105#endif // _Graphic3d_PresentationAttributes_HeaderFile