dad7cd0c7c5e1ce74c69cfb6c38902345f91c68b
[occt.git] / src / BRepFeat / BRepFeat_SplitShape.hxx
1 // Created on: 1995-09-04
2 // Created by: Jacques GOUSSARD
3 // Copyright (c) 1995-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 _BRepFeat_SplitShape_HeaderFile
18 #define _BRepFeat_SplitShape_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <LocOpe_Spliter.hxx>
25 #include <BRepBuilderAPI_MakeShape.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <TopTools_ListOfShape.hxx>
28 #include <TopTools_SequenceOfShape.hxx>
29
30 class LocOpe_WiresOnShape;
31 class StdFail_NotDone;
32 class Standard_ConstructionError;
33 class Standard_NoSuchObject;
34 class TopoDS_Shape;
35 class TopoDS_Wire;
36 class TopoDS_Face;
37 class TopoDS_Edge;
38 class TopoDS_Compound;
39
40
41 //! One of the most significant aspects of BRepFeat functionality is the use of local
42 //! operations as opposed to global ones. In a global operation, you would first construct a
43 //! form of the type you wanted in your final feature, and then remove matter so that it could
44 //! fit into your initial basis object. In a local operation, however, you specify the domain of
45 //! the feature construction with aspects of the shape on which the feature is being created.
46 //! These semantics are expressed in terms of a member shape of the basis shape from which -
47 //! or up to which - matter will be added or removed. As a result, local operations make
48 //! calculations simpler and faster than global operations.
49 //! In BRepFeat, the semantics of local operations define features constructed from a contour or a
50 //! part of the basis shape referred to as the tool. In a SplitShape object, wires or edges of a
51 //! face in the basis shape to be used as a part of the feature are cut out and projected to a plane
52 //! outside or inside the basis shape. By rebuilding the initial shape incorporating the edges and
53 //! the faces of the tool, protrusion or depression features can be constructed.
54 class BRepFeat_SplitShape  : public BRepBuilderAPI_MakeShape
55 {
56 public:
57
58   DEFINE_STANDARD_ALLOC
59
60   
61   //! Empty constructor
62     BRepFeat_SplitShape();
63   
64   //! Creates the process  with the shape <S>.
65   BRepFeat_SplitShape(const TopoDS_Shape& S);
66
67   //! Add splitting edges or wires for whole initial shape
68   //! withot additional specification edge->face, edge->edge
69   //! This method puts edge on the corresponding faces from initial shape
70   Standard_Boolean Add(const TopTools_SequenceOfShape& theEdges);
71   
72   //! Initializes the process on the shape <S>.
73     void Init (const TopoDS_Shape& S);
74   
75   //! Set the flag of check internal intersections
76   //! default value is True (to check)
77     void SetCheckInterior (const Standard_Boolean ToCheckInterior);
78   
79   //! Adds the wire <W> on the face <F>.
80   //! Raises NoSuchObject  if <F> does not belong to the original shape.
81     void Add (const TopoDS_Wire& W, const TopoDS_Face& F);
82   
83   //! Adds the edge <E> on the face <F>.
84     void Add (const TopoDS_Edge& E, const TopoDS_Face& F);
85   
86   //! Adds the compound <Comp> on the face <F>. The
87   //! compound <Comp> must consist of edges lying on the
88   //! face <F>. If edges are geometrically connected,
89   //! they must be connected topologically, i.e. they
90   //! must share common vertices.
91   //!
92   //! Raises NoSuchObject  if <F> does not belong to the original shape.
93     void Add (const TopoDS_Compound& Comp, const TopoDS_Face& F);
94   
95   //! Adds the edge <E> on the existing edge <EOn>.
96     void Add (const TopoDS_Edge& E, const TopoDS_Edge& EOn);
97   
98   //! Returns  the faces   which  are the  left of   the
99   //! projected wires.
100   Standard_EXPORT const TopTools_ListOfShape& DirectLeft() const;
101   
102   //! Returns the faces of the "left" part on the shape.
103   //! (It  is build   from  DirectLeft,  with  the faces
104   //! connected to this set, and so on...).
105   //! Raises NotDone if IsDone returns <Standard_False>.
106   Standard_EXPORT const TopTools_ListOfShape& Left() const;
107   
108   //! Returns the faces of the "right" part on the shape.
109   Standard_EXPORT const TopTools_ListOfShape& Right() const;
110   
111   //! Builds the cut and the resulting faces and edges as well.
112   Standard_EXPORT void Build() Standard_OVERRIDE;
113   
114   //! Returns true if the shape has been deleted.
115   Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& S) Standard_OVERRIDE;
116   
117   //! Returns the list of generated Faces.
118   Standard_EXPORT const TopTools_ListOfShape& Modified (const TopoDS_Shape& F) Standard_OVERRIDE;
119
120
121
122
123 protected:
124
125
126
127
128
129 private:
130
131
132
133   LocOpe_Spliter mySShape;
134   Handle(LocOpe_WiresOnShape) myWOnShape;
135
136   mutable TopTools_ListOfShape myRight;
137
138
139 };
140
141
142 #include <BRepFeat_SplitShape.lxx>
143
144
145
146
147
148 #endif // _BRepFeat_SplitShape_HeaderFile