b311480e |
1 | // Created on: 1996-03-07 |
2 | // Created by: Jean Yves LEBEY |
3 | // Copyright (c) 1996-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 <TopOpeBRepBuild_Builder.ixx> |
23 | |
24 | #include <TopOpeBRepDS.hxx> |
25 | #include <TopoDS.hxx> |
26 | #include <TopOpeBRepBuild_define.hxx> |
27 | #include <TopOpeBRepDS_EXPORT.hxx> |
28 | #include <TopOpeBRepTool_EXPORT.hxx> |
29 | #include <TopOpeBRepTool_2d.hxx> |
30 | |
31 | #ifdef DEB |
32 | Standard_EXPORT void debfctwesmess(const Standard_Integer i,const TCollection_AsciiString& s = ""); |
33 | Standard_EXPORT void debffwesON(const Standard_Integer i); |
34 | Standard_EXPORT void debffwesk(const Standard_Integer i) {cout<<"++ debffwesk "<<i<<endl;} |
35 | #endif |
36 | |
1d0a9d4d |
37 | Standard_Boolean TopOpeBRepBuild_FUN_aresamegeom(const TopoDS_Shape& S1,const TopoDS_Shape& S2); |
7fd59977 |
38 | |
39 | #define M_IN(st ) (st == TopAbs_IN) |
40 | #define M_OUT(st) (st == TopAbs_OUT) |
41 | #define M_FORWARD(st ) (st == TopAbs_FORWARD) |
42 | #define M_REVERSED(st) (st == TopAbs_REVERSED) |
43 | #define M_INTERNAL(st) (st == TopAbs_INTERNAL) |
44 | #define M_EXTERNAL(st) (st == TopAbs_EXTERNAL) |
45 | |
46 | //======================================================================= |
47 | //function : GFillFacesWESK |
48 | //purpose : |
49 | //======================================================================= |
50 | void TopOpeBRepBuild_Builder::GFillFacesWESK(const TopTools_ListOfShape& LS1,const TopTools_ListOfShape& LS2,const TopOpeBRepBuild_GTopo& G1,TopOpeBRepBuild_WireEdgeSet& WES,const Standard_Integer Kfill) |
51 | { |
52 | if ( LS1.IsEmpty() ) return; |
53 | TopAbs_State TB1,TB2; G1.StatesON(TB1,TB2); |
54 | |
55 | const TopOpeBRepDS_DataStructure& BDS = myDataStructure->DS(); |
56 | |
57 | const TopoDS_Shape& F1 = LS1.First(); |
58 | myFaceReference = TopoDS::Face(F1); |
59 | #ifdef DEB |
60 | Standard_Integer iF1 = |
61 | #endif |
62 | BDS.Shape(F1); |
63 | Standard_Integer iref = BDS.SameDomainRef(F1); |
64 | TopAbs_Orientation oref = BDS.Shape(iref).Orientation(); |
65 | |
66 | #ifdef DEB |
67 | Standard_Boolean tSPS = GtraceSPS(F1,iF1); |
68 | if(tSPS) cout<<"\n%%%%%%%%%%%%% K = "<<Kfill<<" %%%%%%%%%%%%% "; |
69 | if(tSPS) GdumpSHASTA(iF1,TB1,WES,"GFillFacesWESK","myFaceReference"); |
70 | if(tSPS) debffwesk(iF1); |
71 | #endif |
72 | |
73 | TopAbs_State TB; |
74 | TopOpeBRepBuild_GTopo G; |
75 | TopTools_ListIteratorOfListOfShape it; |
76 | Standard_Boolean gistoreverse1; |
77 | |
78 | G = G1; |
79 | gistoreverse1 = G.IsToReverse1(); |
80 | TB = TB1; |
81 | it.Initialize(LS1); |
82 | |
83 | #ifdef DEB |
84 | if(tSPS){ |
85 | cout<<"\n^^^^^^^^ GFillFacesWESK : traitement de 1/2"; |
86 | TopAbs_State TB11,TB21; G.StatesON(TB11,TB21); |
87 | cout<<" TB = ";TopAbs::Print(TB,cout); cout<<" "; |
88 | cout<<"(TB1 = ";TopAbs::Print(TB11,cout);cout<<","; |
89 | cout<<" TB2 = ";TopAbs::Print(TB21,cout);cout<<")\n\n"; |
90 | } |
91 | #endif |
92 | |
93 | for(; it.More(); it.Next()) { |
94 | const TopoDS_Shape& S = it.Value(); Standard_Integer iS = myDataStructure->Shape(S); |
95 | Standard_Boolean tomerge = !IsMerged(S,TB); |
96 | if (!tomerge) continue; |
97 | |
98 | // lors de l'insertion des composantes (edges splitees) de S dans le WES : |
99 | // - faces de meme orientation geometrique : |
100 | // la grille indique l'orientation des composantes |
101 | // - faces d'orientation geometrique != : |
102 | // les aretes de S sont exprimees dans une surface |
103 | // d'orientation opposee a la surface de la face de reference. |
104 | // Leur orientation dans la face resultat (reference) est le contraire |
105 | // de la grille. |
106 | // Modified by Sergey KHROMOV - Sat Apr 27 14:40:35 2002 Begin |
107 | // const TopoDS_Shape& Fref = WES.Face(); |
108 | // const TopoDS_Shape& F = S; |
109 | // Standard_Boolean samegeom = ::TopOpeBRepBuild_FUN_aresamegeom(Fref,F); |
110 | // Standard_Boolean r = gistoreverse1; |
111 | // if ( !samegeom ) { r = !r; G.SetReverse(r); } |
112 | |
113 | // Standard_Boolean rev = Standard_False; |
114 | // Modified by Sergey KHROMOV - Sat Apr 27 14:40:36 2002 End |
115 | TopAbs_Orientation oS = BDS.Shape(iS).Orientation(); |
116 | TopOpeBRepDS_Config conf = BDS.SameDomainOri(S); |
117 | Standard_Boolean b1 = (conf == TopOpeBRepDS_DIFFORIENTED && (oS == oref)); |
118 | Standard_Boolean b2 = (conf == TopOpeBRepDS_SAMEORIENTED && (oS != oref)); |
119 | Standard_Boolean b = b1 || b2; |
120 | // Modified by Sergey KHROMOV - Sat Apr 27 14:40:01 2002 Begin |
121 | // if (b) { |
122 | // rev = Standard_True; |
123 | // G.SetReverse(rev); |
124 | // } |
125 | if (b) |
126 | G.SetReverse(!gistoreverse1); |
127 | // Modified by Sergey KHROMOV - Sat Apr 27 14:40:03 2002 End |
128 | |
129 | if (Kfill == 1) { |
130 | GFillFaceWES(S,LS2,G,WES); |
131 | } |
132 | else if (Kfill == 2) { |
133 | #ifdef DEB |
134 | if (tSPS) debfctwesmess(iF1); |
135 | #endif |
136 | GFillCurveTopologyWES(S,G,WES); |
137 | } |
138 | else if (Kfill == 3) { |
139 | #ifdef DEB |
140 | if (tSPS) debffwesON(iF1); |
141 | #endif |
142 | GFillONPartsWES(S,G,LS2,WES); |
143 | } |
144 | else { |
145 | // error |
146 | } |
147 | } // it(LS1) |
148 | |
149 | |
150 | G = G1.CopyPermuted(); |
151 | gistoreverse1 = G.IsToReverse1(); |
152 | TB = TB2; |
153 | it.Initialize(LS2); |
154 | |
155 | #ifdef DEB |
156 | if(tSPS){ |
157 | cout<<"\n^^^^^^^^ GFillFacesWESK : traitement de 2/1"; |
158 | TopAbs_State TB12,TB22; G.StatesON(TB12,TB22); |
159 | cout<<" TB = ";TopAbs::Print(TB,cout); cout<<" "; |
160 | cout<<"(TB1 = ";TopAbs::Print(TB12,cout);cout<<","; |
161 | cout<<" TB2 = ";TopAbs::Print(TB22,cout);cout<<")\n\n"; |
162 | } |
163 | #endif |
164 | |
165 | for (; it.More(); it.Next()) { |
166 | const TopoDS_Shape& S = it.Value(); Standard_Integer iS = myDataStructure->Shape(S); |
167 | Standard_Boolean tomerge = !IsMerged(S,TB); |
168 | if (!tomerge) continue; |
169 | |
170 | // Modified by Sergey KHROMOV - Sat Apr 27 14:38:33 2002 Begin |
171 | // const TopoDS_Shape& Fref = WES.Face(); |
172 | // const TopoDS_Shape& F = S; |
173 | // Standard_Boolean samegeom = ::TopOpeBRepBuild_FUN_aresamegeom(Fref,F); |
174 | // Standard_Boolean r = gistoreverse1; |
175 | // if ( !samegeom ) { r = !r; G.SetReverse(r); } |
176 | |
177 | // Standard_Boolean rev = Standard_False; |
178 | // Modified by Sergey KHROMOV - Sat Apr 27 14:38:30 2002 End |
179 | TopAbs_Orientation oS = BDS.Shape(iS).Orientation(); |
180 | TopOpeBRepDS_Config conf = BDS.SameDomainOri(S); |
181 | Standard_Boolean b1 = (conf == TopOpeBRepDS_DIFFORIENTED && (oS == oref)); |
182 | Standard_Boolean b2 = (conf == TopOpeBRepDS_SAMEORIENTED && (oS != oref)); |
183 | Standard_Boolean b = b1 || b2; |
184 | // Modified by Sergey KHROMOV - Sat Apr 27 14:39:04 2002 Begin |
185 | // if (b) { |
186 | // rev = Standard_True; |
187 | // G.SetReverse(rev); |
188 | // } |
189 | if (b) |
190 | G.SetReverse(!gistoreverse1); |
191 | // Modified by Sergey KHROMOV - Sat Apr 27 14:39:08 2002 End |
192 | |
193 | if (Kfill == 1) { |
194 | GFillFaceWES(S,LS1,G,WES); |
195 | } |
196 | else if (Kfill == 2) { |
197 | GFillCurveTopologyWES(S,G,WES); |
198 | } |
199 | else if (Kfill == 3) { |
200 | #ifdef DEB |
201 | if(tSPS) debffwesON(iF1); |
202 | #endif |
203 | GFillONPartsWES(S,G,LS1,WES); |
204 | } |
205 | else { |
206 | } |
207 | |
208 | } // it(LS2) |
209 | |
210 | } // GFillFacesWESK |