0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / RWStepGeom / RWStepGeom_RWCompositeCurveSegment.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 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
973c2be1 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.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
7fd59977 13
7fd59977 14
42cf5bc1 15#include <Interface_Check.hxx>
7fd59977 16#include <Interface_EntityIterator.hxx>
42cf5bc1 17#include <RWStepGeom_RWCompositeCurveSegment.hxx>
18#include <StepData_StepReaderData.hxx>
19#include <StepData_StepWriter.hxx>
7fd59977 20#include <StepGeom_CompositeCurveSegment.hxx>
42cf5bc1 21#include <StepGeom_Curve.hxx>
22#include <StepGeom_TransitionCode.hxx>
7fd59977 23#include <TCollection_AsciiString.hxx>
24
b311480e 25// --- Enum : TransitionCode ---
7fd59977 26static TCollection_AsciiString tcDiscontinuous(".DISCONTINUOUS.");
27static TCollection_AsciiString tcContSameGradientSameCurvature(".CONT_SAME_GRADIENT_SAME_CURVATURE.");
28static TCollection_AsciiString tcContSameGradient(".CONT_SAME_GRADIENT.");
29static TCollection_AsciiString tcContinuous(".CONTINUOUS.");
30
31RWStepGeom_RWCompositeCurveSegment::RWStepGeom_RWCompositeCurveSegment () {}
32
33void RWStepGeom_RWCompositeCurveSegment::ReadStep
34 (const Handle(StepData_StepReaderData)& data,
35 const Standard_Integer num,
36 Handle(Interface_Check)& ach,
37 const Handle(StepGeom_CompositeCurveSegment)& ent) const
38{
39
40
41 // --- Number of Parameter Control ---
42
43 if (!data->CheckNbParams(num,3,ach,"composite_curve_segment")) return;
44
45 // --- own field : transition ---
46
47 StepGeom_TransitionCode aTransition = StepGeom_tcDiscontinuous;
48 if (data->ParamType(num,1) == Interface_ParamEnum) {
49 Standard_CString text = data->ParamCValue(num,1);
50 if (tcDiscontinuous.IsEqual(text)) aTransition = StepGeom_tcDiscontinuous;
51 else if (tcContSameGradientSameCurvature.IsEqual(text)) aTransition = StepGeom_tcContSameGradientSameCurvature;
52 else if (tcContSameGradient.IsEqual(text)) aTransition = StepGeom_tcContSameGradient;
53 else if (tcContinuous.IsEqual(text)) aTransition = StepGeom_tcContinuous;
54 else ach->AddFail("Enumeration transition_code has not an allowed value");
55 }
56 else ach->AddFail("Parameter #1 (transition) is not an enumeration");
57
58 // --- own field : sameSense ---
59
60 Standard_Boolean aSameSense;
61 //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
62 data->ReadBoolean (num,2,"same_sense",ach,aSameSense);
63
64 // --- own field : parentCurve ---
65
66 Handle(StepGeom_Curve) aParentCurve;
67 //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
68 data->ReadEntity(num, 3,"parent_curve", ach, STANDARD_TYPE(StepGeom_Curve), aParentCurve);
69
70 //--- Initialisation of the read entity ---
71
72
73 ent->Init(aTransition, aSameSense, aParentCurve);
74}
75
76
77void RWStepGeom_RWCompositeCurveSegment::WriteStep
78 (StepData_StepWriter& SW,
79 const Handle(StepGeom_CompositeCurveSegment)& ent) const
80{
81
82 // --- own field : transition ---
83
84 switch(ent->Transition()) {
85 case StepGeom_tcDiscontinuous : SW.SendEnum (tcDiscontinuous); break;
86 case StepGeom_tcContSameGradientSameCurvature : SW.SendEnum (tcContSameGradientSameCurvature); break;
87 case StepGeom_tcContSameGradient : SW.SendEnum (tcContSameGradient); break;
88 case StepGeom_tcContinuous : SW.SendEnum (tcContinuous); break;
89 }
90
91 // --- own field : sameSense ---
92
93 SW.SendBoolean(ent->SameSense());
94
95 // --- own field : parentCurve ---
96
97 SW.Send(ent->ParentCurve());
98}
99
100
101void RWStepGeom_RWCompositeCurveSegment::Share(const Handle(StepGeom_CompositeCurveSegment)& ent, Interface_EntityIterator& iter) const
102{
103
104 iter.GetOneItem(ent->ParentCurve());
105}
106