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