7fd59977 |
1 | |
2 | #include <RWStepVisual_RWTextStyleWithBoxCharacteristics.ixx> |
3 | #include <Standard_Real.hxx> |
4 | #include <StepVisual_TextStyleForDefinedFont.hxx> |
5 | |
6 | #include <StepVisual_HArray1OfBoxCharacteristicSelect.hxx> |
7 | |
8 | #include <Interface_EntityIterator.hxx> |
9 | |
10 | |
11 | #include <StepVisual_TextStyleWithBoxCharacteristics.hxx> |
12 | |
13 | |
14 | RWStepVisual_RWTextStyleWithBoxCharacteristics::RWStepVisual_RWTextStyleWithBoxCharacteristics () {} |
15 | |
16 | void RWStepVisual_RWTextStyleWithBoxCharacteristics::ReadStep |
17 | (const Handle(StepData_StepReaderData)& data, |
18 | const Standard_Integer num, |
19 | Handle(Interface_Check)& ach, |
20 | const Handle(StepVisual_TextStyleWithBoxCharacteristics)& ent) const |
21 | { |
22 | |
23 | |
24 | // --- Number of Parameter Control --- |
25 | |
26 | if (!data->CheckNbParams(num,3,ach,"text_style_with_box_characteristics has not 3 parameter(s)")) return; |
27 | |
28 | // --- inherited field : name --- |
29 | |
30 | Handle(TCollection_HAsciiString) aName; |
31 | //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed |
32 | data->ReadString (num,1,"name",ach,aName); |
33 | |
34 | // --- inherited field : characterAppearance --- |
35 | |
36 | Handle(StepVisual_TextStyleForDefinedFont) aCharacterAppearance; |
37 | //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed |
38 | data->ReadEntity(num, 2,"character_appearance", ach, |
39 | STANDARD_TYPE(StepVisual_TextStyleForDefinedFont), aCharacterAppearance); |
40 | |
41 | // --- own field : characteristics --- |
42 | |
43 | Standard_Integer numr, numpr; |
44 | TCollection_AsciiString TypeHeigth("BOX_HEIGHT"); |
45 | TCollection_AsciiString TypeWidth("BOX_WIDTH"); |
46 | TCollection_AsciiString TypeSlant("BOX_SLANT_ANGLE"); |
47 | TCollection_AsciiString TypeRotate("BOX_ROTATE_ANGLE"); |
48 | TCollection_AsciiString TrueType; |
49 | |
50 | Handle(StepVisual_HArray1OfBoxCharacteristicSelect) aCharacteristics; |
51 | Standard_Real aCharacteristicsItem; |
52 | StepVisual_BoxCharacteristicSelect aBoxCharacteristicSelect; |
53 | |
54 | Standard_Integer nsub3; |
55 | nsub3 = data->SubListNumber(num, 3, Standard_False); |
56 | if (nsub3 !=0) { |
57 | Standard_Integer nb3 = data->NbParams(nsub3); |
58 | aCharacteristics = new StepVisual_HArray1OfBoxCharacteristicSelect(1, nb3); |
59 | for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) { |
60 | // Looks for true type : |
61 | //szv#4:S4163:12Mar99 `Standard_Boolean statType =` not needed |
62 | if (data->ReadTypedParam(nsub3,i3,Standard_True,"characteristics",ach,numr,numpr,TrueType)) { |
63 | //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed |
64 | if (data->ReadReal (numr,numpr,"characteristics",ach,aCharacteristicsItem)) { |
65 | aBoxCharacteristicSelect.SetRealValue(aCharacteristicsItem); |
66 | if (TrueType == TypeHeigth) |
67 | aBoxCharacteristicSelect.SetTypeOfContent(1); |
68 | else if (TrueType == TypeWidth) |
69 | aBoxCharacteristicSelect.SetTypeOfContent(2); |
70 | else if (TrueType == TypeSlant) |
71 | aBoxCharacteristicSelect.SetTypeOfContent(3); |
72 | else if (TrueType == TypeRotate) |
73 | aBoxCharacteristicSelect.SetTypeOfContent(4); |
74 | else { |
75 | ach->AddFail("Parameter #3 (characteristics) item has illegal TYPE"); |
76 | } |
77 | aCharacteristics->SetValue(i3, aBoxCharacteristicSelect); |
78 | } |
79 | else { |
80 | ach->AddFail("Parameter #3 (characteristics) item is not a REAL"); |
81 | } |
82 | } |
83 | else { |
84 | ach->AddFail("Parameter #3 (characteristics) item is not TYPED"); |
85 | } |
86 | } |
87 | } |
88 | else { |
89 | ach->AddFail("Parameter #3 (characteristics) is not a LIST"); |
90 | } |
91 | |
92 | //--- Initialisation of the read entity --- |
93 | |
94 | ent->Init(aName, aCharacterAppearance, aCharacteristics); |
95 | } |
96 | |
97 | |
98 | void RWStepVisual_RWTextStyleWithBoxCharacteristics::WriteStep |
99 | (StepData_StepWriter& SW, |
100 | const Handle(StepVisual_TextStyleWithBoxCharacteristics)& ent) const |
101 | { |
102 | |
103 | // --- inherited field name --- |
104 | |
105 | SW.Send(ent->Name()); |
106 | |
107 | // --- inherited field characterAppearance --- |
108 | |
109 | SW.Send(ent->CharacterAppearance()); |
110 | |
111 | // --- own field : characteristics --- |
112 | // Attention : a modifier avant utilisation |
113 | |
114 | SW.Send(ent->Characteristics()); |
115 | } |
116 | |
117 | |
118 | void RWStepVisual_RWTextStyleWithBoxCharacteristics::Share(const Handle(StepVisual_TextStyleWithBoxCharacteristics)& ent, Interface_EntityIterator& iter) const |
119 | { |
120 | |
121 | iter.GetOneItem(ent->CharacterAppearance()); |
122 | } |
123 | |