0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / RWStepGeom / RWStepGeom_RWQuasiUniformCurve.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_RWQuasiUniformCurve.hxx>
18 #include <StepData_Logical.hxx>
19 #include <StepData_StepReaderData.hxx>
20 #include <StepData_StepWriter.hxx>
21 #include <StepGeom_BSplineCurveForm.hxx>
22 #include <StepGeom_CartesianPoint.hxx>
23 #include <StepGeom_HArray1OfCartesianPoint.hxx>
24 #include <StepGeom_QuasiUniformCurve.hxx>
25
26 // --- Enum : BSplineCurveForm ---
27 static TCollection_AsciiString bscfEllipticArc(".ELLIPTIC_ARC.");
28 static TCollection_AsciiString bscfPolylineForm(".POLYLINE_FORM.");
29 static TCollection_AsciiString bscfParabolicArc(".PARABOLIC_ARC.");
30 static TCollection_AsciiString bscfCircularArc(".CIRCULAR_ARC.");
31 static TCollection_AsciiString bscfUnspecified(".UNSPECIFIED.");
32 static TCollection_AsciiString bscfHyperbolicArc(".HYPERBOLIC_ARC.");
33
34 RWStepGeom_RWQuasiUniformCurve::RWStepGeom_RWQuasiUniformCurve () {}
35
36 void RWStepGeom_RWQuasiUniformCurve::ReadStep
37         (const Handle(StepData_StepReaderData)& data,
38          const Standard_Integer num,
39          Handle(Interface_Check)& ach,
40          const Handle(StepGeom_QuasiUniformCurve)& ent) const
41 {
42
43
44         // --- Number of Parameter Control ---
45
46         if (!data->CheckNbParams(num,6,ach,"quasi_uniform_curve")) return;
47
48         // --- inherited field : name ---
49
50         Handle(TCollection_HAsciiString) aName;
51         //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
52         data->ReadString (num,1,"name",ach,aName);
53
54         // --- inherited field : degree ---
55
56         Standard_Integer aDegree;
57         //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
58         data->ReadInteger (num,2,"degree",ach,aDegree);
59
60         // --- inherited field : controlPointsList ---
61
62         Handle(StepGeom_HArray1OfCartesianPoint) aControlPointsList;
63         Handle(StepGeom_CartesianPoint) anent3;
64         Standard_Integer nsub3;
65         if (data->ReadSubList (num,3,"control_points_list",ach,nsub3)) {
66           Standard_Integer nb3 = data->NbParams(nsub3);
67           aControlPointsList = new StepGeom_HArray1OfCartesianPoint (1, nb3);
68           for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
69             //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
70             if (data->ReadEntity (nsub3, i3,"cartesian_point", ach,
71                                   STANDARD_TYPE(StepGeom_CartesianPoint), anent3))
72               aControlPointsList->SetValue(i3, anent3);
73           }
74         }
75
76         // --- inherited field : curveForm ---
77
78         StepGeom_BSplineCurveForm aCurveForm = StepGeom_bscfPolylineForm;
79         if (data->ParamType(num,4) == Interface_ParamEnum) {
80           Standard_CString text = data->ParamCValue(num,4);
81           if      (bscfEllipticArc.IsEqual(text)) aCurveForm = StepGeom_bscfEllipticArc;
82           else if (bscfPolylineForm.IsEqual(text)) aCurveForm = StepGeom_bscfPolylineForm;
83           else if (bscfParabolicArc.IsEqual(text)) aCurveForm = StepGeom_bscfParabolicArc;
84           else if (bscfCircularArc.IsEqual(text)) aCurveForm = StepGeom_bscfCircularArc;
85           else if (bscfUnspecified.IsEqual(text)) aCurveForm = StepGeom_bscfUnspecified;
86           else if (bscfHyperbolicArc.IsEqual(text)) aCurveForm = StepGeom_bscfHyperbolicArc;
87           else ach->AddFail("Enumeration b_spline_curve_form has not an allowed value");
88         }
89         else ach->AddFail("Parameter #4 (curve_form) is not an enumeration");
90
91         // --- inherited field : closedCurve ---
92
93         StepData_Logical aClosedCurve;
94         //szv#4:S4163:12Mar99 `Standard_Boolean stat5 =` not needed
95         data->ReadLogical (num,5,"closed_curve",ach,aClosedCurve);
96
97         // --- inherited field : selfIntersect ---
98
99         StepData_Logical aSelfIntersect;
100         //szv#4:S4163:12Mar99 `Standard_Boolean stat6 =` not needed
101         data->ReadLogical (num,6,"self_intersect",ach,aSelfIntersect);
102
103         //--- Initialisation of the read entity ---
104
105
106         ent->Init(aName, aDegree, aControlPointsList, aCurveForm, aClosedCurve, aSelfIntersect);
107 }
108
109
110 void RWStepGeom_RWQuasiUniformCurve::WriteStep
111         (StepData_StepWriter& SW,
112          const Handle(StepGeom_QuasiUniformCurve)& ent) const
113 {
114
115         // --- inherited field name ---
116
117         SW.Send(ent->Name());
118
119         // --- inherited field degree ---
120
121         SW.Send(ent->Degree());
122
123         // --- inherited field controlPointsList ---
124
125         SW.OpenSub();
126         for (Standard_Integer i3 = 1;  i3 <= ent->NbControlPointsList();  i3 ++) {
127           SW.Send(ent->ControlPointsListValue(i3));
128         }
129         SW.CloseSub();
130
131         // --- inherited field curveForm ---
132
133         switch(ent->CurveForm()) {
134           case StepGeom_bscfEllipticArc : SW.SendEnum (bscfEllipticArc); break;
135           case StepGeom_bscfPolylineForm : SW.SendEnum (bscfPolylineForm); break;
136           case StepGeom_bscfParabolicArc : SW.SendEnum (bscfParabolicArc); break;
137           case StepGeom_bscfCircularArc : SW.SendEnum (bscfCircularArc); break;
138           case StepGeom_bscfUnspecified : SW.SendEnum (bscfUnspecified); break;
139           case StepGeom_bscfHyperbolicArc : SW.SendEnum (bscfHyperbolicArc); break;
140         }
141
142         // --- inherited field closedCurve ---
143
144         SW.SendLogical(ent->ClosedCurve());
145
146         // --- inherited field selfIntersect ---
147
148         SW.SendLogical(ent->SelfIntersect());
149 }
150
151
152 void RWStepGeom_RWQuasiUniformCurve::Share(const Handle(StepGeom_QuasiUniformCurve)& ent, Interface_EntityIterator& iter) const
153 {
154
155         Standard_Integer nbElem1 = ent->NbControlPointsList();
156         for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) {
157           iter.GetOneItem(ent->ControlPointsListValue(is1));
158         }
159
160 }
161