0031382: Data Exchange - BinXCAF should preserve length unit information
[occt.git] / src / XSAlgo / XSAlgo_AlgoContainer.cxx
1 // Created on: 2000-01-19
2 // Created by: data exchange team
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16
17 #include <BRep_Builder.hxx>
18 #include <BRep_Tool.hxx>
19 #include <BRepBuilderAPI_MakeEdge.hxx>
20 #include <Geom2d_Curve.hxx>
21 #include <Geom_Curve.hxx>
22 #include <Geom_Surface.hxx>
23 #include <gp_Pnt.hxx>
24 #include <gp_Pnt2d.hxx>
25 #include <Interface_Static.hxx>
26 #include <Message_ListIteratorOfListOfMsg.hxx>
27 #include <Message_ListOfMsg.hxx>
28 #include <Message_Msg.hxx>
29 #include <Resource_Manager.hxx>
30 #include <ShapeAlgo.hxx>
31 #include <ShapeAlgo_AlgoContainer.hxx>
32 #include <ShapeAlgo_ToolContainer.hxx>
33 #include <ShapeAnalysis_Edge.hxx>
34 #include <ShapeBuild_Edge.hxx>
35 #include <ShapeBuild_ReShape.hxx>
36 #include <ShapeCustom.hxx>
37 #include <ShapeExtend_DataMapOfShapeListOfMsg.hxx>
38 #include <ShapeExtend_MsgRegistrator.hxx>
39 #include <ShapeFix_Edge.hxx>
40 #include <ShapeFix_Shape.hxx>
41 #include <ShapeProcess.hxx>
42 #include <ShapeProcess_ShapeContext.hxx>
43 #include <Standard_ErrorHandler.hxx>
44 #include <Standard_Failure.hxx>
45 #include <Standard_Transient.hxx>
46 #include <Standard_Type.hxx>
47 #include <TopExp.hxx>
48 #include <TopoDS.hxx>
49 #include <TopoDS_Edge.hxx>
50 #include <TopoDS_Face.hxx>
51 #include <TopoDS_Iterator.hxx>
52 #include <TopoDS_Shape.hxx>
53 #include <TopoDS_Vertex.hxx>
54 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
55 #include <TopTools_DataMapOfShapeShape.hxx>
56 #include <Transfer_FinderProcess.hxx>
57 #include <Transfer_TransientListBinder.hxx>
58 #include <Transfer_TransientProcess.hxx>
59 #include <TransferBRep.hxx>
60 #include <TransferBRep_ShapeBinder.hxx>
61 #include <TransferBRep_ShapeMapper.hxx>
62 #include <UnitsMethods.hxx>
63 #include <XSAlgo_AlgoContainer.hxx>
64 #include <XSAlgo_ToolContainer.hxx>
65 #include <TopExp_Explorer.hxx>
66
67 IMPLEMENT_STANDARD_RTTIEXT(XSAlgo_AlgoContainer,Standard_Transient)
68
69 //=======================================================================
70 //function : XSAlgo_AlgoContainer
71 //purpose  : 
72 //=======================================================================
73 XSAlgo_AlgoContainer::XSAlgo_AlgoContainer()
74 {
75   myTC = new XSAlgo_ToolContainer;
76 }
77
78 //=======================================================================
79 //function : PrepareForTransfer
80 //purpose  : 
81 //=======================================================================
82
83 void XSAlgo_AlgoContainer::PrepareForTransfer() const
84 {
85   UnitsMethods::SetCasCadeLengthUnit(Interface_Static::IVal("xstep.cascade.unit"));
86 }
87
88 //=======================================================================
89 //function : ProcessShape
90 //purpose  : 
91 //=======================================================================
92
93 TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
94                                                  const Standard_Real Prec,
95                                                  const Standard_Real maxTol,
96                                                  const Standard_CString prscfile,
97                                                  const Standard_CString pseq,
98                                                  Handle(Standard_Transient)& info,
99                                                  const Message_ProgressRange& theProgress,
100                                                  const Standard_Boolean NonManifold) const
101 {
102   if ( shape.IsNull() ) return shape;
103   
104   Handle(ShapeProcess_ShapeContext) context = Handle(ShapeProcess_ShapeContext)::DownCast(info);
105   if ( context.IsNull() )
106   {
107     Standard_CString rscfile = Interface_Static::CVal(prscfile);
108     if (!rscfile)
109       rscfile = prscfile;
110     context = new ShapeProcess_ShapeContext(shape, rscfile);
111     context->SetDetalisation(TopAbs_EDGE);
112   }
113   context->SetNonManifold(NonManifold);
114   info = context;
115   
116   Standard_CString seq = Interface_Static::CVal ( pseq );
117   if ( ! seq ) seq = pseq;
118   
119   // if resource file is not loaded or does not define <seq>.exec.op, 
120   // do default fixes
121   Handle(Resource_Manager) rsc = context->ResourceManager();
122   TCollection_AsciiString str ( seq );
123   str += ".exec.op";
124   if ( ! rsc->Find ( str.ToCString() ) ) {
125 #ifdef OCCT_DEBUG
126     {
127       static Standard_Integer time = 0;
128       if ( ! time )
129         std::cout << "Warning: XSAlgo_AlgoContainer::ProcessShape(): Sequence " << str.ToCString() << 
130                 " is not defined in " << prscfile << " resource; do default processing" << std::endl;
131       time++;
132     }
133 #endif
134     // if reading, do default ShapeFix
135     if ( ! strncmp ( pseq, "read.", 5 ) ) {
136       try {
137         OCC_CATCH_SIGNALS
138         Handle(ShapeExtend_MsgRegistrator) msg = new ShapeExtend_MsgRegistrator;
139         Handle(ShapeFix_Shape) sfs = ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape();
140         sfs->Init ( shape );
141         sfs->SetMsgRegistrator ( msg );
142         sfs->SetPrecision ( Prec );
143         sfs->SetMaxTolerance ( maxTol );
144         sfs->FixFaceTool()->FixWireTool()->FixSameParameterMode() = Standard_False;
145         sfs->FixSolidTool()->CreateOpenSolidMode() = Standard_False;
146         sfs->Perform(theProgress);
147
148         TopoDS_Shape S = sfs->Shape();
149         if ( ! S.IsNull() && S != shape ) {
150           context->RecordModification ( sfs->Context(), msg );
151           context->SetResult ( S );
152         }
153       }
154       catch (Standard_Failure const& anException) {
155 #ifdef OCCT_DEBUG
156         std::cout << "Error: XSAlgo_AlgoContainer::ProcessShape(): Exception in ShapeFix::Shape" << std::endl;
157         anException.Print(std::cout); std::cout << std::endl;
158 #endif
159         (void)anException;
160       }
161       return context->Result();
162     }
163     // for writing, define default sequence of DirectFaces
164     else if ( ! strncmp ( pseq, "write.", 6 ) ) {
165       rsc->SetResource ( str.ToCString(), "DirectFaces" );
166     }
167   }
168   
169   // Define runtime tolerances and do Shape Processing 
170   rsc->SetResource ( "Runtime.Tolerance", Prec );
171   rsc->SetResource ( "Runtime.MaxTolerance", maxTol );
172
173   if ( !ShapeProcess::Perform(context, seq, theProgress) )
174     return shape; // return original shape
175
176   return context->Result();
177 }
178                                                   
179 //=======================================================================
180 //function : PerformFixShape
181 //purpose  : 
182 //=======================================================================
183
184 /*
185 TopoDS_Shape XSAlgo_AlgoContainer::PerformFixShape(const TopoDS_Shape& S,
186                                                       const Handle(Transfer_TransientProcess)& TP,
187                                                       const Standard_Real Prec,
188                                                       const Standard_Real MaxTol) const
189 {
190   if ( S.IsNull() ) return S;
191   
192   TopoDS_Shape shape = S;
193   // fixing shape
194   try {
195     OCC_CATCH_SIGNALS
196     Handle(ShapeFix_Shape) sfs = ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape();
197     sfs->Init ( S );
198     sfs->SetMsgRegistrator ( new ShapeExtend_MsgRegistrator );
199     sfs->SetPrecision ( Prec );
200     sfs->SetMaxTolerance ( MaxTol );
201     sfs->FixFaceTool()->FixWireTool()->FixSameParameterMode() = Standard_False;
202     sfs->Perform();
203
204     shape = sfs->Shape();
205     
206     // to be removed when messages come
207     if ( shape == S || shape.IsNull() ) return S;
208     
209     // update map to reflect the substitutions
210     Handle(ShapeBuild_ReShape) context = sfs->Context();
211     const ShapeExtend_DataMapOfShapeListOfMsg& msgmap = 
212       Handle(ShapeExtend_MsgRegistrator)::DownCast (sfs->MsgRegistrator())->MapShape();
213     for ( Standard_Integer i=1; i <= TP->NbMapped(); i++ ) {
214       Handle(Transfer_Binder) bnd = TP->MapItem ( i );
215       Handle(TransferBRep_ShapeBinder) sb = Handle(TransferBRep_ShapeBinder)::DownCast ( bnd );
216       if ( sb.IsNull() || sb->Result().IsNull() ) continue;
217       
218       TopoDS_Shape orig = sb->Result();
219       
220       // update messages (messages must be taken from each level in the substitution map)
221       TopoDS_Shape cur, next = orig;
222       do {
223         cur = next;
224         Message_ListOfMsg msglist;
225         if (msgmap.IsBound (cur)) {
226           msglist = msgmap.Find (cur);
227           for (Message_ListIteratorOfListOfMsg iter (msglist); iter.More(); iter.Next()) {
228             const Message_Msg& msg = iter.Value();
229             sb->AddWarning (msg.Value(), msg.Original());
230           }
231         }
232         next = context->Value (cur);
233       } while (cur != next);
234
235       // update shapes
236       TopoDS_Shape res;
237       if ( ! context->Status ( orig, res, Standard_True ) ) continue;
238
239       sb->SetResult ( res );
240     }
241   }
242   catch (Standard_Failure) {
243 #ifdef OCCT_DEBUG
244     std::cout << "Error: XSAlgo_AlgoContainer::PerformFixShape(): Exception in ShapeFix::Shape" << std::endl;
245 #endif
246   }   
247   return shape;
248 }
249 */
250
251 // ============================================================================
252 // Method  : MakeEdgeOnCurve
253 // Purpose : for CheckPCurve
254 // ============================================================================
255
256 static TopoDS_Edge MakeEdgeOnCurve(const TopoDS_Edge edge)
257 {
258   TopoDS_Edge result;
259   //BRep_Builder B; // B not used - see below (skl)
260   Handle(Geom_Curve) C3d;
261   ShapeAnalysis_Edge sae;
262   Standard_Real cf, cl;
263   if (!sae.Curve3d (edge, C3d, cf, cl, Standard_False )) 
264     return result;
265   gp_Pnt PV1 = C3d->Value(cf);
266   gp_Pnt PV2 = C3d->Value(cl);
267   BRepBuilderAPI_MakeEdge mkEdge(C3d, PV1, PV2, cf, cl);
268 //:S4136  Standard_Real tol = BRep_Tool::Tolerance (edge);
269   ShapeBuild_Edge SBE;          //skl 10.07.2001
270   SBE.SetRange3d(mkEdge,cf,cl); //skl 10.07.2001
271   result = mkEdge.Edge();
272 //:S4136  B.UpdateEdge(result,tol);
273   return result;
274 }
275
276 //=======================================================================
277 //function : CheckPCurve
278 //purpose  : 
279 //=======================================================================
280
281 Standard_Boolean XSAlgo_AlgoContainer::CheckPCurve (const TopoDS_Edge& E,
282                                                     const TopoDS_Face& face,
283                                                     const Standard_Real preci,
284                                                     const Standard_Boolean isSeam) const
285 {
286   Standard_Real w1, w2;  
287   Handle(Geom2d_Curve) thePC;
288   ShapeAnalysis_Edge sae;
289   if ( ! sae.PCurve (E, face, thePC, w1, w2, Standard_False ) ) {
290     return Standard_False;
291   }
292
293   // Check for pcurve longer than surface
294   Handle(Geom_Surface) surf = BRep_Tool::Surface(face);
295   Standard_Real UF,UL,VF,VL;
296   surf->Bounds (UF,UL,VF,VL);
297   gp_Pnt2d PUV1, PUV2;
298   PUV1 = thePC->Value(w1);
299   PUV2 = thePC->Value(w2);
300   //    Multi-periodique ? mieux vaut jeter (attention aux valeurs infinies)
301   Standard_Real DU = Abs (PUV1.X() - PUV2.X());
302   Standard_Real DV = Abs (PUV1.Y() - PUV2.Y());
303   if ( DU/8. > (UL/6. - UF/6.) || DV/8. > (VL/6. - VF/6.) ) {
304     ShapeBuild_Edge().RemovePCurve(E,face);
305 #ifdef OCCT_DEBUG
306     std::cout<<"Removing pcurve periodic"<<std::endl;
307 #endif      
308     return Standard_False;
309   }
310
311   // Second Check : 2D and 3D consistency (if the Pcurve has not been 
312   //                dropped)
313   //  On verifie aussi qu on ne s enroule pas trop ...
314   //  ex. : UVV en DEGRES sur une surface en RADIANS, recalee = 57 tours !
315
316   Handle(Geom_Curve) C3d;
317   Standard_Real cf1, cl1;
318   sae.Curve3d (E, C3d, cf1, cl1, Standard_False );
319
320   gp_Pnt P1 = surf->Value(PUV1.X(), PUV1.Y());
321   gp_Pnt P2 = surf->Value(PUV2.X(), PUV2.Y());
322   TopoDS_Vertex V1 = TopExp::FirstVertex(E);
323   TopoDS_Vertex V2 = TopExp::LastVertex(E);
324   gp_Pnt PV1 = ( C3d.IsNull() ? BRep_Tool::Pnt(V1) : C3d->Value(cf1) );
325   gp_Pnt PV2 = ( C3d.IsNull() ? BRep_Tool::Pnt(V2) : C3d->Value(cl1) );
326   Standard_Real Dist11 = PV1.Distance(P1), Dist22 = PV2.Distance(P2);
327     
328   if (!((Dist11 <= preci) && (Dist22 <= preci))) {
329     ShapeBuild_Edge().RemovePCurve(E,face);
330 #ifdef OCCT_DEBUG
331     std::cout<<"Removing pcurve points"<<std::endl;
332 #endif      
333     return Standard_False;
334   }
335
336   //
337   // pdn checking deviation between pcurve and 3D curve
338   //
339   
340   // Make temporary edge for analysis
341   if ( C3d.IsNull() ) return Standard_False;
342   TopoDS_Edge edge = MakeEdgeOnCurve(E);
343   
344   // fill it with pcurve(s)
345   BRep_Builder B;
346   Handle(Geom2d_Curve) seamPC;
347   if ( isSeam ) {
348     Standard_Real f, l;
349     TopoDS_Shape REdge = E.Reversed() ;
350     if ( ! sae.PCurve ( TopoDS::Edge ( REdge ), 
351                         face, seamPC, f, l, Standard_False ) ||
352          seamPC == thePC ) 
353       seamPC = Handle(Geom2d_Curve)::DownCast ( thePC->Copy() );
354     B.UpdateEdge ( edge, thePC, seamPC, face, 0.);
355   }
356   else B.UpdateEdge ( edge, thePC, face, 0.);
357   B.Range(edge,face,w1,w2);
358   B.SameRange(edge, Standard_False );
359   //:S4136
360   Standard_Integer SPmode = Interface_Static::IVal("read.stdsameparameter.mode");
361   if ( SPmode ) 
362     B.SameParameter (edge, Standard_False );
363
364   // call FixSP to see what it will do
365   Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge;
366   sfe->FixSameParameter(edge);
367   Standard_Real tol = BRep_Tool::Tolerance (edge);
368   //    Standard_Real tolV1 = BRep_Tool::Tolerance(TopExp::FirstVertex(edge));
369   //    Standard_Real tolV2 = BRep_Tool::Tolerance(TopExp::LastVertex(edge));                          
370   Standard_Boolean sr = BRep_Tool::SameRange ( edge );
371   Standard_Boolean sp = BRep_Tool::SameParameter ( edge );
372   
373   // if result is not nice, try to call projection and take the best
374   if ( tol > Min ( 1., 2.*preci ) || ! sr ) {
375     //pdn trying to recompute pcurve 
376     TopoDS_Edge edgePr = MakeEdgeOnCurve(E);
377     sfe->FixAddPCurve(edgePr, face, isSeam, preci);
378     sfe->FixSameParameter(edgePr);
379     Standard_Real tolPr = BRep_Tool::Tolerance (edgePr);
380     //pdn choose the best pcurve
381     if ( tolPr < tol || ! sr ) {
382       //        tolV1 = BRep_Tool::Tolerance(TopExp::FirstVertex(edgePr));
383       //        tolV2 = BRep_Tool::Tolerance(TopExp::LastVertex(edgePr));
384       sr = BRep_Tool::SameRange ( edgePr );
385       sp = BRep_Tool::SameParameter ( edgePr );
386       tol = tolPr;
387       edge = edgePr;
388     }
389   }
390   
391   // get corrected pcurve from the temporary edge, and put to original
392   sae.PCurve ( edge, face, thePC, w1, w2, Standard_False );
393   if ( isSeam ) {
394     Standard_Real f, l;
395     TopoDS_Shape REdge = edge.Reversed();
396     sae.PCurve ( TopoDS::Edge ( REdge ), face, seamPC, f, l, Standard_False );
397     if ( E.Orientation() == TopAbs_REVERSED ) //:abv 14.11.01: coneEl.sat loop
398       B.UpdateEdge ( E, seamPC, thePC, face, tol );
399     else 
400       B.UpdateEdge ( E, thePC, seamPC, face, tol );
401   }
402   else B.UpdateEdge ( E, thePC, face, tol );
403
404   B.UpdateVertex(V1,tol);
405   B.UpdateVertex(V2,tol);
406   B.Range(E,face, w1, w2);
407   if(BRep_Tool::SameRange(E))
408     B.SameRange( E, sr );
409   if(BRep_Tool::SameParameter(E))
410     B.SameParameter ( E, sp );
411   
412   return Standard_True;
413 }
414
415 //=======================================================================
416 //function : MergeTransferInfo
417 //purpose  : 
418 //=======================================================================
419
420 void XSAlgo_AlgoContainer::MergeTransferInfo(const Handle(Transfer_TransientProcess)& TP,
421                                                 const Handle(Standard_Transient) &info,
422                                                 const Standard_Integer startTPitem) const
423 {
424   Handle(ShapeProcess_ShapeContext) context = Handle(ShapeProcess_ShapeContext)::DownCast ( info );
425   if ( context.IsNull() ) return;
426
427   const TopTools_DataMapOfShapeShape &map = context->Map();
428   Handle(ShapeExtend_MsgRegistrator) msg = context->Messages();
429   if ( map.Extent() <=0 && ( msg.IsNull() || msg->MapShape().Extent() <=0 ) )
430     return;
431
432   Standard_Integer i = ( startTPitem >0 ? startTPitem : 1 );
433   for ( ; i <= TP->NbMapped(); i++ )
434   {
435     Handle(Transfer_Binder) bnd = TP->MapItem ( i );
436     Handle(TransferBRep_ShapeBinder) sb = Handle(TransferBRep_ShapeBinder)::DownCast ( bnd );
437     if ( sb.IsNull() || sb->Result().IsNull() ) continue;
438
439     TopoDS_Shape orig = sb->Result();
440
441     if ( map.IsBound ( orig ) )
442     {
443       sb->SetResult ( map.Find ( orig ) );
444     }
445     else if ( !orig.Location().IsIdentity() )
446     {
447       TopLoc_Location aNullLoc;
448       TopoDS_Shape atmpSh = orig.Located(aNullLoc);
449       if ( map.IsBound ( atmpSh ) ) sb->SetResult ( map.Find ( atmpSh ) );
450     }
451     else
452     {
453       // Some of edges may be modified.
454       BRepTools_ReShape aReShape;
455       Standard_Boolean hasModifiedEdges = Standard_False;
456       TopExp_Explorer anExpSE(orig, TopAbs_EDGE);
457
458       // Remember modifications.
459       for( ; anExpSE.More() ; anExpSE.Next() )
460       {
461         if (  map.IsBound ( anExpSE.Current() ) )
462         {
463           hasModifiedEdges = Standard_True;
464           TopoDS_Shape aModifiedShape = map.Find( anExpSE.Current() );
465           aReShape.Replace(anExpSE.Current(), aModifiedShape);
466         }
467       }
468
469       // Apply modifications and store result in binder.
470       if (hasModifiedEdges)
471       {
472         TopoDS_Shape aRes = aReShape.Apply(orig);
473         sb->SetResult ( aRes );
474       }
475     }
476
477       
478     // update messages
479     if ( ! msg.IsNull() ) {
480       const ShapeExtend_DataMapOfShapeListOfMsg& msgmap = msg->MapShape();
481       if ( msgmap.IsBound (orig) ) {
482         const Message_ListOfMsg &msglist = msgmap.Find (orig);
483         for (Message_ListIteratorOfListOfMsg iter (msglist); iter.More(); iter.Next()) {
484           const Message_Msg& mess = iter.Value();
485           sb->AddWarning (TCollection_AsciiString(mess.Value()).ToCString(),
486                           TCollection_AsciiString(mess.Original()).ToCString());
487         }
488       }
489     }
490   }
491 }
492
493 //=======================================================================
494 //function : MergeTransferInfo
495 //purpose  : 
496 //=======================================================================
497
498 void XSAlgo_AlgoContainer::MergeTransferInfo(const Handle(Transfer_FinderProcess)& FP,
499                                                 const Handle(Standard_Transient) &info) const
500 {
501   Handle(ShapeProcess_ShapeContext) context = Handle(ShapeProcess_ShapeContext)::DownCast ( info );
502   if ( context.IsNull() ) return;
503
504   const TopTools_DataMapOfShapeShape &map = context->Map();
505   TopTools_DataMapIteratorOfDataMapOfShapeShape ShapeShapeIterator(map);
506   Handle(ShapeExtend_MsgRegistrator) msg = context->Messages();
507
508   for ( ; ShapeShapeIterator.More(); ShapeShapeIterator.Next() ) {
509
510     TopoDS_Shape orig = ShapeShapeIterator.Key(), res = ShapeShapeIterator.Value();
511     Handle(TransferBRep_ShapeMapper) resMapper = TransferBRep::ShapeMapper ( FP, res );
512     Handle(Transfer_Binder) resBinder = FP->Find ( resMapper );
513     
514     if (resBinder.IsNull()) {
515       resBinder = new TransferBRep_ShapeBinder(res);
516       //if <orig> shape was split, put entities corresponding to new shapes
517       // into Transfer_TransientListBinder.
518       if ( orig.ShapeType() > res.ShapeType() ) {
519         TopoDS_Shape sub;
520         Handle(Transfer_TransientListBinder) TransientListBinder = new Transfer_TransientListBinder;
521         for (TopoDS_Iterator it(res); it.More(); it.Next()) {
522           Handle(Transfer_Finder) subMapper = TransferBRep::ShapeMapper ( FP, it.Value());
523           if (subMapper.IsNull()) continue;
524
525           Handle(Standard_Transient) tr = FP->FindTransient ( subMapper );
526           if (tr.IsNull()) continue;
527           TransientListBinder->AddResult(tr);
528           sub = it.Value();
529         }
530         if ( TransientListBinder->NbTransients() == 1 ) resBinder = new TransferBRep_ShapeBinder(sub);
531         else if ( TransientListBinder->NbTransients() > 1 ) {
532           resBinder->AddResult(TransientListBinder);
533 //        resBinder->SetNext(TransientListBinder, Standard_True);
534 #ifdef OCCT_DEBUG
535           std::cout<<"Info: TransientListBinder created for split shape"<<std::endl;
536         } 
537         else {
538           std::cout<<"Warning: XSAlgo_AlgoContainer::MergeTransferInfo() "
539             <<"No results were found for split shape. "<<std::endl;
540           //<<"Transfer_FinderProcess->NbMapped() = "<<FP->NbMapped()<<std::endl;
541 #endif    
542         }
543       }
544     }
545     
546     Handle(TransferBRep_ShapeMapper) origMapper= TransferBRep::ShapeMapper ( FP, orig);
547     Handle(Transfer_Binder) origBinder = FP->Find ( origMapper );
548     if ( origBinder.IsNull() ) {
549       FP->Bind(origMapper, resBinder);
550     }
551     else {
552       origBinder->AddResult ( resBinder );
553     }
554     
555     // update messages
556     if ( ! msg.IsNull() ) {
557       const ShapeExtend_DataMapOfShapeListOfMsg& msgmap = msg->MapShape();
558       if ( msgmap.IsBound (orig) ) {
559         const Message_ListOfMsg &msglist = msgmap.Find (orig);
560         for (Message_ListIteratorOfListOfMsg iter (msglist); iter.More(); iter.Next()) {
561           const Message_Msg& mess = iter.Value();
562           resBinder->AddWarning (TCollection_AsciiString(mess.Value()).ToCString(),
563                                  TCollection_AsciiString(mess.Original()).ToCString());
564         }
565       }
566     }
567   }
568 }