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