Commit | Line | Data |
---|---|---|
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 | |
15 | #include <BRepToIGES_BREntity.hxx> | |
16 | #include <BRepToIGESBRep_Entity.hxx> | |
7fd59977 | 17 | #include <Geom_Curve.hxx> |
18 | #include <Geom_Surface.hxx> | |
19 | #include <GeomToIGES_GeomCurve.hxx> | |
20 | #include <GeomToIGES_GeomSurface.hxx> | |
42cf5bc1 | 21 | #include <IGESControl_ActorWrite.hxx> |
22 | #include <IGESData_IGESEntity.hxx> | |
23 | #include <IGESData_IGESModel.hxx> | |
24 | #include <Interface_Macros.hxx> | |
25 | #include <Interface_Static.hxx> | |
26 | #include <Standard_Type.hxx> | |
27 | #include <Transfer_Binder.hxx> | |
28 | #include <Transfer_Finder.hxx> | |
29 | #include <Transfer_FinderProcess.hxx> | |
30 | #include <Transfer_SimpleBinderOfTransient.hxx> | |
31 | #include <Transfer_TransientMapper.hxx> | |
32 | #include <TransferBRep_ShapeMapper.hxx> | |
7fd59977 | 33 | #include <XSAlgo.hxx> |
34 | #include <XSAlgo_AlgoContainer.hxx> | |
7fd59977 | 35 | |
92efcf78 | 36 | IMPLEMENT_STANDARD_RTTIEXT(IGESControl_ActorWrite,Transfer_ActorOfFinderProcess) |
37 | ||
7fd59977 | 38 | IGESControl_ActorWrite::IGESControl_ActorWrite () { ModeTrans() = 0; } |
39 | ||
40 | Standard_Boolean IGESControl_ActorWrite::Recognize | |
41 | (const Handle(Transfer_Finder)& start) | |
42 | { | |
43 | DeclareAndCast(TransferBRep_ShapeMapper,shmap,start); | |
44 | if (!shmap.IsNull()) return Standard_True; | |
45 | DeclareAndCast(Transfer_TransientMapper,gemap,start); | |
46 | if (!gemap.IsNull()) { | |
47 | Handle(Standard_Transient) geom = gemap->Value(); | |
48 | DeclareAndCast(Geom_Curve,Curve,geom); | |
49 | DeclareAndCast(Geom_Surface,Surf,geom); | |
50 | if (!Curve.IsNull() || !Surf.IsNull()) return Standard_True; | |
51 | } | |
52 | return Standard_False; | |
53 | } | |
54 | ||
55 | Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer | |
56 | (const Handle(Transfer_Finder)& start, | |
57 | const Handle(Transfer_FinderProcess)& FP) | |
58 | { | |
59 | XSAlgo::AlgoContainer()->PrepareForTransfer(); | |
60 | ||
61 | DeclareAndCast(IGESData_IGESModel,modl,FP->Model()); | |
62 | if (modl.IsNull()) return NullResult(); | |
63 | if (themodetrans < 0 || themodetrans > 1) return NullResult(); | |
64 | Handle(Standard_Transient) ent; | |
65 | ||
66 | DeclareAndCast(TransferBRep_ShapeMapper,shmap,start); | |
67 | if (!shmap.IsNull()) { | |
68 | TopoDS_Shape shape = shmap->Value(); | |
69 | if (shape.IsNull()) return NullResult(); | |
70 | // modified by NIZHNY-EAP Tue Aug 29 11:16:54 2000 ___BEGIN___ | |
71 | Handle(Standard_Transient) info; | |
72 | Standard_Real Tol = Interface_Static::RVal("write.precision.val"); | |
73 | Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val"); | |
74 | shape = XSAlgo::AlgoContainer()->ProcessShape( shape, Tol, maxTol, | |
75 | "write.iges.resource.name", | |
b485ee79 KD |
76 | "write.iges.sequence", info, |
77 | FP->GetProgress() ); | |
7fd59977 | 78 | // modified by NIZHNY-EAP Tue Aug 29 11:17:01 2000 ___END___ |
79 | ||
80 | BRepToIGES_BREntity BR0; BR0.SetModel(modl); BR0.SetTransferProcess(FP); | |
81 | BRepToIGESBRep_Entity BR1; BR1.SetModel(modl); BR1.SetTransferProcess(FP); | |
82 | ||
83 | if (themodetrans == 0) ent = BR0.TransferShape(shape); | |
84 | if (themodetrans == 1) ent = BR1.TransferShape(shape); | |
85 | // modified by NIZHNY-EAP Tue Aug 29 11:37:18 2000 ___BEGIN___ | |
86 | XSAlgo::AlgoContainer()->MergeTransferInfo(FP, info); | |
87 | // modified by NIZHNY-EAP Tue Aug 29 11:37:25 2000 ___END___ | |
88 | if (!ent.IsNull()) return TransientResult(ent); | |
89 | } | |
90 | DeclareAndCast(Transfer_TransientMapper,gemap,start); | |
91 | if (!gemap.IsNull()) { | |
92 | Handle(Standard_Transient) geom = gemap->Value(); | |
93 | DeclareAndCast(Geom_Curve,Curve,geom); | |
94 | DeclareAndCast(Geom_Surface,Surf,geom); | |
95 | ||
96 | // On reconnait : Curve et Surface de Geom | |
97 | // quid de Point; Geom2d ? | |
98 | ||
99 | // GeomToIGES_GeomPoint GP; | |
100 | GeomToIGES_GeomCurve GC; GC.SetModel(modl); | |
101 | GeomToIGES_GeomSurface GS; GS.SetModel(modl); | |
102 | if (!Curve.IsNull()) | |
103 | ent = GC.TransferCurve(Curve,Curve->FirstParameter(),Curve->LastParameter()) | |
104 | ; | |
105 | else if (!Surf.IsNull()) { | |
106 | Standard_Real U1,U2,V1,V2; | |
107 | Surf->Bounds(U1,U2,V1,V2); | |
108 | ent = GS.TransferSurface(Surf,U1,U2,V1,V2); | |
109 | } | |
110 | if (!ent.IsNull()) return TransientResult(ent); | |
111 | } | |
112 | ||
113 | return NullResult(); | |
114 | } |