1 // Created on: 1996-08-30
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 _BRepOffset_Inter3d_HeaderFile
18 #define _BRepOffset_Inter3d_HeaderFile
19 
20 #include <Message_ProgressRange.hxx>
21 #include <Standard.hxx>
22 #include <Standard_DefineAlloc.hxx>
23 #include <Standard_Handle.hxx>
24 
25 #include <TopTools_IndexedMapOfShape.hxx>
26 #include <TopTools_DataMapOfShapeListOfShape.hxx>
27 #include <TopAbs_State.hxx>
28 #include <Standard_Real.hxx>
29 #include <TopTools_ListOfShape.hxx>
30 #include <BRepOffset_DataMapOfShapeOffset.hxx>
31 #include <TopTools_DataMapOfShapeShape.hxx>
32 #include <Standard_Boolean.hxx>
33 class BRepAlgo_AsDes;
34 class BRepAlgo_Image;
35 class TopoDS_Face;
36 class TopoDS_Shape;
37 class BRepOffset_Analyse;
38 
39 
40 
41 //! Computes the connection of the offset and not offset faces
42 //! according to the connection type required.
43 //! Store the result in AsDes tool.
44 class BRepOffset_Inter3d
45 {
46 public:
47   DEFINE_STANDARD_ALLOC
48 
49 public:
50 
51   //! Constructor
52   Standard_EXPORT BRepOffset_Inter3d (const Handle (BRepAlgo_AsDes)& AsDes,
53                                       const TopAbs_State Side,
54                                       const Standard_Real Tol);
55 
56   // Computes intersection of the given faces among each other
57   Standard_EXPORT void CompletInt (const TopTools_ListOfShape& SetOfFaces,
58                                    const BRepAlgo_Image& InitOffsetFace,
59                                    const Message_ProgressRange& theRange);
60 
61   //! Computes intersection of pair of faces
62   Standard_EXPORT void FaceInter (const TopoDS_Face& F1,
63                                   const TopoDS_Face& F2,
64                                   const BRepAlgo_Image& InitOffsetFace);
65 
66   //! Computes connections of the offset faces that have to be connected by arcs.
67   Standard_EXPORT void ConnexIntByArc (const TopTools_ListOfShape& SetOfFaces,
68                                        const TopoDS_Shape& ShapeInit,
69                                        const BRepOffset_Analyse& Analyse,
70                                        const BRepAlgo_Image& InitOffsetFace,
71                                        const Message_ProgressRange& theRange);
72 
73   //! Computes intersection of the offset faces that have to be connected by
74   //! sharp edges, i.e. it computes intersection between extended offset faces.
75   Standard_EXPORT void ConnexIntByInt (const TopoDS_Shape& SI,
76                                        const BRepOffset_DataMapOfShapeOffset& MapSF,
77                                        const BRepOffset_Analyse& A,
78                                        TopTools_DataMapOfShapeShape& MES,
79                                        TopTools_DataMapOfShapeShape& Build,
80                                        TopTools_ListOfShape& Failed,
81                                        const Message_ProgressRange& theRange,
82                                        const Standard_Boolean bIsPlanar = Standard_False);
83 
84   //! Computes intersection with not offset faces .
85   Standard_EXPORT void ContextIntByInt (const TopTools_IndexedMapOfShape& ContextFaces,
86                                         const Standard_Boolean ExtentContext,
87                                         const BRepOffset_DataMapOfShapeOffset& MapSF,
88                                         const BRepOffset_Analyse& A,
89                                         TopTools_DataMapOfShapeShape& MES,
90                                         TopTools_DataMapOfShapeShape& Build,
91                                         TopTools_ListOfShape& Failed,
92                                         const Message_ProgressRange& theRange,
93                                         const Standard_Boolean bIsPlanar = Standard_False);
94 
95   //! Computes connections of the not offset faces that have to be connected by arcs
96   Standard_EXPORT void ContextIntByArc (const TopTools_IndexedMapOfShape& ContextFaces,
97                                         const Standard_Boolean ExtentContext,
98                                         const BRepOffset_Analyse& Analyse,
99                                         const BRepAlgo_Image& InitOffsetFace,
100                                         BRepAlgo_Image& InitOffsetEdge,
101                                         const Message_ProgressRange& theRange);
102 
103   //! Marks the pair of faces as already intersected
104   Standard_EXPORT void SetDone (const TopoDS_Face& F1, const TopoDS_Face& F2);
105 
106   //! Checks if the pair of faces has already been treated.
107   Standard_EXPORT Standard_Boolean IsDone (const TopoDS_Face& F1,
108                                            const TopoDS_Face& F2) const;
109 
110   //! Returns touched faces
TouchedFaces()111   TopTools_IndexedMapOfShape& TouchedFaces() { return myTouched; };
112 
113   //! Returns AsDes tool
AsDes() const114   Handle (BRepAlgo_AsDes) AsDes() const { return myAsDes; }
115 
116   //! Returns new edges
NewEdges()117   TopTools_IndexedMapOfShape& NewEdges() { return myNewEdges; }
118 
119 private:
120 
121   //! Stores the intersection results into AsDes
122   Standard_EXPORT void Store (const TopoDS_Face& F1,
123                               const TopoDS_Face& F2,
124                               const TopTools_ListOfShape& LInt1,
125                               const TopTools_ListOfShape& LInt2);
126 
127 private:
128   Handle (BRepAlgo_AsDes) myAsDes;
129   TopTools_IndexedMapOfShape myTouched;
130   TopTools_DataMapOfShapeListOfShape myDone;
131   TopTools_IndexedMapOfShape myNewEdges;
132   TopAbs_State mySide;
133   Standard_Real myTol;
134 };
135 #endif // _BRepOffset_Inter3d_HeaderFile
136