summaryrefslogtreecommitdiff
path: root/src/TopoDSToStep/TopoDSToStep.cxx
blob: acba9b136fc96cc1be3ef93cc75b73afc0ce06c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
// File:	TopoDSToStep.cxx
// Created:	Tue Dec 13 14:03:54 1994
// Author:	Frederic MAUPAS
//		<fma@stylox>

#include <TopoDSToStep.ixx>
#include <BRepTools_Modifier.hxx>
//#include <TopoDSToStep_DirectModification.hxx>
//#include <TopoDSToStep_ConicalSurfModif.hxx>

#include <TColStd_MapOfTransient.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopLoc_Location.hxx>
#include <Geom_Surface.hxx>
#include <BRep_Tool.hxx>
#include <Transfer_SimpleBinderOfTransient.hxx>
#include <TransferBRep_ShapeMapper.hxx>
#include <TransferBRep.hxx>
#include <Transfer_Binder.hxx>
#include <MoniTool_DataMapOfShapeTransient.hxx>
#include <TopoDSToStep_Tool.hxx>
#include <MoniTool_DataMapIteratorOfDataMapOfShapeTransient.hxx>


Handle(TCollection_HAsciiString) 
TopoDSToStep::DecodeBuilderError(const TopoDSToStep_BuilderError E)
{
  Handle(TCollection_HAsciiString) mess;
  switch(E)
    {
    case TopoDSToStep_BuilderDone:
      {
	mess = new TCollection_HAsciiString("Builder Done");
	break;
      }
    case TopoDSToStep_NoFaceMapped:
      {
	mess = new TCollection_HAsciiString("None of the Shell Faces has been mapped");
	break;
      }
    case TopoDSToStep_BuilderOther:
      {
	mess = new TCollection_HAsciiString("Other Error in Builder");
	break;
      }
    }
  return mess;
}

Handle(TCollection_HAsciiString) 
TopoDSToStep::DecodeFaceError(const TopoDSToStep_MakeFaceError E)
{
  Handle(TCollection_HAsciiString) mess;
  switch(E)
    {
    case TopoDSToStep_FaceDone:
      {
	mess = new TCollection_HAsciiString("Face Done");
	break;
      }
    case TopoDSToStep_FaceOther:
      {
	mess = new TCollection_HAsciiString("Other Error in Make STEP face");
	break;
      }
    case TopoDSToStep_InfiniteFace:
      {
	mess = new TCollection_HAsciiString("The Face has no Outer Wire");
	break;
      }
    case TopoDSToStep_NonManifoldFace:
      {
	mess = new TCollection_HAsciiString("The Face is Internal or External");
	break;
      }
    case TopoDSToStep_NoWireMapped:
      {
	mess = new TCollection_HAsciiString("None of the Face Wires has been mapped");
	break;
      }
    }
  return mess;
}

Handle(TCollection_HAsciiString) 
TopoDSToStep::DecodeWireError(const TopoDSToStep_MakeWireError E)
{
  Handle(TCollection_HAsciiString) mess;
  switch(E)
    {
    case TopoDSToStep_WireDone:
      {
	mess = new TCollection_HAsciiString("Wire Done");
	break;
      }
    case TopoDSToStep_WireOther:
      {
	mess = new TCollection_HAsciiString("Other Error in Make STEP wire");
	break;
      }
    case TopoDSToStep_NonManifoldWire:
      {
	mess = new TCollection_HAsciiString("The Wire is Internal or External");
	break;
	}
    }
  return mess;
}

Handle(TCollection_HAsciiString) 
TopoDSToStep::DecodeEdgeError(const TopoDSToStep_MakeEdgeError E)
{
  Handle(TCollection_HAsciiString) mess;
  switch(E)
    {
    case TopoDSToStep_EdgeDone:
      {
	mess = new TCollection_HAsciiString("Edge Done");
	break;
      }
    case TopoDSToStep_EdgeOther:
      {
	mess = new TCollection_HAsciiString("Other Error in Make STEP Edge");
	break;
      }
    case TopoDSToStep_NonManifoldEdge:
      {
	mess = new TCollection_HAsciiString("The Edge is Internal or External");
	break;
      }
    }
  return mess;
}

Handle(TCollection_HAsciiString) 
TopoDSToStep::DecodeVertexError(const TopoDSToStep_MakeVertexError E)
{
  Handle(TCollection_HAsciiString) mess;
  switch(E)
    {
    case TopoDSToStep_VertexDone:
      {
	mess = new TCollection_HAsciiString("Vertex Done");
	break;
      }
    case TopoDSToStep_VertexOther:
      {
	mess = new TCollection_HAsciiString("Other Error in Make STEP Vertex");
	break;
      }
    }
  return mess;
}

//=======================================================================
//function : AddResult
//purpose  : 
//=======================================================================

void TopoDSToStep::AddResult (const Handle(Transfer_FinderProcess)& FP,
			      const TopoDS_Shape &Shape,
			      const Handle(Standard_Transient) &ent)
{
  Handle(Transfer_SimpleBinderOfTransient) result = new Transfer_SimpleBinderOfTransient;
  result->SetResult (ent);

  Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper (FP,Shape);
  Handle(Transfer_Binder) binder = FP->Find ( mapper );

  if ( binder.IsNull() ) FP->Bind ( mapper, result );
  else binder->AddResult ( result );
}

//=======================================================================
//function : AddResult
//purpose  : 
//=======================================================================

void TopoDSToStep::AddResult (const Handle(Transfer_FinderProcess)& FP,
			      const TopoDSToStep_Tool &Tool)
{
  const MoniTool_DataMapOfShapeTransient &Map = Tool.Map();
  MoniTool_DataMapIteratorOfDataMapOfShapeTransient it ( Map );
  for ( ; it.More(); it.Next() ) 
    TopoDSToStep::AddResult ( FP, it.Key(), it.Value() );
}