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