973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
42cf5bc1 |
14 | |
15 | #include <IFSelect_AppliedModifiers.hxx> |
7fd59977 |
16 | #include <IFSelect_ContextModif.hxx> |
17 | #include <IFSelect_ContextWrite.hxx> |
42cf5bc1 |
18 | #include <IFSelect_GeneralModifier.hxx> |
19 | #include <IFSelect_ModelCopier.hxx> |
20 | #include <IFSelect_Modifier.hxx> |
21 | #include <IFSelect_Selection.hxx> |
22 | #include <IFSelect_ShareOut.hxx> |
23 | #include <IFSelect_ShareOutResult.hxx> |
24 | #include <IFSelect_WorkLibrary.hxx> |
7fd59977 |
25 | #include <Interface_Check.hxx> |
26 | #include <Interface_CheckIterator.hxx> |
42cf5bc1 |
27 | #include <Interface_CopyTool.hxx> |
28 | #include <Interface_EntityIterator.hxx> |
7fd59977 |
29 | #include <Interface_GeneralLib.hxx> |
42cf5bc1 |
30 | #include <Interface_Graph.hxx> |
31 | #include <Interface_InterfaceModel.hxx> |
32 | #include <Interface_Protocol.hxx> |
7fd59977 |
33 | #include <Message.hxx> |
42cf5bc1 |
34 | #include <Message_Messenger.hxx> |
35 | #include <Standard_Type.hxx> |
36 | #include <TCollection_AsciiString.hxx> |
37 | #include <TCollection_HAsciiString.hxx> |
38 | #include <TColStd_HSequenceOfInteger.hxx> |
7fd59977 |
39 | |
42cf5bc1 |
40 | #include <stdio.h> |
92efcf78 |
41 | IMPLEMENT_STANDARD_RTTIEXT(IFSelect_ModelCopier,MMgt_TShared) |
42 | |
7fd59977 |
43 | //#define MISOPOINT |
b311480e |
44 | IFSelect_ModelCopier::IFSelect_ModelCopier () { } |
7fd59977 |
45 | |
46 | void IFSelect_ModelCopier::SetShareOut |
47 | (const Handle(IFSelect_ShareOut)& sho) |
48 | { theshareout = sho; } |
49 | |
50 | |
51 | // ######################################################################## |
52 | // ######## OPERATIONS DE TRANSFERT GLOBAL (memorise ou non) ######## |
53 | |
54 | |
55 | void IFSelect_ModelCopier::ClearResult () |
56 | { thefilemodels.Clear(); thefilenames.Clear(); theapplieds.Clear(); |
57 | theremain.Nullify(); } |
58 | |
59 | |
60 | Standard_Boolean IFSelect_ModelCopier::AddFile |
61 | (const TCollection_AsciiString& filename, |
62 | const Handle(Interface_InterfaceModel)& content) |
63 | { |
64 | Standard_Integer nb = thefilenames.Length(); |
65 | for (Standard_Integer i = 1; i <= nb; i ++) { |
66 | if (filename.IsEmpty()) continue; |
67 | if (thefilenames(i).IsEqual(filename)) return Standard_False; |
68 | } |
69 | Handle(IFSelect_AppliedModifiers) nulapplied; |
70 | thefilenames.Append (filename); |
71 | thefilemodels.Append (content); |
72 | theapplieds.Append (nulapplied); |
73 | return Standard_True; |
74 | } |
75 | |
76 | Standard_Boolean IFSelect_ModelCopier::NameFile |
77 | (const Standard_Integer num, |
78 | const TCollection_AsciiString& filename) |
79 | { |
80 | Standard_Integer nb = thefilenames.Length(); |
81 | if (num <= 0 || num > nb) return Standard_False; |
82 | for (Standard_Integer i = 1; i <= nb; i ++) { |
83 | if (filename.IsEmpty()) continue; |
84 | if (thefilenames(i).IsEqual(filename)) return Standard_False; |
85 | } |
86 | thefilenames.SetValue(num,filename); |
87 | return Standard_True; |
88 | } |
89 | |
90 | Standard_Boolean IFSelect_ModelCopier::ClearFile |
91 | (const Standard_Integer num) |
92 | { |
93 | Standard_Integer nb = thefilenames.Length(); |
94 | if (num <= 0 || num > nb) return Standard_False; |
95 | thefilenames.ChangeValue(num).Clear(); |
96 | return Standard_True; |
97 | } |
98 | |
99 | Standard_Boolean IFSelect_ModelCopier::SetAppliedModifiers |
100 | (const Standard_Integer num, const Handle(IFSelect_AppliedModifiers)& applied) |
101 | { |
102 | Standard_Integer nb = theapplieds.Length(); |
103 | if (num <= 0 || num > nb) return Standard_False; |
104 | theapplieds.SetValue(num,applied); |
105 | return Standard_True; |
106 | } |
107 | |
108 | Standard_Boolean IFSelect_ModelCopier::ClearAppliedModifiers |
109 | (const Standard_Integer num) |
110 | { |
111 | Standard_Integer nb = theapplieds.Length(); |
112 | if (num <= 0 || num > nb) return Standard_False; |
113 | theapplieds.ChangeValue(num).Nullify(); |
114 | return Standard_True; |
115 | } |
116 | |
117 | // .... Copy : Opere les Transferts, les Memorise (pas d envoi fichier ici) |
118 | |
119 | Interface_CheckIterator IFSelect_ModelCopier::Copy |
120 | (IFSelect_ShareOutResult& eval, |
121 | const Handle(IFSelect_WorkLibrary)& WL, |
122 | const Handle(Interface_Protocol)& protocol) |
123 | { |
124 | Interface_CopyTool TC (eval.Graph().Model(), protocol); |
125 | return Copying (eval,WL,protocol,TC); |
126 | } |
127 | |
128 | // Copy Interne |
129 | |
130 | Interface_CheckIterator IFSelect_ModelCopier::Copying |
131 | (IFSelect_ShareOutResult& eval, |
132 | const Handle(IFSelect_WorkLibrary)& WL, |
133 | const Handle(Interface_Protocol)& protocol, |
134 | Interface_CopyTool& TC) |
135 | { |
136 | Message::DefaultMessenger() << |
137 | "** WorkSession : Copying split data before sending"<<endl; |
138 | const Interface_Graph& G = eval.Graph(); |
139 | Interface_CheckIterator checks; |
140 | theshareout = eval.ShareOut(); |
141 | theremain = new TColStd_HArray1OfInteger(0,G.Size()); theremain->Init(0); |
142 | for (eval.Evaluate(); eval.More(); eval.Next()) { |
143 | Handle(Interface_InterfaceModel) model; |
144 | TCollection_AsciiString filename = eval.FileName(); |
145 | Standard_Integer dispnum = eval.DispatchRank(); |
146 | Standard_Integer numod, nbmod; |
147 | eval.PacketsInDispatch (numod,nbmod); |
148 | Handle(IFSelect_AppliedModifiers) curapp; |
149 | CopiedModel (G, WL,protocol, eval.PacketRoot(), filename,dispnum,numod, TC, |
150 | model, curapp,checks); |
151 | |
152 | AddFile (filename, model); |
153 | theapplieds.SetValue (theapplieds.Length(), curapp); |
154 | } |
155 | theshareout->SetLastRun (theshareout->NbDispatches()); |
156 | checks.SetName ("X-STEP WorkSession : Split Copy (no Write)"); |
157 | return checks; |
158 | } |
159 | |
160 | // Send a deux arguments : Envoi Fichier du Resultat deja memorise |
161 | |
162 | Interface_CheckIterator IFSelect_ModelCopier::SendCopied |
163 | (const Handle(IFSelect_WorkLibrary)& WL, |
164 | const Handle(Interface_Protocol)& protocol) |
165 | { |
166 | Message::DefaultMessenger() << |
167 | "** WorkSession : Sending split data already copied"<<endl; |
168 | Standard_Integer nb = NbFiles(); |
169 | Interface_CheckIterator checks; |
170 | if (nb > 0) { |
171 | for (Standard_Integer i = 1; i <= nb; i ++) { |
172 | if (FileName(i).Length() == 0) continue; |
173 | Handle(IFSelect_AppliedModifiers) curapp = theapplieds.Value(i); |
174 | IFSelect_ContextWrite ctx (FileModel(i),protocol,curapp,FileName(i).ToCString()); |
175 | Standard_Boolean res = WL->WriteFile (ctx); |
176 | Interface_CheckIterator checklst = ctx.CheckList(); |
177 | checks.Merge(checklst); |
178 | // (FileName(i).ToCString(), FileModel(i),protocol,curapp,checks); |
179 | // if (!checks.IsEmpty(Standard_False)) { |
180 | // sout<<" ** On Sending File n0."<<i<<", Check Messages : **"<<endl; |
181 | // checks.Print (sout,Standard_False); |
182 | // } |
183 | if (!res) { |
184 | char mess[100]; sprintf(mess,"Split Send (WriteFile) abandon on file n0.%d",i); |
185 | checks.CCheck(0)->AddFail (mess); |
186 | Message::DefaultMessenger() << |
187 | " ** Sending File n0."<<i<<" has failed, abandon **"<<endl; |
188 | return checks; |
189 | } |
190 | AddSentFile (FileName(i).ToCString()); |
191 | } |
192 | ClearResult(); |
193 | } |
194 | checks.SetName ("X-STEP WorkSession : Split Send (Copy+Write)"); |
195 | return checks; |
196 | } |
197 | |
198 | |
199 | // .... Send a 4 arguments : Calcul du Transfert et Envoi sur Fichier |
200 | |
201 | Interface_CheckIterator IFSelect_ModelCopier::Send |
202 | (IFSelect_ShareOutResult& eval, |
203 | const Handle(IFSelect_WorkLibrary)& WL, |
204 | const Handle(Interface_Protocol)& protocol) |
205 | { |
206 | Interface_CopyTool TC (eval.Graph().Model(), protocol); |
207 | return Sending (eval,WL,protocol,TC); |
208 | } |
209 | |
210 | Interface_CheckIterator IFSelect_ModelCopier::Sending |
211 | (IFSelect_ShareOutResult& eval, |
212 | const Handle(IFSelect_WorkLibrary)& WL, |
213 | const Handle(Interface_Protocol)& protocol, |
214 | Interface_CopyTool& TC) |
215 | { |
216 | const Interface_Graph& G = eval.Graph(); |
217 | Interface_CheckIterator checks; |
218 | Standard_Integer i = 0; |
219 | Message::DefaultMessenger() << |
220 | "** WorkSession : Copying then sending split data"<<endl; |
221 | theshareout = eval.ShareOut(); |
222 | theremain = new TColStd_HArray1OfInteger(0,G.Size()); theremain->Init(0); |
223 | for (eval.Evaluate(); eval.More(); eval.Next()) { |
224 | i ++; |
225 | Handle(Interface_InterfaceModel) model; |
226 | TCollection_AsciiString filename = eval.FileName(); |
227 | Standard_Integer dispnum = eval.DispatchRank(); |
228 | Standard_Integer numod, nbmod; |
229 | eval.PacketsInDispatch (numod,nbmod); |
230 | Handle(IFSelect_AppliedModifiers) curapp; |
231 | CopiedModel (G, WL,protocol, eval.PacketRoot(), filename,dispnum,numod, TC, |
232 | model, curapp, checks); |
233 | IFSelect_ContextWrite ctx (model,protocol,curapp,filename.ToCString()); |
234 | Standard_Boolean res = WL->WriteFile (ctx); |
235 | Interface_CheckIterator checklst = ctx.CheckList(); |
236 | checks.Merge(checklst); |
237 | // (filename.ToCString(), model, protocol, curapp, checks); |
238 | // if (!checks.IsEmpty(Standard_False)) { |
239 | // sout<<" ** On Sending File "<<filename<<", Check Messages : **"<<endl; |
240 | // checks.Print (sout,model,Standard_False); |
241 | // } |
242 | if (!res) { |
243 | char mess[100]; sprintf(mess,"Split Send (WriteFile) abandon on file n0.%d",i); |
244 | checks.CCheck(0)->AddFail (mess); |
245 | Message::DefaultMessenger() << |
246 | " ** Sending File "<<filename<<" has failed, abandon **"<<endl; |
247 | checks.SetName ("X-STEP WorkSession : Split Send (only Write)"); |
248 | return checks; |
249 | } |
250 | AddSentFile (filename.ToCString()); |
251 | } |
252 | theshareout->SetLastRun (theshareout->NbDispatches()); |
253 | checks.SetName ("X-STEP WorkSession : Split Send (only Write)"); |
254 | return checks; |
255 | } |
256 | |
257 | |
258 | // .... SendAll : Donnees a tranferer dans G, aucun split, envoi sur fichier |
259 | |
260 | Interface_CheckIterator IFSelect_ModelCopier::SendAll |
261 | (const Standard_CString filename, const Interface_Graph& G, |
262 | const Handle(IFSelect_WorkLibrary)& WL, |
263 | const Handle(Interface_Protocol)& protocol) |
264 | { |
265 | Interface_CheckIterator checks; |
266 | checks.SetName ("X-STEP WorkSession : Send All"); |
267 | Message::DefaultMessenger() << |
268 | "** WorkSession : Sending all data"<<endl; |
269 | Handle(Interface_InterfaceModel) model = G.Model(); |
270 | if (model.IsNull() || protocol.IsNull() || WL.IsNull()) return checks; |
271 | |
272 | Interface_CopyTool TC (model, protocol); |
273 | Standard_Integer i, nb = model->NbEntities(); |
274 | for (i = 1; i <= nb; i ++) TC.Bind (model->Value(i),model->Value(i)); |
275 | |
276 | Interface_EntityIterator pipo; |
277 | Handle(Interface_InterfaceModel) newmod; |
278 | Handle(IFSelect_AppliedModifiers) applied; |
279 | CopiedModel (G, WL,protocol,pipo,TCollection_AsciiString(filename), |
280 | 0,0,TC,newmod, applied,checks); |
281 | |
282 | IFSelect_ContextWrite ctx (model,protocol,applied,filename); |
283 | Standard_Boolean res = WL->WriteFile (ctx); |
284 | Interface_CheckIterator checklst = ctx.CheckList(); |
285 | checks.Merge(checklst); |
286 | if (!res) checks.CCheck(0)->AddFail ("SendAll (WriteFile) has failed"); |
287 | // if (!checks.IsEmpty(Standard_False)) { |
288 | // Message::DefaultMessenger() << |
289 | // " ** SendAll has produced Check Messages : **"<<endl; |
290 | // checks.Print (sout,model,Standard_False); |
291 | // } |
292 | return checks; |
293 | } |
294 | |
295 | |
296 | // .... SendSelected : Donnees a tranferer dans G, filtrees par iter, |
297 | // aucun split, envoi sur fichier |
298 | |
299 | Interface_CheckIterator IFSelect_ModelCopier::SendSelected |
300 | (const Standard_CString filename, const Interface_Graph& G, |
301 | const Handle(IFSelect_WorkLibrary)& WL, |
302 | const Handle(Interface_Protocol)& protocol, |
303 | const Interface_EntityIterator& list) |
304 | { |
305 | Interface_CheckIterator checks; |
306 | checks.SetName ("X-STEP WorkSession : Send Selected"); |
307 | Message::DefaultMessenger() << |
308 | "** WorkSession : Sending selected data"<<endl; |
309 | Handle(Interface_InterfaceModel) original = G.Model(); |
310 | if (original.IsNull() || protocol.IsNull() || WL.IsNull()) return checks; |
311 | Handle(Interface_InterfaceModel) newmod = original->NewEmptyModel(); |
312 | Interface_CopyTool TC (original, protocol); |
313 | TC.FillModel(newmod); // pour Header ... |
314 | |
315 | // Pas de copie : AddWithRefs plus declaration de Bind |
316 | Interface_GeneralLib lib(protocol); |
317 | for (list.Start(); list.More(); list.Next()) { |
318 | newmod->AddWithRefs (list.Value(),lib); |
319 | } |
320 | Standard_Integer i, nb = newmod->NbEntities(); |
321 | for (i = 1; i <= nb; i ++) TC.Bind (newmod->Value(i),newmod->Value(i)); |
322 | if (theremain.IsNull()) |
323 | { theremain = new TColStd_HArray1OfInteger(0,G.Size()); theremain->Init(0); } |
324 | |
325 | Interface_EntityIterator pipo; |
326 | Handle(IFSelect_AppliedModifiers) applied; |
327 | CopiedModel (G, WL,protocol, pipo,TCollection_AsciiString(filename), |
328 | 0,0,TC,newmod, applied,checks); |
329 | // Alimenter Remaining : les entites copiees sont a noter |
330 | Handle(Standard_Transient) ent1,ent2; |
331 | for (Standard_Integer ic = TC.LastCopiedAfter (0,ent1,ent2); ic > 0; |
332 | ic = TC.LastCopiedAfter (ic,ent1,ent2) ) { |
333 | if (ic <= theremain->Upper()) |
334 | theremain->SetValue(ic,theremain->Value(ic)+1); |
335 | } |
336 | IFSelect_ContextWrite ctx (newmod,protocol,applied,filename); |
337 | Standard_Boolean res = WL->WriteFile (ctx); |
338 | Interface_CheckIterator checklst = ctx.CheckList(); |
339 | checks.Merge(checklst); |
340 | if (!res) checks.CCheck(0)->AddFail ("SendSelected (WriteFile) has failed"); |
341 | // if (!checks.IsEmpty(Standard_False)) { |
342 | // Message::DefaultMessenger() << |
343 | // " ** SendSelected has produced Check Messages : **"<<endl; |
344 | // checks.Print (sout,original,Standard_False); |
345 | // } |
346 | return checks; |
347 | } |
348 | |
349 | |
350 | // ########################################################################## |
351 | // ######## UN TRANSFERT UNITAIRE (avec Modifications) ######## |
352 | |
353 | void IFSelect_ModelCopier::CopiedModel |
354 | (const Interface_Graph& G, |
355 | const Handle(IFSelect_WorkLibrary)& WL, |
356 | const Handle(Interface_Protocol)& protocol, |
357 | const Interface_EntityIterator& tocopy, |
358 | const TCollection_AsciiString& filename, |
359 | const Standard_Integer dispnum, const Standard_Integer /* numod */, |
360 | Interface_CopyTool& TC, |
361 | Handle(Interface_InterfaceModel)& newmod, |
362 | Handle(IFSelect_AppliedModifiers)& applied, |
363 | Interface_CheckIterator& checks) const |
364 | { |
365 | // ... Premiere partie "standard" : remplissage du modele ... |
366 | // On cree le Modele, on le remplit avec les Entites, et avec le Header depart |
367 | |
368 | // ATTENTION : dispnum = 0 signifie prendre modele original, ne rien copier |
369 | // et aussi : pas de Dispatch (envoi en bloc) |
370 | |
371 | applied.Nullify(); |
372 | Handle(Interface_InterfaceModel) original = G.Model(); |
373 | if (dispnum > 0) { |
374 | newmod = original->NewEmptyModel(); |
375 | TC.Clear(); |
376 | WL->CopyModel (original,newmod,tocopy,TC); |
377 | |
378 | Handle(Standard_Transient) ent1,ent2; |
379 | // Alimenter Remaining : les entites copiees sont a noter |
380 | for (Standard_Integer ic = TC.LastCopiedAfter (0,ent1,ent2); ic > 0; |
381 | ic = TC.LastCopiedAfter (ic,ent1,ent2) ) { |
382 | if (ic <= theremain->Upper()) |
383 | theremain->SetValue(ic,theremain->Value(ic)+1); |
384 | } |
385 | } |
386 | else if (newmod.IsNull()) newmod = original; |
387 | |
388 | // ... Ensuite : On prend en compte les Model Modifiers ... |
389 | Standard_Integer nbmod = 0; |
390 | if (!theshareout.IsNull()) nbmod = theshareout->NbModifiers(Standard_True); |
391 | Standard_Integer i; // svv Jan11 2000 : porting on DEC |
392 | for (i = 1; i <= nbmod; i ++) { |
393 | Handle(IFSelect_Modifier) unmod = theshareout->ModelModifier(i); |
394 | |
395 | // D abord, critere Dispatch/Packet |
396 | if (dispnum > 0) |
397 | if (!unmod->Applies (theshareout->Dispatch(dispnum))) continue; |
398 | IFSelect_ContextModif ctx (G,TC,filename.ToCString()); |
399 | // Ensuite, la Selection |
400 | Handle(IFSelect_Selection) sel = unmod->Selection(); |
401 | if (!sel.IsNull()) { |
402 | Interface_EntityIterator entiter = sel->UniqueResult(G); |
403 | ctx.Select (entiter); |
404 | } |
405 | if (ctx.IsForNone()) continue; |
406 | unmod->Perform (ctx,newmod,protocol,TC); |
407 | Interface_CheckIterator checklst = ctx.CheckList(); |
408 | checks.Merge (checklst); |
409 | |
410 | // Faut-il enregistrer les erreurs dans newmod ? bonne question |
411 | // if (!checks.IsEmpty(Standard_False)) { |
412 | // Message::DefaultMessenger() << |
413 | // " Messages on Copied Model n0 "<<numod<<", Dispatch Rank "<<dispnum<<endl; |
414 | // checks.Print(sout,newmod,Standard_False); |
415 | // } |
416 | } |
417 | |
418 | // ... Puis les File Modifiers : en fait, on les enregistre ... |
419 | nbmod = 0; |
420 | if (!theshareout.IsNull()) nbmod = theshareout->NbModifiers(Standard_False); |
421 | if (nbmod == 0) return; |
422 | applied = new IFSelect_AppliedModifiers (nbmod,newmod->NbEntities()); |
423 | for (i = 1; i <= nbmod; i ++) { |
424 | Handle(IFSelect_GeneralModifier) unmod = theshareout->GeneralModifier(Standard_False,i); |
425 | |
426 | // D abord, critere Dispatch/Packet |
427 | if (dispnum > 0) |
428 | if (!unmod->Applies (theshareout->Dispatch(dispnum))) continue; |
429 | // Ensuite, la Selection |
430 | Handle(IFSelect_Selection) sel = unmod->Selection(); |
431 | if (sel.IsNull()) applied->AddModif (unmod); // vide -> on prend tout |
432 | else { |
433 | Interface_EntityIterator list = sel->UniqueResult(G); |
434 | Handle(Standard_Transient) newent; |
435 | |
436 | // Entites designees par la Selection et Copiees ? |
437 | // -> s ilyena au moins une, le Modifier s applique, sinon il est rejete |
438 | // -> et cette liste est exploitable par le Modifier ... |
439 | for (list.Start(); list.More(); list.Next()) { |
440 | if (TC.Search (list.Value(),newent)) |
441 | applied->AddNum (newmod->Number(newent)); |
442 | } |
443 | } |
444 | } |
445 | } |
446 | |
447 | |
448 | void IFSelect_ModelCopier::CopiedRemaining |
449 | (const Interface_Graph& G, const Handle(IFSelect_WorkLibrary)& WL, |
450 | Interface_CopyTool& TC, Handle(Interface_InterfaceModel)& newmod) |
451 | { |
452 | Handle(Interface_InterfaceModel) original = G.Model(); |
453 | // Interface_CopyTool TC(original,protocol); |
454 | newmod = original->NewEmptyModel(); |
455 | TC.Clear(); |
456 | Interface_EntityIterator tocopy; |
457 | Standard_Integer nb = G.Size(); |
458 | theremain = new TColStd_HArray1OfInteger(0,nb+1); theremain->Init(0); |
459 | for (Standard_Integer i = 1; i <= nb; i ++) { |
460 | if (G.Status(i) == 0) tocopy.AddItem (original->Value(i)); |
461 | else theremain->SetValue(i,-1); // ?? -1 |
462 | } |
463 | WL->CopyModel (original,newmod,tocopy,TC); |
464 | |
465 | if (newmod->NbEntities() == 0) newmod.Nullify(); |
466 | else { |
467 | // CE QUI SUIT NE DOIT PAS ETRE SUPPRIME ! cf theremain |
468 | Handle(Standard_Transient) ent1,ent2; |
469 | for (Standard_Integer ic = TC.LastCopiedAfter (0,ent1,ent2); ic > 0; |
470 | ic = TC.LastCopiedAfter (ic,ent1,ent2) ) { |
471 | if (ic <= theremain->Upper()) |
472 | theremain->SetValue(ic,1); |
473 | } |
474 | // qq impressions de mise au point |
475 | #ifdef MISOPOINT |
476 | cout << " Remaining Model : " << newmod->NbEntities() << " Entities"<<endl; |
477 | Standard_Integer ne = 0; |
478 | for (i = 1; i <= nb; i ++) { |
479 | if (theremain->Value(i) == 0) { |
480 | if (ne == 0) cout << " Refractaires : "; |
481 | ne ++; cout << " " << i; |
482 | } |
483 | } |
484 | if (ne > 0) cout << " -- " << ne << " Entities" << endl; |
485 | else cout<<" -- Remaining data complete"<<endl; |
486 | #endif |
487 | } |
488 | } |
489 | |
490 | Standard_Boolean IFSelect_ModelCopier::SetRemaining |
491 | (Interface_Graph& CG) const |
492 | { |
493 | Standard_Integer nb = CG.Size(); |
494 | if (theremain.IsNull()) return (nb == 0); |
495 | if (nb != theremain->Upper()) return Standard_False; |
496 | for (Standard_Integer i = 1; i <= nb; i ++) { |
497 | if (CG.Status(i) >= 0) CG.SetStatus(i,CG.Status(i)+theremain->Value(i)); |
498 | } |
499 | theremain->Init(0); |
500 | return Standard_True; |
501 | } |
502 | |
503 | // ########################################################################## |
504 | // ######## RESULTAT de la Memorisation des Transferts ######## |
505 | |
506 | Standard_Integer IFSelect_ModelCopier::NbFiles () const |
507 | { return thefilemodels.Length(); } |
508 | |
509 | TCollection_AsciiString IFSelect_ModelCopier::FileName |
510 | (const Standard_Integer num) const |
511 | { return thefilenames.Value(num); } |
512 | |
513 | Handle(Interface_InterfaceModel) IFSelect_ModelCopier::FileModel |
514 | (const Standard_Integer num) const |
515 | { return thefilemodels.Value(num); } |
516 | |
517 | Handle(IFSelect_AppliedModifiers) IFSelect_ModelCopier::AppliedModifiers |
518 | (const Standard_Integer num) const |
519 | { return theapplieds.Value(num); } |
520 | |
521 | |
522 | void IFSelect_ModelCopier::BeginSentFiles |
523 | (const Handle(IFSelect_ShareOut)& sho, const Standard_Boolean record) |
524 | { |
525 | thesentfiles.Nullify(); |
526 | if (record) thesentfiles = new TColStd_HSequenceOfHAsciiString(); |
527 | // et numerotation des fichiers par defaut : detenue par ShareOut |
528 | if (sho.IsNull()) return; |
529 | Standard_Integer lastrun = sho->LastRun(); |
530 | sho->ClearResult (Standard_True); |
531 | sho->SetLastRun (lastrun); // on ne s interesse quaux numeros |
532 | } |
533 | |
534 | void IFSelect_ModelCopier::AddSentFile (const Standard_CString filename) |
535 | { if (!thesentfiles.IsNull()) |
536 | thesentfiles->Append(new TCollection_HAsciiString(filename)); } |
537 | |
538 | Handle(TColStd_HSequenceOfHAsciiString) IFSelect_ModelCopier::SentFiles () const |
539 | { return thesentfiles; } |