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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <TopoDSToStep.hxx>
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>
29 Handle(TCollection_HAsciiString)
30 TopoDSToStep::DecodeBuilderError(const TopoDSToStep_BuilderError E)
32 Handle(TCollection_HAsciiString) mess;
35 case TopoDSToStep_BuilderDone:
37 mess = new TCollection_HAsciiString("Builder Done");
40 case TopoDSToStep_NoFaceMapped:
42 mess = new TCollection_HAsciiString("None of the Shell Faces has been mapped");
45 case TopoDSToStep_BuilderOther:
47 mess = new TCollection_HAsciiString("Other Error in Builder");
54 Handle(TCollection_HAsciiString)
55 TopoDSToStep::DecodeFaceError(const TopoDSToStep_MakeFaceError E)
57 Handle(TCollection_HAsciiString) mess;
60 case TopoDSToStep_FaceDone:
62 mess = new TCollection_HAsciiString("Face Done");
65 case TopoDSToStep_FaceOther:
67 mess = new TCollection_HAsciiString("Other Error in Make STEP face");
70 case TopoDSToStep_InfiniteFace:
72 mess = new TCollection_HAsciiString("The Face has no Outer Wire");
75 case TopoDSToStep_NonManifoldFace:
77 mess = new TCollection_HAsciiString("The Face is Internal or External");
80 case TopoDSToStep_NoWireMapped:
82 mess = new TCollection_HAsciiString("None of the Face Wires has been mapped");
89 Handle(TCollection_HAsciiString)
90 TopoDSToStep::DecodeWireError(const TopoDSToStep_MakeWireError E)
92 Handle(TCollection_HAsciiString) mess;
95 case TopoDSToStep_WireDone:
97 mess = new TCollection_HAsciiString("Wire Done");
100 case TopoDSToStep_WireOther:
102 mess = new TCollection_HAsciiString("Other Error in Make STEP wire");
105 case TopoDSToStep_NonManifoldWire:
107 mess = new TCollection_HAsciiString("The Wire is Internal or External");
114 Handle(TCollection_HAsciiString)
115 TopoDSToStep::DecodeEdgeError(const TopoDSToStep_MakeEdgeError E)
117 Handle(TCollection_HAsciiString) mess;
120 case TopoDSToStep_EdgeDone:
122 mess = new TCollection_HAsciiString("Edge Done");
125 case TopoDSToStep_EdgeOther:
127 mess = new TCollection_HAsciiString("Other Error in Make STEP Edge");
130 case TopoDSToStep_NonManifoldEdge:
132 mess = new TCollection_HAsciiString("The Edge is Internal or External");
139 Handle(TCollection_HAsciiString)
140 TopoDSToStep::DecodeVertexError(const TopoDSToStep_MakeVertexError E)
142 Handle(TCollection_HAsciiString) mess;
145 case TopoDSToStep_VertexDone:
147 mess = new TCollection_HAsciiString("Vertex Done");
150 case TopoDSToStep_VertexOther:
152 mess = new TCollection_HAsciiString("Other Error in Make STEP Vertex");
159 //=======================================================================
160 //function : AddResult
162 //=======================================================================
164 void TopoDSToStep::AddResult (const Handle(Transfer_FinderProcess)& FP,
165 const TopoDS_Shape &Shape,
166 const Handle(Standard_Transient) &ent)
168 Handle(Transfer_SimpleBinderOfTransient) result = new Transfer_SimpleBinderOfTransient;
169 result->SetResult (ent);
171 Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper (FP,Shape);
172 Handle(Transfer_Binder) binder = FP->Find ( mapper );
174 if ( binder.IsNull() ) FP->Bind ( mapper, result );
175 else binder->AddResult ( result );
178 //=======================================================================
179 //function : AddResult
181 //=======================================================================
183 void TopoDSToStep::AddResult (const Handle(Transfer_FinderProcess)& FP,
184 const TopoDSToStep_Tool &Tool)
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() );