0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / BRepOffsetAPI / BRepOffsetAPI_MakeOffsetShape.hxx
1 // Created on: 1996-02-13
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1996-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 _BRepOffsetAPI_MakeOffsetShape_HeaderFile
18 #define _BRepOffsetAPI_MakeOffsetShape_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <BRepOffset_MakeOffset.hxx>
25 #include <BRepBuilderAPI_MakeShape.hxx>
26 #include <Standard_Real.hxx>
27 #include <BRepOffset_Mode.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <GeomAbs_JoinType.hxx>
30 #include <TopTools_ListOfShape.hxx>
31 class TopoDS_Shape;
32 class BRepOffset_MakeOffset;
33
34
35 //! Describes functions to build a shell out of a shape. The
36 //! result is an unlooped shape parallel to the source shape.
37 //! A MakeOffsetShape object provides a framework for:
38 //! - defining the construction of a shell
39 //! - implementing the construction algorithm
40 //! - consulting the result.
41 class BRepOffsetAPI_MakeOffsetShape  : public BRepBuilderAPI_MakeShape
42 {
43 public:
44
45   DEFINE_STANDARD_ALLOC
46
47   
48   Standard_EXPORT BRepOffsetAPI_MakeOffsetShape();
49   
50   //! Constructs a shape parallel to the shape S, where
51   //! - S may be a face, a shell, a solid or a compound of these shape kinds;
52   //! - Offset is the offset value. The offset shape is constructed:
53   //! - outside S, if Offset is positive,
54   //! - inside S, if Offset is negative;
55   //! - Tol defines the coincidence tolerance criterion for generated shapes;
56   //! - Mode defines the construction type of parallels
57   //! applied to the free edges of shape S; currently, only one
58   //! construction type is implemented, namely the one where the free
59   //! edges do not generate parallels; this corresponds to the default
60   //! value BRepOffset_Skin;
61   //! - Intersection specifies how the algorithm must work in
62   //! order to limit the parallels to two adjacent shapes:
63   //! - if Intersection is false (default value), the intersection
64   //! is calculated with the parallels to the two adjacent shapes,
65   //! - if Intersection is true, the intersection is calculated by
66   //! taking all generated parallels into account; this computation method is
67   //! more general as it avoids some self-intersections generated in the
68   //! offset shape from features of small dimensions on shape S, however this
69   //! method has not been completely implemented and therefore is not
70   //! recommended for use;
71   //! - SelfInter tells the algorithm whether a computation
72   //! to eliminate self-intersections must be applied to the resulting
73   //! shape; however, as this functionality is not yet
74   //! implemented, it is recommended to use the default value (false);
75   //! - Join defines how to fill the holes that may appear between
76   //! parallels to the two adjacent faces. It may take values
77   //! GeomAbs_Arc or GeomAbs_Intersection:
78   //! - if Join is equal to GeomAbs_Arc, then pipes are generated
79   //! between two free edges of two adjacent parallels,
80   //! and spheres are generated on "images" of vertices;
81   //! it is the default value,
82   //! - if Join is equal to GeomAbs_Intersection, then the parallels to the
83   //! two adjacent faces are enlarged and intersected,
84   //! so that there are no free edges on parallels to faces.
85   //! RemoveIntEdges flag defines whether to remove the INTERNAL edges 
86   //! from the result or not.
87   //! Warnings
88   //! 1. All the faces of the shape S should be based on the surfaces
89   //! with continuity at least C1.
90   //! 2. The offset value should be sufficiently small to avoid
91   //! self-intersections in resulting shape. Otherwise these
92   //! self-intersections may appear inside an offset face if its
93   //! initial surface is not plane or sphere or cylinder, also some
94   //! non-adjacent offset faces may intersect each other. Also, some
95   //! offset surfaces may "turn inside out".
96   //! 3. The algorithm may fail if the shape S contains vertices where
97   //! more than 3 edges converge.
98   //! 4. Since 3d-offset algorithm involves intersection of surfaces,
99   //! it is under limitations of surface intersection algorithm.
100   //! 5. A result cannot be generated if the underlying geometry of S is
101   //! BSpline with continuity C0.
102   //! Exceptions
103   //! Geom_UndefinedDerivative if the underlying
104   //! geometry of S is BSpline with continuity C0.
105   Standard_EXPORT BRepOffsetAPI_MakeOffsetShape(const TopoDS_Shape& S, 
106                                                 const Standard_Real Offset, 
107                                                 const Standard_Real Tol, 
108                                                 const BRepOffset_Mode Mode = BRepOffset_Skin, 
109                                                 const Standard_Boolean Intersection = Standard_False, 
110                                                 const Standard_Boolean SelfInter = Standard_False, 
111                                                 const GeomAbs_JoinType Join = GeomAbs_Arc,
112                                                 const Standard_Boolean RemoveIntEdges = Standard_False);
113
114   Standard_EXPORT virtual const BRepOffset_MakeOffset& MakeOffset() const;
115   
116   //! Builds the resulting shape (redefined from MakeShape).
117   Standard_EXPORT virtual void Build() Standard_OVERRIDE;
118   
119   //! Returns the  list   of shapes generated   from the
120   //! shape <S>.
121   Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
122   
123   //! Returns the list of edges generated from the shape <S>.
124   Standard_EXPORT const TopTools_ListOfShape& GeneratedEdge (const TopoDS_Shape& S);
125   
126   //! Returns offset join type.
127   Standard_EXPORT GeomAbs_JoinType GetJoinType() const;
128
129
130
131
132 protected:
133
134
135
136   BRepOffset_MakeOffset myOffsetShape;
137
138
139 private:
140
141
142
143
144
145 };
146
147
148
149
150
151
152
153 #endif // _BRepOffsetAPI_MakeOffsetShape_HeaderFile