0024601: Unwanted spheres shown after Step-Import
[occt.git] / src / StepToTopoDS / StepToTopoDS_Tool.cxx
CommitLineData
b311480e 1// Created on: 1995-01-03
2// Created by: Frederic MAUPAS
3// Copyright (c) 1995-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17// Complement : CKY, alimentation du TransientProcess
18// (Bind general; BindVertex ?)
19
20#include <StepToTopoDS_Tool.ixx>
21#include <TransferBRep.hxx>
22
23// ============================================================================
24// Method : StepToTopoDS_Tool::StepToTopoDS_Tool
25// Purpose : Empty Constructor
26// ============================================================================
27
28StepToTopoDS_Tool::StepToTopoDS_Tool() {}
29
30// ============================================================================
31// Method : StepToTopoDS_Tool::StepToTopoDS_Tool
32// Purpose : Constructor with a Map and a TransientProcess
33// ============================================================================
34
35StepToTopoDS_Tool::StepToTopoDS_Tool(const StepToTopoDS_DataMapOfTRI& Map,
36 const Handle(Transfer_TransientProcess)& TP)
37{
38 Init(Map, TP);
39}
40
41// ============================================================================
42// Method : Init
43// Purpose : Init with a Map
44// ============================================================================
45
46void StepToTopoDS_Tool::Init(const StepToTopoDS_DataMapOfTRI& Map,
47 const Handle(Transfer_TransientProcess)& TP)
48{
49 myComputePC = Standard_False;
50
51 StepToTopoDS_PointVertexMap aVertexMap;
52 StepToTopoDS_PointEdgeMap aEdgeMap;
53
54 myDataMap = Map;
55 myVertexMap = aVertexMap;
56 myEdgeMap = aEdgeMap;
57 myTransProc = TP;
58
59 myNbC0Surf = myNbC1Surf = myNbC2Surf = 0;
60 myNbC0Cur2 = myNbC1Cur2 = myNbC2Cur2 = 0;
61 myNbC0Cur3 = myNbC1Cur3 = myNbC2Cur3 = 0;
62
63
64}
65
66// ============================================================================
67// Method : StepToTopoDS_Tool::IsBound
68// Purpose : Indicates weither a TRI is bound or not in the Map
69// ============================================================================
70
71Standard_Boolean StepToTopoDS_Tool::IsBound(const Handle(StepShape_TopologicalRepresentationItem)& TRI)
72{
73 return myDataMap.IsBound(TRI);
74}
75
76// ============================================================================
77// Method : StepToTopoDS_Tool::Bind
78// Purpose : Binds a TRI with a Shape in the Map
79// ============================================================================
80
81void StepToTopoDS_Tool::Bind(const Handle(StepShape_TopologicalRepresentationItem)& TRI, const TopoDS_Shape& S)
82{
83 myDataMap.Bind(TRI, S);
84 TransferBRep::SetShapeResult (myTransProc,TRI,S);
85}
86
87// ============================================================================
88// Method : StepToTopoDS_Tool::Find
89// Purpose : Returns the Shape corresponding to the bounded TRI
90// ============================================================================
91
92const TopoDS_Shape& StepToTopoDS_Tool::Find(const Handle(StepShape_TopologicalRepresentationItem)& TRI)
93{
94 return myDataMap.Find(TRI);
95}
96
97
98// ============================================================================
99// Method : StepToTopoDS_Tool::ClearEdgeMap
100// Purpose :
101// ============================================================================
102
103void StepToTopoDS_Tool::ClearEdgeMap()
104{
105 myEdgeMap.Clear();
106}
107
108// ============================================================================
109// Method : StepToTopoDS_Tool::IsEdgeBound
110// Purpose :
111// ============================================================================
112
113Standard_Boolean StepToTopoDS_Tool::IsEdgeBound(const StepToTopoDS_PointPair& PP)
114{
115 return myEdgeMap.IsBound(PP);
116}
117
118// ============================================================================
119// Method : StepToTopoDS_Tool_BindEdge
120// Purpose :
121// ============================================================================
122
123void StepToTopoDS_Tool::BindEdge(const StepToTopoDS_PointPair& PP, const TopoDS_Edge& E)
124{
125 myEdgeMap.Bind(PP, E);
126}
127
128// ============================================================================
129// Method : StepToTopoDS_Tool::FindEdge
130// Purpose :
131// ============================================================================
132
133const TopoDS_Edge& StepToTopoDS_Tool::FindEdge(const StepToTopoDS_PointPair& PP)
134{
135 return myEdgeMap.Find(PP);
136}
137
138// ============================================================================
139// Method : StepToTopoDS_Tool::ClearVertexMap
140// Purpose :
141// ============================================================================
142
143void StepToTopoDS_Tool::ClearVertexMap()
144{
145 myVertexMap.Clear();
146}
147
148// ============================================================================
149// Method : StepToTopoDS_Tool::IsVertexBound
150// Purpose :
151// ============================================================================
152
153Standard_Boolean StepToTopoDS_Tool::IsVertexBound(const Handle(StepGeom_CartesianPoint)& PG)
154{
155 return myVertexMap.IsBound(PG);
156}
157
158// ============================================================================
159// Method : StepToTopoDS_Tool::BindVertex
160// Purpose :
161// ============================================================================
162
163void StepToTopoDS_Tool::BindVertex(const Handle(StepGeom_CartesianPoint)& P, const TopoDS_Vertex& V)
164{
165 myVertexMap.Bind(P, V);
0797d9d3 166#ifdef OCCT_DEBUG
7fd59977 167 TransferBRep::SetShapeResult (myTransProc,P,V);
168#endif
169}
170
171// ============================================================================
172// Method : StepToTopoDS_Tool::FindVertex
173// Purpose :
174// ============================================================================
175
176const TopoDS_Vertex& StepToTopoDS_Tool::FindVertex(const Handle(StepGeom_CartesianPoint)& P)
177{
178 return myVertexMap.Find(P);
179}
180
181// ============================================================================
182// Method : ComputePCurve
183// Purpose :
184// ============================================================================
185
186void StepToTopoDS_Tool::ComputePCurve(const Standard_Boolean B)
187{
188 myComputePC = B;
189}
190
191// ============================================================================
192// Method : ComputePCurve
193// Purpose :
194// ============================================================================
195
196Standard_Boolean StepToTopoDS_Tool::ComputePCurve() const
197{
198 return myComputePC;
199}
200
201// ============================================================================
202// Method : StepToTopoDS_Tool::TransientProcess
203// Purpose : Returns the TransientProcess
204// ============================================================================
205
206Handle(Transfer_TransientProcess) StepToTopoDS_Tool::TransientProcess() const
207{
208 return myTransProc;
209}
210
211
212//===========
213// AddStatistics
214//===========
215
216void StepToTopoDS_Tool::AddContinuity (const Handle(Geom_Surface)& GeomSurf)
217{
218 switch(GeomSurf->Continuity())
219 {
220 case GeomAbs_C0: myNbC0Surf ++; break;
221 case GeomAbs_C1: myNbC1Surf ++; break;
222 default: myNbC2Surf ++;
223 }
224}
225
226void StepToTopoDS_Tool::AddContinuity (const Handle(Geom_Curve)& GeomCurve)
227{
228 switch(GeomCurve->Continuity())
229 {
230 case GeomAbs_C0: myNbC0Cur3 ++; break;
231 case GeomAbs_C1: myNbC1Cur3 ++; break;
232 default: myNbC2Cur3 ++;
233 }
234}
235
236void StepToTopoDS_Tool::AddContinuity (const Handle(Geom2d_Curve)& GeomCur2d)
237{
238 switch(GeomCur2d->Continuity())
239 {
240 case GeomAbs_C0: myNbC0Cur2 ++; break;
241 case GeomAbs_C1: myNbC1Cur2 ++; break;
242 default: myNbC2Cur2 ++;
243 }
244}
245
246//===========
247// Statistics
248//===========
249
250Standard_Integer StepToTopoDS_Tool::C0Surf() const
251{
252 return myNbC0Surf;
253}
254
255
256Standard_Integer StepToTopoDS_Tool::C1Surf() const
257{
258 return myNbC1Surf;
259}
260
261
262Standard_Integer StepToTopoDS_Tool::C2Surf() const
263{
264 return myNbC2Surf;
265}
266
267
268//===========
269// Statistics
270//===========
271
272Standard_Integer StepToTopoDS_Tool::C0Cur2() const
273{
274 return myNbC0Cur2;
275}
276
277
278Standard_Integer StepToTopoDS_Tool::C1Cur2() const
279{
280 return myNbC1Cur2;
281}
282
283
284Standard_Integer StepToTopoDS_Tool::C2Cur2() const
285{
286 return myNbC2Cur2;
287}
288
289
290//===========
291// Statistics
292//===========
293
294Standard_Integer StepToTopoDS_Tool::C0Cur3() const
295{
296 return myNbC0Cur3;
297}
298
299
300Standard_Integer StepToTopoDS_Tool::C1Cur3() const
301{
302 return myNbC1Cur3;
303}
304
305
306Standard_Integer StepToTopoDS_Tool::C2Cur3() const
307{
308 return myNbC2Cur3;
309}
310