1 // Created on: 1999-03-09
2 // Created by: Roman LYGIN
3 // Copyright (c) 1999-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 
18 #include <BRep_TEdge.hxx>
19 #include <BRep_TFace.hxx>
20 #include <BRep_TVertex.hxx>
21 #include <Geom2d_Curve.hxx>
22 #include <Geom_Curve.hxx>
23 #include <Geom_Surface.hxx>
24 #include <gp_Pnt.hxx>
25 #include <gp_Trsf.hxx>
26 #include <ShapeCustom_TrsfModification.hxx>
27 #include <Standard_Type.hxx>
28 #include <TopLoc_Location.hxx>
29 #include <TopoDS_Edge.hxx>
30 #include <TopoDS_Face.hxx>
31 #include <TopoDS_Vertex.hxx>
32 
IMPLEMENT_STANDARD_RTTIEXT(ShapeCustom_TrsfModification,BRepTools_TrsfModification)33 IMPLEMENT_STANDARD_RTTIEXT(ShapeCustom_TrsfModification,BRepTools_TrsfModification)
34 
35 //=======================================================================
36 //function : ShapeCustom_TrsfModification
37 //purpose  :
38 //=======================================================================
39 ShapeCustom_TrsfModification::ShapeCustom_TrsfModification(const gp_Trsf& T):
40        BRepTools_TrsfModification(T)
41 {
42 }
43 
44 //=======================================================================
45 //function : NewSurface
46 //purpose  :
47 //=======================================================================
48 
NewSurface(const TopoDS_Face & F,Handle (Geom_Surface)& S,TopLoc_Location & L,Standard_Real & Tol,Standard_Boolean & RevWires,Standard_Boolean & RevFace)49  Standard_Boolean ShapeCustom_TrsfModification::NewSurface(const TopoDS_Face& F,
50 							   Handle(Geom_Surface)& S,
51 							   TopLoc_Location& L,
52 							   Standard_Real& Tol,
53 							   Standard_Boolean& RevWires,
54 							   Standard_Boolean& RevFace)
55 {
56   Standard_Boolean result = BRepTools_TrsfModification::NewSurface(F, S, L, Tol, RevWires, RevFace);
57   Tol = (*((Handle(BRep_TFace)*)&F.TShape()))->Tolerance() * Abs(Trsf().ScaleFactor());
58   return result;
59 }
60 
61 //=======================================================================
62 //function : NewCurve
63 //purpose  :
64 //=======================================================================
65 
NewCurve(const TopoDS_Edge & E,Handle (Geom_Curve)& C,TopLoc_Location & L,Standard_Real & Tol)66  Standard_Boolean ShapeCustom_TrsfModification::NewCurve(const TopoDS_Edge& E,
67 							 Handle(Geom_Curve)& C,
68 							 TopLoc_Location& L,
69 							 Standard_Real& Tol)
70 {
71   Standard_Boolean result = BRepTools_TrsfModification::NewCurve (E, C, L, Tol);
72   Tol = (*((Handle(BRep_TEdge)*)&E.TShape()))->Tolerance() * Abs(Trsf().ScaleFactor());
73   return result;
74 }
75 
76 //=======================================================================
77 //function : NewPoint
78 //purpose  :
79 //=======================================================================
80 
NewPoint(const TopoDS_Vertex & V,gp_Pnt & P,Standard_Real & Tol)81  Standard_Boolean ShapeCustom_TrsfModification::NewPoint(const TopoDS_Vertex& V,
82 							 gp_Pnt& P,
83 							 Standard_Real& Tol)
84 {
85   Standard_Boolean result = BRepTools_TrsfModification::NewPoint (V, P, Tol);
86   Tol = (*((Handle(BRep_TVertex)*)&V.TShape()))->Tolerance() * Abs(Trsf().ScaleFactor());
87   return result;
88 }
89 
90 //=======================================================================
91 //function : NewCurve2d
92 //purpose  :
93 //=======================================================================
94 
NewCurve2d(const TopoDS_Edge & E,const TopoDS_Face & F,const TopoDS_Edge & NewE,const TopoDS_Face & NewF,Handle (Geom2d_Curve)& C,Standard_Real & Tol)95  Standard_Boolean ShapeCustom_TrsfModification::NewCurve2d(const TopoDS_Edge& E,
96 							   const TopoDS_Face& F,
97 							   const TopoDS_Edge& NewE,
98 							   const TopoDS_Face& NewF,
99 							   Handle(Geom2d_Curve)& C,
100 							   Standard_Real& Tol)
101 {
102   Standard_Boolean result = BRepTools_TrsfModification::NewCurve2d (E, F, NewE, NewF, C, Tol);
103   Tol = (*((Handle(BRep_TEdge)*)&E.TShape()))->Tolerance() * Abs(Trsf().ScaleFactor());
104   return result;
105 }
106 
107 //=======================================================================
108 //function : NewParameter
109 //purpose  :
110 //=======================================================================
111 
NewParameter(const TopoDS_Vertex & V,const TopoDS_Edge & E,Standard_Real & P,Standard_Real & Tol)112  Standard_Boolean ShapeCustom_TrsfModification::NewParameter(const TopoDS_Vertex& V,
113 							     const TopoDS_Edge& E,
114 							     Standard_Real& P,
115 							     Standard_Real& Tol)
116 {
117   Standard_Boolean result = BRepTools_TrsfModification::NewParameter (V, E, P, Tol);
118   Tol = (*((Handle(BRep_TVertex)*)&V.TShape()))->Tolerance() * Abs(Trsf().ScaleFactor());
119   return result;
120 }
121 
122