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_Check.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <RWStepVisual_RWSurfaceStyleUsage.hxx>
18 #include <StepData_StepReaderData.hxx>
19 #include <StepData_StepWriter.hxx>
20 #include <StepVisual_SurfaceSide.hxx>
21 #include <StepVisual_SurfaceSideStyle.hxx>
22 #include <StepVisual_SurfaceStyleUsage.hxx>
23 #include <TCollection_AsciiString.hxx>
25 // --- Enum : SurfaceSide ---
26 static TCollection_AsciiString ssNegative(".NEGATIVE.");
27 static TCollection_AsciiString ssPositive(".POSITIVE.");
28 static TCollection_AsciiString ssBoth(".BOTH.");
30 RWStepVisual_RWSurfaceStyleUsage::RWStepVisual_RWSurfaceStyleUsage () {}
32 void RWStepVisual_RWSurfaceStyleUsage::ReadStep
33 (const Handle(StepData_StepReaderData)& data,
34 const Standard_Integer num,
35 Handle(Interface_Check)& ach,
36 const Handle(StepVisual_SurfaceStyleUsage)& ent) const
40 // --- Number of Parameter Control ---
42 if (!data->CheckNbParams(num,2,ach,"surface_style_usage")) return;
44 // --- own field : side ---
46 StepVisual_SurfaceSide aSide = StepVisual_ssNegative;
47 if (data->ParamType(num,1) == Interface_ParamEnum) {
48 Standard_CString text = data->ParamCValue(num,1);
49 if (ssNegative.IsEqual(text)) aSide = StepVisual_ssNegative;
50 else if (ssPositive.IsEqual(text)) aSide = StepVisual_ssPositive;
51 else if (ssBoth.IsEqual(text)) aSide = StepVisual_ssBoth;
52 else ach->AddFail("Enumeration surface_side has not an allowed value");
54 else ach->AddFail("Parameter #1 (side) is not an enumeration");
56 // --- own field : style ---
58 Handle(StepVisual_SurfaceSideStyle) aStyle;
59 //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
60 data->ReadEntity(num, 2,"style", ach, STANDARD_TYPE(StepVisual_SurfaceSideStyle), aStyle);
62 //--- Initialisation of the read entity ---
65 ent->Init(aSide, aStyle);
69 void RWStepVisual_RWSurfaceStyleUsage::WriteStep
70 (StepData_StepWriter& SW,
71 const Handle(StepVisual_SurfaceStyleUsage)& ent) const
74 // --- own field : side ---
77 case StepVisual_ssNegative : SW.SendEnum (ssNegative); break;
78 case StepVisual_ssPositive : SW.SendEnum (ssPositive); break;
79 case StepVisual_ssBoth : SW.SendEnum (ssBoth); break;
82 // --- own field : style ---
84 SW.Send(ent->Style());
88 void RWStepVisual_RWSurfaceStyleUsage::Share(const Handle(StepVisual_SurfaceStyleUsage)& ent, Interface_EntityIterator& iter) const
91 iter.GetOneItem(ent->Style());