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
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 // Complement : CKY, alimentation du TransientProcess
18 // (Bind general; BindVertex ?)
20 #include <StepToTopoDS_Tool.ixx>
21 #include <TransferBRep.hxx>
23 // ============================================================================
24 // Method : StepToTopoDS_Tool::StepToTopoDS_Tool
25 // Purpose : Empty Constructor
26 // ============================================================================
28 StepToTopoDS_Tool::StepToTopoDS_Tool() {}
30 // ============================================================================
31 // Method : StepToTopoDS_Tool::StepToTopoDS_Tool
32 // Purpose : Constructor with a Map and a TransientProcess
33 // ============================================================================
35 StepToTopoDS_Tool::StepToTopoDS_Tool(const StepToTopoDS_DataMapOfTRI& Map,
36 const Handle(Transfer_TransientProcess)& TP)
41 // ============================================================================
43 // Purpose : Init with a Map
44 // ============================================================================
46 void StepToTopoDS_Tool::Init(const StepToTopoDS_DataMapOfTRI& Map,
47 const Handle(Transfer_TransientProcess)& TP)
49 myComputePC = Standard_False;
51 StepToTopoDS_PointVertexMap aVertexMap;
52 StepToTopoDS_PointEdgeMap aEdgeMap;
55 myVertexMap = aVertexMap;
59 myNbC0Surf = myNbC1Surf = myNbC2Surf = 0;
60 myNbC0Cur2 = myNbC1Cur2 = myNbC2Cur2 = 0;
61 myNbC0Cur3 = myNbC1Cur3 = myNbC2Cur3 = 0;
66 // ============================================================================
67 // Method : StepToTopoDS_Tool::IsBound
68 // Purpose : Indicates weither a TRI is bound or not in the Map
69 // ============================================================================
71 Standard_Boolean StepToTopoDS_Tool::IsBound(const Handle(StepShape_TopologicalRepresentationItem)& TRI)
73 return myDataMap.IsBound(TRI);
76 // ============================================================================
77 // Method : StepToTopoDS_Tool::Bind
78 // Purpose : Binds a TRI with a Shape in the Map
79 // ============================================================================
81 void StepToTopoDS_Tool::Bind(const Handle(StepShape_TopologicalRepresentationItem)& TRI, const TopoDS_Shape& S)
83 myDataMap.Bind(TRI, S);
84 TransferBRep::SetShapeResult (myTransProc,TRI,S);
87 // ============================================================================
88 // Method : StepToTopoDS_Tool::Find
89 // Purpose : Returns the Shape corresponding to the bounded TRI
90 // ============================================================================
92 const TopoDS_Shape& StepToTopoDS_Tool::Find(const Handle(StepShape_TopologicalRepresentationItem)& TRI)
94 return myDataMap.Find(TRI);
98 // ============================================================================
99 // Method : StepToTopoDS_Tool::ClearEdgeMap
101 // ============================================================================
103 void StepToTopoDS_Tool::ClearEdgeMap()
108 // ============================================================================
109 // Method : StepToTopoDS_Tool::IsEdgeBound
111 // ============================================================================
113 Standard_Boolean StepToTopoDS_Tool::IsEdgeBound(const StepToTopoDS_PointPair& PP)
115 return myEdgeMap.IsBound(PP);
118 // ============================================================================
119 // Method : StepToTopoDS_Tool_BindEdge
121 // ============================================================================
123 void StepToTopoDS_Tool::BindEdge(const StepToTopoDS_PointPair& PP, const TopoDS_Edge& E)
125 myEdgeMap.Bind(PP, E);
128 // ============================================================================
129 // Method : StepToTopoDS_Tool::FindEdge
131 // ============================================================================
133 const TopoDS_Edge& StepToTopoDS_Tool::FindEdge(const StepToTopoDS_PointPair& PP)
135 return myEdgeMap.Find(PP);
138 // ============================================================================
139 // Method : StepToTopoDS_Tool::ClearVertexMap
141 // ============================================================================
143 void StepToTopoDS_Tool::ClearVertexMap()
148 // ============================================================================
149 // Method : StepToTopoDS_Tool::IsVertexBound
151 // ============================================================================
153 Standard_Boolean StepToTopoDS_Tool::IsVertexBound(const Handle(StepGeom_CartesianPoint)& PG)
155 return myVertexMap.IsBound(PG);
158 // ============================================================================
159 // Method : StepToTopoDS_Tool::BindVertex
161 // ============================================================================
163 void StepToTopoDS_Tool::BindVertex(const Handle(StepGeom_CartesianPoint)& P, const TopoDS_Vertex& V)
165 myVertexMap.Bind(P, V);
167 TransferBRep::SetShapeResult (myTransProc,P,V);
171 // ============================================================================
172 // Method : StepToTopoDS_Tool::FindVertex
174 // ============================================================================
176 const TopoDS_Vertex& StepToTopoDS_Tool::FindVertex(const Handle(StepGeom_CartesianPoint)& P)
178 return myVertexMap.Find(P);
181 // ============================================================================
182 // Method : ComputePCurve
184 // ============================================================================
186 void StepToTopoDS_Tool::ComputePCurve(const Standard_Boolean B)
191 // ============================================================================
192 // Method : ComputePCurve
194 // ============================================================================
196 Standard_Boolean StepToTopoDS_Tool::ComputePCurve() const
201 // ============================================================================
202 // Method : StepToTopoDS_Tool::TransientProcess
203 // Purpose : Returns the TransientProcess
204 // ============================================================================
206 Handle(Transfer_TransientProcess) StepToTopoDS_Tool::TransientProcess() const
216 void StepToTopoDS_Tool::AddContinuity (const Handle(Geom_Surface)& GeomSurf)
218 switch(GeomSurf->Continuity())
220 case GeomAbs_C0: myNbC0Surf ++; break;
221 case GeomAbs_C1: myNbC1Surf ++; break;
222 default: myNbC2Surf ++;
226 void StepToTopoDS_Tool::AddContinuity (const Handle(Geom_Curve)& GeomCurve)
228 switch(GeomCurve->Continuity())
230 case GeomAbs_C0: myNbC0Cur3 ++; break;
231 case GeomAbs_C1: myNbC1Cur3 ++; break;
232 default: myNbC2Cur3 ++;
236 void StepToTopoDS_Tool::AddContinuity (const Handle(Geom2d_Curve)& GeomCur2d)
238 switch(GeomCur2d->Continuity())
240 case GeomAbs_C0: myNbC0Cur2 ++; break;
241 case GeomAbs_C1: myNbC1Cur2 ++; break;
242 default: myNbC2Cur2 ++;
250 Standard_Integer StepToTopoDS_Tool::C0Surf() const
256 Standard_Integer StepToTopoDS_Tool::C1Surf() const
262 Standard_Integer StepToTopoDS_Tool::C2Surf() const
272 Standard_Integer StepToTopoDS_Tool::C0Cur2() const
278 Standard_Integer StepToTopoDS_Tool::C1Cur2() const
284 Standard_Integer StepToTopoDS_Tool::C2Cur2() const
294 Standard_Integer StepToTopoDS_Tool::C0Cur3() const
300 Standard_Integer StepToTopoDS_Tool::C1Cur3() const
306 Standard_Integer StepToTopoDS_Tool::C2Cur3() const