3dda9fbfdf881a1b55d7371910fbfe61b995a1bf
[occt.git] / src / XCAFPrs / XCAFPrs_Style.cxx
1 // Created on: 2000-08-11
2 // Created by: Andrey BETENEV
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 #include <XCAFPrs_Style.hxx>
17
18 #include <Standard_Dump.hxx>
19
20 //=======================================================================
21 //function : XCAFPrs_Style
22 //purpose  :
23 //=======================================================================
24 XCAFPrs_Style::XCAFPrs_Style()
25 : myHasColorSurf(Standard_False),
26   myHasColorCurv(Standard_False),
27   myIsVisible   (Standard_True)
28 {
29   //
30 }
31
32 //=======================================================================
33 //function : SetColorSurf
34 //purpose  :
35 //=======================================================================
36 void XCAFPrs_Style::SetColorSurf (const Quantity_ColorRGBA& theColor)
37 {
38   myColorSurf    = theColor;
39   myHasColorSurf = Standard_True;
40 }
41
42 //=======================================================================
43 //function : UnSetColorSurf
44 //purpose  :
45 //=======================================================================
46 void XCAFPrs_Style::UnSetColorSurf()
47 {
48   myHasColorSurf = Standard_False;
49   myColorSurf.ChangeRGB().SetValues (Quantity_NOC_YELLOW);
50   myColorSurf.SetAlpha (1.0f);
51 }
52
53 //=======================================================================
54 //function : SetColorCurv
55 //purpose  :
56 //=======================================================================
57 void XCAFPrs_Style::SetColorCurv (const Quantity_Color& theColor)
58 {
59   myColorCurv    = theColor;
60   myHasColorCurv = Standard_True;
61 }
62
63 //=======================================================================
64 //function : UnSetColorCurv
65 //purpose  :
66 //=======================================================================
67 void XCAFPrs_Style::UnSetColorCurv()
68 {
69   myHasColorCurv = Standard_False;
70   myColorCurv.SetValues (Quantity_NOC_YELLOW);
71 }
72
73 //=======================================================================
74 //function : DumpJson
75 //purpose  : 
76 //=======================================================================
77 void XCAFPrs_Style::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
78 {
79   DUMP_CLASS_BEGIN (theOStream, XCAFPrs_Style);
80
81   DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColorSurf);
82   DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myColorCurv);
83
84   DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasColorSurf);
85   DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasColorCurv);
86   DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsVisible);
87 }