28a73c1f |
1 | // Created on: 2015-07-22 |
2 | // Created by: Irina KRYLOVA |
3 | // Copyright (c) 2015 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #include <Interface_Check.hxx> |
17 | #include <RWStepRepr_RWReprItemAndPlaneAngleMeasureWithUnitAndQRI.hxx> |
18 | #include <StepBasic_MeasureValueMember.hxx> |
19 | #include <StepBasic_MeasureWithUnit.hxx> |
20 | #include <StepBasic_Unit.hxx> |
21 | #include <StepData_StepReaderData.hxx> |
22 | #include <StepData_StepWriter.hxx> |
23 | #include <StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI.hxx> |
28a73c1f |
24 | #include <StepShape_QualifiedRepresentationItem.hxx> |
25 | #include <StepShape_ValueQualifier.hxx> |
26 | |
27 | //======================================================================= |
28 | //function : RWSteprepr_RWReprItemAndPlaneAngleMeasureWithUnitAndQRI |
29 | //purpose : |
30 | //======================================================================= |
31 | RWStepRepr_RWReprItemAndPlaneAngleMeasureWithUnitAndQRI::RWStepRepr_RWReprItemAndPlaneAngleMeasureWithUnitAndQRI() {} |
32 | |
33 | |
34 | //======================================================================= |
35 | //function : ReadStep |
36 | //purpose : |
37 | //======================================================================= |
38 | |
39 | void RWStepRepr_RWReprItemAndPlaneAngleMeasureWithUnitAndQRI::ReadStep |
40 | (const Handle(StepData_StepReaderData)& data, |
41 | const Standard_Integer num0, |
42 | Handle(Interface_Check)& ach, |
43 | const Handle(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)& ent) const |
44 | { |
45 | Standard_Integer num = 0;//num0; |
a7197ef3 |
46 | data->NamedForComplex("MEASURE_WITH_UNIT","MSWTUN",num0,num,ach); |
28a73c1f |
47 | if (!data->CheckNbParams(num,2,ach,"measure_with_unit")) return; |
48 | // --- own field : valueComponent --- |
49 | Handle(StepBasic_MeasureValueMember) mvc = new StepBasic_MeasureValueMember; |
50 | data->ReadMember (num,1, "value_component", ach, mvc); |
51 | // --- own field : unitComponent --- |
52 | StepBasic_Unit aUnitComponent; |
53 | data->ReadEntity(num, 2,"unit_component", ach, aUnitComponent); |
54 | Handle(StepBasic_MeasureWithUnit) aMeasureWithUnit = new StepBasic_MeasureWithUnit; |
55 | aMeasureWithUnit->Init(mvc, aUnitComponent); |
56 | |
a7197ef3 |
57 | data->NamedForComplex("QUALIFIED_REPRESENTATION_ITEM","QLRPIT",num0,num,ach); |
28a73c1f |
58 | if (!data->CheckNbParams(num,1,ach,"qualified_representation_item")) return; |
59 | // --- own field : qualifiers --- |
60 | Handle(StepShape_HArray1OfValueQualifier) quals; |
61 | Standard_Integer nsub; |
62 | if (data->ReadSubList (num, 1, "qualifiers", ach, nsub)) { |
63 | Standard_Integer nb = data->NbParams(nsub); |
64 | quals = new StepShape_HArray1OfValueQualifier (1, nb); |
65 | for (Standard_Integer i = 1; i <= nb; i++) { |
66 | StepShape_ValueQualifier aVQ; |
67 | if (data->ReadEntity (nsub, i, "qualifier" ,ach, aVQ)) |
68 | quals->SetValue (i, aVQ); |
69 | } |
70 | } |
71 | Handle(StepShape_QualifiedRepresentationItem) aQRI = new StepShape_QualifiedRepresentationItem(); |
72 | aQRI->SetQualifiers(quals); |
73 | |
a7197ef3 |
74 | data->NamedForComplex("REPRESENTATION_ITEM","RPRITM",num0,num,ach); |
28a73c1f |
75 | if (!data->CheckNbParams(num,1,ach,"representation_item")) return; |
76 | // --- own field : name --- |
77 | Handle(TCollection_HAsciiString) aName; |
78 | data->ReadString (num,1,"name",ach,aName); |
79 | Handle(StepRepr_RepresentationItem) aReprItem = new StepRepr_RepresentationItem; |
80 | aReprItem->Init(aName); |
81 | |
82 | //--- Initialisation of the read entity --- |
83 | ent->Init(aMeasureWithUnit,aReprItem, aQRI); |
84 | } |
85 | |
86 | |
87 | //======================================================================= |
88 | //function : WriteStep |
89 | //purpose : |
90 | //======================================================================= |
91 | |
92 | void RWStepRepr_RWReprItemAndPlaneAngleMeasureWithUnitAndQRI::WriteStep |
93 | (StepData_StepWriter& SW, |
94 | const Handle(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)& ent) const |
95 | { |
96 | SW.StartEntity("MEASURE_REPRESENTATION_ITEM"); |
97 | SW.StartEntity("MEASURE_WITH_UNIT"); |
98 | SW.Send(ent->GetMeasureWithUnit()->ValueComponentMember()); |
99 | SW.Send(ent->GetMeasureWithUnit()->UnitComponent().Value()); |
100 | SW.StartEntity("PLANE_ANGLE_MEASURE_WITH_UNIT"); |
101 | SW.StartEntity ("QUALIFIED_REPRESENTATION_ITEM"); |
102 | Handle(StepShape_QualifiedRepresentationItem) aQRI = ent->GetQualifiedRepresentationItem(); |
103 | Standard_Integer i, nbq = aQRI->NbQualifiers(); |
104 | SW.OpenSub(); |
105 | for (i = 1; i <= nbq; i ++) |
106 | SW.Send (aQRI->QualifiersValue(i).Value()); |
107 | SW.CloseSub(); |
108 | SW.StartEntity("REPRESENTATION_ITEM"); |
109 | SW.Send(ent->Name()); |
110 | } |