1 #include <IGESControl_ActorWrite.ixx>
2 #include <TransferBRep_ShapeMapper.hxx>
3 #include <Interface_Macros.hxx>
4 #include <IGESData_IGESModel.hxx>
6 #include <BRepToIGES_BREntity.hxx>
7 #include <BRepToIGESBRep_Entity.hxx>
9 #include <Transfer_TransientMapper.hxx>
10 #include <Geom_Curve.hxx>
11 #include <Geom_Surface.hxx>
12 #include <GeomToIGES_GeomCurve.hxx>
13 #include <GeomToIGES_GeomSurface.hxx>
15 #include <XSAlgo_AlgoContainer.hxx>
16 #include <Interface_Static.hxx>
18 IGESControl_ActorWrite::IGESControl_ActorWrite () { ModeTrans() = 0; }
20 Standard_Boolean IGESControl_ActorWrite::Recognize
21 (const Handle(Transfer_Finder)& start)
23 DeclareAndCast(TransferBRep_ShapeMapper,shmap,start);
24 if (!shmap.IsNull()) return Standard_True;
25 DeclareAndCast(Transfer_TransientMapper,gemap,start);
26 if (!gemap.IsNull()) {
27 Handle(Standard_Transient) geom = gemap->Value();
28 DeclareAndCast(Geom_Curve,Curve,geom);
29 DeclareAndCast(Geom_Surface,Surf,geom);
30 if (!Curve.IsNull() || !Surf.IsNull()) return Standard_True;
32 return Standard_False;
35 Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer
36 (const Handle(Transfer_Finder)& start,
37 const Handle(Transfer_FinderProcess)& FP)
39 XSAlgo::AlgoContainer()->PrepareForTransfer();
41 DeclareAndCast(IGESData_IGESModel,modl,FP->Model());
42 if (modl.IsNull()) return NullResult();
43 if (themodetrans < 0 || themodetrans > 1) return NullResult();
44 Handle(Standard_Transient) ent;
46 DeclareAndCast(TransferBRep_ShapeMapper,shmap,start);
47 if (!shmap.IsNull()) {
48 TopoDS_Shape shape = shmap->Value();
49 if (shape.IsNull()) return NullResult();
50 // modified by NIZHNY-EAP Tue Aug 29 11:16:54 2000 ___BEGIN___
51 Handle(Standard_Transient) info;
52 Standard_Real Tol = Interface_Static::RVal("write.precision.val");
53 Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val");
54 shape = XSAlgo::AlgoContainer()->ProcessShape( shape, Tol, maxTol,
55 "write.iges.resource.name",
56 "write.iges.sequence", info,
58 // modified by NIZHNY-EAP Tue Aug 29 11:17:01 2000 ___END___
60 BRepToIGES_BREntity BR0; BR0.SetModel(modl); BR0.SetTransferProcess(FP);
61 BRepToIGESBRep_Entity BR1; BR1.SetModel(modl); BR1.SetTransferProcess(FP);
63 if (themodetrans == 0) ent = BR0.TransferShape(shape);
64 if (themodetrans == 1) ent = BR1.TransferShape(shape);
65 // modified by NIZHNY-EAP Tue Aug 29 11:37:18 2000 ___BEGIN___
66 XSAlgo::AlgoContainer()->MergeTransferInfo(FP, info);
67 // modified by NIZHNY-EAP Tue Aug 29 11:37:25 2000 ___END___
68 if (!ent.IsNull()) return TransientResult(ent);
70 DeclareAndCast(Transfer_TransientMapper,gemap,start);
71 if (!gemap.IsNull()) {
72 Handle(Standard_Transient) geom = gemap->Value();
73 DeclareAndCast(Geom_Curve,Curve,geom);
74 DeclareAndCast(Geom_Surface,Surf,geom);
76 // On reconnait : Curve et Surface de Geom
77 // quid de Point; Geom2d ?
79 // GeomToIGES_GeomPoint GP;
80 GeomToIGES_GeomCurve GC; GC.SetModel(modl);
81 GeomToIGES_GeomSurface GS; GS.SetModel(modl);
83 ent = GC.TransferCurve(Curve,Curve->FirstParameter(),Curve->LastParameter())
85 else if (!Surf.IsNull()) {
86 Standard_Real U1,U2,V1,V2;
87 Surf->Bounds(U1,U2,V1,V2);
88 ent = GS.TransferSurface(Surf,U1,U2,V1,V2);
90 if (!ent.IsNull()) return TransientResult(ent);