0026912: CLang 3.6.2 compiler warning [-Winconsistent-missing-override]
[occt.git] / src / IGESControl / IGESControl_ActorWrite.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <BRepToIGES_BREntity.hxx>
16 #include <BRepToIGESBRep_Entity.hxx>
17 #include <Geom_Curve.hxx>
18 #include <Geom_Surface.hxx>
19 #include <GeomToIGES_GeomCurve.hxx>
20 #include <GeomToIGES_GeomSurface.hxx>
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>
33 #include <XSAlgo.hxx>
34 #include <XSAlgo_AlgoContainer.hxx>
35
36 IGESControl_ActorWrite::IGESControl_ActorWrite ()  {  ModeTrans() = 0;  }
37
38 Standard_Boolean  IGESControl_ActorWrite::Recognize
39   (const Handle(Transfer_Finder)& start)
40 {
41   DeclareAndCast(TransferBRep_ShapeMapper,shmap,start);
42   if (!shmap.IsNull()) return Standard_True;
43   DeclareAndCast(Transfer_TransientMapper,gemap,start);
44   if (!gemap.IsNull()) {
45     Handle(Standard_Transient) geom = gemap->Value();
46     DeclareAndCast(Geom_Curve,Curve,geom);
47     DeclareAndCast(Geom_Surface,Surf,geom);
48     if (!Curve.IsNull() || !Surf.IsNull()) return Standard_True;
49   }
50   return Standard_False;
51 }
52
53 Handle(Transfer_Binder)  IGESControl_ActorWrite::Transfer
54   (const Handle(Transfer_Finder)& start,
55    const Handle(Transfer_FinderProcess)& FP)
56 {
57   XSAlgo::AlgoContainer()->PrepareForTransfer();
58     
59   DeclareAndCast(IGESData_IGESModel,modl,FP->Model());
60   if (modl.IsNull()) return NullResult();
61   if (themodetrans < 0 || themodetrans > 1) return NullResult();
62   Handle(Standard_Transient) ent;
63
64   DeclareAndCast(TransferBRep_ShapeMapper,shmap,start);
65   if (!shmap.IsNull()) {
66     TopoDS_Shape shape = shmap->Value();
67     if (shape.IsNull()) return NullResult();
68 //  modified by NIZHNY-EAP Tue Aug 29 11:16:54 2000 ___BEGIN___
69     Handle(Standard_Transient) info;
70     Standard_Real Tol = Interface_Static::RVal("write.precision.val");
71     Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val");
72     shape = XSAlgo::AlgoContainer()->ProcessShape( shape, Tol, maxTol, 
73                                                    "write.iges.resource.name", 
74                                                    "write.iges.sequence", info,
75                                                    FP->GetProgress() );
76 //  modified by NIZHNY-EAP Tue Aug 29 11:17:01 2000 ___END___
77
78     BRepToIGES_BREntity   BR0; BR0.SetModel(modl);  BR0.SetTransferProcess(FP);
79     BRepToIGESBRep_Entity BR1; BR1.SetModel(modl);  BR1.SetTransferProcess(FP);
80
81     if (themodetrans == 0) ent = BR0.TransferShape(shape);
82     if (themodetrans == 1) ent = BR1.TransferShape(shape);
83 //  modified by NIZHNY-EAP Tue Aug 29 11:37:18 2000 ___BEGIN___
84     XSAlgo::AlgoContainer()->MergeTransferInfo(FP, info);
85 //  modified by NIZHNY-EAP Tue Aug 29 11:37:25 2000 ___END___
86     if (!ent.IsNull()) return TransientResult(ent);
87   }
88   DeclareAndCast(Transfer_TransientMapper,gemap,start);
89   if (!gemap.IsNull()) {
90     Handle(Standard_Transient) geom = gemap->Value();
91     DeclareAndCast(Geom_Curve,Curve,geom);
92     DeclareAndCast(Geom_Surface,Surf,geom);
93  
94 //  On reconnait : Curve et Surface de Geom
95 //   quid de Point; Geom2d ?
96  
97 //  GeomToIGES_GeomPoint GP;
98     GeomToIGES_GeomCurve GC;    GC.SetModel(modl);
99     GeomToIGES_GeomSurface GS;  GS.SetModel(modl);
100     if (!Curve.IsNull())
101       ent = GC.TransferCurve(Curve,Curve->FirstParameter(),Curve->LastParameter())
102 ;
103     else if (!Surf.IsNull()) {
104       Standard_Real U1,U2,V1,V2;
105       Surf->Bounds(U1,U2,V1,V2);
106       ent = GS.TransferSurface(Surf,U1,U2,V1,V2);
107     }
108     if (!ent.IsNull()) return TransientResult(ent);
109   }
110
111   return NullResult();
112 }