42cf5bc1 |
1 | // Created on: 2001-05-03 |
2 | // Created by: Michael SAZONOV |
3 | // Copyright (c) 2001-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _QANewModTopOpe_Glue_HeaderFile |
17 | #define _QANewModTopOpe_Glue_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_DefineAlloc.hxx> |
21 | #include <Standard_Handle.hxx> |
22 | |
23 | #include <Standard_Boolean.hxx> |
24 | #include <BRepTools_Substitution.hxx> |
25 | #include <TopTools_DataMapOfShapeListOfShape.hxx> |
26 | #include <TopTools_DataMapOfShapeShape.hxx> |
27 | #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> |
28 | #include <TopTools_MapOfShape.hxx> |
29 | #include <BRepAlgoAPI_BooleanOperation.hxx> |
30 | #include <TopTools_ListOfShape.hxx> |
31 | #include <TopAbs_State.hxx> |
32 | #include <Standard_Integer.hxx> |
33 | #include <Standard_Real.hxx> |
34 | class TopoDS_Shape; |
35 | class TopoDS_Face; |
36 | class gp_Pnt; |
37 | class TopoDS_Edge; |
38 | class TopoDS_Vertex; |
39 | |
40 | |
41 | //! Perform the gluing topological operation |
42 | //! (topological sewing of two topological objects). |
43 | class QANewModTopOpe_Glue : public BRepAlgoAPI_BooleanOperation |
44 | { |
45 | public: |
46 | |
47 | DEFINE_STANDARD_ALLOC |
48 | |
49 | |
50 | //! Defines 2 operands. |
51 | //! If one of operands is Solid and another is Shell and Shell |
52 | //! goes inside Solid, the <allowCutting> determines what to do: |
53 | //! if True, Shell is cut by Solid during the operation; |
54 | //! if False, Null shape is returned, IsDone() returns False. |
55 | //! If <thePerformNow> is False then does not compute immediately. |
56 | Standard_EXPORT QANewModTopOpe_Glue(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2, const Standard_Boolean theAllowCutting = Standard_False, const Standard_Boolean thePerformNow = Standard_True); |
57 | |
58 | //! Computation; is usefull when Create was called with thePerformNow |
59 | //! being False |
60 | Standard_EXPORT void Build() Standard_OVERRIDE; |
61 | |
62 | //! Returns the list of shapes generated from the |
63 | //! shape <theS>. |
64 | Standard_EXPORT const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS) Standard_OVERRIDE; |
65 | |
66 | //! Returns the list of shapes modified from the shape |
67 | //! <theS>. |
68 | Standard_EXPORT const TopTools_ListOfShape& Modified (const TopoDS_Shape& theS) Standard_OVERRIDE; |
69 | |
70 | //! Returns True if the shape <theS> existed in one of operands |
71 | //! and is absent in the result. |
72 | Standard_EXPORT Standard_Boolean IsDeleted (const TopoDS_Shape& theS) Standard_OVERRIDE; |
73 | |
74 | //! Returns True if there is at leat one generated shape |
75 | Standard_EXPORT virtual Standard_Boolean HasGenerated() const Standard_OVERRIDE; |
76 | |
77 | //! Returns True if there is at leat one modified shape |
78 | Standard_EXPORT virtual Standard_Boolean HasModified() const Standard_OVERRIDE; |
79 | |
80 | //! Returns True if there is at leat one deleted shape |
81 | Standard_EXPORT virtual Standard_Boolean HasDeleted() const Standard_OVERRIDE; |
82 | |
83 | Standard_EXPORT static Standard_Boolean ProjPointOnEdge (const gp_Pnt& thePnt, const TopoDS_Edge& theEdge, Standard_Real& thePar, Standard_Real& theDist); |
84 | |
85 | Standard_EXPORT static void InsertVertexInEdge (const TopoDS_Edge& theEdge, const TopoDS_Vertex& theVer, const Standard_Real thePar, TopoDS_Edge& theNewEdge); |
86 | |
87 | Standard_EXPORT static void SplitEdgeByVertex (const TopoDS_Edge& theEdge, const TopoDS_Vertex& theVer, const Standard_Real thePar, TopTools_ListOfShape& theListE); |
88 | |
89 | Standard_EXPORT static Standard_Boolean CompareVertices (const TopoDS_Vertex& theV1, const TopoDS_Vertex& theV2, Standard_Real& theDist); |
90 | |
91 | |
92 | |
93 | |
94 | protected: |
95 | |
96 | |
97 | |
98 | |
99 | |
100 | private: |
101 | |
102 | |
103 | //! Performs gluing Shell-Wire |
104 | Standard_EXPORT void PerformShellWire(); |
105 | |
106 | //! Performs gluing Solid-Vertex and Shell-Vertex |
107 | Standard_EXPORT void PerformVertex(); |
108 | |
109 | //! Performs gluing Solid-Shell and Shell-Shell |
110 | Standard_EXPORT void PerformShell(); |
111 | |
112 | //! Performs gluing Wire-Wire |
113 | Standard_EXPORT void PerformWires(); |
114 | |
115 | //! This function performs gluing operation of same domain |
116 | //! faces theFirstSDFace and theSecondSDFace on shapes |
117 | //! theNewSolid1 and theNewSolid2 and returns them. |
118 | //! theMapOfChangedFaces contains changed faces as keys and |
119 | //! lists of their splits as items. |
120 | Standard_EXPORT Standard_Boolean SubstitudeSDFaces (const TopoDS_Shape& theFirstSDFace, const TopoDS_Shape& theSecondSDFace, TopoDS_Shape& theNewSolid1, TopoDS_Shape& theNewSolid2, TopTools_DataMapOfShapeListOfShape& theMapOfChangedFaces); |
121 | |
122 | //! Performs gluing between same domain faces of object and tool |
123 | Standard_EXPORT void PerformSDFaces(); |
124 | |
125 | //! For the case Solid-Shell, <aFace> is from Shell. |
126 | //! Splits <theFace> onto faces by section edges <theListSE> and |
127 | //! add <theFace> for substitution by list of faces which are "out" |
128 | //! of Solid |
129 | Standard_EXPORT Standard_Boolean CutFace (const TopoDS_Face& theFace, const TopTools_ListOfShape& theListSE); |
130 | |
131 | //! For the case Solid-Shell, <theFace> is a split of Shell's face. |
132 | //! Returns the state of <theFace> relatively Solid. |
133 | Standard_EXPORT TopAbs_State ClassifyFace (const TopoDS_Face& theFace, const TopTools_ListOfShape& theListSE) const; |
134 | |
135 | //! Inserts "internal" elements (wires, edges, vertices) computed |
136 | //! from a list of section edges <theListSE> into <theFace>. |
137 | Standard_EXPORT void SectionInsideFace (const TopoDS_Face& theFace, const TopTools_ListOfShape& theListSE, const Standard_Integer theShapeNum, const TopTools_MapOfShape& theGenEdges); |
138 | |
139 | Standard_EXPORT static const TopoDS_Shape& FindWireOrUpdateMap (const TopoDS_Shape& theWire, TopTools_IndexedDataMapOfShapeListOfShape& theMapELW); |
140 | |
141 | |
142 | Standard_Boolean myCompleted; |
143 | Standard_Boolean myAllowCutting; |
144 | BRepTools_Substitution mySubst; |
145 | TopTools_DataMapOfShapeListOfShape myMapSEdgeFaces1; |
146 | TopTools_DataMapOfShapeListOfShape myMapSEdgeFaces2; |
147 | TopTools_DataMapOfShapeShape myMapSEdgeCrossFace1; |
148 | TopTools_DataMapOfShapeShape myMapSEdgeCrossFace2; |
149 | TopTools_IndexedDataMapOfShapeListOfShape myMapEdgeWires; |
150 | TopTools_MapOfShape myEdgesToLeave; |
151 | TopTools_DataMapOfShapeListOfShape myMapModif; |
152 | TopTools_DataMapOfShapeListOfShape myMapGener; |
153 | |
154 | |
155 | }; |
156 | |
157 | |
158 | |
159 | |
160 | |
161 | |
162 | |
163 | #endif // _QANewModTopOpe_Glue_HeaderFile |