0030949: Foundation Classes - Dump improvement for OCCT classes
[occt.git] / src / Graphic3d / Graphic3d_Aspects.cxx
1 // Copyright (c) 2019 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #include <Graphic3d_Aspects.hxx>
15 #include <Standard_Dump.hxx>
16
17 IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Aspects, Standard_Transient)
18
19 // =======================================================================
20 // function : Graphic3d_Aspects
21 // purpose  :
22 // =======================================================================
23 Graphic3d_Aspects::Graphic3d_Aspects()
24 : myInteriorColor       (Quantity_NOC_CYAN1),
25   myBackInteriorColor   (Quantity_NOC_CYAN1),
26   myEdgeColor           (Quantity_NOC_WHITE),
27   myInteriorStyle       (Aspect_IS_SOLID),
28   myShadingModel        (Graphic3d_TOSM_DEFAULT),
29   myAlphaMode           (Graphic3d_AlphaMode_BlendAuto),
30   myAlphaCutoff         (0.5f),
31   myLineType            (Aspect_TOL_SOLID),
32   myLineWidth           (1.0f),
33   myMarkerType          (Aspect_TOM_POINT),
34   myMarkerScale         (1.0f),
35   myTextStyle           (Aspect_TOST_NORMAL),
36   myTextDisplayType     (Aspect_TODT_NORMAL),
37   myTextFontAspect      (Font_FontAspect_Regular),
38   myTextAngle           (0.0f),
39   myToSkipFirstEdge     (false),
40   myToDistinguishMaterials (false),
41   myToDrawEdges         (false),
42   myToDrawSilhouette    (false),
43   myToSuppressBackFaces (true),
44   myToMapTexture        (false),
45   myIsTextZoomable      (false)
46 {
47   //
48 }
49
50 // =======================================================================
51 // function : SetTextureMap
52 // purpose  :
53 // =======================================================================
54 void Graphic3d_Aspects::SetTextureMap (const Handle(Graphic3d_TextureMap)& theTexture)
55 {
56   if (theTexture.IsNull())
57   {
58     myTextureSet.Nullify();
59     return;
60   }
61
62   myTextureSet = new Graphic3d_TextureSet (theTexture);
63 }
64
65 //=======================================================================
66 //function : DumpJson
67 //purpose  : 
68 //=======================================================================
69 void Graphic3d_Aspects::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
70 {
71   DUMP_CLASS_BEGIN (theOStream, Graphic3d_Aspects);
72
73   DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myInteriorColor);
74   DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBackInteriorColor);
75   DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEdgeColor);
76   DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPolygonOffset);
77
78   DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToSkipFirstEdge);
79   DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDistinguishMaterials);
80   DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDrawEdges);
81   DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDrawSilhouette);
82   DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToSuppressBackFaces);
83   DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToMapTexture);
84   DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsTextZoomable);
85 }