42cf5bc1 |
1 | // Created on: 1997-08-13 |
2 | // Created by: Prestataire Mary FABIEN |
3 | // Copyright (c) 1997-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 _BRepAlgo_DSAccess_HeaderFile |
18 | #define _BRepAlgo_DSAccess_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <TopOpeBRep_DSFiller.hxx> |
25 | #include <TopoDS_Shape.hxx> |
26 | #include <TopAbs_State.hxx> |
27 | #include <TopTools_ListOfShape.hxx> |
28 | #include <Standard_Boolean.hxx> |
29 | #include <TopoDS_Wire.hxx> |
30 | #include <TColStd_ListOfInteger.hxx> |
31 | #include <TopTools_DataMapOfShapeShape.hxx> |
32 | #include <TColStd_PackedMapOfInteger.hxx> |
33 | #include <BRepAlgo_CheckStatus.hxx> |
34 | #include <Standard_Integer.hxx> |
35 | #include <TopOpeBRepDS_Kind.hxx> |
36 | class TopOpeBRepDS_HDataStructure; |
37 | class TopOpeBRepBuild_HBuilder; |
38 | class BRepAlgo_EdgeConnector; |
39 | class BRepAlgo_BooleanOperations; |
40 | class TopoDS_Shape; |
41 | class TopoDS_Vertex; |
42 | |
43 | |
44 | |
45 | class BRepAlgo_DSAccess |
46 | { |
47 | public: |
48 | |
49 | DEFINE_STANDARD_ALLOC |
50 | |
51 | |
52 | Standard_EXPORT BRepAlgo_DSAccess(); |
53 | |
54 | //! Clears the internal data structure, including the |
55 | Standard_EXPORT void Init(); |
56 | |
57 | //! Loads the shape in DS. |
58 | Standard_EXPORT void Load (const TopoDS_Shape& S); |
59 | |
60 | //! Loads two shapes in the DS without intersecting them. |
61 | Standard_EXPORT void Load (TopoDS_Shape& S1, TopoDS_Shape& S2); |
62 | |
63 | //! Intersects two shapes at input and loads the DS with |
64 | //! their intersection. Clears the TopOpeBRepBuild_HBuilder if |
65 | //! necessary |
66 | Standard_EXPORT void Intersect(); |
67 | |
68 | //! Intersects the faces contained in two given shapes |
69 | //! and loads them in the DS. Clears the TopOpeBRepBuild_HBuilder |
70 | //! if necessary |
71 | Standard_EXPORT void Intersect (const TopoDS_Shape& S1, const TopoDS_Shape& S2); |
72 | |
73 | //! This method does the same thing as the previous, |
74 | //! but faster. There is no intersection face/face 3D. |
75 | //! The faces have the same support(surface). No test of |
76 | //! tangency (that is why it is faster). Intersects in 2d |
77 | //! the faces tangent F1 anf F2. |
78 | Standard_EXPORT void SameDomain (const TopoDS_Shape& S1, const TopoDS_Shape& S2); |
79 | |
80 | //! returns compounds of Edge connected with section, which |
81 | //! contains sections between faces contained in S1 and S2. |
82 | //! returns an empty list of Shape if S1 or S2 do not contain |
83 | //! face. |
84 | //! calls GetSectionEdgeSet() if it has not already been done |
85 | Standard_EXPORT const TopTools_ListOfShape& GetSectionEdgeSet (const TopoDS_Shape& S1, const TopoDS_Shape& S2); |
86 | |
87 | //! returns all compounds of edges connected with section |
88 | //! contained in the DS |
89 | Standard_EXPORT const TopTools_ListOfShape& GetSectionEdgeSet(); |
90 | |
91 | //! NYI |
92 | Standard_EXPORT Standard_Boolean IsWire (const TopoDS_Shape& Compound); |
93 | |
94 | //! NYI |
95 | Standard_EXPORT const TopoDS_Shape& Wire (const TopoDS_Shape& Compound); |
96 | |
97 | //! NYI |
98 | //! returns the vertex of section, which contains the section |
99 | //! between face S1 and edge S2 (returns an empty Shape |
100 | //! if S1 is not a face or if S2 is not an edge) |
101 | Standard_EXPORT const TopTools_ListOfShape& SectionVertex (const TopoDS_Shape& S1, const TopoDS_Shape& S2); |
102 | |
103 | //! Invalidates a complete line of section. All |
104 | //! Edges connected by Vertex or a Wire. Can be |
105 | //! a group of connected Edges, which do not form a |
106 | //! standard Wire. |
107 | Standard_EXPORT void SuppressEdgeSet (const TopoDS_Shape& Compound); |
108 | |
109 | //! Modifies a line of section. <New> -- should be a |
110 | //! Group of Edges connected by Vertex. -- Can be a |
111 | //! Wire. Can be a group of connected Edges that do not |
112 | //! form a standard Wire. <New> should be sub-groupn of <Old> |
113 | Standard_EXPORT void ChangeEdgeSet (const TopoDS_Shape& Old, const TopoDS_Shape& New); |
114 | |
115 | //! NYI |
116 | //! Make invalid a Vertex of section. The Vertex shoud be |
117 | //! reconstructed from a point. |
118 | Standard_EXPORT void SuppressSectionVertex (const TopoDS_Vertex& V); |
119 | |
120 | Standard_EXPORT const TopoDS_Shape& Merge (const TopAbs_State state1, const TopAbs_State state2); |
121 | |
122 | Standard_EXPORT const TopoDS_Shape& Merge (const TopAbs_State state1); |
123 | |
124 | //! NYI Propagation of a state starting from the shape |
125 | //! FromShape = edge or vertex of section, face or |
126 | //! Coumpound de section. LoadShape is either S1, |
127 | //! or S2 (see the method Load). Propagation from |
128 | //! FromShape, on the states <what> of LoadShape. |
129 | //! Return a Wire in 2d, a Shell in 3d. |
130 | //! Specifications are incomplete, to be redefined for the typologies |
131 | //! correpsonding to <FromShape> and the result : |
132 | //! exemple : FromShape resultat |
133 | //! vertex wire (or edge) |
134 | //! edge of section face (or shell) |
135 | //! compound of section shell |
136 | //! ... ... |
137 | Standard_EXPORT const TopoDS_Shape& Propagate (const TopAbs_State what, const TopoDS_Shape& FromShape, const TopoDS_Shape& LoadShape); |
138 | |
139 | //! SectionShape est soit un Vertex de section(NYI), soit |
140 | //! une Edge de section. Propagation des shapes |
141 | //! de section en partant de SectionShape. |
142 | //! return un Compound de section. |
143 | Standard_EXPORT const TopoDS_Shape& PropagateFromSection (const TopoDS_Shape& SectionShape); |
144 | |
145 | //! Returns the list of the descendant shapes of the shape <S>. |
146 | Standard_EXPORT const TopTools_ListOfShape& Modified (const TopoDS_Shape& S); |
147 | |
148 | //! Returns the fact that the shape <S> has been deleted or not |
149 | //! by the boolean operation. |
150 | Standard_EXPORT Standard_Boolean IsDeleted (const TopoDS_Shape& S); |
151 | |
152 | //! NYI |
153 | //! coherence of the internal Data Structure. |
154 | Standard_EXPORT BRepAlgo_CheckStatus Check(); |
155 | |
156 | Standard_EXPORT const Handle(TopOpeBRepDS_HDataStructure)& DS() const; |
157 | |
158 | Standard_EXPORT Handle(TopOpeBRepDS_HDataStructure)& ChangeDS(); |
159 | |
160 | Standard_EXPORT const Handle(TopOpeBRepBuild_HBuilder)& Builder() const; |
161 | |
162 | Standard_EXPORT Handle(TopOpeBRepBuild_HBuilder)& ChangeBuilder(); |
163 | |
164 | |
165 | friend class BRepAlgo_BooleanOperations; |
166 | |
167 | |
168 | protected: |
169 | |
170 | |
171 | |
172 | |
173 | |
174 | private: |
175 | |
176 | |
177 | Standard_EXPORT void Suppress (const TopoDS_Shape& Compound, const TopoDS_Shape& KeepComp); |
178 | |
179 | Standard_EXPORT void RemoveEdgeInterferences (const Standard_Integer iF1, const Standard_Integer iF2, const Standard_Integer iCurve); |
180 | |
181 | Standard_EXPORT void RemoveEdgeInterferences (const Standard_Integer iE1, const Standard_Integer iE2, const TopoDS_Shape& SectEdge); |
182 | |
183 | Standard_EXPORT void RemoveFaceInterferences (const Standard_Integer iF1, const Standard_Integer iF2, const Standard_Integer iE1, const Standard_Integer iE2); |
184 | |
185 | Standard_EXPORT void RemoveFaceInterferences (const Standard_Integer iF1, const Standard_Integer iF2, const Standard_Integer iCurve); |
186 | |
187 | Standard_EXPORT void RemoveEdgeInterferencesFromFace (const Standard_Integer iF1, const Standard_Integer iF2, const Standard_Integer ipv1, const TopOpeBRepDS_Kind kind1, const Standard_Integer ipv2, const TopOpeBRepDS_Kind kind2); |
188 | |
189 | Standard_EXPORT void RemoveEdgeFromFace (const Standard_Integer iF, const Standard_Integer iV); |
190 | |
191 | Standard_EXPORT void PntVtxOnCurve (const Standard_Integer iCurve, Standard_Integer& ipv1, TopOpeBRepDS_Kind& ik1, Standard_Integer& ipv2, TopOpeBRepDS_Kind& ik2); |
192 | |
193 | Standard_EXPORT void PntVtxOnSectEdge (const TopoDS_Shape& SectEdge, Standard_Integer& ipv1, TopOpeBRepDS_Kind& ik1, Standard_Integer& ipv2, TopOpeBRepDS_Kind& ik2); |
194 | |
195 | Standard_EXPORT void RemoveEdgeSameDomain (const Standard_Integer iE1, const Standard_Integer iE2); |
196 | |
197 | Standard_EXPORT void RemoveFaceSameDomain (const TopoDS_Shape& C); |
198 | |
199 | Standard_EXPORT TColStd_ListOfInteger& FindGoodFace (const Standard_Integer iE, Standard_Integer& iF1, Standard_Boolean& b); |
200 | |
201 | Standard_EXPORT void RemoveFaceSameDomain (const Standard_Integer iF1, const Standard_Integer iF2); |
202 | |
203 | Standard_EXPORT Standard_Boolean GoodInterf (const TopoDS_Shape& SectEdge, const TopOpeBRepDS_Kind kind, const Standard_Integer iPointVertex); |
204 | |
205 | |
206 | Handle(TopOpeBRepDS_HDataStructure) myHDS; |
207 | TopOpeBRep_DSFiller myDSFiller; |
208 | Handle(TopOpeBRepBuild_HBuilder) myHB; |
209 | Handle(BRepAlgo_EdgeConnector) myEC; |
210 | TopoDS_Shape myS1; |
211 | TopoDS_Shape myS2; |
212 | TopAbs_State myState1; |
213 | TopAbs_State myState2; |
214 | TopTools_ListOfShape myListOfCompoundOfEdgeConnected; |
215 | TopTools_ListOfShape myCurrentList; |
216 | Standard_Boolean myRecomputeBuilderIsDone; |
217 | Standard_Boolean myGetSectionIsDone; |
218 | TopoDS_Shape myResultShape; |
219 | TopoDS_Wire myWire; |
220 | TopTools_ListOfShape myListOfVertex; |
221 | TopTools_ListOfShape myModified; |
222 | TopoDS_Shape myEmptyShape; |
223 | TopTools_ListOfShape myEmptyListOfShape; |
224 | TColStd_ListOfInteger myEmptyListOfInteger; |
225 | TopTools_DataMapOfShapeShape myCompoundWireMap; |
226 | TColStd_PackedMapOfInteger mySetOfKeepPoint; |
227 | |
228 | |
229 | }; |
230 | |
231 | |
232 | |
233 | |
234 | |
235 | |
236 | |
237 | #endif // _BRepAlgo_DSAccess_HeaderFile |