1 // Created on: 1999-06-17
2 // Created by: data exchange team
3 // Copyright (c) 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 #ifndef _ShapeCustom_ConvertToBSpline_HeaderFile
18 #define _ShapeCustom_ConvertToBSpline_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22 
23 #include <Standard_Boolean.hxx>
24 #include <ShapeCustom_Modification.hxx>
25 #include <Standard_Real.hxx>
26 #include <GeomAbs_Shape.hxx>
27 class TopoDS_Face;
28 class Geom_Surface;
29 class TopLoc_Location;
30 class TopoDS_Edge;
31 class Geom_Curve;
32 class TopoDS_Vertex;
33 class gp_Pnt;
34 class Geom2d_Curve;
35 
36 
37 class ShapeCustom_ConvertToBSpline;
38 DEFINE_STANDARD_HANDLE(ShapeCustom_ConvertToBSpline, ShapeCustom_Modification)
39 
40 //! implement a modification for BRepTools
41 //! Modifier algorithm. Converts Surface of
42 //! Linear Exctrusion, Revolution and Offset
43 //! surfaces into BSpline Surface according to
44 //! flags.
45 class ShapeCustom_ConvertToBSpline : public ShapeCustom_Modification
46 {
47 
48 public:
49 
50 
51   Standard_EXPORT ShapeCustom_ConvertToBSpline();
52 
53   //! Sets mode for conversion of Surfaces of Linear
54   //! extrusion.
55   Standard_EXPORT void SetExtrusionMode (const Standard_Boolean extrMode);
56 
57   //! Sets mode for conversion of Surfaces of Revolution.
58   Standard_EXPORT void SetRevolutionMode (const Standard_Boolean revolMode);
59 
60   //! Sets mode for conversion of Offset surfaces.
61   Standard_EXPORT void SetOffsetMode (const Standard_Boolean offsetMode);
62 
63   //! Sets mode for conversion of Plane surfaces.
64   Standard_EXPORT void SetPlaneMode (const Standard_Boolean planeMode);
65 
66   //! Returns Standard_True if the face <F> has  been
67   //! modified. In this case, <S> is the new geometric
68   //! support of the face, <L> the new location,  <Tol>
69   //! the new tolerance.  Otherwise, returns
70   //! Standard_False, and <S>, <L>, <Tol> are  not
71   //! significant.
72   Standard_EXPORT Standard_Boolean NewSurface (const TopoDS_Face& F, Handle(Geom_Surface)& S, TopLoc_Location& L, Standard_Real& Tol, Standard_Boolean& RevWires, Standard_Boolean& RevFace) Standard_OVERRIDE;
73 
74   //! Returns Standard_True  if  the edge  <E> has  been
75   //! modified.  In this case,  <C> is the new geometric
76   //! support of the  edge, <L> the  new location, <Tol>
77   //! the         new    tolerance.   Otherwise, returns
78   //! Standard_False,    and  <C>,  <L>,   <Tol> are not
79   //! significant.
80   Standard_EXPORT Standard_Boolean NewCurve (const TopoDS_Edge& E, Handle(Geom_Curve)& C, TopLoc_Location& L, Standard_Real& Tol) Standard_OVERRIDE;
81 
82   //! Returns  Standard_True if the  vertex <V> has been
83   //! modified.  In this  case, <P> is the new geometric
84   //! support of the vertex,   <Tol> the new  tolerance.
85   //! Otherwise, returns Standard_False, and <P>,  <Tol>
86   //! are not significant.
87   Standard_EXPORT Standard_Boolean NewPoint (const TopoDS_Vertex& V, gp_Pnt& P, Standard_Real& Tol) Standard_OVERRIDE;
88 
89   //! Returns Standard_True if  the edge  <E> has a  new
90   //! curve on surface on the face <F>.In this case, <C>
91   //! is the new geometric support of  the edge, <L> the
92   //! new location, <Tol> the new tolerance.
93   //!
94   //! Otherwise, returns  Standard_False, and <C>,  <L>,
95   //! <Tol> are not significant.
96   //!
97   //! <NewE> is the new  edge created from  <E>.  <NewF>
98   //! is the new face created from <F>. They may be useful.
99   Standard_EXPORT Standard_Boolean NewCurve2d (const TopoDS_Edge& E, const TopoDS_Face& F, const TopoDS_Edge& NewE, const TopoDS_Face& NewF, Handle(Geom2d_Curve)& C, Standard_Real& Tol) Standard_OVERRIDE;
100 
101   //! Returns Standard_True if the Vertex  <V> has a new
102   //! parameter on the  edge <E>. In  this case,  <P> is
103   //! the parameter,    <Tol>  the     new    tolerance.
104   //! Otherwise, returns Standard_False, and <P>,  <Tol>
105   //! are not significant.
106   Standard_EXPORT Standard_Boolean NewParameter (const TopoDS_Vertex& V, const TopoDS_Edge& E, Standard_Real& P, Standard_Real& Tol) Standard_OVERRIDE;
107 
108   //! Returns the  continuity of  <NewE> between <NewF1>
109   //! and <NewF2>.
110   //!
111   //! <NewE> is the new  edge created from <E>.  <NewF1>
112   //! (resp. <NewF2>) is the new  face created from <F1>
113   //! (resp. <F2>).
114   Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const TopoDS_Edge& NewE, const TopoDS_Face& NewF1, const TopoDS_Face& NewF2) Standard_OVERRIDE;
115 
116 
117 
118 
119   DEFINE_STANDARD_RTTIEXT(ShapeCustom_ConvertToBSpline,ShapeCustom_Modification)
120 
121 protected:
122 
123 
124 
125 
126 private:
127 
128 
129   Standard_EXPORT Standard_Boolean IsToConvert (const Handle(Geom_Surface)& S, Handle(Geom_Surface)& SS) const;
130 
131   Standard_Boolean myExtrMode;
132   Standard_Boolean myRevolMode;
133   Standard_Boolean myOffsetMode;
134   Standard_Boolean myPlaneMode;
135 
136 
137 };
138 
139 
140 
141 
142 
143 
144 
145 #endif // _ShapeCustom_ConvertToBSpline_HeaderFile
146