summaryrefslogtreecommitdiff
path: root/src/RWStepVisual/RWStepVisual_RWTextStyleWithBoxCharacteristics.cxx
blob: 1505cb930909d7b2ba5bc3487b5ea70d7036465d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123

#include <RWStepVisual_RWTextStyleWithBoxCharacteristics.ixx>
#include <Standard_Real.hxx>
#include <StepVisual_TextStyleForDefinedFont.hxx>

#include <StepVisual_HArray1OfBoxCharacteristicSelect.hxx>

#include <Interface_EntityIterator.hxx>


#include <StepVisual_TextStyleWithBoxCharacteristics.hxx>


RWStepVisual_RWTextStyleWithBoxCharacteristics::RWStepVisual_RWTextStyleWithBoxCharacteristics () {}

void RWStepVisual_RWTextStyleWithBoxCharacteristics::ReadStep
(const Handle(StepData_StepReaderData)& data,
 const Standard_Integer num,
 Handle(Interface_Check)& ach,
 const Handle(StepVisual_TextStyleWithBoxCharacteristics)& ent) const
{
  
  
  // --- Number of Parameter Control ---
  
  if (!data->CheckNbParams(num,3,ach,"text_style_with_box_characteristics has not 3 parameter(s)")) return;
  
  // --- inherited field : name ---
  
  Handle(TCollection_HAsciiString) aName;
  //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
  data->ReadString (num,1,"name",ach,aName);
  
  // --- inherited field : characterAppearance ---
  
  Handle(StepVisual_TextStyleForDefinedFont) aCharacterAppearance;
  //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
  data->ReadEntity(num, 2,"character_appearance", ach, 
		   STANDARD_TYPE(StepVisual_TextStyleForDefinedFont), aCharacterAppearance);
  
  // --- own field : characteristics ---

  Standard_Integer numr, numpr;
  TCollection_AsciiString TypeHeigth("BOX_HEIGHT");
  TCollection_AsciiString TypeWidth("BOX_WIDTH");
  TCollection_AsciiString TypeSlant("BOX_SLANT_ANGLE");
  TCollection_AsciiString TypeRotate("BOX_ROTATE_ANGLE");
  TCollection_AsciiString TrueType;

  Handle(StepVisual_HArray1OfBoxCharacteristicSelect) aCharacteristics;
  Standard_Real aCharacteristicsItem;
  StepVisual_BoxCharacteristicSelect aBoxCharacteristicSelect;

  Standard_Integer nsub3;
  nsub3 = data->SubListNumber(num, 3, Standard_False);
  if (nsub3 !=0) {
    Standard_Integer nb3 = data->NbParams(nsub3);
    aCharacteristics = new StepVisual_HArray1OfBoxCharacteristicSelect(1, nb3);
    for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
      // Looks for true type :
      //szv#4:S4163:12Mar99 `Standard_Boolean statType =` not needed
      if (data->ReadTypedParam(nsub3,i3,Standard_True,"characteristics",ach,numr,numpr,TrueType)) {
	//szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
	if (data->ReadReal (numr,numpr,"characteristics",ach,aCharacteristicsItem)) {
	  aBoxCharacteristicSelect.SetRealValue(aCharacteristicsItem);
	  if (TrueType == TypeHeigth)
	    aBoxCharacteristicSelect.SetTypeOfContent(1);
	  else if (TrueType == TypeWidth) 
	    aBoxCharacteristicSelect.SetTypeOfContent(2);
	  else if (TrueType == TypeSlant) 
	    aBoxCharacteristicSelect.SetTypeOfContent(3);
	  else if (TrueType == TypeRotate) 
	    aBoxCharacteristicSelect.SetTypeOfContent(4);
	  else {
	    ach->AddFail("Parameter #3 (characteristics) item has illegal TYPE");
	  }
	  aCharacteristics->SetValue(i3, aBoxCharacteristicSelect);
	}
	else {
	  ach->AddFail("Parameter #3 (characteristics) item is not a REAL");
	}
      }
      else {
	ach->AddFail("Parameter #3 (characteristics) item is not TYPED");
      }
    }
  }
  else {
    ach->AddFail("Parameter #3 (characteristics) is not a LIST");
  }
  
  //--- Initialisation of the read entity ---
  
  ent->Init(aName, aCharacterAppearance, aCharacteristics);
}


void RWStepVisual_RWTextStyleWithBoxCharacteristics::WriteStep
(StepData_StepWriter& SW,
 const Handle(StepVisual_TextStyleWithBoxCharacteristics)& ent) const
{
  
  // --- inherited field name ---
  
  SW.Send(ent->Name());
  
  // --- inherited field characterAppearance ---
  
  SW.Send(ent->CharacterAppearance());
  
  // --- own field : characteristics ---
  // Attention : a modifier avant utilisation

  SW.Send(ent->Characteristics());
}


void RWStepVisual_RWTextStyleWithBoxCharacteristics::Share(const Handle(StepVisual_TextStyleWithBoxCharacteristics)& ent, Interface_EntityIterator& iter) const
{
  
  iter.GetOneItem(ent->CharacterAppearance());
}