0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / RWStepGeom / RWStepGeom_RWReparametrisedCompositeCurveSegment.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_Check.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <RWStepGeom_RWReparametrisedCompositeCurveSegment.hxx>
18 #include <StepData_StepReaderData.hxx>
19 #include <StepData_StepWriter.hxx>
20 #include <StepGeom_Curve.hxx>
21 #include <StepGeom_ReparametrisedCompositeCurveSegment.hxx>
22 #include <StepGeom_TransitionCode.hxx>
23
24 // --- Enum : TransitionCode ---
25 static TCollection_AsciiString tcDiscontinuous(".DISCONTINUOUS.");
26 static TCollection_AsciiString tcContSameGradientSameCurvature(".CONT_SAME_GRADIENT_SAME_CURVATURE.");
27 static TCollection_AsciiString tcContSameGradient(".CONT_SAME_GRADIENT.");
28 static TCollection_AsciiString tcContinuous(".CONTINUOUS.");
29
30 RWStepGeom_RWReparametrisedCompositeCurveSegment::RWStepGeom_RWReparametrisedCompositeCurveSegment () {}
31
32 void RWStepGeom_RWReparametrisedCompositeCurveSegment::ReadStep
33         (const Handle(StepData_StepReaderData)& data,
34          const Standard_Integer num,
35          Handle(Interface_Check)& ach,
36          const Handle(StepGeom_ReparametrisedCompositeCurveSegment)& ent) const
37 {
38
39
40         // --- Number of Parameter Control ---
41
42         if (!data->CheckNbParams(num,4,ach,"reparametrised_composite_curve_segment")) return;
43
44         // --- inherited field : transition ---
45
46         StepGeom_TransitionCode aTransition = StepGeom_tcDiscontinuous;
47         if (data->ParamType(num,1) == Interface_ParamEnum) {
48           Standard_CString text = data->ParamCValue(num,1);
49           if      (tcDiscontinuous.IsEqual(text)) aTransition = StepGeom_tcDiscontinuous;
50           else if (tcContSameGradientSameCurvature.IsEqual(text)) aTransition = StepGeom_tcContSameGradientSameCurvature;
51           else if (tcContSameGradient.IsEqual(text)) aTransition = StepGeom_tcContSameGradient;
52           else if (tcContinuous.IsEqual(text)) aTransition = StepGeom_tcContinuous;
53           else ach->AddFail("Enumeration transition_code has not an allowed value");
54         }
55         else ach->AddFail("Parameter #1 (transition) is not an enumeration");
56
57         // --- inherited field : sameSense ---
58
59         Standard_Boolean aSameSense;
60         //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
61         data->ReadBoolean (num,2,"same_sense",ach,aSameSense);
62
63         // --- inherited field : parentCurve ---
64
65         Handle(StepGeom_Curve) aParentCurve;
66         //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
67         data->ReadEntity(num, 3,"parent_curve", ach, STANDARD_TYPE(StepGeom_Curve), aParentCurve);
68
69         // --- own field : paramLength ---
70
71         Standard_Real aParamLength;
72         //szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed
73         data->ReadReal (num,4,"param_length",ach,aParamLength);
74
75         //--- Initialisation of the read entity ---
76
77
78         ent->Init(aTransition, aSameSense, aParentCurve, aParamLength);
79 }
80
81
82 void RWStepGeom_RWReparametrisedCompositeCurveSegment::WriteStep
83         (StepData_StepWriter& SW,
84          const Handle(StepGeom_ReparametrisedCompositeCurveSegment)& ent) const
85 {
86
87         // --- inherited field transition ---
88
89         switch(ent->Transition()) {
90           case StepGeom_tcDiscontinuous : SW.SendEnum (tcDiscontinuous); break;
91           case StepGeom_tcContSameGradientSameCurvature : SW.SendEnum (tcContSameGradientSameCurvature); break;
92           case StepGeom_tcContSameGradient : SW.SendEnum (tcContSameGradient); break;
93           case StepGeom_tcContinuous : SW.SendEnum (tcContinuous); break;
94         }
95
96         // --- inherited field sameSense ---
97
98         SW.SendBoolean(ent->SameSense());
99
100         // --- inherited field parentCurve ---
101
102         SW.Send(ent->ParentCurve());
103
104         // --- own field : paramLength ---
105
106         SW.Send(ent->ParamLength());
107 }
108
109
110 void RWStepGeom_RWReparametrisedCompositeCurveSegment::Share(const Handle(StepGeom_ReparametrisedCompositeCurveSegment)& ent, Interface_EntityIterator& iter) const
111 {
112
113         iter.GetOneItem(ent->ParentCurve());
114 }
115