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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
//--------------------------------------------------------------------
//
// File Name : IGESGraph_TextFontDef.cxx
// Date :
// Author : CKY / Contract Toubro-Larsen
// Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------
#include <IGESGraph_ToolTextFontDef.ixx>
#include <IGESData_ParamCursor.hxx>
#include <gp_GTrsf.hxx>
#include <gp_XY.hxx>
#include <gp_Pnt2d.hxx>
#include <TCollection_HAsciiString.hxx>
#include <IGESGraph_TextFontDef.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColgp_HArray1OfXY.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <IGESBasic_HArray1OfHArray1OfInteger.hxx>
#include <IGESBasic_HArray1OfHArray1OfXY.hxx>
#include <IGESData_Dump.hxx>
#include <Interface_Macros.hxx>
IGESGraph_ToolTextFontDef::IGESGraph_ToolTextFontDef () { }
void IGESGraph_ToolTextFontDef::ReadOwnParams
(const Handle(IGESGraph_TextFontDef)& ent,
const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
{
//Standard_Boolean st; //szv#4:S4163:12Mar99 moved down
Standard_Integer nbval;
Standard_Integer fontCode;
Handle(TCollection_HAsciiString) fontName;
Standard_Integer supersededFont;
Handle(IGESGraph_TextFontDef) supersededEntity;
Standard_Integer scale;
Handle(TColStd_HArray1OfInteger) aSCIICodes;
Handle(TColStd_HArray1OfInteger) nextCharX, nextCharY;
Handle(TColStd_HArray1OfInteger) penMotions;
Handle(IGESBasic_HArray1OfHArray1OfInteger) penFlags;
Handle(IGESBasic_HArray1OfHArray1OfInteger) movePenX, movePenY;
Standard_Integer tempCode, tempNextX,tempNextY;
Standard_Integer tempMotion;
Standard_Integer tempFlag, tempMoveX,tempMoveY;
// Reading fontCode(Integer)
PR.ReadInteger (PR.Current(), "Font Code", fontCode); //szv#4:S4163:12Mar99 `st=` not needed
// Reading fontName(String)
PR.ReadText (PR.Current(), "Font Name", fontName); //szv#4:S4163:12Mar99 `st=` not needed
if ( PR.IsParamEntity(PR.CurrentNumber()) )
{
supersededFont = -1;
// Reading supersededEntity(TextFontDef)
PR.ReadEntity (IR, PR.Current(), "Text Definition Entity",
STANDARD_TYPE(IGESGraph_TextFontDef), supersededEntity); //szv#4:S4163:12Mar99 `st=` not needed
}
else
// Reading supersededFont(Integer)
PR.ReadInteger(PR.Current(), "No. of superseded font", supersededFont); //szv#4:S4163:12Mar99 `st=` not needed
// Reading scale(Integer)
PR.ReadInteger(PR.Current(), "Grid units eqvt to one text height", scale); //szv#4:S4163:12Mar99 `st=` not needed
// Reading nbval(Integer)
Standard_Boolean st = PR.ReadInteger(PR.Current(), "No. of characters in this defn", nbval);
if (st && nbval > 0)
{
aSCIICodes = new TColStd_HArray1OfInteger(1, nbval);
nextCharX = new TColStd_HArray1OfInteger(1, nbval);
nextCharY = new TColStd_HArray1OfInteger(1, nbval);
penMotions = new TColStd_HArray1OfInteger(1, nbval);
penFlags = new IGESBasic_HArray1OfHArray1OfInteger(1, nbval);
movePenX = new IGESBasic_HArray1OfHArray1OfInteger(1, nbval);
movePenY = new IGESBasic_HArray1OfHArray1OfInteger(1, nbval);
for ( Standard_Integer i = 1; i <= nbval; i++ )
{
// Reading aSCIICodes(HArray1OfInteger)
if (PR.ReadInteger(PR.Current(), "array aSCIICodes", tempCode)) //szv#4:S4163:12Mar99 `st=` not needed
aSCIICodes->SetValue(i, tempCode);
// Reading nextChars(HArray1OfInteger*2)
if (PR.ReadInteger(PR.Current(), "array nextChar X", tempNextX)) //szv#4:S4163:12Mar99 `st=` not needed
nextCharX->SetValue(i, tempNextX);
if (PR.ReadInteger(PR.Current(), "array nextChar Y", tempNextY)) //szv#4:S4163:12Mar99 `st=` not needed
nextCharY->SetValue(i, tempNextY);
// Reading penMotions(HArray1OfInteger)
if (PR.ReadInteger(PR.Current(), "array penMotions", tempMotion)) { //szv#4:S4163:12Mar99 `st=` not needed
penMotions->SetValue(i, tempMotion);
if (tempMotion > 0) {
Handle(TColStd_HArray1OfInteger) intarray, xarray, yarray;
intarray = new TColStd_HArray1OfInteger(1, tempMotion);
xarray = new TColStd_HArray1OfInteger(1, tempMotion);
yarray = new TColStd_HArray1OfInteger(1, tempMotion);
for ( Standard_Integer j = 1; j <= tempMotion; j++ ) {
if (PR.DefinedElseSkip()) {
// Reading penFlags(HArray1OfHArray1OfInteger)
if (PR.ReadInteger(PR.Current(), "array penFlags", tempFlag)) //szv#4:S4163:12Mar99 `st=` not needed
intarray->SetValue(j, tempFlag);
}
else intarray->SetValue(j, 0); // Default Value
// Reading movePenTo(HArray1OfHArray1OfInteger*2)
if (PR.ReadInteger(PR.Current(), "array movePenTo X", tempMoveX)) //szv#4:S4163:12Mar99 `st=` not needed
xarray->SetValue(j, tempMoveX);
if (PR.ReadInteger(PR.Current(), "array movePenTo Y", tempMoveY)) //szv#4:S4163:12Mar99 `st=` not needed
yarray->SetValue(j, tempMoveY);
}
penFlags->SetValue(i, intarray);
movePenX->SetValue(i, xarray);
movePenY->SetValue(i, yarray);
}
else PR.AddFail("Count of Pen motions : Not Positive");
}
}
}
else PR.AddFail ("Count of characters in this defn : Not Positive");
DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
ent->Init
(fontCode, fontName, supersededFont, supersededEntity,
scale, aSCIICodes, nextCharX, nextCharY,
penMotions, penFlags, movePenX, movePenY);
}
void IGESGraph_ToolTextFontDef::WriteOwnParams
(const Handle(IGESGraph_TextFontDef)& ent, IGESData_IGESWriter& IW) const
{
Standard_Integer IX,IY;
IW.Send( ent->FontCode() );
IW.Send( ent->FontName() );
if ( ent->IsSupersededFontEntity() )
IW.Send( ent->SupersededFontEntity(), Standard_True ); // negative
else
IW.Send( ent->SupersededFontCode() );
IW.Send( ent->Scale() );
Standard_Integer Up = ent->NbCharacters();
IW.Send( Up );
for ( Standard_Integer i = 1; i <= Up; i++)
{
IW.Send( ent->ASCIICode(i) );
ent->NextCharOrigin (i,IX,IY);
IW.Send( IX );
IW.Send( IY );
IW.Send( ent->NbPenMotions(i) );
for ( Standard_Integer j = 1; j <= ent->NbPenMotions(i); j ++)
{
IW.SendBoolean( ent->IsPenUp(i,j) );
ent->NextPenPosition (i,j, IX,IY);
IW.Send( IX );
IW.Send( IY );
}
}
}
void IGESGraph_ToolTextFontDef::OwnShared
(const Handle(IGESGraph_TextFontDef)& ent, Interface_EntityIterator& iter) const
{
if ( ent->IsSupersededFontEntity() )
iter.GetOneItem( ent->SupersededFontEntity() );
}
void IGESGraph_ToolTextFontDef::OwnCopy
(const Handle(IGESGraph_TextFontDef)& another,
const Handle(IGESGraph_TextFontDef)& ent, Interface_CopyTool& TC) const
{
Standard_Integer nbval;
Standard_Integer fontCode;
Handle(TCollection_HAsciiString) fontName;
Standard_Integer supersededFont=0;
Handle(IGESGraph_TextFontDef) supersededEntity;
Standard_Integer scale;
Handle(TColStd_HArray1OfInteger) aSCIICodes, nextCharX,nextCharY;
Handle(TColStd_HArray1OfInteger) penMotions;
Handle(IGESBasic_HArray1OfHArray1OfInteger) penFlags,movePenX,movePenY;
Standard_Integer tempMotion;
Handle(TColStd_HArray1OfInteger) intarray,xarray,yarray;
nbval = another->NbCharacters();
aSCIICodes = new TColStd_HArray1OfInteger(1, nbval);
nextCharX = new TColStd_HArray1OfInteger(1, nbval);
nextCharY = new TColStd_HArray1OfInteger(1, nbval);
penMotions = new TColStd_HArray1OfInteger(1, nbval);
penFlags = new IGESBasic_HArray1OfHArray1OfInteger(1, nbval);
movePenX = new IGESBasic_HArray1OfHArray1OfInteger(1, nbval);
movePenY = new IGESBasic_HArray1OfHArray1OfInteger(1, nbval);
fontCode = another->FontCode();
fontName = new TCollection_HAsciiString(another->FontName());
if ( another->IsSupersededFontEntity() )
supersededEntity =
Handle(IGESGraph_TextFontDef)::DownCast (TC.Transferred(another->SupersededFontEntity()));
else
supersededFont = another->SupersededFontCode();
scale = another->Scale();
Standard_Integer j, IX,IY;
for (Standard_Integer i = 1; i <= nbval; i++)
{
aSCIICodes->SetValue( i, another->ASCIICode(i) );
ent->NextCharOrigin (i,IX,IY);
nextCharX->SetValue ( i, IX);
nextCharY->SetValue ( i, IY);
tempMotion = another->NbPenMotions(i);
penMotions->SetValue( i, tempMotion );
intarray = new TColStd_HArray1OfInteger(1, tempMotion);
xarray = new TColStd_HArray1OfInteger(1, tempMotion);
yarray = new TColStd_HArray1OfInteger(1, tempMotion);
for (j = 1; j <= tempMotion; j++)
{
if ( another->IsPenUp(i, j) ) intarray->SetValue(j, 1);
else intarray->SetValue(j, 0);
another->NextPenPosition(i, j, IX,IY);
xarray->SetValue(j, IX);
yarray->SetValue(j, IY);
}
penFlags->SetValue(i, intarray);
movePenX->SetValue(i, xarray);
movePenY->SetValue(i, yarray);
}
ent->Init(fontCode, fontName, supersededFont, supersededEntity,
scale, aSCIICodes, nextCharX, nextCharY, penMotions,
penFlags, movePenX, movePenY);
}
IGESData_DirChecker IGESGraph_ToolTextFontDef::DirChecker
(const Handle(IGESGraph_TextFontDef)& /*ent*/) const
{
IGESData_DirChecker DC (310, 0);
DC.Structure(IGESData_DefVoid);
DC.LineFont(IGESData_DefVoid);
DC.LineWeight(IGESData_DefVoid);
DC.Color(IGESData_DefVoid);
DC.BlankStatusIgnored();
DC.SubordinateStatusRequired(0);
DC.UseFlagRequired(2);
DC.HierarchyStatusIgnored();
return DC;
}
void IGESGraph_ToolTextFontDef::OwnCheck
(const Handle(IGESGraph_TextFontDef)& /*ent*/,
const Interface_ShareTool& , Handle(Interface_Check)& /*ach*/) const
{
}
void IGESGraph_ToolTextFontDef::OwnDump
(const Handle(IGESGraph_TextFontDef)& ent, const IGESData_IGESDumper& dumper,
const Handle(Message_Messenger)& S, const Standard_Integer level) const
{
Standard_Integer sublevel = (level <= 4) ? 0 : 1;
Standard_Integer nbchars = ent->NbCharacters();
S << "IGESGraph_TextFontDef" << endl;
S << "Font Code : " << ent->FontCode() << endl;
S << "Font Name : ";
IGESData_DumpString(S,ent->FontName());
S << endl;
if ( ent->IsSupersededFontEntity() ) {
S << "Text Definition Entity : ";
dumper.Dump(ent->SupersededFontEntity(),S, sublevel);
}
else S << "Superseding Font Number : " << ent->SupersededFontCode();
S << endl;
S << "No. of Grid Units eqvt to 1 Text Height : " << ent->Scale() << endl;
S << "ASCII Codes : " << endl
<< "Grid Locations of next character origins : " << endl
<< "Pen Motions : " << endl
<< "Pen Positions : " << endl
<< "Grid Locations the pen moves to : ";
S << "Count = " << nbchars << endl;
IGESData_DumpVals(S,-level,1,nbchars,ent->ASCIICode);
S << endl;
if (level > 4 )
{
Handle(TColgp_HArray1OfXY) arrXY;
Standard_Integer I, J, nbmotions;
for (I = 1; I <= nbchars; I++)
{
Standard_Integer IX,IY;
S << "[" << I << "]: ";
S << "ASCII Code : " << ent->ASCIICode(I) << endl;
S << "Grid Location of next character's origin : ";
ent->NextCharOrigin(I,IX,IY);
S << "X=" << IX << " Y=" << IY;
nbmotions = ent->NbPenMotions(I);
S << " No. of Pen Motions : " << nbmotions;
if (level <= 5) S << " [ ask level > 5 for Details ]" << endl;
else {
S << endl;
for (J = 1; J <= nbmotions; J++)
{
S << "Pen up(1) / down(0) flag : " << (Standard_Integer)ent->IsPenUp(I,J);
S << " Next Pen Position : ";
ent->NextPenPosition(I,J, IX,IY);
S << " X="<<IX<<" Y="<<IY;
S << endl;
}
}
}
}
S << endl;
}
|