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
|
//--------------------------------------------------------------------
//
// File Name : IGESAppli_Flow.cxx
// Date :
// Author : CKY / Contract Toubro-Larsen
// Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------
#include <IGESAppli_ToolFlow.ixx>
#include <IGESData_ParamCursor.hxx>
#include <IGESGraph_TextDisplayTemplate.hxx>
#include <TCollection_HAsciiString.hxx>
#include <IGESData_IGESEntity.hxx>
#include <IGESDraw_ConnectPoint.hxx>
#include <IGESDraw_HArray1OfConnectPoint.hxx>
#include <Interface_HArray1OfHAsciiString.hxx>
#include <IGESGraph_HArray1OfTextDisplayTemplate.hxx>
#include <IGESData_HArray1OfIGESEntity.hxx>
#include <IGESData_Dump.hxx>
#include <Interface_Macros.hxx>
IGESAppli_ToolFlow::IGESAppli_ToolFlow () { }
void IGESAppli_ToolFlow::ReadOwnParams
(const Handle(IGESAppli_Flow)& ent,
const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
{
//Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
Standard_Integer tempNbContextFlags;
Standard_Integer tempTypeOfFlow;
Standard_Integer tempFunctionFlag;
Standard_Integer i, nf,nc,nj,nn,nt,np;
Handle(IGESData_HArray1OfIGESEntity) tempFlowAssocs;
Handle(IGESDraw_HArray1OfConnectPoint) tempConnectPoints;
Handle(IGESData_HArray1OfIGESEntity) tempJoins;
Handle(Interface_HArray1OfHAsciiString) tempFlowNames;
Handle(IGESGraph_HArray1OfTextDisplayTemplate) tempTextDisplayTemplates;
Handle(IGESData_HArray1OfIGESEntity) tempContFlowAssocs;
//szv#4:S4163:12Mar99 `st=` not needed
if (PR.DefinedElseSkip())
PR.ReadInteger(PR.Current(), "Number of Context Flags", tempNbContextFlags);
else
tempNbContextFlags = 2;
//szv#4:S4163:12Mar99 moved in if
if (!PR.ReadInteger(PR.Current(), "Number of Flow Associativities", nf)) nf = 0;
if (nf > 0) tempFlowAssocs = new IGESData_HArray1OfIGESEntity(1, nf);
else PR.AddFail ("Number of Flow Associativities: Not Positive");
if (!PR.ReadInteger(PR.Current(), "Number of Connect Points", nc)) nc = 0;
if (nc > 0) tempConnectPoints = new IGESDraw_HArray1OfConnectPoint(1, nc);
else PR.AddFail("Number of Connect Points: Not Positive");
if (!PR.ReadInteger(PR.Current(), "Number of Joins", nj)) nj = 0;
if (nj > 0) tempJoins = new IGESData_HArray1OfIGESEntity(1, nj);
else PR.AddFail("Number of Joins: Not Positive");
if (!PR.ReadInteger(PR.Current(), "Number of Flow Names", nn)) nn = 0;
if (nn > 0) tempFlowNames = new Interface_HArray1OfHAsciiString(1, nn);
else PR.AddFail("Number of Flow Names: Not Positive");
if (!PR.ReadInteger(PR.Current(), "Number of Text Displays", nt)) nt = 0;
if (nt > 0) tempTextDisplayTemplates =
new IGESGraph_HArray1OfTextDisplayTemplate(1, nt);
else PR.AddFail("Number of Text Displays: Not Positive");
if (!PR.ReadInteger(PR.Current(), "Number of Continuation Flows", np)) np = 0;
if (np > 0) tempContFlowAssocs = new IGESData_HArray1OfIGESEntity(1, np);
else PR.AddFail("Number of Continuation Flows Not Positive");
if (PR.DefinedElseSkip())
PR.ReadInteger(PR.Current(), "Type of Flow", tempTypeOfFlow);
else
tempTypeOfFlow = 0;
if (PR.DefinedElseSkip())
PR.ReadInteger(PR.Current(), "Function Flag", tempFunctionFlag);
else
tempFunctionFlag = 0;
for ( i = 1; i <= nf; i++ ) {
Handle(IGESData_IGESEntity) tempEntity;
if (PR.ReadEntity(IR, PR.Current(), "Flow Associativity", tempEntity))
tempFlowAssocs->SetValue(i, tempEntity);
}
for ( i = 1; i <= nc; i++ ) {
Handle(IGESDraw_ConnectPoint) tempEntity;
if (PR.ReadEntity(IR, PR.Current(), "Connect Point", STANDARD_TYPE(IGESDraw_ConnectPoint), tempEntity))
tempConnectPoints->SetValue(i, tempEntity);
}
for ( i = 1; i <= nj; i++ ) {
Handle(IGESData_IGESEntity) tempEntity;
if (PR.ReadEntity(IR, PR.Current(), "Join", tempEntity))
tempJoins->SetValue(i, tempEntity);
}
for ( i = 1; i <= nn; i++ ) {
Handle(TCollection_HAsciiString) tempString;
if (PR.ReadText(PR.Current(), "Flow Name", tempString))
tempFlowNames->SetValue(i, tempString);
}
for ( i = 1; i <= nt; i++ ) {
Handle(IGESGraph_TextDisplayTemplate) tempEntity;
if (PR.ReadEntity(IR, PR.Current(), "Text Display Template",
STANDARD_TYPE(IGESGraph_TextDisplayTemplate), tempEntity))
tempTextDisplayTemplates->SetValue(i, tempEntity);
}
for ( i = 1; i <= np; i++ ) {
Handle(IGESData_IGESEntity) tempEntity;
if (PR.ReadEntity(IR, PR.Current(), "Continuation Flow Associativities", tempEntity))
tempContFlowAssocs->SetValue(i, tempEntity);
}
DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
ent->Init(tempNbContextFlags, tempTypeOfFlow, tempFunctionFlag,
tempFlowAssocs, tempConnectPoints, tempJoins, tempFlowNames,
tempTextDisplayTemplates, tempContFlowAssocs);
}
void IGESAppli_ToolFlow::WriteOwnParams
(const Handle(IGESAppli_Flow)& ent, IGESData_IGESWriter& IW) const
{
Standard_Integer i, num;
IW.Send(ent->NbContextFlags());
IW.Send(ent->NbFlowAssociativities());
IW.Send(ent->NbConnectPoints());
IW.Send(ent->NbJoins());
IW.Send(ent->NbFlowNames());
IW.Send(ent->NbTextDisplayTemplates());
IW.Send(ent->NbContFlowAssociativities());
IW.Send(ent->TypeOfFlow());
IW.Send(ent->FunctionFlag());
for ( num = ent->NbFlowAssociativities(), i = 1; i <= num; i++ )
IW.Send(ent->FlowAssociativity(i));
for ( num = ent->NbConnectPoints(), i = 1; i <= num; i++ )
IW.Send(ent->ConnectPoint(i));
for ( num = ent->NbJoins(), i = 1; i <= num; i++ )
IW.Send(ent->Join(i));
for ( num = ent->NbFlowNames(), i = 1; i <= num; i++ )
IW.Send(ent->FlowName(i));
for ( num = ent->NbTextDisplayTemplates(), i = 1; i <= num; i++ )
IW.Send(ent->TextDisplayTemplate(i));
for ( num = ent->NbContFlowAssociativities(), i = 1; i <= num; i++ )
IW.Send(ent->ContFlowAssociativity(i));
}
void IGESAppli_ToolFlow::OwnShared
(const Handle(IGESAppli_Flow)& ent, Interface_EntityIterator& iter) const
{
Standard_Integer i, num;
for ( num = ent->NbFlowAssociativities(), i = 1; i <= num; i++ )
iter.GetOneItem(ent->FlowAssociativity(i));
for ( num = ent->NbConnectPoints(), i = 1; i <= num; i++ )
iter.GetOneItem(ent->ConnectPoint(i));
for ( num = ent->NbJoins(), i = 1; i <= num; i++ )
iter.GetOneItem(ent->Join(i));
for ( num = ent->NbTextDisplayTemplates(), i = 1; i <= num; i++ )
iter.GetOneItem(ent->TextDisplayTemplate(i));
for ( num = ent->NbContFlowAssociativities(), i = 1; i <= num; i++ )
iter.GetOneItem(ent->ContFlowAssociativity(i));
}
void IGESAppli_ToolFlow::OwnCopy
(const Handle(IGESAppli_Flow)& another,
const Handle(IGESAppli_Flow)& ent, Interface_CopyTool& TC) const
{
Standard_Integer tempNbContextFlags = another->NbContextFlags();
Standard_Integer tempTypeOfFlow = another->TypeOfFlow();
Standard_Integer tempFunctionFlag = another->FunctionFlag();
Standard_Integer i, num;
num = another->NbFlowAssociativities();
Handle(IGESData_HArray1OfIGESEntity) tempFlowAssocs;
if (num > 0) tempFlowAssocs = new IGESData_HArray1OfIGESEntity(1, num);
for ( i = 1; i <= num; i++ )
{
DeclareAndCast(IGESData_IGESEntity, new_item,
TC.Transferred(another->FlowAssociativity(i)));
tempFlowAssocs->SetValue(i, new_item);
}
num = another->NbConnectPoints();
Handle(IGESDraw_HArray1OfConnectPoint) tempConnectPoints;
if (num > 0) tempConnectPoints = new IGESDraw_HArray1OfConnectPoint(1, num);
for ( i = 1; i <= num; i++ )
{
DeclareAndCast(IGESDraw_ConnectPoint, new_item,
TC.Transferred(another->ConnectPoint(i)));
tempConnectPoints->SetValue(i, new_item);
}
num = another->NbJoins();
Handle(IGESData_HArray1OfIGESEntity) tempJoins;
if (num > 0) tempJoins = new IGESData_HArray1OfIGESEntity(1, num);
for ( i = 1; i <= num; i++ )
{
DeclareAndCast(IGESData_IGESEntity, new_item,
TC.Transferred(another->Join(i)));
tempJoins->SetValue(i, new_item);
}
num = another->NbFlowNames();
Handle(Interface_HArray1OfHAsciiString) tempFlowNames;
if (num > 0) tempFlowNames = new Interface_HArray1OfHAsciiString(1, num);
for ( i = 1; i <= num; i++ )
tempFlowNames->SetValue
(i, new TCollection_HAsciiString(another->FlowName(i)));
num = another->NbTextDisplayTemplates();
Handle(IGESGraph_HArray1OfTextDisplayTemplate) tempTextDisplayTemplates;
if (num > 0) tempTextDisplayTemplates =
new IGESGraph_HArray1OfTextDisplayTemplate(1, num);
for ( i = 1; i <= num; i++ )
{
DeclareAndCast(IGESGraph_TextDisplayTemplate, new_item,
TC.Transferred(another->TextDisplayTemplate(i)));
tempTextDisplayTemplates->SetValue(i, new_item);
}
num = another->NbContFlowAssociativities();
Handle(IGESData_HArray1OfIGESEntity) tempContFlowAssocs;
if (num > 0) tempContFlowAssocs = new IGESData_HArray1OfIGESEntity(1, num);
for ( i = 1; i <= num; i++ )
{
DeclareAndCast(IGESData_IGESEntity, new_item,
TC.Transferred(another->ContFlowAssociativity(i)));
tempContFlowAssocs->SetValue(i, new_item);
}
ent->Init (tempNbContextFlags, tempTypeOfFlow, tempFunctionFlag,
tempFlowAssocs, tempConnectPoints, tempJoins, tempFlowNames,
tempTextDisplayTemplates, tempContFlowAssocs);
}
Standard_Boolean IGESAppli_ToolFlow::OwnCorrect
(const Handle(IGESAppli_Flow)& ent) const
{
return ent->OwnCorrect(); // nbcontextflags = 2
}
IGESData_DirChecker IGESAppli_ToolFlow::DirChecker
(const Handle(IGESAppli_Flow)& /* ent */ ) const
{
IGESData_DirChecker DC(402, 18);
DC.Structure(IGESData_DefVoid);
DC.GraphicsIgnored();
DC.LineFont(IGESData_DefVoid);
DC.LineWeight(IGESData_DefVoid);
DC.Color(IGESData_DefVoid);
DC.BlankStatusIgnored();
DC.UseFlagRequired(3);
DC.HierarchyStatusIgnored();
return DC;
}
void IGESAppli_ToolFlow::OwnCheck
(const Handle(IGESAppli_Flow)& ent,
const Interface_ShareTool& , Handle(Interface_Check)& ach) const
{
if (ent->NbContextFlags() != 2)
ach->AddFail("Number of Context Flags != 2");
if ((ent->TypeOfFlow() < 0) || (ent->TypeOfFlow() > 2))
ach->AddFail("Type of Flow != 0,1,2");
if ((ent->FunctionFlag() < 0) || (ent->FunctionFlag() > 2))
ach->AddFail("Function Flag != 0,1,2");
}
void IGESAppli_ToolFlow::OwnDump
(const Handle(IGESAppli_Flow)& ent, const IGESData_IGESDumper& dumper,
const Handle(Message_Messenger)& S, const Standard_Integer level) const
{
S << "IGESAppli_Flow" << endl;
S << "Number of Context Flags : " << ent->NbContextFlags() << endl;
Standard_Integer tf = ent->TypeOfFlow();
S << "Type of Flow : " << tf;
if (tf == 1) S << " (logical)" << endl;
else if (tf == 2) S << " (physical)" << endl;
else S << " (not specified)" << endl;
tf = ent->FunctionFlag();
S << "Function Flag : " << tf;
if (tf == 1) S << " (electrical signal)" << endl;
else if (tf == 2) S << " (fluid flow path)" << endl;
else S << " (not specified)" << endl;
S << "Flow Associativities : ";
IGESData_DumpEntities(S,dumper ,level,1, ent->NbFlowAssociativities(),
ent->FlowAssociativity);
S << endl << "Connect Points : ";
IGESData_DumpEntities(S,dumper ,level,1, ent->NbConnectPoints(),
ent->ConnectPoint);
S << endl << "Joins : ";
IGESData_DumpEntities(S,dumper ,level,1, ent->NbJoins(),ent->Join);
S << endl << "Flow Names : ";
IGESData_DumpStrings(S ,level,1, ent->NbFlowNames(),ent->FlowName);
S << endl << "Text Display Templates : ";
IGESData_DumpEntities(S,dumper ,level,1, ent->NbTextDisplayTemplates(),
ent->TextDisplayTemplate);
S << endl << "Continuation Flow Associativities : ";
IGESData_DumpEntities(S,dumper ,level,1, ent->NbContFlowAssociativities(),
ent->ContFlowAssociativity);
S << endl;
}
|