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