summaryrefslogtreecommitdiff
path: root/inc/IGESData_Dump.hxx
blob: f40eae84b70b3633f175c45d18b38741978dada2 (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
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
//		       --------------------------
//			    IGESData_Dump.hxx
//		       --------------------------
#include <gp_XY.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_XYZ.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Dir.hxx>
#include <gp_GTrsf.hxx>
#include <Interface_MSG.hxx>

//  ###############################################################
//
//  Macros to help Dumping Parts of IGES Entities
//  (for usefull and repetitive cases but which apply to different classes
//   but with similar signatures, such as Arrays)
//  Remember that the class IGESDumper processes itself individual dump of
//  IGESEntity

//  General Names are : IGESData_Dump***(S,arglist);  S being an output Stream

//  ---------------------------------------------------------------
//                          AVAILABLE MACROS

//  Dumping simple IGESEntity : see the class IGESDumper itself
//  Dumping a text as HAsciiString (either from PCollection or TCollection)
//  (manages an empty pointer) :
//  IGESData_DumpString(S,str)  displays   " "Content" " or "(undefined)"

//  Dumping Simple Data : Level must be managed by the caller
//  (general rule : Transformed Display to be used if Level > 5)

//  IGESData_DumpXY(S,XYval)               " (Xval,Yval)"         (no Transf)
//  IGESData_DumpXYT(S,XYVal,Trsf)         " (Xval,Yval)"         Z ignored
//  IGESData_DumpXYTZ(S,XYVal,Trsf,Z)      " (Xval,Yval,Zval)"    Z combined
//  IGESData_DumpXYZ(S,XYZval)             " (Xval,Yval,Zval)"    (no Transf)
//  IGESData_DumpXYZT(S,XYZval,Trsf)       " (Xval,Yval,Zval)"    (Transf)

//  Dumping Simple Data with Level : first displays Immediate Value, then
//  if Level > 5 and Transformation is not Identity, displays Transformed Value

//  IGESData_DumpXYL(S,Level,XYVal,Trsf)    " (Xval,Yval)  Transformed : (..)"
//  IGESData_DumpXYLZ(S,Level,XYVal,Trsf,Z) " (Xval,Yval,Zval)  Transformed :."
//  IGESData_DumpXYZL(S,Level,XYZval,Trsf)  " (Xval,Yval,Zval)  Transformed :."

//  Dumping Lists : general features
//      Lower and Upper are effective Values (immediate or given by functions).
//      Typically, give Lower = 1, Upper = ent->NbItems()
//      Item is the name of the access fonction (without its Index)
//      For Instance,   Item = compcurve->Curve  AND NOT  compcurve->Curve(..)
//      If Level is present, it commands more or less extensive display :
//        Level = 4, only limits are displayed
//  If it is a classic list, starting from 1 with a count (which can be 0),
//  displays "Count <upper> ..."  or "Empty". Else, display "(low - up) ..."
//        Level = 5, in addfition items are displayed shortly
//        (Entity Directory Numbers, XY/XYZ Coordinates)
//        Level > 5, in some cases, items are displayed with more details
//        (Entities with Type/Form, XY/XYZ with Transformed equivalents)

//  IGESData_DumpListVal(S,Lower,Upper,Item)   Item can be Real,Integer,
//                more generally, any type having operator << to Handle(Message_Messenger)
//  IGESData_DumpListXY(S,Lower,Upper,Item)    Item : XY without Transformation
//  IGESData_DumpListXYZ(S,Lower,Upper,Item)   Item : XYZ without Transf

//  IGESData_DumpVals(S,Level,Lower,Upper,Item)             Item : Real,Integer
//  IGESData_DumpListXYL(S,Level,Lower,Upper,Item,Trsf)     Item : XY
//  IGESData_DumpListXYLZ(S,Level,Lower,Upper,Item,Trsf,Z)  Item : XY. Z is a
//                Common Displacement
//  IGESData_DumpListXYZL(S,Level,Lower,Upper,Item,Trsf)    Item : XYZ

//  IGESData_DumpStrings(S,Level,Lower,Upper,Item)          Item : HAsciiString
//  IGESData_DumpEntities(S,Dumper,Level,Lower,Upper,Item)  Item : IGESEntity
//                Dumper is an IGESDumper which displays IGES Entities

//  Dumping Complex Arrays : only the most useful cases are taken into account
//  Doubles Arrays (Rectangles) and Single Arrays of Single Arrays (Jagged)

//  IGESData_DumpRectVals(S,Level,LowerRow,UpperRow,LowerCol,UpperCol,Item) 
//           LowerRow,LowerCol,UpperRow,UpperCol : effective values
//           Item : Real,Integer

//  ---------------------------------------------------------------

#define IGESData_DumpString(S,str) \
  if (str.IsNull()) S << "(undefined)";\
  else {  S << '"' << str << '"';  }

#define IGESData_DumpXY(S,XYval) \
 S << " (" << XYval.X() << "," << XYval.Y() << ")"

#define IGESData_DumpXYZ(S,XYZval) \
  S << " (" << XYZval.X() << "," << XYZval.Y() << "," << XYZval.Z() << ")"


#define IGESData_DumpXYT(S,XYval,Trsf) \
{\
  gp_XYZ XYZval(XYval.X(),XYval.Y(),0.);\
  Trsf.Transforms(XYZval);\
  IGESData_DumpXY(S,XYZval);\
}

#define IGESData_DumpXYTZ(S,XYval,Trsf,Z) \
{\
  gp_XYZ XYZval(XYval.X(),XYval.Y(),Z);\
  Trsf.Transforms(XYZval);\
  IGESData_DumpXYZ(S,XYZval);\
}

#define IGESData_DumpXYZT(S,XYZval,Trsf) \
{\
  gp_XYZ XYZTval(XYZval.X(),XYZval.Y(),XYZval.Z());\
  Trsf.Transforms(XYZTval);\
  IGESData_DumpXYZ(S,XYZTval);\
}


#define IGESData_DumpXYL(S,Level,XYval,Trsf) \
{\
  IGESData_DumpXY(S,XYval);\
  if (Level > 5 && Trsf.Form() != gp_Identity) {\
    S << "  Transformed :";\
    IGESData_DumpXYT(S,XYval,Trsf);\
  }\
}

#define IGESData_DumpXYLZ(S,Level,XYval,Trsf,Z) \
{\
  IGESData_DumpXY(S,XYval);\
  if (Level > 5 && Trsf.Form() != gp_Identity) {\
    S << "  Transformed :";\
    IGESData_DumpXYTZ(S,XYval,Trsf,Z);\
  }\
}

#define IGESData_DumpXYZL(S,Level,XYZval,Trsf) \
{\
  IGESData_DumpXYZ(S,XYZval);\
  if (Level > 5 && Trsf.Form() != gp_Identity) {\
    S << "  Transformed :";\
    IGESData_DumpXYZT(S,XYZval,Trsf);\
  }\
}


#define IGESData_DumpListHeader(S,lower,upper) \
{\
  if (lower > upper) S << " (Empty List)";\
  else if (lower == 1) S << " (Count : " << upper << ")";\
  else S << " (" << lower << " - " << upper << ")";\
}


#define IGESData_DumpListVal(S,lower,upper,item) \
{\
  Standard_Integer lo = lower;  Standard_Integer up = upper;\
  IGESData_DumpListHeader(S,lo,up);\
  S << " :";\
  for (Standard_Integer iopa = lo; iopa <= up; iopa ++)  S << " " << item(iopa);\
}

#define IGESData_DumpListXY(S,lower,upper,item) \
{\
  Standard_Integer lo = lower;  Standard_Integer up = upper;\
  IGESData_DumpListHeader(S,lo,up);\
  S << " :";\
  for (Standard_Integer iopa = lo; iopa <= up; iopa ++) IGESData_DumpXY(S,item(iopa));\
}

#define IGESData_DumpListXYZ(S,lower,upper,item) \
{\
  Standard_Integer lo = lower;  Standard_Integer up = upper;\
  IGESData_DumpListHeader(S,lo,up);\
  S << " :";\
  for (Standard_Integer iopa = lo; iopa <= up; iopa ++) IGESData_DumpXYZ(S,item(iopa));\
}


#define IGESData_DumpVals(S,Level,lower,upper,item) \
{\
  Standard_Integer lo = lower;  Standard_Integer up = upper;\
  IGESData_DumpListHeader(S,lo,up);\
  if (lo > up) {}\
  else if (Level == 4 || Level == -4) S <<" [content : ask level > 4]";\
  else if (Level > 0) {\
    S << " :";\
    for (Standard_Integer iopa = lo; iopa <= up; iopa ++)  S << " " << item(iopa);\
  }\
}

#define IGESData_DumpListXYL(S,Level,lower,upper,item,Trsf) \
{\
  Standard_Integer lo = lower;  Standard_Integer up = upper;\
  IGESData_DumpListHeader(S,lo,up);\
  if (lo > up) {}\
  else if (Level == 4 || Level == -4)\
    S <<" [content : ask level > 4, transformed : level > 5]";\
  else if (Level > 0) {\
    S << " :";\
    for (Standard_Integer iopa = lo; iopa <= up; iopa ++) IGESData_DumpXY(S,item(iopa));\
    if (Trsf.Form() != gp_Identity) {\
      S<< "\n Transformed :";\
      if (Level == 5) S<<" [ask level > 5]";\
      else\
	for (Standard_Integer jopa = lo; jopa <= up; jopa ++)\
	  IGESData_DumpXYT(S,item(jopa),Trsf);\
    }\
  }\
}

#define IGESData_DumpListXYLZ(S,Level,lower,upper,item,Trsf,Z) \
{\
  Standard_Integer lo = lower;  Standard_Integer up = upper;\
  IGESData_DumpListHeader(S,lo,up);\
  if (lo > up) {}\
  else if (Level == 4 || Level == -4)\
    S <<" [content : ask level > 4, transformed : level > 5]";\
  else if (Level > 0) {\
    S << " :";\
    for (Standard_Integer iopa = lo; iopa <= up; iopa ++) IGESData_DumpXY(S,item(iopa));\
    if (Trsf.Form() != gp_Identity) {\
      S<< "\n Transformed :";\
      if (Level == 5) S<<" [ask level > 5]";\
      else\
	for (Standard_Integer jopa = lo; jopa <= up; jopa ++)\
	  IGESData_DumpXYTZ(S,item(jopa),Trsf,Z);\
    }\
  }\
}


#define IGESData_DumpListXYZL(S,Level,lower,upper,item,Trsf) \
{\
  Standard_Integer lo = lower;  Standard_Integer up = upper;\
  IGESData_DumpListHeader(S,lo,up);\
  if (lo > up) {}\
  else if (Level == 4 || Level == -4)\
    S <<" [content : ask level > 4, transformed : level > 5]";\
  else if (Level > 0) {\
    S << " :";\
    for (Standard_Integer iopa = lo; iopa <= up; iopa ++) IGESData_DumpXYZ(S,item(iopa));\
    if (Trsf.Form() != gp_Identity) {\
      S<< "\n Transformed :";\
      if (Level == 5) S<<" [ask level > 5]";\
      else\
	for (Standard_Integer jopa = lo; jopa <= up; jopa ++)\
	  IGESData_DumpXYZT(S,item(jopa),Trsf);\
    }\
  }\
}


#define IGESData_DumpStrings(S,Level,lower,upper,item) \
{\
  Standard_Integer lo = lower;  Standard_Integer up = upper;\
  IGESData_DumpListHeader(S,lo,up);\
  if (lo > up) {}\
  else if (Level == 4 || Level == -4) S <<" [content : ask level > 4]";\
  else if (Level > 0) {\
    S << " :";\
    for (Standard_Integer iopa = lo; iopa <= up; iopa ++)\
      {  S << "\n["<<Interface_MSG::Blanks(iopa,3)<<iopa<<"]:\"" << item(iopa) << '"';  }\
    S << "\n";\
  }\
}

#define IGESData_DumpEntities(S,dumper,Level,lower,upper,item) \
{\
  Standard_Integer lo = lower;  Standard_Integer up = upper;\
  IGESData_DumpListHeader(S,lo,up);\
  if (lo > up) {}\
  else if (Level == 4 || Level == -4) S <<" [content : ask level > 4]";\
  else if (Level > 0) {\
    S << " :";\
    for (Standard_Integer iopa = lo; iopa <= up; iopa ++) {\
      if (Level == 5) {  S << " " ;           dumper.PrintDNum  (item(iopa),S); }\
      else            {  S << "\n["<<Interface_MSG::Blanks(iopa,3)<<iopa<<"]:"; dumper.PrintShort (item(iopa),S); }\
    }\
  }\
}


#define  IGESData_DumpRectVals(S,Level,LowCol,UpCol,LowRow,UpRow,Item)  \
{\
  int loco = LowCol; int upc = UpCol;  int lor = LowRow; int upr = UpRow;\
  S <<" (Row :"<< lor <<" - "<< upr <<" ; Col :"<< loco <<" - "<< upc <<")";\
  if (loco > upc || lor > upr) {}\
  else if (Level == 4 || Level == -4) S <<" [content : ask level > 4]";\
  else if (Level > 0) {\
    S << "\n";\
    for (int ir = lor; ir <= upr; ir ++) {\
      S << "Row "<<ir<<":[";\
      for (int ic = loco; ic <= upc; ic ++)  S << " " << Item(ic,ir);\
      S << " ]\n";\
    }\
  }\
}