0033040: Coding - get rid of unused headers [Storage to TopOpeBRepTool]
[occt.git] / src / TopoDSToStep / TopoDSToStep.cxx
1 // Created on: 1994-12-13
2 // Created by: Frederic MAUPAS
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <TopoDSToStep.hxx>
18
19 #include <BRep_Tool.hxx>
20 #include <BRepTools_Modifier.hxx>
21 #include <Standard_Transient.hxx>
22 #include <TopoDS_Shape.hxx>
23 #include <TopoDSToStep_Tool.hxx>
24 #include <Transfer_FinderProcess.hxx>
25 #include <Transfer_SimpleBinderOfTransient.hxx>
26 #include <TransferBRep.hxx>
27 #include <TransferBRep_ShapeMapper.hxx>
28
29 Handle(TCollection_HAsciiString) 
30 TopoDSToStep::DecodeBuilderError(const TopoDSToStep_BuilderError E)
31 {
32   Handle(TCollection_HAsciiString) mess;
33   switch(E)
34     {
35     case TopoDSToStep_BuilderDone:
36       {
37         mess = new TCollection_HAsciiString("Builder Done");
38         break;
39       }
40     case TopoDSToStep_NoFaceMapped:
41       {
42         mess = new TCollection_HAsciiString("None of the Shell Faces has been mapped");
43         break;
44       }
45     case TopoDSToStep_BuilderOther:
46       {
47         mess = new TCollection_HAsciiString("Other Error in Builder");
48         break;
49       }
50     }
51   return mess;
52 }
53
54 Handle(TCollection_HAsciiString) 
55 TopoDSToStep::DecodeFaceError(const TopoDSToStep_MakeFaceError E)
56 {
57   Handle(TCollection_HAsciiString) mess;
58   switch(E)
59     {
60     case TopoDSToStep_FaceDone:
61       {
62         mess = new TCollection_HAsciiString("Face Done");
63         break;
64       }
65     case TopoDSToStep_FaceOther:
66       {
67         mess = new TCollection_HAsciiString("Other Error in Make STEP face");
68         break;
69       }
70     case TopoDSToStep_InfiniteFace:
71       {
72         mess = new TCollection_HAsciiString("The Face has no Outer Wire");
73         break;
74       }
75     case TopoDSToStep_NonManifoldFace:
76       {
77         mess = new TCollection_HAsciiString("The Face is Internal or External");
78         break;
79       }
80     case TopoDSToStep_NoWireMapped:
81       {
82         mess = new TCollection_HAsciiString("None of the Face Wires has been mapped");
83         break;
84       }
85     }
86   return mess;
87 }
88
89 Handle(TCollection_HAsciiString) 
90 TopoDSToStep::DecodeWireError(const TopoDSToStep_MakeWireError E)
91 {
92   Handle(TCollection_HAsciiString) mess;
93   switch(E)
94     {
95     case TopoDSToStep_WireDone:
96       {
97         mess = new TCollection_HAsciiString("Wire Done");
98         break;
99       }
100     case TopoDSToStep_WireOther:
101       {
102         mess = new TCollection_HAsciiString("Other Error in Make STEP wire");
103         break;
104       }
105     case TopoDSToStep_NonManifoldWire:
106       {
107         mess = new TCollection_HAsciiString("The Wire is Internal or External");
108         break;
109         }
110     }
111   return mess;
112 }
113
114 Handle(TCollection_HAsciiString) 
115 TopoDSToStep::DecodeEdgeError(const TopoDSToStep_MakeEdgeError E)
116 {
117   Handle(TCollection_HAsciiString) mess;
118   switch(E)
119     {
120     case TopoDSToStep_EdgeDone:
121       {
122         mess = new TCollection_HAsciiString("Edge Done");
123         break;
124       }
125     case TopoDSToStep_EdgeOther:
126       {
127         mess = new TCollection_HAsciiString("Other Error in Make STEP Edge");
128         break;
129       }
130     case TopoDSToStep_NonManifoldEdge:
131       {
132         mess = new TCollection_HAsciiString("The Edge is Internal or External");
133         break;
134       }
135     }
136   return mess;
137 }
138
139 Handle(TCollection_HAsciiString) 
140 TopoDSToStep::DecodeVertexError(const TopoDSToStep_MakeVertexError E)
141 {
142   Handle(TCollection_HAsciiString) mess;
143   switch(E)
144     {
145     case TopoDSToStep_VertexDone:
146       {
147         mess = new TCollection_HAsciiString("Vertex Done");
148         break;
149       }
150     case TopoDSToStep_VertexOther:
151       {
152         mess = new TCollection_HAsciiString("Other Error in Make STEP Vertex");
153         break;
154       }
155     }
156   return mess;
157 }
158
159 //=======================================================================
160 //function : AddResult
161 //purpose  : 
162 //=======================================================================
163
164 void TopoDSToStep::AddResult (const Handle(Transfer_FinderProcess)& FP,
165                               const TopoDS_Shape &Shape,
166                               const Handle(Standard_Transient) &ent)
167 {
168   Handle(Transfer_SimpleBinderOfTransient) result = new Transfer_SimpleBinderOfTransient;
169   result->SetResult (ent);
170
171   Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper (FP,Shape);
172   Handle(Transfer_Binder) binder = FP->Find ( mapper );
173
174   if ( binder.IsNull() ) FP->Bind ( mapper, result );
175   else binder->AddResult ( result );
176 }
177
178 //=======================================================================
179 //function : AddResult
180 //purpose  : 
181 //=======================================================================
182
183 void TopoDSToStep::AddResult (const Handle(Transfer_FinderProcess)& FP,
184                               const TopoDSToStep_Tool &Tool)
185 {
186   const MoniTool_DataMapOfShapeTransient &Map = Tool.Map();
187   MoniTool_DataMapIteratorOfDataMapOfShapeTransient it ( Map );
188   for ( ; it.More(); it.Next() ) 
189     TopoDSToStep::AddResult ( FP, it.Key(), it.Value() );
190 }