b311480e |
1 | // Created by: CKY / Contract Toubro-Larsen |
2 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
7fd59977 |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
7fd59977 |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
16 | //-------------------------------------------------------------------- |
7fd59977 |
17 | //-------------------------------------------------------------------- |
18 | |
7fd59977 |
19 | #include <gp_XYZ.hxx> |
42cf5bc1 |
20 | #include <IGESData_DirChecker.hxx> |
21 | #include <IGESData_Dump.hxx> |
7fd59977 |
22 | #include <IGESData_HArray1OfIGESEntity.hxx> |
42cf5bc1 |
23 | #include <IGESData_IGESDumper.hxx> |
24 | #include <IGESData_IGESEntity.hxx> |
25 | #include <IGESData_IGESReaderData.hxx> |
26 | #include <IGESData_IGESWriter.hxx> |
27 | #include <IGESData_ParamCursor.hxx> |
28 | #include <IGESData_ParamReader.hxx> |
29 | #include <IGESDimen_NewGeneralNote.hxx> |
30 | #include <IGESDimen_ToolNewGeneralNote.hxx> |
31 | #include <Interface_Check.hxx> |
32 | #include <Interface_CopyTool.hxx> |
33 | #include <Interface_EntityIterator.hxx> |
7fd59977 |
34 | #include <Interface_HArray1OfHAsciiString.hxx> |
42cf5bc1 |
35 | #include <Interface_Macros.hxx> |
36 | #include <Interface_ShareTool.hxx> |
37 | #include <Message_Messenger.hxx> |
38 | #include <Standard_DomainError.hxx> |
39 | #include <TColgp_HArray1OfXYZ.hxx> |
40 | #include <TCollection_HAsciiString.hxx> |
7fd59977 |
41 | #include <TColStd_HArray1OfInteger.hxx> |
42 | #include <TColStd_HArray1OfReal.hxx> |
7fd59977 |
43 | |
42cf5bc1 |
44 | #include <stdio.h> |
7fd59977 |
45 | IGESDimen_ToolNewGeneralNote::IGESDimen_ToolNewGeneralNote () { } |
46 | |
47 | |
48 | void IGESDimen_ToolNewGeneralNote::ReadOwnParams |
49 | (const Handle(IGESDimen_NewGeneralNote)& ent, |
50 | const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const |
51 | { |
52 | //Standard_Boolean st; //szv#4:S4163:12Mar99 moved down |
53 | |
54 | Standard_Integer nbval; |
55 | Standard_Real width; |
56 | Standard_Real height; |
57 | Standard_Integer justifyCode; |
58 | gp_XYZ areaLoc; |
59 | Standard_Real areaRotationAngle; |
60 | gp_XYZ baseLinePos; |
61 | Standard_Real normalInterlineSpace; |
62 | Handle(TColStd_HArray1OfInteger) charDisplays; |
63 | Handle(TColStd_HArray1OfReal) charWidths; |
64 | Handle(TColStd_HArray1OfReal) charHeights; |
65 | Handle(TColStd_HArray1OfReal) interCharSpaces; |
66 | Handle(TColStd_HArray1OfReal) interlineSpaces; |
67 | Handle(TColStd_HArray1OfInteger) fontStyles; |
68 | Handle(TColStd_HArray1OfReal) charAngles; |
69 | Handle(Interface_HArray1OfHAsciiString) controlCodeStrings; |
70 | Handle(TColStd_HArray1OfInteger) nbChars; |
71 | Handle(TColStd_HArray1OfReal) boxWidths; |
72 | Handle(TColStd_HArray1OfReal) boxHeights; |
73 | Handle(TColStd_HArray1OfInteger) charSetCodes; |
74 | Handle(IGESData_HArray1OfIGESEntity) charSetEntities; |
75 | Handle(TColStd_HArray1OfReal) slantAngles; |
76 | Handle(TColStd_HArray1OfReal) rotationAngles; |
77 | Handle(TColStd_HArray1OfInteger) mirrorFlags; |
78 | Handle(TColStd_HArray1OfInteger) rotateFlags; |
79 | Handle(TColgp_HArray1OfXYZ) startPoints; |
80 | Handle(Interface_HArray1OfHAsciiString) texts; |
81 | |
82 | //szv#4:S4163:12Mar99 `st=` not needed |
83 | PR.ReadReal(PR.Current(), "Text Width", width); |
84 | PR.ReadReal(PR.Current(), "Text Height", height); |
85 | PR.ReadInteger(PR.Current(), "Justification Code", justifyCode); |
86 | PR.ReadXYZ(PR.CurrentList(1, 3), "Area Location Point", areaLoc); |
87 | PR.ReadReal(PR.Current(), "Area Rotation Angle", areaRotationAngle); |
88 | PR.ReadXYZ(PR.CurrentList(1, 3), "Base Line Position", baseLinePos); |
89 | PR.ReadReal(PR.Current(),"NormalInterline Spacing",normalInterlineSpace); |
90 | |
91 | Standard_Boolean st = PR.ReadInteger(PR.Current(), "Number of Text Strings", nbval); |
92 | if (st && nbval > 0) |
93 | { |
94 | charDisplays = new TColStd_HArray1OfInteger(1, nbval); |
95 | charWidths = new TColStd_HArray1OfReal(1, nbval); |
96 | charHeights = new TColStd_HArray1OfReal(1, nbval); |
97 | interCharSpaces = new TColStd_HArray1OfReal(1, nbval); |
98 | interlineSpaces = new TColStd_HArray1OfReal(1, nbval); |
99 | fontStyles = new TColStd_HArray1OfInteger(1, nbval); |
100 | charAngles = new TColStd_HArray1OfReal(1, nbval); |
101 | controlCodeStrings = new Interface_HArray1OfHAsciiString(1, nbval); |
102 | nbChars = new TColStd_HArray1OfInteger(1, nbval); |
103 | boxWidths = new TColStd_HArray1OfReal(1, nbval); |
104 | boxHeights = new TColStd_HArray1OfReal(1, nbval); |
105 | charSetCodes = new TColStd_HArray1OfInteger(1, nbval); |
106 | charSetEntities = new IGESData_HArray1OfIGESEntity(1,nbval); |
107 | slantAngles = new TColStd_HArray1OfReal(1, nbval); |
108 | rotationAngles = new TColStd_HArray1OfReal(1, nbval); |
109 | mirrorFlags = new TColStd_HArray1OfInteger(1, nbval); |
110 | rotateFlags = new TColStd_HArray1OfInteger(1, nbval); |
111 | startPoints = new TColgp_HArray1OfXYZ(1, nbval); |
112 | texts = new Interface_HArray1OfHAsciiString(1, nbval); |
113 | } |
114 | else PR.AddFail("Number of Text Strings: Not Positive"); |
115 | |
116 | if (! charDisplays.IsNull()) |
117 | for (Standard_Integer i = 1; i <= nbval; i++) |
118 | { |
119 | Standard_Integer charDisplay; |
120 | Standard_Real charWidth; |
121 | Standard_Real charHeight; |
122 | Standard_Real interCharSpace; |
123 | Standard_Real interlineSpace; |
124 | Standard_Integer fontStyle; |
125 | Standard_Real charAngle; |
126 | Handle(TCollection_HAsciiString) controlCodeString; |
127 | Standard_Integer nbChar; |
128 | Standard_Real boxWidth; |
129 | Standard_Real boxHeight; |
130 | Standard_Integer charSetCode; |
131 | Handle(IGESData_IGESEntity) charSetEntity; |
132 | Standard_Real slantAngle; |
133 | Standard_Real rotationAngle; |
134 | Standard_Integer mirrorFlag; |
135 | Standard_Integer rotateFlag; |
136 | gp_XYZ startPoint; |
137 | Handle(TCollection_HAsciiString) text; |
138 | |
139 | //st = PR.ReadInteger(PR.Current(), "Character Display",charDisplay); //szv#4:S4163:12Mar99 moved in if |
140 | if (PR.ReadInteger(PR.Current(), "Character Display",charDisplay)) |
141 | charDisplays->SetValue(i, charDisplay); |
142 | |
143 | //st = PR.ReadReal(PR.Current(), "Character Width", charWidth); //szv#4:S4163:12Mar99 moved in if |
144 | if (PR.ReadReal(PR.Current(), "Character Width", charWidth)) |
145 | charWidths->SetValue(i, charWidth); |
146 | |
147 | //st = PR.ReadReal(PR.Current(), "Character Height", charHeight); //szv#4:S4163:12Mar99 moved in if |
148 | if (PR.ReadReal(PR.Current(), "Character Height", charHeight)) |
149 | charHeights->SetValue(i, charHeight); |
150 | |
151 | //st = PR.ReadReal(PR.Current(), "Inter-character space", interCharSpace); //szv#4:S4163:12Mar99 moved in if |
152 | if (PR.ReadReal(PR.Current(), "Inter-character space", interCharSpace)) |
153 | interCharSpaces->SetValue(i, interCharSpace); |
154 | |
155 | //st = PR.ReadReal(PR.Current(), "Interline space", interlineSpace); //szv#4:S4163:12Mar99 moved in if |
156 | if (PR.ReadReal(PR.Current(), "Interline space", interlineSpace)) |
157 | interlineSpaces->SetValue(i, interlineSpace); |
158 | |
159 | //st = PR.ReadInteger(PR.Current(), "Font Style", fontStyle); //szv#4:S4163:12Mar99 moved in if |
160 | if (PR.ReadInteger(PR.Current(), "Font Style", fontStyle)) |
161 | fontStyles->SetValue(i, fontStyle); |
162 | |
163 | //st = PR.ReadReal(PR.Current(), "Character Angle", charAngle); //szv#4:S4163:12Mar99 moved in if |
164 | if (PR.ReadReal(PR.Current(), "Character Angle", charAngle)) |
165 | charAngles->SetValue(i, charAngle); |
166 | |
167 | //st = PR.ReadText(PR.Current(),"Control Code String", controlCodeString); //szv#4:S4163:12Mar99 moved in if |
168 | if (PR.ReadText(PR.Current(),"Control Code String", controlCodeString)) |
169 | controlCodeStrings->SetValue(i, controlCodeString); |
170 | |
171 | //st = PR.ReadInteger(PR.Current(), "Number of Characters", nbChar); //szv#4:S4163:12Mar99 moved in if |
172 | if (PR.ReadInteger(PR.Current(), "Number of Characters", nbChar)) |
173 | nbChars->SetValue(i, nbChar); |
174 | |
175 | //st = PR.ReadReal(PR.Current(), "Box Width", boxWidth); //szv#4:S4163:12Mar99 moved in if |
176 | if (PR.ReadReal(PR.Current(), "Box Width", boxWidth)) |
177 | boxWidths->SetValue(i, boxWidth); |
178 | |
179 | //st = PR.ReadReal(PR.Current(), "Box Height", boxHeight); //szv#4:S4163:12Mar99 moved in if |
180 | if (PR.ReadReal(PR.Current(), "Box Height", boxHeight)) |
181 | boxHeights->SetValue(i, boxHeight); |
182 | |
183 | Standard_Integer curnum = PR.CurrentNumber(); |
184 | if (PR.DefinedElseSkip()) |
185 | { |
186 | // Reading fontCode(Integer, must be positive) |
187 | PR.ReadInteger(PR.Current(), "Character Set Interpretation Code",charSetCode); //szv#4:S4163:12Mar99 `st=` not needed |
188 | // Reading charSetEnt |
189 | if (charSetCode < 0) { |
190 | charSetEntity = PR.ParamEntity (IR,curnum); |
191 | if (charSetEntity.IsNull()) |
192 | PR.AddFail("Char Set Interpretation Entity : incorrect reference"); |
193 | charSetEntities->SetValue(i, charSetEntity); |
194 | charSetCodes->SetValue(i, -1); |
195 | } else { |
196 | charSetCodes->SetValue(i, charSetCode); |
197 | } |
198 | } |
199 | |
200 | else |
201 | charSetCodes->SetValue(i, 1); |
202 | |
203 | if (PR.DefinedElseSkip()) |
204 | { |
205 | //st = PR.ReadReal(PR.Current(), "Slant Angle", slantAngle); //szv#4:S4163:12Mar99 moved in if |
206 | if (PR.ReadReal(PR.Current(), "Slant Angle", slantAngle)) |
207 | slantAngles->SetValue(i, slantAngle); |
208 | } |
209 | else |
c6541a0c |
210 | slantAngles->SetValue(i, M_PI/2); |
7fd59977 |
211 | |
212 | //st = PR.ReadReal(PR.Current(), "Rotation Angle", rotationAngle); //szv#4:S4163:12Mar99 moved in if |
213 | if (PR.ReadReal(PR.Current(), "Rotation Angle", rotationAngle)) |
214 | rotationAngles->SetValue(i, rotationAngle); |
215 | |
216 | //st = PR.ReadInteger(PR.Current(), "Mirror Flag", mirrorFlag); //szv#4:S4163:12Mar99 moved in if |
217 | if (PR.ReadInteger(PR.Current(), "Mirror Flag", mirrorFlag)) |
218 | mirrorFlags->SetValue(i, mirrorFlag); |
219 | |
220 | //st = PR.ReadInteger(PR.Current(), "Rotate Flag", rotateFlag); //szv#4:S4163:12Mar99 moved in if |
221 | if (PR.ReadInteger(PR.Current(), "Rotate Flag", rotateFlag)) |
222 | rotateFlags->SetValue(i, rotateFlag); |
223 | |
224 | //st = PR.ReadXYZ(PR.CurrentList(1, 3), "Start Point", startPoint); //szv#4:S4163:12Mar99 moved in if |
225 | if (PR.ReadXYZ(PR.CurrentList(1, 3), "Start Point", startPoint)) |
226 | startPoints->SetValue(i, startPoint); |
227 | |
228 | //st = PR.ReadText(PR.Current(), "Text String", text); //szv#4:S4163:12Mar99 moved in if |
229 | if (PR.ReadText(PR.Current(), "Text String", text)) |
230 | texts->SetValue(i, text); |
231 | } |
232 | |
233 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
234 | ent->Init |
235 | ( width, height, justifyCode, areaLoc, areaRotationAngle,baseLinePos, |
236 | normalInterlineSpace, charDisplays, charWidths, charHeights, |
237 | interCharSpaces, interlineSpaces, fontStyles, charAngles, |
238 | controlCodeStrings, nbChars, boxWidths, boxHeights, charSetCodes, |
239 | charSetEntities, slantAngles, rotationAngles, mirrorFlags, rotateFlags, |
240 | startPoints, texts); |
241 | } |
242 | |
243 | void IGESDimen_ToolNewGeneralNote::WriteOwnParams |
244 | (const Handle(IGESDimen_NewGeneralNote)& ent, IGESData_IGESWriter& IW) const |
245 | { |
246 | IW.Send(ent->TextWidth()); |
247 | IW.Send(ent->TextHeight()); |
248 | IW.Send(ent->JustifyCode()); |
249 | IW.Send(ent->AreaLocation().X()); |
250 | IW.Send(ent->AreaLocation().Y()); |
251 | IW.Send(ent->AreaLocation().Z()); |
252 | IW.Send(ent->AreaRotationAngle()); |
253 | IW.Send(ent->BaseLinePosition().X()); |
254 | IW.Send(ent->BaseLinePosition().Y()); |
255 | IW.Send(ent->BaseLinePosition().Z()); |
256 | IW.Send(ent->NormalInterlineSpace()); |
257 | Standard_Integer nbval = ent->NbStrings(); |
258 | IW.Send(nbval); |
259 | |
260 | for (Standard_Integer i = 1; i <= nbval; i++) |
261 | { |
262 | IW.Send(ent->CharacterDisplay(i)); |
263 | IW.Send(ent->CharacterWidth(i)); |
264 | IW.Send(ent->CharacterHeight(i)); |
265 | IW.Send(ent->InterCharacterSpace(i)); |
266 | IW.Send(ent->InterlineSpace(i)); |
267 | IW.Send(ent->FontStyle(i)); |
268 | IW.Send(ent->CharacterAngle(i)); |
269 | IW.Send(ent->ControlCodeString(i)); |
270 | IW.Send(ent->NbCharacters(i)); |
271 | IW.Send(ent->BoxWidth(i)); |
272 | IW.Send(ent->BoxHeight(i)); |
273 | if (ent->IsCharSetEntity(i)) |
274 | IW.Send(ent->CharSetEntity(i),Standard_True); // negative |
275 | else |
276 | IW.Send(ent->CharSetCode(i)); |
277 | IW.Send(ent->SlantAngle(i)); |
278 | IW.Send(ent->RotationAngle(i)); |
279 | IW.Send(ent->MirrorFlag(i)); |
280 | IW.Send(ent->RotateFlag(i)); |
281 | IW.Send((ent->StartPoint(i)).X()); |
282 | IW.Send((ent->StartPoint(i)).Y()); |
283 | IW.Send((ent->StartPoint(i)).Z()); |
284 | IW.Send(ent->Text(i)); |
285 | } |
286 | } |
287 | |
288 | void IGESDimen_ToolNewGeneralNote::OwnShared |
289 | (const Handle(IGESDimen_NewGeneralNote)& ent, Interface_EntityIterator& iter) const |
290 | { |
291 | Standard_Integer nbval = ent->NbStrings(); |
292 | for (Standard_Integer i = 1; i <= nbval; i++) |
293 | { |
294 | |
295 | if (ent->IsCharSetEntity(i)) |
296 | iter.GetOneItem(ent->CharSetEntity(i)); |
297 | } |
298 | } |
299 | |
300 | void IGESDimen_ToolNewGeneralNote::OwnCopy |
301 | (const Handle(IGESDimen_NewGeneralNote)& another, |
302 | const Handle(IGESDimen_NewGeneralNote)& ent, Interface_CopyTool& TC) const |
303 | { |
304 | Standard_Real width = another->TextWidth(); |
305 | Standard_Real height = another->TextHeight(); |
306 | Standard_Integer justifyCode = another->JustifyCode(); |
307 | gp_XYZ areaLoc = (another->AreaLocation()).XYZ(); |
308 | Standard_Real areaRotationAngle = another->AreaRotationAngle(); |
309 | gp_XYZ baseLinePos = (another->BaseLinePosition()).XYZ(); |
310 | Standard_Real normalInterlineSpace = another->NormalInterlineSpace(); |
311 | Standard_Integer nbval = another->NbStrings(); |
312 | |
313 | Handle(TColStd_HArray1OfInteger) charDisplays; |
314 | Handle(TColStd_HArray1OfReal) charWidths; |
315 | Handle(TColStd_HArray1OfReal) charHeights; |
316 | Handle(TColStd_HArray1OfReal) interCharSpaces; |
317 | Handle(TColStd_HArray1OfReal) interlineSpaces; |
318 | Handle(TColStd_HArray1OfInteger) fontStyles; |
319 | Handle(TColStd_HArray1OfReal) charAngles; |
320 | Handle(Interface_HArray1OfHAsciiString) controlCodeStrings; |
321 | Handle(TColStd_HArray1OfInteger) nbChars; |
322 | Handle(TColStd_HArray1OfReal) boxWidths; |
323 | Handle(TColStd_HArray1OfReal) boxHeights; |
324 | Handle(TColStd_HArray1OfInteger) charSetCodes; |
325 | Handle(IGESData_HArray1OfIGESEntity) charSetEntities; |
326 | Handle(TColStd_HArray1OfReal) slantAngles; |
327 | Handle(TColStd_HArray1OfReal) rotationAngles; |
328 | Handle(TColStd_HArray1OfInteger) mirrorFlags; |
329 | Handle(TColStd_HArray1OfInteger) rotateFlags; |
330 | Handle(TColgp_HArray1OfXYZ) startPoints; |
331 | Handle(Interface_HArray1OfHAsciiString) texts; |
332 | |
333 | charDisplays = new TColStd_HArray1OfInteger(1, nbval); |
334 | charWidths = new TColStd_HArray1OfReal (1, nbval); |
335 | charHeights = new TColStd_HArray1OfReal (1, nbval); |
336 | interCharSpaces = new TColStd_HArray1OfReal (1, nbval); |
337 | interlineSpaces = new TColStd_HArray1OfReal (1, nbval); |
338 | fontStyles = new TColStd_HArray1OfInteger(1, nbval); |
339 | charAngles = new TColStd_HArray1OfReal (1, nbval); |
340 | controlCodeStrings = new Interface_HArray1OfHAsciiString(1, nbval); |
341 | nbChars = new TColStd_HArray1OfInteger(1, nbval); |
342 | boxWidths = new TColStd_HArray1OfReal (1, nbval); |
343 | boxHeights = new TColStd_HArray1OfReal (1, nbval); |
344 | charSetCodes = new TColStd_HArray1OfInteger(1, nbval); |
345 | charSetEntities = new IGESData_HArray1OfIGESEntity(1, nbval); |
346 | slantAngles = new TColStd_HArray1OfReal (1, nbval); |
347 | rotationAngles = new TColStd_HArray1OfReal (1, nbval); |
348 | mirrorFlags = new TColStd_HArray1OfInteger(1, nbval); |
349 | rotateFlags = new TColStd_HArray1OfInteger(1, nbval); |
350 | startPoints = new TColgp_HArray1OfXYZ (1, nbval); |
351 | texts = new Interface_HArray1OfHAsciiString(1, nbval); |
352 | |
353 | for (Standard_Integer i = 1; i <= nbval; i++) |
354 | { |
355 | charDisplays->SetValue (i, another->CharacterDisplay(i)); |
356 | charWidths->SetValue (i, another->CharacterWidth(i)); |
357 | charHeights->SetValue (i, another->CharacterHeight(i)); |
358 | interCharSpaces->SetValue (i, another->InterCharacterSpace(i)); |
359 | interlineSpaces->SetValue (i, another->InterlineSpace(i)); |
360 | fontStyles->SetValue (i, another->FontStyle(i)); |
361 | charAngles->SetValue (i, another->CharacterAngle(i)); |
362 | controlCodeStrings->SetValue |
363 | (i, new TCollection_HAsciiString(another->ControlCodeString(i))); |
364 | nbChars->SetValue (i, another->NbCharacters(i)); |
365 | boxWidths->SetValue (i, another->BoxWidth(i)); |
366 | boxHeights->SetValue (i, another->BoxHeight(i)); |
367 | |
368 | if (another->IsCharSetEntity(i)) { |
369 | DeclareAndCast(IGESData_IGESEntity, charSetEntity, |
370 | TC.Transferred(another->CharSetEntity(i))); |
371 | charSetEntities->SetValue(i, charSetEntity); |
372 | } |
373 | else charSetCodes->SetValue(i, another->CharSetCode(i)); |
374 | |
375 | slantAngles->SetValue (i, another->SlantAngle(i)); |
376 | rotationAngles->SetValue (i, another->RotationAngle(i)); |
377 | mirrorFlags->SetValue (i, another->MirrorFlag(i)); |
378 | rotateFlags->SetValue (i, another->RotateFlag(i)); |
379 | startPoints->SetValue (i, another->StartPoint(i).XYZ()); |
380 | texts->SetValue |
381 | (i, new TCollection_HAsciiString(another->Text(i))); |
382 | } |
383 | |
384 | ent->Init (width, height, justifyCode, areaLoc, areaRotationAngle, baseLinePos, |
385 | normalInterlineSpace, charDisplays, charWidths, charHeights, |
386 | interCharSpaces, interlineSpaces, fontStyles, charAngles, |
387 | controlCodeStrings,nbChars, boxWidths, boxHeights, charSetCodes, |
388 | charSetEntities, slantAngles, rotationAngles, mirrorFlags, |
389 | rotateFlags, startPoints, texts); |
390 | |
391 | } |
392 | |
393 | IGESData_DirChecker IGESDimen_ToolNewGeneralNote::DirChecker |
394 | (const Handle(IGESDimen_NewGeneralNote)& /* ent */ ) const |
395 | { |
396 | IGESData_DirChecker DC (213, 0); |
397 | DC.Structure(IGESData_DefVoid); |
398 | DC.LineFont(IGESData_DefValue); |
399 | DC.LineWeight(IGESData_DefValue); |
400 | DC.Color(IGESData_DefAny); |
401 | DC.UseFlagRequired(1); |
402 | DC.HierarchyStatusIgnored(); |
403 | return DC; |
404 | } |
405 | |
406 | void IGESDimen_ToolNewGeneralNote::OwnCheck |
407 | (const Handle(IGESDimen_NewGeneralNote)& ent, |
408 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
409 | { |
410 | |
411 | Standard_Integer jcode = ent->JustifyCode(); |
412 | if ((jcode < 0) || (jcode > 3)) |
413 | ach->AddFail("Justify Code != 0, 1, 2, 3"); |
414 | Standard_Integer upper = ent->NbStrings(); |
415 | for (Standard_Integer i = 1; i <= upper; i ++) |
416 | { |
417 | if (ent->NbCharacters(i) != ent->Text(i)->Length()) |
418 | { |
419 | char mess[80]; |
420 | sprintf(mess,"%d : Number of Characters != Length of Text String",i); |
421 | ach->AddFail(mess); |
422 | } |
423 | |
424 | Standard_Integer charcode = ent->CharSetCode(i); |
425 | if ( (charcode >= 0) && (charcode != 1) && |
426 | ((charcode < 1001) || (charcode > 1003))) |
427 | { |
428 | char mess[80]; |
429 | sprintf(mess, "%d : Character Set Code != 1, 1001, 1002, 1003",i); |
430 | ach->AddFail(mess); |
431 | } |
432 | |
433 | Standard_Integer chardisp = ent->CharacterDisplay(i); |
434 | if ((chardisp < 0) || (chardisp > 1)) |
435 | { |
436 | char mess[80]; |
437 | sprintf(mess, "%d : Character Display != 0, 1",i); |
438 | ach->AddFail(mess); |
439 | } |
440 | |
441 | Standard_Integer mflag = ent->MirrorFlag(i); |
442 | if ((mflag < 0) || (mflag > 2)) |
443 | { |
444 | char mess[80]; |
445 | sprintf(mess, "%d : Mirror flag != 0, 1, 2",i); |
446 | ach->AddFail(mess); |
447 | } |
448 | |
449 | Standard_Integer rflag = ent->RotateFlag(i); |
450 | if ((rflag < 0) || (rflag > 1)) |
451 | { |
452 | char mess[80]; |
453 | sprintf(mess, "%d : Rotate flag != 0, 1",i); |
454 | ach->AddFail(mess); |
455 | } |
456 | } |
457 | } |
458 | |
459 | void IGESDimen_ToolNewGeneralNote::OwnDump |
460 | (const Handle(IGESDimen_NewGeneralNote)& ent, const IGESData_IGESDumper& dumper, |
461 | const Handle(Message_Messenger)& S, const Standard_Integer level) const |
462 | { |
463 | Standard_Integer sublevel = (level > 4) ? 1 : 0; |
464 | Standard_Integer nbval = ent->NbStrings(); |
465 | |
466 | S << "IGESDimen_NewGeneralNote" << endl; |
467 | S << "Text Area : Width : " << ent->TextWidth() << " "; |
468 | S << "Height : " << ent->TextHeight() << " "; |
469 | S << "Justification Code : " << ent->JustifyCode() << endl; |
470 | S << "Text Area Location Point : "; |
471 | IGESData_DumpXYZL(S,level, ent->AreaLocation(), ent->Location()); |
472 | S << "Rotation Angle of Text : " << ent->AreaRotationAngle() << endl; |
473 | S << "Base Line Position : "; |
474 | IGESData_DumpXYZL(S,level, ent->BaseLinePosition(), ent->Location()); |
475 | S << "Normal Interline Spacing : " << ent->NormalInterlineSpace() << endl; |
476 | S << "Number of Text Strings : " << nbval << endl; |
477 | |
478 | S << "Character Display : " << endl; |
479 | S << "Character Width : " << endl; |
480 | S << "Character Height : " << endl; |
481 | S << "Inter Character Spacing : " << endl; |
482 | S << "Interline Spacing : " << endl; |
483 | S << "Font Styles : " << endl; |
484 | S << "Character Angle : " << endl; |
485 | S << "Control Code String : " << endl; |
486 | S << "Number of Characters : " << endl; |
487 | S << "Box Widths : " << endl; |
488 | S << "Box Heights : " << endl; |
489 | S << "Character Set Codes : " << endl; |
490 | S << "Character Set Entities : " << endl; |
491 | S << "Slant Angles : " << endl; |
492 | S << "Rotation Angles : " << endl; |
493 | S << "Mirror Flags : " << endl; |
494 | S << "Rotate Flags : " << endl; |
495 | S << "Start Points : " << endl; |
496 | S << "Texts : "; |
497 | IGESData_DumpVals(S,-level,1, nbval, ent->NbCharacters); |
498 | S << endl; |
499 | if (level > 4) |
500 | { |
501 | S << "Details of each String" << endl; |
502 | for ( Standard_Integer i = 1; i <= nbval; i++) |
503 | { |
504 | S << "[" << i << "]: " << endl; |
505 | S << "Character Display : " << ent->CharacterDisplay(i) << " "; |
506 | S << "Character Width : " << ent->CharacterWidth(i) << " "; |
507 | S << "Character Height : " << ent->CharacterHeight(i) << endl; |
508 | S << "Inter Character Spacing : "<<ent->InterCharacterSpace(i)<<" "; |
509 | S << "Interline Spacing : " << ent->InterlineSpace(i) << endl; |
510 | S << "Font Styles : " << ent->FontStyle(i) << endl; |
511 | S << "Character Angle : " << ent->CharacterAngle(i) << endl; |
512 | S << "Control Code String : " ; |
513 | IGESData_DumpString(S,ent->ControlCodeString(i)); |
514 | S << endl; |
515 | S << "Number of Characters : " << ent->NbCharacters(i) << " "; |
516 | S << "Box Width : " << ent->BoxWidth(i) << " "; |
517 | S << "Box Height : " << ent->BoxHeight(i) << endl; |
518 | if (ent->IsCharSetEntity(i)) |
519 | { |
520 | S << "Character Set Entity : "; |
521 | dumper.Dump (ent->CharSetEntity(i),S, sublevel); |
522 | S << endl; |
523 | } |
524 | else |
525 | S << "Character Set Code : " << ent->CharSetCode(i) << endl; |
526 | |
527 | S << "Slant Angle : " << ent->SlantAngle(i) << " "; |
528 | S << "Rotation Angle : " << ent->RotationAngle(i) << " "; |
529 | S << "Mirror Flag : " << ent->MirrorFlag(i) << " "; |
530 | S << "Rotate Flag : " << ent->RotateFlag(i) << endl; |
531 | S << "Start Point : "; |
532 | IGESData_DumpXYZL(S,level, ent->StartPoint(i), ent->Location()); |
533 | S << "Text : "; |
534 | IGESData_DumpString(S,ent->Text(i)); |
535 | S << endl; |
536 | } |
537 | } |
538 | else S << endl; |
539 | } |