1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
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>
23 // --- Enum : SurfaceSide ---
24 static TCollection_AsciiString ssNegative(".NEGATIVE.");
25 static TCollection_AsciiString ssPositive(".POSITIVE.");
26 static TCollection_AsciiString ssBoth(".BOTH.");
28 RWStepVisual_RWSurfaceStyleUsage::RWStepVisual_RWSurfaceStyleUsage () {}
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
38 // --- Number of Parameter Control ---
40 if (!data->CheckNbParams(num,2,ach,"surface_style_usage")) return;
42 // --- own field : side ---
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");
52 else ach->AddFail("Parameter #1 (side) is not an enumeration");
54 // --- own field : style ---
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);
60 //--- Initialisation of the read entity ---
63 ent->Init(aSide, aStyle);
67 void RWStepVisual_RWSurfaceStyleUsage::WriteStep
68 (StepData_StepWriter& SW,
69 const Handle(StepVisual_SurfaceStyleUsage)& ent) const
72 // --- own field : 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;
80 // --- own field : style ---
82 SW.Send(ent->Style());
86 void RWStepVisual_RWSurfaceStyleUsage::Share(const Handle(StepVisual_SurfaceStyleUsage)& ent, Interface_EntityIterator& iter) const
89 iter.GetOneItem(ent->Style());