Integration of OCCT 6.5.0 from SVN
[occt.git] / src / XSControl / XSControl_TransferReader.cxx
CommitLineData
7fd59977 1//: abv 09.04.99: S4136: remove parameter lastpreci
2// szv#11:CASCADE30:01Feb00 BRepBuilderAPI::Precision(p) removed
3#include <XSControl_TransferReader.ixx>
4#include <Standard_ErrorHandler.hxx>
5#include <Standard_Failure.hxx>
6#include <Transfer_SimpleBinderOfTransient.hxx>
7#include <Transfer_ResultFromTransient.hxx>
8#include <Transfer_TransferOutput.hxx>
9
10#include <TransferBRep.hxx>
11#include <TransferBRep_BinderOfShape.hxx>
12#include <TransferBRep_ShapeBinder.hxx>
13#include <TopoDS_HShape.hxx>
14#include <XSControl_Utils.hxx>
15#include <TopTools_MapOfShape.hxx>
16
17// Precision :
18#include <Interface_Static.hxx>
19#include <BRepBuilderAPI.hxx>
20
21// Pour les regularites
22#include <BRepLib.hxx>
23
24#include <Interface_EntityIterator.hxx>
25#include <IFSelect_SignatureList.hxx>
26#include <Interface_MSG.hxx>
27
28#include <TCollection_HAsciiString.hxx>
29#include <Interface_Macros.hxx>
30
31#include <Transfer_IteratorOfProcessForTransient.hxx>
32#include <IFSelect_CheckCounter.hxx>
33
34#include <Interface_InterfaceModel.hxx>
35#include <Interface_SignLabel.hxx>
36#include <Interface_Check.hxx>
37
38#include <Message_Messenger.hxx>
39
40#include <ShapeFix.hxx>
41#include <stdio.h>
42
43/*
44#ifdef DEB
45static void monDBPE
46 (const Handle(Message_Messenger)& S, const Handle(Standard_Transient)& ent, const Handle(Standard_Transient)& context)
47{
48 if (ent.IsNull()) { S<<"(null)"; return; }
49 DeclareAndCast(Interface_InterfaceModel,model,context);
50 if (model.IsNull()) { S<<ent->DynamicType()->Name(); return; }
51 model->Print (ent,S);
52 S<<" "<<model->TypeName(ent,Standard_False);
53}
54#endif
55*/
56
57//=======================================================================
58//function : XSControl_TransferReader
59//purpose :
60//=======================================================================
61
62XSControl_TransferReader::XSControl_TransferReader ()
63{
64}
65
66
67//=======================================================================
68//function : SetController
69//purpose :
70//=======================================================================
71
72void XSControl_TransferReader::SetController(const Handle(XSControl_Controller)& control)
73{
74 theController = control;
75 theActor.Nullify();
76 Clear(-1);
77}
78
79
80//=======================================================================
81//function : SetActor
82//purpose :
83//=======================================================================
84
85void XSControl_TransferReader::SetActor
86 (const Handle(Transfer_ActorOfTransientProcess)& actor)
87{
88 theActor = actor;
89}
90
91
92//=======================================================================
93//function : Actor
94//purpose :
95//=======================================================================
96
97Handle(Transfer_ActorOfTransientProcess) XSControl_TransferReader::Actor ()
98{
99 if ( theActor.IsNull() && !theController.IsNull() && !theModel.IsNull())
100 theActor = theController->ActorRead(theModel);
101 return theActor;
102}
103
104
105//=======================================================================
106//function : SetModel
107//purpose :
108//=======================================================================
109
110void XSControl_TransferReader::SetModel(const Handle(Interface_InterfaceModel)& model)
111{
112 theModel = model;
113 if (!theTransfer.IsNull()) theTransfer->SetModel(model);
114}
115
116
117//=======================================================================
118//function : SetGraph
119//purpose :
120//=======================================================================
121
122void XSControl_TransferReader::SetGraph(const Handle(Interface_HGraph)& graph)
123{
124 if (graph.IsNull()) return;
125 theGraph = graph;
126 theModel = graph->Graph().Model();
127 if (!theTransfer.IsNull()) theTransfer->SetGraph(graph);
128}
129
130
131//=======================================================================
132//function : Model
133//purpose :
134//=======================================================================
135
136Handle(Interface_InterfaceModel) XSControl_TransferReader::Model () const
137{
138 return theModel;
139}
140
141
142//=======================================================================
143//function : SetContext
144//purpose :
145//=======================================================================
146
147void XSControl_TransferReader::SetContext(const Standard_CString name,
148 const Handle(Standard_Transient)& ctx)
149{
150 if (theContext.IsNull()) theContext = new Dico_DictionaryOfTransient;
151 theContext->SetItem (name,ctx);
152}
153
154
155//=======================================================================
156//function : GetContext
157//purpose :
158//=======================================================================
159
160Standard_Boolean XSControl_TransferReader::GetContext
161 (const Standard_CString name, const Handle(Standard_Type)& type,
162 Handle(Standard_Transient)& ctx) const
163{
164 if (theContext.IsNull()) return Standard_False;
165 if (!theContext->GetItem (name,ctx)) ctx.Nullify();
166 if (ctx.IsNull()) return Standard_False;
167 if (type.IsNull()) return Standard_True;
168 if (!ctx->IsKind(type)) ctx.Nullify();
169 return !ctx.IsNull();
170}
171
172
173//=======================================================================
174//function : Context
175//purpose :
176//=======================================================================
177
178Handle(Dico_DictionaryOfTransient)& XSControl_TransferReader::Context ()
179{
180 return theContext;
181}
182
183
184//=======================================================================
185//function : SetFileName
186//purpose :
187//=======================================================================
188
189void XSControl_TransferReader::SetFileName (const Standard_CString name)
190{
191 theFilename.Clear();
192 theFilename.AssignCat(name);
193}
194
195
196//=======================================================================
197//function : FileName
198//purpose :
199//=======================================================================
200
201Standard_CString XSControl_TransferReader::FileName () const
202{
203 return theFilename.ToCString();
204}
205
206
207//=======================================================================
208//function : Clear
209//purpose :
210//=======================================================================
211
212void XSControl_TransferReader::Clear (const Standard_Integer mode)
213{
214 if (mode & 1) {
215 theResults.Clear();
216 theShapeResult.Nullify();
217 }
218 if (mode & 2) {
219 theModel.Nullify();
220 theGraph.Nullify();
221 theTransfer.Nullify();
222 theActor.Nullify();
223 theFilename.Clear();
224 } // theContext.Nullify();
225}
226
227
228//=======================================================================
229//function : TransientProcess
230//purpose :
231//=======================================================================
232
233Handle(Transfer_TransientProcess) XSControl_TransferReader::TransientProcess () const
234{
235 return theTransfer;
236}
237
238
239//=======================================================================
240//function : SetTransientProcess
241//purpose :
242//=======================================================================
243
244void XSControl_TransferReader::SetTransientProcess
245 (const Handle(Transfer_TransientProcess)& TP)
246{
247 theTransfer = TP;
248}
249
250
251// ########################################################
252// ########### RESULTATS ############
253
254
255//=======================================================================
256//function : RecordResult
257//purpose :
258//=======================================================================
259
260Standard_Boolean XSControl_TransferReader::RecordResult
261 (const Handle(Standard_Transient)& ent)
262{
263 if (theModel.IsNull() || theTransfer.IsNull()) return Standard_False;
264 Standard_Integer num = theModel->Number(ent);
265 if (num == 0) return Standard_False;
266 Handle(TCollection_HAsciiString) lab = theModel->StringLabel(ent);
267
268 Handle(Transfer_ResultFromModel) res = new Transfer_ResultFromModel;
269 res->Fill (theTransfer,ent);
270
271 // Cas du resultat Shape : pour resultat principal, faire HShape ...
272 Handle(Transfer_Binder) binder = res->MainResult()->Binder();
273 DeclareAndCast(TransferBRep_ShapeBinder,shb,binder);
274 if (!shb.IsNull()) {
275 Handle(Transfer_SimpleBinderOfTransient) trb = new Transfer_SimpleBinderOfTransient;
276 trb->SetResult ( new TopoDS_HShape(shb->Result()) );
277 trb->Merge(binder);
278 res->MainResult()->SetBinder (trb);
279 }
280
281 res->SetFileName(theFilename.ToCString());
282 theResults.Bind(num,res);
283 return Standard_True;
284}
285
286
287//=======================================================================
288//function : IsRecorded
289//purpose :
290//=======================================================================
291
292Standard_Boolean XSControl_TransferReader::IsRecorded
293 (const Handle(Standard_Transient)& ent) const
294{
295 if (theModel.IsNull()) return Standard_False;
296 Standard_Integer num = theModel->Number(ent);
297 if (num == 0) return Standard_False;
298 if(!theResults.IsBound(num)) return Standard_False;
299 return (theResults.Find(num)->DynamicType() == STANDARD_TYPE(Transfer_ResultFromModel) );
300}
301
302
303//=======================================================================
304//function : HasResult
305//purpose :
306//=======================================================================
307
308Standard_Boolean XSControl_TransferReader::HasResult
309 (const Handle(Standard_Transient)& ent) const
310{
311 if (theModel.IsNull()) return Standard_False;
312 Standard_Integer num = theModel->Number(ent);
313 if (num == 0) return Standard_False;
314 if(!theResults.IsBound(num)) return Standard_False;
315 DeclareAndCast(Transfer_ResultFromModel,fr,theResults.Find(num));
316 if (fr.IsNull()) return Standard_False;
317 return fr->HasResult();
318}
319
320
321//=======================================================================
322//function : RecordedList
323//purpose :
324//=======================================================================
325
326Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::RecordedList () const
327{
328 Handle(TColStd_HSequenceOfTransient) li = new TColStd_HSequenceOfTransient();
329 if (theModel.IsNull()) return li;
330 Standard_Integer i, nb = theModel->NbEntities();
331 for (i = 1; i <= nb; i ++) {
332 if(theResults.IsBound(i))
333 if(!theResults.Find(i).IsNull()) li->Append (theModel->Value(i));
334 }
335 return li;
336}
337
338
339//=======================================================================
340//function : Skip
341//purpose :
342//=======================================================================
343
344Standard_Boolean XSControl_TransferReader::Skip(const Handle(Standard_Transient)& ent)
345{
346 if (theModel.IsNull() || theTransfer.IsNull()) return Standard_False;
347 Standard_Integer num = theModel->Number(ent);
348 if (num == 0) return Standard_False;
349 theResults.Bind(num,ent);
350 return Standard_True;
351}
352
353
354//=======================================================================
355//function : IsSkipped
356//purpose :
357//=======================================================================
358
359Standard_Boolean XSControl_TransferReader::IsSkipped
360 (const Handle(Standard_Transient)& ent) const
361{
362 if (theModel.IsNull()) return Standard_False;
363 Standard_Integer num = theModel->Number(ent);
364 if (num == 0) return Standard_False;
365 if(!theResults.IsBound(num)) return Standard_False;
366 return (theResults.Find(num)->DynamicType() != STANDARD_TYPE(Transfer_ResultFromModel) );
367}
368
369
370//=======================================================================
371//function : IsMarked
372//purpose :
373//=======================================================================
374
375Standard_Boolean XSControl_TransferReader::IsMarked
376 (const Handle(Standard_Transient)& ent) const
377{
378 if (theModel.IsNull()) return Standard_False;
379 Standard_Integer num = theModel->Number(ent);
380 if (num == 0) return Standard_False;
381 if(!theResults.IsBound(num)) return Standard_False;
382 if (theResults.Find(num).IsNull()) return Standard_False;
383 return Standard_True;
384}
385
386
387// ######### ACCES UN PEU PLUS FIN #########
388
389
390//=======================================================================
391//function : FinalResult
392//purpose :
393//=======================================================================
394
395Handle(Transfer_ResultFromModel) XSControl_TransferReader::FinalResult
396 (const Handle(Standard_Transient)& ent) const
397{
398 Handle(Transfer_ResultFromModel) res;
399 if (theModel.IsNull()) return res;
400 Standard_Integer num = theModel->Number(ent);
401 if (num == 0) return res;
402 if(!theResults.IsBound(num)) return res;
403 res = GetCasted(Transfer_ResultFromModel,theResults.Find(num));
404 return res;
405}
406
407
408//=======================================================================
409//function : FinalEntityLabel
410//purpose :
411//=======================================================================
412
413Standard_CString XSControl_TransferReader::FinalEntityLabel
414 (const Handle(Standard_Transient)& ent) const
415{
416 Handle(Transfer_ResultFromModel) resu = FinalResult (ent);
417 if (resu.IsNull()) return "";
418 return resu->MainLabel();
419}
420
421
422//=======================================================================
423//function : FinalEntityNumber
424//purpose :
425//=======================================================================
426
427Standard_Integer XSControl_TransferReader::FinalEntityNumber
428 (const Handle(Standard_Transient)& ent) const
429{
430 Handle(Transfer_ResultFromModel) resu = FinalResult (ent);
431 if (resu.IsNull()) return 0;
432 return resu->MainNumber();
433}
434
435
436//=======================================================================
437//function : ResultFromNumber
438//purpose :
439//=======================================================================
440
441Handle(Transfer_ResultFromModel) XSControl_TransferReader::ResultFromNumber
442 (const Standard_Integer num) const
443{
444 Handle(Transfer_ResultFromModel) res;
445 if ( num<1 || num>theModel->NbEntities() ) return res;
446 if(!theResults.IsBound(num)) return res;
447 res = GetCasted(Transfer_ResultFromModel,theResults.Find(num));
448 return res;
449}
450
451
452//=======================================================================
453//function : TransientResult
454//purpose :
455//=======================================================================
456
457Handle(Standard_Transient) XSControl_TransferReader::TransientResult
458 (const Handle(Standard_Transient)& ent) const
459{
460 Handle(Standard_Transient) tres;
461 Handle(Transfer_ResultFromModel) res = FinalResult(ent);
462 if (res.IsNull()) return tres;
463 Handle(Transfer_ResultFromTransient) mres = res->MainResult();
464 if (mres.IsNull()) return tres;
465 DeclareAndCast(Transfer_SimpleBinderOfTransient,bnd,mres->Binder());
466 if (bnd.IsNull()) return tres;
467 if (!bnd->HasResult()) return tres;
468 return bnd->Result();
469}
470
471
472//=======================================================================
473//function : ShapeResult
474//purpose :
475//=======================================================================
476
477TopoDS_Shape XSControl_TransferReader::ShapeResult
478 (const Handle(Standard_Transient)& ent) const
479{
480 TopoDS_Shape tres; // DOIT RESTER NULL
481 Handle(Transfer_ResultFromModel) res = FinalResult(ent);
482 if (res.IsNull()) return tres;
483 Handle(Transfer_ResultFromTransient) mres = res->MainResult();
484 if (mres.IsNull()) return tres;
485 XSControl_Utils xu;
486 TopoDS_Shape sh = xu.BinderShape (mres->Binder());
487
488// Ouh la vilaine verrue
489 Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle");
490 if (tolang <= 0 || sh.IsNull()) return sh;
491 ShapeFix::EncodeRegularity (sh,tolang);
492 return sh;
493}
494
495
496//=======================================================================
497//function : ClearResult
498//purpose :
499//=======================================================================
500
501Standard_Boolean XSControl_TransferReader::ClearResult
502 (const Handle(Standard_Transient)& ent, const Standard_Integer mode)
503{
504 if (theModel.IsNull()) return Standard_False;
505 Standard_Integer num = theModel->Number(ent);
506 if (num == 0) return Standard_False;
507 if(!theResults.IsBound(num)) return Standard_False;
508 if (mode < 0)
509 theResults.ChangeFind(num).Nullify();
510 else {
511 DeclareAndCast(Transfer_ResultFromModel,resu,theResults.Find(num));
512 if (resu.IsNull()) return Standard_False;
513 resu->Strip (mode);
514 }
515 return Standard_True;
516}
517
518
519// <<<< >>>> ATTENTION, pas terrible : mieux vaudrait
520// faire une map inverse et la consulter
521// ou muscler ResultFromModel ...
522
523
524//=======================================================================
525//function : EntityFromResult
526//purpose :
527//=======================================================================
528
529Handle(Standard_Transient) XSControl_TransferReader::EntityFromResult
530 (const Handle(Standard_Transient)& res, const Standard_Integer mode) const
531{
532 Handle(Standard_Transient) nulh;
533 // cas de la shape
534 XSControl_Utils xu;
535 TopoDS_Shape sh = xu.BinderShape (res);
536 if (!sh.IsNull()) return EntityFromShapeResult (sh,mode);
537
538 Handle(Transfer_Binder) abinder;
539 DeclareAndCast(Transfer_Binder,binder,res);
540 Standard_Integer i,j,nb;
541
542 if (mode == 0 || mode == 1) {
543 // on regarde dans le TransientProcess (Roots ou tous Mappeds)
544 if (!theTransfer.IsNull()) {
545 nb = (mode == 0 ? theTransfer->NbRoots() : theTransfer->NbMapped());
546 for (j = 1; j <= nb; j ++) {
547 i = (mode == 0 ? theModel->Number (theTransfer->Root(j)) : j);
548 if (i == 0) continue;
549 abinder = theTransfer->MapItem(i);
550 if (abinder.IsNull()) continue;
551 if (!binder.IsNull()) {
552 if (binder == abinder) return theTransfer->Mapped(i);
553 continue;
554 }
555 DeclareAndCast(Transfer_SimpleBinderOfTransient,trb,abinder);
556 if (trb.IsNull()) continue;
557 if (trb->Result() == res) return theTransfer->Mapped(i);
558 }
559 }
560 return nulh; // Null
561 }
562
563 // Recherche dans theResults (racines)
564 // 2 : Main only 3 : Main + one sub; 4 : all
565 if (mode >= 2) {
566 nb = theModel->NbEntities();
567 for (i = 1; i <= nb; i ++) {
568 Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i);
569 if (rec.IsNull()) return nulh;
570 Handle(TColStd_HSequenceOfTransient) list = rec->Results (mode-2);
571 Standard_Integer ir,nr = list->Length();
572 for (ir = 1; ir <= nr; ir ++) {
573 DeclareAndCast(Transfer_ResultFromTransient,rft,list->Value(ir));
574 if (rft.IsNull()) continue;
575 if (rft->Binder() == binder) return rft->Start();
576 }
577
578 }
579 }
580
581 // autres cas non encore implementes
582 return nulh;
583}
584
585
586// <<<< >>>> ATTENTION, encore moins bien que le precedent
587
588
589//=======================================================================
590//function : EntityFromShapeResult
591//purpose :
592//=======================================================================
593
594Handle(Standard_Transient) XSControl_TransferReader::EntityFromShapeResult
595 (const TopoDS_Shape& res, const Standard_Integer mode) const
596{
597 Handle(Standard_Transient) nulh, samesh, partner;
598 if (res.IsNull()) return nulh;
599 Standard_Integer i,j,nb;
600
601 XSControl_Utils xu;
602 if (mode == 0 || mode == 1 || mode == -1) {
603 // on regarde dans le TransientProcess
604 if (!theTransfer.IsNull()) {
605 nb = (mode == 0 ? theTransfer->NbRoots() : theTransfer->NbMapped());
606 for (j = 1; j <= nb; j ++) {
607 i = (mode == 0 ? theModel->Number (theTransfer->Root(j)) : j);
608 if (i == 0) continue;
609 Handle(Standard_Transient) ent = theTransfer->Mapped(i);
610 TopoDS_Shape sh = TransferBRep::ShapeResult (theTransfer,ent);
611 if (!sh.IsNull()) {
612 if (sh == res) return ent;
613 // priorites moindre : Same (tjrs) ou Partner (mode < 0)
614 if (sh.IsSame(res)) samesh = ent;
615 if (mode == -1 && sh.IsPartner(res)) partner= ent;
616 }
617 }
618 }
619 // Ici, pas trouve de vraie egalite. Priorites moindres : Same puis Partner
620 if (!samesh.IsNull()) return samesh;
621 if (!partner.IsNull()) return partner; // calcule si mode = -1
622 return nulh;
623 }
624
625 // Recherche dans theResults (racines)
626 // 2 : Main only 3 : Main + one sub; 4 : all
627 if (mode >= 2) {
628 nb = theModel->NbEntities();
629 for (i = 1; i <= nb; i ++) {
630 Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i);
631 if (rec.IsNull()) continue;
632
633 Handle(TColStd_HSequenceOfTransient) list = rec->Results (mode-2);
634 Standard_Integer ir,nr = list->Length();
635 for (ir = 1; ir <= nr; ir ++) {
636 DeclareAndCast(Transfer_ResultFromTransient,rft,list->Value(ir));
637 if (rft.IsNull()) continue;
638 TopoDS_Shape sh = xu.BinderShape (rft->Binder());
639 if (!sh.IsNull() && sh == res) return rft->Start();
640 }
641
642 }
643 }
644
645 return nulh;
646}
647
648
649//=======================================================================
650//function : EntitiesFromShapeList
651//purpose :
652//=======================================================================
653
654Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::EntitiesFromShapeList
655 (const Handle(TopTools_HSequenceOfShape)& res,
656 const Standard_Integer mode) const
657{
658 Handle(TColStd_HSequenceOfTransient) lt = new TColStd_HSequenceOfTransient();
659 if (res.IsNull()) return lt;
660 TopTools_MapOfShape shapes;
661
662 // On convertit res en une map, pour test de presence rapide
663 Standard_Integer i, j, nb = res->Length();
664 if (nb == 0) return lt;
665 for (i = 1; i <= nb; i ++) shapes.Add (res->Value(i));
666
667 // A present, recherche et enregistrement
668
669 XSControl_Utils xu;
670 if (mode == 0 || mode == 1) {
671 // on regarde dans le TransientProcess
672 if (!theTransfer.IsNull()) {
673 nb = (mode == 0 ? theTransfer->NbRoots() : theTransfer->NbMapped());
674 for (j = 1; j <= nb; j ++) {
675 i = (mode == 0 ? theModel->Number (theTransfer->Root(j)) : j);
676 if (i == 0) continue;
677 TopoDS_Shape sh = xu.BinderShape (theTransfer->MapItem(i));
678 if (!sh.IsNull() && shapes.Contains(sh)) {
679 lt->Append (theTransfer->Mapped(i));
680 j=nb; //skl (for looking for entities in checkbrep)
681 }
682 }
683 }
684 }
685
686 // Recherche dans theResults (racines)
687 // 2 : Main only 3 : Main + one sub; 4 : all
688 if (mode >= 2) {
689 nb = theModel->NbEntities();
690 for (i = 1; i <= nb; i ++) {
691 Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i);
692 if (rec.IsNull()) continue;
693
694 Handle(TColStd_HSequenceOfTransient) list = rec->Results (mode-2);
695 Standard_Integer ir,nr = list->Length();
696 for (ir = 1; ir <= nr; ir ++) {
697 DeclareAndCast(Transfer_ResultFromTransient,rft,list->Value(i));
698 if (rft.IsNull()) continue;
699 TopoDS_Shape sh = xu.BinderShape (rft->Binder());
700 if (!sh.IsNull() && shapes.Contains(sh)) lt->Append (rft->Start());
701 }
702
703 }
704 }
705
706 return lt;
707}
708
709
710// <<<< >>>> ATTENTION, level pas traite (utile ?) -> ResultFromModel
711
712
713//=======================================================================
714//function : CheckList
715//purpose :
716//=======================================================================
717
718Interface_CheckIterator XSControl_TransferReader::CheckList
719 (const Handle(Standard_Transient)& ent, const Standard_Integer level) const
720{
721 Interface_CheckIterator chl;
722 if (theModel.IsNull() || ent.IsNull()) return chl;
723 // Check-List COMPLETE ... tout le Modele
724 if (ent == theModel) {
725 Standard_Integer i,nb = theModel->NbEntities();
726 for (i = 1; i <= nb; i ++) {
727 Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i);
728 if (!rec.IsNull()) {
729 Interface_CheckIterator chiter = rec->CheckList (Standard_False,2);
730 chl.Merge (chiter);
731 }
732 }
733 }
734 // Check-List sur une LISTE ...
735 else if (ent->IsKind(STANDARD_TYPE(TColStd_HSequenceOfTransient))) {
736 DeclareAndCast(TColStd_HSequenceOfTransient,list,ent);
737 Standard_Integer i,nb = list->Length();
738 for (i = 1; i <= nb; i ++) {
739 Handle(Transfer_ResultFromModel) rec = FinalResult (list->Value(i));
740 if (!rec.IsNull()) {
741 Interface_CheckIterator chiter = rec->CheckList (Standard_False,level);
742 chl.Merge (chiter);
743 }
744 }
745 }
746
747 // sinon, Check-List sur une entite : Last ou FinalResult
748 else if (level < 0) {
749 if (theTransfer.IsNull()) return chl;
750 chl.Add (theTransfer->Check(ent),theModel->Number(ent));
751 } else {
752 Handle(Transfer_ResultFromModel) rec = FinalResult (ent);
753 if (rec.IsNull()) return chl;
754 chl = rec->CheckList(Standard_False,level); // manque level ...
755 }
756 if (ent == theModel) chl.SetName ("XSControl : CheckList complete Model");
757 else if (level < 0) chl.SetName ("XSControl : CheckList Last");
758 else if (level == 0) chl.SetName ("XSControl : CheckList Final Main");
759 else if (level == 1) chl.SetName ("XSControl : CheckList Final Main+Subs");
760 else if (level >= 2) chl.SetName ("XSControl : CheckList Final Complete");
761 return chl;
762}
763
764
765//=======================================================================
766//function : HasChecks
767//purpose :
768//=======================================================================
769
770Standard_Boolean XSControl_TransferReader::HasChecks
771 (const Handle(Standard_Transient)& ent, const Standard_Boolean failsonly) const
772{
773 Handle(Transfer_ResultFromModel) resu = FinalResult (ent);
774 if (resu.IsNull()) return Standard_False;
775 Standard_Integer stat = resu->ComputeCheckStatus (Standard_False);
776 if (stat == 0) return Standard_False;
777 if (stat > 1) return Standard_True;
778 return (!failsonly);
779}
780
781
782//=======================================================================
783//function : CheckedList
784//purpose :
785//=======================================================================
786
787Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::CheckedList
788 (const Handle(Standard_Transient)& ent,
789 const Interface_CheckStatus withcheck, const Standard_Boolean level) const
790{
791 Handle(TColStd_HSequenceOfTransient) res = new TColStd_HSequenceOfTransient();
792 if (ent.IsNull()) return res;
793
794 if (ent == theModel) {
795 Standard_Integer i,nb = theModel->NbEntities();
796 for (i = 1; i <= nb; i ++) {
797 Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i);
798 if (!rec.IsNull()) res->Append (rec->CheckedList(withcheck,level));
799 }
800 } else if (ent->IsKind(STANDARD_TYPE(TColStd_HSequenceOfTransient))) {
801 DeclareAndCast(TColStd_HSequenceOfTransient,list,ent);
802 Standard_Integer i,nb = list->Length();
803 for (i = 1; i <= nb; i ++) {
804 Handle(Transfer_ResultFromModel) rec = FinalResult (list->Value(i));
805 if (!rec.IsNull()) res->Append (rec->CheckedList(withcheck,level));
806 }
807 } else {
808 Handle(Transfer_ResultFromModel) rec = FinalResult (ent);
809 if (!rec.IsNull()) res = rec->CheckedList(withcheck,level);
810 }
811 return res;
812}
813
814
815// ########################################################
816// ########### TRANSFERT ############
817// ########################################################
818
819
820//=======================================================================
821//function : BeginTransfer
822//purpose :
823//=======================================================================
824
825Standard_Boolean XSControl_TransferReader::BeginTransfer ()
826{
827 if (theModel.IsNull()) return Standard_False;
828 if (Actor().IsNull()) return Standard_False;
829 theShapeResult.Nullify();
830
831 if (theTransfer.IsNull()) theTransfer = new Transfer_TransientProcess
832 (theModel->NbEntities());
833
834 Handle(Transfer_ActorOfTransientProcess) actor;
835 theTransfer->SetActor (actor); // -> RAZ
836 actor = Actor();
837 theTransfer->SetActor (actor); // Set proprement dit
838 theTransfer->SetErrorHandle (Standard_True);
839 theTransfer->Context() = theContext;
840 return Standard_True;
841}
842
843
844//=======================================================================
845//function : Recognize
846//purpose :
847//=======================================================================
848
849Standard_Boolean XSControl_TransferReader::Recognize
850 (const Handle(Standard_Transient)& ent)
851{
852 if (theActor.IsNull()) return Standard_False;
853 return theActor->Recognize (ent);
854}
855
856
857//=======================================================================
858//function : TransferOne
859//purpose :
860//=======================================================================
861
862Standard_Integer XSControl_TransferReader::TransferOne
863 (const Handle(Standard_Transient)& ent, const Standard_Boolean rec)
864{
865 if (theActor.IsNull() || theModel.IsNull()) return 0;
866
867 if (theTransfer.IsNull()) { if (!BeginTransfer()) return 0; }
868
869 Handle(Message_Messenger) sout = theTransfer->Messenger();
870 Standard_Integer level = theTransfer->TraceLevel();
871
872 //BRepBuilderAPI::Precision (Interface_Static::RVal("read.precision.val")); //szv#11:CASCADE30:01Feb00
873 //Interface_Static::SetRVal("lastpreci",0.0);
874
875 Transfer_TransferOutput TP (theTransfer,theModel);
876 if (theGraph.IsNull()) theTransfer->SetModel(theModel);
877 else theTransfer->SetGraph(theGraph);
878
879 // pour le log-file
880 if (level > 1) {
881 Standard_Integer num = theModel->Number(ent);
882 Handle(TCollection_HAsciiString) lab = theModel->StringLabel(ent);
883 sout<<"\n*******************************************************************\n";
884 sout << "****** Transferring one Entity ******"<<endl;
885 if (!lab.IsNull())
886 sout<<"****** N0 in file : "<<Interface_MSG::Blanks(num,5)<<num
887 <<" Ident : "<<lab->ToCString()
888 << Interface_MSG::Blanks(14 - lab->Length())<<"******\n";
889 sout << "****** Type : "<<theModel->TypeName(ent,Standard_False)
890 << Interface_MSG::Blanks(44 - strlen(theModel->TypeName(ent,Standard_False)))
891 << "******";
892 sout<<"\n*******************************************************************\n";
893 }
894
895 // seule difference entre TransferRoots et TransferOne
896 Standard_Integer res = 0;
897 Handle(Standard_Transient) obj = ent;
898 TP.Transfer (obj);
899 theTransfer->SetRoot (obj);
900
901 // Resultat ...
902 Handle(Transfer_Binder) binder = theTransfer->Find (obj);
903 if (binder.IsNull()) return res;
904 if (rec) RecordResult (obj);
905
906 if (!binder->HasResult()) return res;
907 res ++;
908
909 return res;
910}
911
912
913//=======================================================================
914//function : TransferList
915//purpose :
916//=======================================================================
917
918Standard_Integer XSControl_TransferReader::TransferList
919 (const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Boolean rec)
920{
921 if (theActor.IsNull() || theModel.IsNull()) return 0;
922
923 if (theTransfer.IsNull()) { if (!BeginTransfer()) return 0; }
924
925 Handle(Message_Messenger) sout = theTransfer->Messenger();
926 Standard_Integer level = theTransfer->TraceLevel();
927
928 //BRepBuilderAPI::Precision (Interface_Static::RVal("read.precision.val")); //szv#11:CASCADE30:01Feb00
929 //Interface_Static::SetRVal("lastpreci",0.0);
930 Transfer_TransferOutput TP (theTransfer,theModel);
931 if (theGraph.IsNull()) theTransfer->SetModel(theModel);
932 else theTransfer->SetGraph(theGraph);
933
934 Standard_Integer i,nb = list->Length();
935
936 // Pour le log-file
937 if (level > 0) {
938 sout<<"\n*******************************************************************\n";
939 sout << "****** Transferring a list of "<<Interface_MSG::Blanks(nb,5)<<" Entities ******"<<endl;
940 sout<<"\n*******************************************************************\n";
941
942 Handle(IFSelect_SignatureList) sl = new IFSelect_SignatureList;
943 for (i = 1; i <= nb; i ++)
944 sl->Add (list->Value(i), theModel->TypeName(list->Value(i),Standard_False));
945 sl->SetName ("Entities to Transfer");
946 sl->PrintCount (sout);
947 sout<<"\n*******************************************************************\n";
948 }
949
950 // seule difference entre TransferRoots et TransferOne
951 Standard_Integer res = 0;
952 nb = list->Length();
953 Handle(Standard_Transient) obj;
954
955 for (i = 1; i <= nb; i ++) {
956 obj = list->Value(i);
957 TP.Transfer (obj);
958 theTransfer->SetRoot (obj);
959
960 // Resultat ...
961 Handle(Transfer_Binder) binder = theTransfer->Find (obj);
962 if (binder.IsNull()) continue;
963 if (rec) RecordResult (obj);
964
965 if (!binder->HasResult()) continue;
966 res ++;
967 }
968 return res;
969}
970
971
972// <<<< >>>> passage Graph : judicieux ?
973
974
975//=======================================================================
976//function : TransferRoots
977//purpose :
978//=======================================================================
979
980Standard_Integer XSControl_TransferReader::TransferRoots(const Interface_Graph& G)
981{
982 if (theModel != G.Model()) return -1;
983 if (!BeginTransfer()) return -1;
984 Handle(Message_Messenger) sout = theTransfer->Messenger();
985 Standard_Integer level = theTransfer->TraceLevel();
986
987 //BRepBuilderAPI::Precision (Interface_Static::RVal("read.precision.val")); //szv#11:CASCADE30:01Feb00
988 //Interface_Static::SetRVal("lastpreci",0.0);
989 Transfer_TransferOutput TP (theTransfer,theModel);
990 if (theGraph.IsNull()) theTransfer->SetModel(theModel);
991 else theTransfer->SetGraph(theGraph);
992
993 // Pour le log-file
994 if (level > 0) {
995 Interface_EntityIterator roots = G.RootEntities();
996 Standard_Integer nb = roots.NbEntities();
997 sout<<"\n*******************************************************************\n";
998 sout << "****** Transferring the "<<Interface_MSG::Blanks(nb,5)<<" Root Entities ******"<<endl;
999 sout<<"\n*******************************************************************\n";
1000 Handle(IFSelect_SignatureList) sl = new IFSelect_SignatureList;
1001 for (roots.Start(); roots.More(); roots.Next())
1002 sl->Add (roots.Value(),theModel->TypeName(roots.Value(),Standard_False));
1003 sl->SetName ("Entities to Transfer");
1004 sl->PrintCount (sout);
1005 sout<<"\n*******************************************************************\n";
1006 }
1007
1008 TP.TransferRoots (G);
1009
1010 // Les entites transferees sont notees "asmain"
1011 Standard_Integer i,n = theTransfer->NbMapped();
1012 for (i = 1; i <= n; i ++) {
1013 Handle(Standard_Transient) ent = theTransfer->Mapped(i);
1014 Handle(Transfer_Binder) bnd = theTransfer->MapItem(i);
1015 if (bnd.IsNull()) continue;
1016 if (!bnd->HasResult()) continue;
1017 RecordResult (ent);
1018 }
1019
1020 // Resultat ... on note soigneuseument les Shapes
1021 theShapeResult = TransferBRep::Shapes (theTransfer,Standard_True);
1022 // ???? Et ici, il faut alimenter Imagine ...
1023 return theShapeResult->Length();
1024}
1025
1026
1027//=======================================================================
1028//function : TransferClear
1029//purpose :
1030//=======================================================================
1031
1032void XSControl_TransferReader::TransferClear(const Handle(Standard_Transient)& ent,
1033 const Standard_Integer level)
1034{
1035 if (theTransfer.IsNull()) return;
1036 if (ent == theModel) { theTransfer->Clear(); return; }
1037
1038 //// if (level > 0) list = TransferredList (list);
1039 // Standard_Integer i, nb = list->Length();
1040 // theTransfer->ComputeScopes();
1041 // for (i = 1; i <= nb; i ++) {
1042 // Handle(Standard_Transient) ent = list->Value(i);
1043 // theTransfer->Unbind (ent);
1044 theTransfer->RemoveResult (ent,level);
1045 ClearResult (ent,-1);
1046 // }
1047}
1048
1049
1050//=======================================================================
1051//function : PrintStats
1052//purpose :
1053//=======================================================================
1054
1055void XSControl_TransferReader::PrintStats
1056 (const Standard_Integer what, const Standard_Integer mode) const
1057{
1058 Handle(Message_Messenger) sout = theTransfer->Messenger();
1059 // A ameliorer ... !
1060 sout<<"\n*******************************************************************\n";
1061 sout << "****** Statistics on Transfer (Read) ******"<<endl;
1062 sout<<"\n*******************************************************************\n";
1063 if (what > 10) { sout<<" *** Not yet implemented"<<endl; return; }
1064 if (what < 10) {
1065 sout << "****** Data recorded on Last Transfer ******"<<endl;
1066 PrintStatsProcess (theTransfer,what,mode);
1067 }
1068 // reste what = 10 : on liste les racines des final results
1069 sout << "****** Final Results ******"<<endl;
1070 if (theModel.IsNull()) { sout<<"**** Model unknown"<<endl; return; }
1071 Handle(TColStd_HSequenceOfTransient) list = RecordedList();
1072 Standard_Integer i, nb = list->Length();
1073 Handle(IFSelect_SignatureList) counter;
1074 if (mode > 2) counter = new IFSelect_SignatureList (mode == 6);
1075 IFSelect_PrintCount pcm = IFSelect_CountByItem;
1076 if (mode == 6) pcm = IFSelect_ListByItem;
1077
1078 sout<<"**** Nb Recorded : "<<nb<<" : entities n0s : ";
1079 for (i = 1; i <= nb; i ++) {
1080 Handle(Standard_Transient) ent = list->Value(i);
1081 if (mode == 0) { sout<<" "<<theModel->Number(ent); continue; }
1082 if (mode == 1 || mode == 2) {
1083 sout<<"[ "<<Interface_MSG::Blanks (i,6)<<" ]:";
1084 theModel->Print (ent,sout);
1085 sout<<" Type:"<<theModel->TypeName(ent,Standard_False);
1086 }
1087 if (mode >= 3 && mode <= 6) {
1088 counter->Add (ent,theModel->TypeName(ent,Standard_False));
1089 }
1090 }
1091 if (!counter.IsNull()) counter->PrintList(sout,theModel,pcm);
1092
1093 sout<<endl;
1094}
1095
1096
1097// ########################################################
1098// ########### TRANSFERT ############
1099
1100
1101//=======================================================================
1102//function : LastCheckList
1103//purpose :
1104//=======================================================================
1105
1106Interface_CheckIterator XSControl_TransferReader::LastCheckList () const
1107{
1108 Interface_CheckIterator chl;
1109 if (!theTransfer.IsNull()) chl = theTransfer->CheckList (Standard_False);
1110 return chl;
1111}
1112
1113
1114//=======================================================================
1115//function : LastTransferList
1116//purpose :
1117//=======================================================================
1118
1119Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::LastTransferList
1120 (const Standard_Boolean roots) const
1121{
1122 Handle(TColStd_HSequenceOfTransient) li = new TColStd_HSequenceOfTransient();
1123 if (theTransfer.IsNull()) return li;
1124 Standard_Integer i,j,nb =
1125 (roots ? theTransfer->NbRoots() : theTransfer->NbMapped());
1126 for (j = 1; j <= nb; j ++) {
1127 i = (roots ? theModel->Number (theTransfer->Root(j)) : j);
1128 Handle(Transfer_Binder) bnd = theTransfer->MapItem(i);
1129 if (bnd.IsNull()) continue;
1130 if (!bnd->HasResult()) continue;
1131 li->Append (theTransfer->Mapped(i));
1132 }
1133 return li;
1134}
1135
1136
1137//=======================================================================
1138//function : ShapeResultList
1139//purpose :
1140//=======================================================================
1141
1142Handle(TopTools_HSequenceOfShape) XSControl_TransferReader::ShapeResultList
1143 (const Standard_Boolean rec)
1144{
1145 if (!rec) {
1146 if (theShapeResult.IsNull()) theShapeResult =
1147 TransferBRep::Shapes (theTransfer,Standard_True);
1148 if (theShapeResult.IsNull()) theShapeResult = new TopTools_HSequenceOfShape();
1149 } else {
1150 if (theShapeResult.IsNull()) theShapeResult = new TopTools_HSequenceOfShape();
1151 if (theModel.IsNull()) return theShapeResult;
1152 Handle(TColStd_HSequenceOfTransient) li = RecordedList();
1153 theShapeResult = new TopTools_HSequenceOfShape();
1154 Standard_Integer i, nb = theModel->NbEntities();
1155 TopoDS_Shape sh;
1156 for (i = 1; i <= nb; i ++) {
1157 sh = ShapeResult (theModel->Value(i));
1158 if (!sh.IsNull()) theShapeResult->Append(sh);
1159 }
1160 }
1161 return theShapeResult;
1162}
1163
1164
1165// **** UTILITAIRE DE STATISTIQUES GENERALES
1166
1167// BinderStatus retourne une valeur :
1168// 0 Binder Null. 1 void 2 Warning seul 3 Fail seul
1169// 11 Resultat OK. 12 Resultat+Warning. 13 Resultat+Fail
1170
1171//=======================================================================
1172//function :
1173//purpose :
1174//=======================================================================
1175static Standard_Integer BinderStatus (const Handle(Transfer_Binder)& binder, char* mess)
1176{
1177 Standard_Integer stat = 0;
1178 mess[0] = '\0';
1179 if (binder.IsNull()) { sprintf (mess,"(no data recorded)"); return 0; }
1180 Interface_CheckStatus cst = binder->Check()->Status();
1181 if (cst == Interface_CheckOK) {
1182 stat = 11;
1183 if (binder->HasResult()) sprintf(mess,"%s",binder->ResultTypeName());
1184 else { sprintf(mess,"(no result)"); stat = 1; }
1185 } else if (cst == Interface_CheckWarning) {
1186 stat = 12;
1187 if (binder->HasResult()) sprintf(mess,"%s (+ warning)",binder->ResultTypeName());
1188 else { sprintf(mess,"(warning)"); stat = 2; }
1189 } else if (cst == Interface_CheckFail) {
1190 stat = 13;
1191 if (binder->HasResult()) sprintf(mess,"%s (+ FAIL)",binder->ResultTypeName());
1192 else { sprintf(mess,"(FAIL)"); stat = 3; }
1193 }
1194 return stat;
1195}
1196
1197
1198//=======================================================================
1199//function :
1200//purpose :
1201//=======================================================================
1202static void PrintPercent(const Handle(Message_Messenger)& sout, const Standard_CString mess,
1203 const Standard_Integer nb, const Standard_Integer nl)
1204{
1205 if (nb <= 0 || nl == 0) return;
1206 sout<<"****** "<<mess<<": ";
1207 if (nb == nl) sout<<"100 %"<<endl;
1208 else if (nb*100/nl == 0) sout<<"< 1 %"<<endl;
1209 else sout<<(nb*100/nl < 10 ? " " : " ")<<nb*100/nl<<" %"<<endl;
1210}
1211
1212
1213//=======================================================================
1214//function : PrintStatsProcess
1215//purpose :
1216//=======================================================================
1217
1218void XSControl_TransferReader::PrintStatsProcess(const Handle(Transfer_TransientProcess)& TP,
1219 const Standard_Integer what,
1220 const Standard_Integer mode)
1221{
1222 Handle(TColStd_HSequenceOfTransient) list; // null
1223 XSControl_TransferReader::PrintStatsOnList (TP,list,what,mode);
1224}
1225
1226
1227//=======================================================================
1228//function : PrintStatsOnList
1229//purpose :
1230//=======================================================================
1231
1232void XSControl_TransferReader::PrintStatsOnList(const Handle(Transfer_TransientProcess)& TP,
1233 const Handle(TColStd_HSequenceOfTransient)& list,
1234 const Standard_Integer what,
1235 const Standard_Integer mode)
1236{
1237 Handle(Message_Messenger) sout = TP->Messenger();
1238 char mess[250];
1239 if (TP.IsNull()) return;
1240 if (what == 0) { TP->PrintStats(0,sout); return; }
1241
1242 sout<<"\n*******************************************************************\n";
1243 sout << "****** Statistics on Transfer Process (Read) ******"<<endl;
1244 if (what == 1) sout << "****** Individual Transfers (Roots) ******\n";
1245 if (what == 2) sout << "****** All recorded data about Transfer ******\n";
1246 if (what == 3) sout << "****** Abnormal records ******\n";
1247 if (what == 1 || what == 2 || what == 3) {
1248 if (mode == 0) sout<<"****** (n0s of recorded entities) ******\n";
1249 if (mode == 1) sout<<"****** (per entity : type + result) ******\n";
1250 if (mode == 2) sout<<"****** (per entity : type + result/status) ******\n";
1251 if (mode == 3) sout<<"****** (count per type of entity) ******\n";
1252 if (mode == 4) sout<<"****** (count per type of result) ******\n";
1253 if (mode == 5) sout<<"****** (count per couple entity-type / result-type/status) ******\n";
1254 if (mode == 6) sout<<"****** (list per couple entity-type / result-type/status) ******\n";
1255 }
1256 if (what == 4) sout << "****** Check messages ******\n";
1257 if (what == 5) sout << "****** Fail messages ******\n";
1258 sout<<"*******************************************************************\n";
1259
1260 // Cas what = 1,2,3 : contenu du TP (binders)
1261
1262 Standard_Boolean nolist = list.IsNull();
1263 Handle(Interface_InterfaceModel) model = TP->Model();
1264 if (what >= 1 && what <= 3) {
1265
1266 Standard_Integer stat;
1267 Standard_Integer nbv = 0, nbw = 0, nbf = 0, nbr = 0, nbrw = 0, nbrf = 0, nbnr = 0, nbi = 0;
1268 Transfer_IteratorOfProcessForTransient itrp(Standard_True);
1269 if (what == 1) itrp = TP->RootResult(Standard_True);
1270 if (what == 2) itrp = TP->CompleteResult(Standard_True);
1271 if (what == 3) itrp = TP->AbnormalResult();
1272 Standard_Integer i = 0, nb = itrp.Number();
1273 if (!nolist) itrp.Filter (list);
1274 Standard_Integer nl = itrp.Number(); // apres filtrage
1275 Handle(IFSelect_SignatureList) counter;
1276 if (mode > 2) counter = new IFSelect_SignatureList (mode == 6);
1277 Standard_Boolean notrec = (!nolist && mode > 2); // noter les "no record"
1278 IFSelect_PrintCount pcm = IFSelect_CountByItem;
1279 if (mode == 6) pcm = IFSelect_ListByItem;
1280
1281 sout <<"**** Entities in Model : "<<model->NbEntities()<<endl;
1282 sout <<"**** Nb Items (Transfer) : "<<nb<<endl;
1283 if (!nolist)
1284 sout<<"**** Nb Items (Listed) : "<<nl<<endl;
1285
1286 for (itrp.Start(); itrp.More(); itrp.Next()) {
1287 nbi ++;
1288 Handle(Transfer_Binder) binder = itrp.Value();
1289 Handle(Standard_Transient) ent = itrp.Starting();
1290 if (binder.IsNull()) {
1291 nbnr ++;
1292 if (notrec) counter->Add(ent,"(not recorded)");
1293 else if (mode == 1 || mode == 2) {
1294 sout<<"["<<Interface_MSG::Blanks (nbi,4)<<nbi<<" ]:";
1295 model->Print (ent,sout);
1296 sout<<" "<<model->TypeName(ent,Standard_False)<<" (not recorded)"<<endl;
1297 continue;
1298 }
1299 }
1300 if (mode == 0) { sout<<" "<<model->Number(ent); continue; }
1301 if (mode != 3) {
1302 stat = BinderStatus(binder,mess);
1303 // 0 Binder Null. 1 void 2 Warning seul 3 Fail seul
1304 // 11 Resultat OK. 12 Resultat+Warning. 13 Resultat+Fail
1305 if (stat == 0 || stat == 1) nbv ++;
1306 if (stat == 2) nbw ++;
1307 if (stat == 3) nbf ++;
1308 if (stat == 11) nbr ++;
1309 if (stat == 12) nbrw ++;
1310 if (stat == 13) nbrf ++;
1311 }
1312
1313 // mode : 0 list num; 1 : num+label + type + result (abrege); 2 : complet
1314 if (mode == 1 || mode == 2) {
1315 sout<<"["<<Interface_MSG::Blanks (i,4)<<i<<" ]:";
1316 model->Print (ent,sout);
1317 sout<<" "<<model->TypeName(ent,Standard_False);
1318 sout<<" Result:"<<mess<<endl;
1319 if (mode == 1) continue;
1320
1321 const Handle(Interface_Check)& ch = binder->Check();
1322 Standard_Integer newi,newnbw = ch->NbWarnings(), newnbf = ch->NbFails();
1323
1324 if (newnbw > 0) {
1325 sout<<" - Warnings : "<<newnbw<<":\n";
1326 for (newi = 1; newi <= newnbw; newi ++) sout<<ch->CWarning(newi)<<endl;
1327 }
1328 if (newnbf > 0) {
1329 sout<<" - Fails : "<<newnbf<<":\n";
1330 for (newi = 1; newi <= newnbf; newi ++) sout<<ch->CFail(newi)<<endl;
1331 }
1332 continue;
1333 }
1334
1335 // mode : 3, counts per type of starting entity (class type)
1336 // 4 : counts per result type and/or status
1337 // 5 : counts per couple (starting type / result type/status)
1338 // 6 : idem plus gives for each item, the list of numbers of
1339 // entities in the starting model
1340 if (mode >= 3 && mode <= 6) {
1341 //IFSelect_PrintCount newpcm = IFSelect_CountByItem;
1342 //if (mode == 6) newpcm = IFSelect_ListByItem;
1343 if (mode == 3) counter->Add (ent,model->TypeName(ent,Standard_False));
1344 if (mode == 4) counter->Add (ent,mess);
1345 if (mode >= 5) {
1346 TCollection_AsciiString mest (model->TypeName(ent,Standard_False));
1347 mest.AssignCat(" -> ");
1348 mest.AssignCat(mess);
1349 //sprintf(mest,"%s -> %s",model->TypeName(ent,Standard_False),mess);
1350 counter->Add (ent,mest.ToCString());
1351 }
1352 }
1353
1354 // Fin de l iteration
1355 }
1356 if (!counter.IsNull()) counter->PrintList(sout,model,pcm);
1357 else sout<<endl;
1358 // Pourcentages
1359 if (mode != 3 && nbi > 0) {
1360 sout << "****** Percentages according Transfer Status ******"<<endl;
1361 PrintPercent (sout,"Result ",nbr+nbrw,nl);
1362 PrintPercent (sout,"Result + FAIL ",nbrf,nl);
1363 PrintPercent (sout,"FAIL, no Result ",nbf,nl);
1364 PrintPercent (sout,"Just Warning ",nbw,nl);
1365 PrintPercent (sout,"Nothing Recorded",nbnr,nl);
1366/* if (nbr+nbrw > 0)
1367 sout<<"****** Result : "<< (nbr+nbrw)*100/nl<<" %"<<endl;
1368 if (nbrf > 0)
1369 sout<<"****** Result + FAIL : "<< (nbrf)*100/nl<<" %"<<endl;
1370 if (nbf > 0)
1371 sout<<"****** FAIL, no Result : "<< (nbf)*100/nl<<" %"<<endl;
1372 if (nbw > 0)
1373 sout<<"****** Just Warning : "<< (nbw)*100/nl<<" %"<<endl;
1374 if (nbnr > 0)
1375 sout<<"****** Nothing Recorded: "<< (nbnr)*100/nl<<" %"<<endl; */
1376 }
1377 return;
1378 }
1379
1380 // Cas what = 4,5 : check-list
1381
1382 if (what == 4 || what == 5) {
1383
1384 Interface_CheckIterator chl = TP->CheckList(Standard_False);
1385 chl.SetName("** TRANSFER READ CHECK **");
1386 if (mode == 0) chl.Print (sout,model,(what == 5));
1387 else {
1388 IFSelect_PrintCount pcm = IFSelect_CountByItem;
1389 if (mode == 2) pcm = IFSelect_ListByItem;
1390 Handle(IFSelect_CheckCounter) counter = new IFSelect_CheckCounter(Standard_True);
1391 counter->Analyse (chl,model,Standard_True,(what == 5));
1392 counter->PrintList (sout,model,pcm);
1393 }
1394 }
1395
1396}