b311480e |
1 | // Created on: 1997-04-22 |
2 | // Created by: Prestataire Mary FABIEN |
3 | // Copyright (c) 1997-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | #include <TopOpeBRepDS_Filter.ixx> |
23 | #include <TopOpeBRepDS_DataStructure.hxx> |
24 | #include <TopoDS_Shape.hxx> |
25 | #include <TopOpeBRepDS_Interference.hxx> |
26 | #include <TopOpeBRepDS_ListOfInterference.hxx> |
27 | #include <TopOpeBRepDS_ListIteratorOfListOfInterference.hxx> |
28 | #include <TopOpeBRepDS_ProcessInterferencesTool.hxx> |
29 | #include <TopOpeBRepDS_define.hxx> |
30 | #include <TopOpeBRepDS_ListOfShapeOn1State.hxx> |
31 | #include <TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State.hxx> |
32 | |
33 | #ifdef DEB |
34 | Standard_EXPORT Standard_Boolean TopOpeBRepDS_GetcontextNOPFI(); |
35 | Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettracePFI(); |
36 | Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettracePI(); |
37 | Standard_EXPORT Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer); |
38 | static Standard_Boolean TRCF(const Standard_Integer F) { |
39 | Standard_Boolean b1 = TopOpeBRepDS_GettracePFI(); |
40 | Standard_Boolean b2 = TopOpeBRepDS_GettracePI(); |
41 | Standard_Boolean b3 = TopOpeBRepDS_GettraceSPSX(F); |
42 | return (b1 || b2 || b3); |
43 | } |
44 | #endif |
45 | |
46 | Standard_EXPORT Standard_Integer FUN_unkeepFdoubleGBoundinterferences(TopOpeBRepDS_ListOfInterference& LI,const TopOpeBRepDS_DataStructure& BDS,const Standard_Integer SIX); |
47 | Standard_EXPORT void FUN_resolveFUNKNOWN |
48 | (TopOpeBRepDS_ListOfInterference& LI,TopOpeBRepDS_DataStructure& BDS, |
49 | const Standard_Integer SIX, |
50 | const TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State& MEsp, |
51 | TopOpeBRepTool_PShapeClassifier pClassif); |
52 | |
53 | #ifdef DEB |
54 | void debfilfac(const Standard_Integer I) {cout<<"+ + + + debfilfac "<<I<<endl;} |
55 | void debpfi(const Standard_Integer I) {cout<<"+ + + + debpfi "<<I<<endl;} |
56 | #endif |
57 | |
58 | // ------------------------------------------------------- |
59 | void FUN_FilterFace |
60 | // ------------------------------------------------------- |
61 | #ifdef DEB |
62 | (TopOpeBRepDS_ListOfInterference& LI,const TopOpeBRepDS_DataStructure& /*BDS*/,const Standard_Integer SIX) |
63 | #else |
64 | (TopOpeBRepDS_ListOfInterference& ,const TopOpeBRepDS_DataStructure& ,const Standard_Integer ) |
65 | #endif |
66 | { |
67 | #ifdef DEB |
68 | Standard_Boolean TRC=TRCF(SIX); |
69 | Standard_Integer nI = 0; |
70 | if (TRC) debfilfac(SIX); |
71 | #endif |
72 | |
73 | #ifdef DEB |
74 | nI = LI.Extent(); |
75 | if (TRC) cout <<"before FUN_FilterFace on "<<SIX<<" nI = "<<nI<<endl; |
76 | #endif |
77 | |
78 | // ::FUN_unkeepFdoubleGBoundinterferences(LI,BDS,SIX); |
79 | |
80 | #ifdef DEB |
81 | nI = LI.Extent(); |
82 | if (TRC) cout <<"after unkeepFinterferences nI = "<<nI<<endl; |
83 | #endif |
84 | } |
85 | |
86 | //======================================================================= |
87 | //function : ProcessFaceInterferences |
88 | //purpose : |
89 | //======================================================================= |
90 | void TopOpeBRepDS_Filter::ProcessFaceInterferences |
91 | (const Standard_Integer SIX,const TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State& MEsp) |
92 | { |
93 | TopOpeBRepDS_DataStructure& BDS = myHDS->ChangeDS(); |
94 | |
95 | #ifdef DEB |
96 | Standard_Boolean TRC=TRCF(SIX); |
97 | Standard_Integer nI = 0; |
98 | if (TRC) debpfi(SIX); |
99 | #endif |
100 | |
101 | // BDS.Shape(SIX); |
102 | TopOpeBRepDS_ListOfInterference& LI = BDS.ChangeShapeInterferences(SIX); |
103 | ::FUN_reducedoublons(LI,BDS,SIX); |
104 | |
105 | #ifdef DEB |
106 | nI = LI.Extent(); |
107 | if (TRC) cout <<"after reducedoublons nI = "<<nI<<endl; |
108 | #endif |
109 | |
110 | TopOpeBRepDS_ListOfInterference lw, lE, lFE, lFEF, lF, lUU, lall; lall.Assign(LI); |
111 | |
112 | #ifdef DEB |
113 | Standard_Integer nUU = |
114 | #endif |
115 | ::FUN_selectTRAUNKinterference(lall,lUU); |
116 | FUN_resolveFUNKNOWN(lUU,BDS,SIX,MEsp,myPShapeClassif); |
117 | lw.Append(lall); |
118 | lw.Append(lUU); |
119 | |
120 | Standard_Integer nF = ::FUN_selectTRASHAinterference(lw,TopAbs_FACE,lF); |
121 | Standard_Integer nFE = ::FUN_selectGKinterference(lF,TopOpeBRepDS_EDGE,lFE); |
122 | Standard_Integer nFEF = ::FUN_selectSKinterference(lFE,TopOpeBRepDS_FACE,lFEF); |
123 | Standard_Integer nE = ::FUN_selectTRASHAinterference(lw,TopAbs_EDGE,lE); |
124 | |
125 | |
126 | #ifdef DEB |
127 | if(TRC){ |
128 | if(nF||nFE||nFEF||nE){cout<<endl;cout<<"-----------------------"<<endl;} |
129 | if(nUU) {cout<<"FACE "<<SIX<<" UNKNOWN : "<<nUU<<endl;FDS_dumpLI(lUU," ");} |
130 | if(nF) {cout<<"FACE "<<SIX<<" (FACE) : "<<nF<<endl;FDS_dumpLI(lF," ");} |
131 | if(nFE){cout<<"FACE "<<SIX<<" (FACE)(GK EDGE) : "<<nFE<<endl;FDS_dumpLI(lFE," ");} |
132 | if(nFEF){cout<<"FACE "<<SIX<<" (FACE)(GK EDGE)(SK FACE) : "<<nFEF<<endl;FDS_dumpLI(lFEF," ");} |
133 | if(nE) {cout<<"FACE "<<SIX<<" (EDGE) : "<<nE<<endl;FDS_dumpLI(lE," ");} |
134 | } |
135 | #endif |
136 | |
137 | ::FUN_FilterFace(lFEF,BDS,SIX); |
138 | |
139 | nF = lF.Extent(); |
140 | nFE = lFE.Extent(); |
141 | nFEF = lFEF.Extent(); |
142 | nE = lE.Extent(); |
143 | #ifdef DEB |
144 | if(TRC){ |
145 | if(nF||nFE||nFEF||nE)cout<<endl; |
146 | if(nF) {cout<<"FACE "<<SIX<<" (FACE) : "<<nF<<endl;FDS_dumpLI(lF," ");} |
147 | if(nFE){cout<<"FACE "<<SIX<<" (FACE)(GK EDGE) : "<<nFE<<endl;FDS_dumpLI(lFE," ");} |
148 | if(nFEF){cout<<"FACE "<<SIX<<" (FACE)(GK EDGE)(SK FACE) : "<<nFEF<<endl;FDS_dumpLI(lFEF," ");} |
149 | if(nE) {cout<<"FACE "<<SIX<<" (EDGE) : "<<nE<<endl;FDS_dumpLI(lE," ");} |
150 | cout<<"-----------------------"<<endl; |
151 | } |
152 | #endif |
153 | |
154 | LI.Clear(); |
155 | LI.Append(lF); |
156 | LI.Append(lFE); |
157 | LI.Append(lFEF); |
158 | LI.Append(lE); |
159 | |
160 | } // ProcessFaceInterferences |