0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / XCAFDoc / XCAFDoc_Color.hxx
1 // Created on: 2000-08-16
2 // Created by: data exchange team
3 // Copyright (c) 2000-2014 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 _XCAFDoc_Color_HeaderFile
17 #define _XCAFDoc_Color_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
21
22 #include <Quantity_Color.hxx>
23 #include <Quantity_ColorRGBA.hxx>
24 #include <TDF_Attribute.hxx>
25 #include <Quantity_NameOfColor.hxx>
26 #include <Standard_Real.hxx>
27 class Standard_GUID;
28 class TDF_Label;
29 class Quantity_Color;
30 class Quantity_ColorRGBA;
31 class TDF_Attribute;
32 class TDF_RelocationTable;
33
34
35 class XCAFDoc_Color;
36 DEFINE_STANDARD_HANDLE(XCAFDoc_Color, TDF_Attribute)
37
38 //! attribute to store color
39 class XCAFDoc_Color : public TDF_Attribute
40 {
41
42 public:
43
44   
45   Standard_EXPORT XCAFDoc_Color();
46   
47   Standard_EXPORT static const Standard_GUID& GetID();
48   
49   Standard_EXPORT static Handle(XCAFDoc_Color) Set (const TDF_Label& label, const Quantity_Color& C);
50
51   Standard_EXPORT static Handle(XCAFDoc_Color) Set (const TDF_Label& label, const Quantity_ColorRGBA& C);
52   
53   Standard_EXPORT static Handle(XCAFDoc_Color) Set (const TDF_Label& label, const Quantity_NameOfColor C);
54   
55   //! Find, or create, a Color attribute and set it's value
56   //! the Color attribute is returned.
57   Standard_EXPORT static Handle(XCAFDoc_Color) Set (const TDF_Label& label, const Standard_Real R, const Standard_Real G, const Standard_Real B, const Standard_Real alpha = 1.0);
58   
59   Standard_EXPORT void Set (const Quantity_Color& C);
60
61   Standard_EXPORT void Set (const Quantity_ColorRGBA& C);
62   
63   Standard_EXPORT void Set (const Quantity_NameOfColor C);
64   
65   Standard_EXPORT void Set (const Standard_Real R, const Standard_Real G, const Standard_Real B, const Standard_Real alpha = 1.0);
66   
67   Standard_EXPORT const Quantity_Color& GetColor() const;
68
69   Standard_EXPORT const Quantity_ColorRGBA& GetColorRGBA() const;
70   
71   Standard_EXPORT Quantity_NameOfColor GetNOC() const;
72   
73   Standard_EXPORT void GetRGB (Standard_Real& R, Standard_Real& G, Standard_Real& B) const;
74
75   Standard_EXPORT Standard_ShortReal GetAlpha() const;
76   
77   Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
78   
79   Standard_EXPORT void Restore (const Handle(TDF_Attribute)& With) Standard_OVERRIDE;
80   
81   Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
82   
83   Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
84   
85   //! Dumps the content of me into the stream
86   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
87
88
89
90
91   DEFINE_STANDARD_RTTIEXT(XCAFDoc_Color,TDF_Attribute)
92
93 protected:
94
95
96
97
98 private:
99
100
101   Quantity_ColorRGBA myColor;
102
103
104 };
105
106
107
108
109
110
111
112 #endif // _XCAFDoc_Color_HeaderFile