Commit | Line | Data |
---|---|---|
691711cd IK |
1 | // Created on : Thu May 14 15:13:19 2020 |
2 | // Created by: Igor KHOZHANOV | |
3 | // Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 | |
4 | // Copyright (c) Open CASCADE 2020 | |
5 | // | |
6 | // This file is part of Open CASCADE Technology software library. | |
7 | // | |
8 | // This library is free software; you can redistribute it and/or modify it under | |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published | |
10 | // by the Free Software Foundation, with special exception defined in the file | |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |
12 | // distribution for complete text of the license and disclaimer of any warranty. | |
13 | // | |
14 | // Alternatively, this file may be used under the terms of Open CASCADE | |
15 | // commercial license or contractual agreement. | |
16 | ||
17 | #include <RWStepVisual_RWSurfaceStyleRenderingWithProperties.hxx> | |
18 | #include <Interface_EntityIterator.hxx> | |
19 | #include <StepData_StepReaderData.hxx> | |
20 | #include <StepData_StepWriter.hxx> | |
21 | #include <StepVisual_SurfaceStyleRenderingWithProperties.hxx> | |
22 | #include <StepVisual_ShadingSurfaceMethod.hxx> | |
23 | #include <StepVisual_Colour.hxx> | |
24 | #include <StepVisual_HArray1OfRenderingPropertiesSelect.hxx> | |
25 | #include <StepVisual_RenderingPropertiesSelect.hxx> | |
26 | ||
27 | //======================================================================= | |
28 | //function : RWStepVisual_RWSurfaceStyleRenderingWithProperties | |
29 | //purpose : | |
30 | //======================================================================= | |
31 | ||
32 | RWStepVisual_RWSurfaceStyleRenderingWithProperties::RWStepVisual_RWSurfaceStyleRenderingWithProperties() {} | |
33 | ||
34 | ||
35 | //======================================================================= | |
36 | //function : ReadStep | |
37 | //purpose : | |
38 | //======================================================================= | |
39 | ||
40 | void RWStepVisual_RWSurfaceStyleRenderingWithProperties::ReadStep (const Handle(StepData_StepReaderData)& data, | |
41 | const Standard_Integer num, | |
42 | Handle(Interface_Check)& ach, | |
43 | const Handle(StepVisual_SurfaceStyleRenderingWithProperties)& ent) const | |
44 | { | |
45 | // Check number of parameters | |
46 | if ( ! data->CheckNbParams(num,3,ach,"surface_style_rendering_with_properties") ) return; | |
47 | ||
48 | // Inherited fields of SurfaceStyleRendering | |
49 | ||
50 | StepVisual_ShadingSurfaceMethod aSurfaceStyleRendering_RenderingMethod = StepVisual_ssmNormalShading; | |
51 | if (data->ParamType (num, 1) == Interface_ParamEnum) { | |
52 | Standard_CString text = data->ParamCValue(num, 1); | |
53 | if (strcmp(text, ".CONSTANT_SHADING.")) aSurfaceStyleRendering_RenderingMethod = StepVisual_ssmConstantShading; | |
54 | else if (strcmp(text, ".COLOUR_SHADING.")) aSurfaceStyleRendering_RenderingMethod = StepVisual_ssmColourShading; | |
55 | else if (strcmp(text, ".DOT_SHADING.")) aSurfaceStyleRendering_RenderingMethod = StepVisual_ssmDotShading; | |
56 | else if (strcmp(text, ".NORMAL_SHADING.")) aSurfaceStyleRendering_RenderingMethod = StepVisual_ssmNormalShading; | |
57 | else ach->AddFail("Parameter #1 (surface_style_rendering.rendering_method) has not allowed value"); | |
58 | } | |
59 | else ach->AddFail("Parameter #1 (surface_style_rendering.rendering_method) is not enumeration"); | |
60 | ||
61 | Handle(StepVisual_Colour) aSurfaceStyleRendering_SurfaceColour; | |
62 | data->ReadEntity (num, 2, "surface_style_rendering.surface_colour", ach, STANDARD_TYPE(StepVisual_Colour), aSurfaceStyleRendering_SurfaceColour); | |
63 | ||
64 | // Own fields of SurfaceStyleRenderingWithProperties | |
65 | ||
66 | Handle(StepVisual_HArray1OfRenderingPropertiesSelect) aProperties; | |
67 | Standard_Integer sub3 = 0; | |
68 | if ( data->ReadSubList (num, 3, "properties", ach, sub3) ) { | |
69 | Standard_Integer nb0 = data->NbParams(sub3); | |
70 | aProperties = new StepVisual_HArray1OfRenderingPropertiesSelect (1, nb0); | |
71 | Standard_Integer num2 = sub3; | |
72 | for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) { | |
73 | StepVisual_RenderingPropertiesSelect anIt0; | |
74 | data->ReadEntity (num2, i0, "rendering_properties_select", ach, anIt0); | |
75 | aProperties->SetValue(i0, anIt0); | |
76 | } | |
77 | } | |
78 | ||
79 | // Initialize entity | |
80 | ent->Init(aSurfaceStyleRendering_RenderingMethod, | |
81 | aSurfaceStyleRendering_SurfaceColour, | |
82 | aProperties); | |
83 | } | |
84 | ||
85 | //======================================================================= | |
86 | //function : WriteStep | |
87 | //purpose : | |
88 | //======================================================================= | |
89 | ||
90 | void RWStepVisual_RWSurfaceStyleRenderingWithProperties::WriteStep (StepData_StepWriter& SW, | |
91 | const Handle(StepVisual_SurfaceStyleRenderingWithProperties)& ent) const | |
92 | { | |
93 | ||
94 | // Own fields of SurfaceStyleRendering | |
95 | ||
96 | switch (ent->RenderingMethod()) { | |
97 | case StepVisual_ssmConstantShading: SW.SendEnum (".CONSTANT_SHADING."); break; | |
98 | case StepVisual_ssmColourShading: SW.SendEnum (".COLOUR_SHADING."); break; | |
99 | case StepVisual_ssmDotShading: SW.SendEnum (".DOT_SHADING."); break; | |
100 | case StepVisual_ssmNormalShading: SW.SendEnum (".NORMAL_SHADING."); break; | |
101 | } | |
102 | ||
103 | SW.Send (ent->SurfaceColour()); | |
104 | ||
105 | // Own fields of SurfaceStyleRenderingWithProperties | |
106 | ||
107 | SW.OpenSub(); | |
108 | for (Standard_Integer i2=1; i2 <= ent->Properties()->Length(); i2++ ) { | |
109 | StepVisual_RenderingPropertiesSelect Var0 = ent->Properties()->Value(i2); | |
110 | SW.Send (Var0.Value()); | |
111 | } | |
112 | SW.CloseSub(); | |
113 | } | |
114 | ||
115 | //======================================================================= | |
116 | //function : Share | |
117 | //purpose : | |
118 | //======================================================================= | |
119 | ||
120 | void RWStepVisual_RWSurfaceStyleRenderingWithProperties::Share (const Handle(StepVisual_SurfaceStyleRenderingWithProperties)& ent, | |
121 | Interface_EntityIterator& iter) const | |
122 | { | |
123 | ||
124 | // Inherited fields of SurfaceStyleRendering | |
125 | ||
126 | iter.AddItem (ent->StepVisual_SurfaceStyleRendering::SurfaceColour()); | |
127 | ||
128 | // Own fields of SurfaceStyleRenderingWithProperties | |
129 | ||
130 | for (Standard_Integer i2=1; i2 <= ent->Properties()->Length(); i2++ ) { | |
131 | StepVisual_RenderingPropertiesSelect Var0 = ent->Properties()->Value(i2); | |
132 | iter.AddItem (Var0.Value()); | |
133 | } | |
134 | } |