0033018: Coding - get rid of unused headers [Plugin to ShapeAnalysis]
[occt.git] / src / RWStepVisual / RWStepVisual_RWSurfaceStyleUsage.cxx
1 // Copyright (c) 1999-2014 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
15 #include <Interface_EntityIterator.hxx>
16 #include <RWStepVisual_RWSurfaceStyleUsage.hxx>
17 #include <StepData_StepReaderData.hxx>
18 #include <StepData_StepWriter.hxx>
19 #include <StepVisual_SurfaceSideStyle.hxx>
20 #include <StepVisual_SurfaceStyleUsage.hxx>
21 #include <TCollection_AsciiString.hxx>
22
23 // --- Enum : SurfaceSide ---
24 static TCollection_AsciiString ssNegative(".NEGATIVE.");
25 static TCollection_AsciiString ssPositive(".POSITIVE.");
26 static TCollection_AsciiString ssBoth(".BOTH.");
27
28 RWStepVisual_RWSurfaceStyleUsage::RWStepVisual_RWSurfaceStyleUsage () {}
29
30 void RWStepVisual_RWSurfaceStyleUsage::ReadStep
31         (const Handle(StepData_StepReaderData)& data,
32          const Standard_Integer num,
33          Handle(Interface_Check)& ach,
34          const Handle(StepVisual_SurfaceStyleUsage)& ent) const
35 {
36
37
38         // --- Number of Parameter Control ---
39
40         if (!data->CheckNbParams(num,2,ach,"surface_style_usage")) return;
41
42         // --- own field : side ---
43
44         StepVisual_SurfaceSide aSide = StepVisual_ssNegative;
45         if (data->ParamType(num,1) == Interface_ParamEnum) {
46           Standard_CString text = data->ParamCValue(num,1);
47           if      (ssNegative.IsEqual(text)) aSide = StepVisual_ssNegative;
48           else if (ssPositive.IsEqual(text)) aSide = StepVisual_ssPositive;
49           else if (ssBoth.IsEqual(text)) aSide = StepVisual_ssBoth;
50           else ach->AddFail("Enumeration surface_side has not an allowed value");
51         }
52         else ach->AddFail("Parameter #1 (side) is not an enumeration");
53
54         // --- own field : style ---
55
56         Handle(StepVisual_SurfaceSideStyle) aStyle;
57         //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
58         data->ReadEntity(num, 2,"style", ach, STANDARD_TYPE(StepVisual_SurfaceSideStyle), aStyle);
59
60         //--- Initialisation of the read entity ---
61
62
63         ent->Init(aSide, aStyle);
64 }
65
66
67 void RWStepVisual_RWSurfaceStyleUsage::WriteStep
68         (StepData_StepWriter& SW,
69          const Handle(StepVisual_SurfaceStyleUsage)& ent) const
70 {
71
72         // --- own field : side ---
73
74         switch(ent->Side()) {
75           case StepVisual_ssNegative : SW.SendEnum (ssNegative); break;
76           case StepVisual_ssPositive : SW.SendEnum (ssPositive); break;
77           case StepVisual_ssBoth : SW.SendEnum (ssBoth); break;
78         }
79
80         // --- own field : style ---
81
82         SW.Send(ent->Style());
83 }
84
85
86 void RWStepVisual_RWSurfaceStyleUsage::Share(const Handle(StepVisual_SurfaceStyleUsage)& ent, Interface_EntityIterator& iter) const
87 {
88
89         iter.GetOneItem(ent->Style());
90 }
91