1 // Created on: 1994-11-30
2 // Created by: Frederic MAUPAS
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 #include <TopoDSToStep_Tool.ixx>
24 #include <BRep_Tool.hxx>
25 #include <Interface_Static.hxx>
27 //=======================================================================
28 //function : TopoDSToStep_Tool
30 //=======================================================================
32 TopoDSToStep_Tool::TopoDSToStep_Tool()
33 :myLowestTol(0.),myReversedSurface (Standard_False)
35 myPCurveMode = Interface_Static::IVal("write.surfacecurve.mode");
38 //=======================================================================
39 //function : TopoDSToStep_Tool
41 //=======================================================================
43 TopoDSToStep_Tool::TopoDSToStep_Tool(const MoniTool_DataMapOfShapeTransient& M, const Standard_Boolean FacetedContext)
44 :myLowestTol(0.),myReversedSurface(Standard_False)
46 Init ( M, FacetedContext );
49 //=======================================================================
52 //=======================================================================
54 void TopoDSToStep_Tool::Init(const MoniTool_DataMapOfShapeTransient& M, const Standard_Boolean FacetedContext)
57 myFacetedContext = FacetedContext;
58 myPCurveMode = Interface_Static::IVal("write.surfacecurve.mode");
61 //=======================================================================
64 //=======================================================================
66 Standard_Boolean TopoDSToStep_Tool::IsBound(const TopoDS_Shape& S)
68 return myDataMap.IsBound(S);
71 //=======================================================================
74 //=======================================================================
76 void TopoDSToStep_Tool::Bind(const TopoDS_Shape& S,
77 const Handle(StepShape_TopologicalRepresentationItem)& T)
82 //=======================================================================
85 //=======================================================================
87 Handle(StepShape_TopologicalRepresentationItem) TopoDSToStep_Tool::Find(const TopoDS_Shape& S)
89 return Handle(StepShape_TopologicalRepresentationItem)::DownCast(myDataMap.Find(S));
92 //=======================================================================
95 //=======================================================================
97 Standard_Boolean TopoDSToStep_Tool::Faceted() const
99 return myFacetedContext;
102 //=======================================================================
103 //function : SetCurrentShell
105 //=======================================================================
107 void TopoDSToStep_Tool::SetCurrentShell(const TopoDS_Shell& S)
110 cout << "Process a Shell which is ";
111 switch(S.Orientation())
115 cout << "FORWARD in the Solid;" << endl;
118 case TopAbs_REVERSED:
120 cout << "REVERSED in the Solid;" << endl;
125 cout << "INTERNAL OR EXTERNAL SHELL" << endl;
132 //=======================================================================
133 //function : CurrentShell
135 //=======================================================================
137 const TopoDS_Shell& TopoDSToStep_Tool::CurrentShell() const
139 return myCurrentShell;
142 //=======================================================================
143 //function : SetCurrentFace
145 //=======================================================================
147 void TopoDSToStep_Tool::SetCurrentFace(const TopoDS_Face& F)
150 cout << " Process a Face which is ";
151 switch(F.Orientation())
155 cout << "FORWARD in the Shell;" << endl;
158 case TopAbs_REVERSED:
160 cout << "REVERSED in the Shell;" << endl;
165 cout << "INTERNAL OR EXTERNAL FACE" << endl;
169 Standard_Real FaceTol = BRep_Tool::Tolerance(F);
170 if (FaceTol > myLowestTol)
171 myLowestTol = FaceTol;
175 //=======================================================================
176 //function : CurrentFace
178 //=======================================================================
180 const TopoDS_Face& TopoDSToStep_Tool::CurrentFace() const
182 return myCurrentFace;
185 //=======================================================================
186 //function : SetCurrentWire
188 //=======================================================================
190 void TopoDSToStep_Tool::SetCurrentWire(const TopoDS_Wire& W)
193 cout << " Process a Wire which is ";
194 switch(W.Orientation())
198 cout << "FORWARD in the Face" << endl;
201 case TopAbs_REVERSED:
203 cout << "REVERSED in the Face;" << endl;
208 cout << "INTERNAL OR EXTERNAL Wire" << endl;
215 //=======================================================================
216 //function : CurrentWire
218 //=======================================================================
220 const TopoDS_Wire& TopoDSToStep_Tool::CurrentWire() const
222 return myCurrentWire;
225 //=======================================================================
226 //function : SetCurrentEdge
228 //=======================================================================
230 void TopoDSToStep_Tool::SetCurrentEdge(const TopoDS_Edge& E)
233 cout << " Process Edge which is ";
234 switch(E.Orientation())
238 cout << "FORWARD in the Wire" << endl;
241 case TopAbs_REVERSED:
243 cout << "REVERSED in the Wire" << endl;
248 cout << "INTERNAL OR EXTERNAL EDGE" << endl;
252 Standard_Real EdgeTol = BRep_Tool::Tolerance(E);
253 if (EdgeTol > myLowestTol)
254 myLowestTol = EdgeTol;
258 //=======================================================================
259 //function : CurrentEdge
261 //=======================================================================
263 const TopoDS_Edge& TopoDSToStep_Tool::CurrentEdge() const
265 return myCurrentEdge;
268 //=======================================================================
269 //function : SetCurrentVertex
271 //=======================================================================
273 void TopoDSToStep_Tool::SetCurrentVertex(const TopoDS_Vertex& V)
275 Standard_Real VertexTol = BRep_Tool::Tolerance(V);
276 if (VertexTol > myLowestTol)
277 myLowestTol = VertexTol;
281 //=======================================================================
282 //function : CurrentVertex
284 //=======================================================================
286 const TopoDS_Vertex& TopoDSToStep_Tool::CurrentVertex() const
288 return myCurrentVertex;
291 //=======================================================================
292 //function : Lowest3DTolerance
294 //=======================================================================
296 Standard_Real TopoDSToStep_Tool::Lowest3DTolerance() const
301 //=======================================================================
302 //function : SetSurfaceReversed
304 //=======================================================================
306 void TopoDSToStep_Tool::SetSurfaceReversed(const Standard_Boolean B)
308 myReversedSurface = B;
311 //=======================================================================
312 //function : SurfaceReversed
314 //=======================================================================
316 Standard_Boolean TopoDSToStep_Tool::SurfaceReversed() const
318 return myReversedSurface;
321 //=======================================================================
324 //=======================================================================
326 const MoniTool_DataMapOfShapeTransient &TopoDSToStep_Tool::Map () const
331 //=======================================================================
332 //function : PCurveMode
334 //=======================================================================
336 Standard_Integer TopoDSToStep_Tool::PCurveMode () const