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
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.
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.
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.
22 #include <TopOpeBRepBuild_Builder.ixx>
24 #include <TopOpeBRepDS.hxx>
26 #include <TopOpeBRepBuild_define.hxx>
27 #include <TopOpeBRepDS_EXPORT.hxx>
28 #include <TopOpeBRepTool_EXPORT.hxx>
29 #include <TopOpeBRepTool_2d.hxx>
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;}
37 Standard_EXPORT Standard_Boolean TopOpeBRepBuild_FUN_aresamegeom(const TopoDS_Shape& S1,const TopoDS_Shape& S2);
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)
46 //=======================================================================
47 //function : GFillFacesWESK
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)
52 if ( LS1.IsEmpty() ) return;
53 TopAbs_State TB1,TB2; G1.StatesON(TB1,TB2);
55 const TopOpeBRepDS_DataStructure& BDS = myDataStructure->DS();
57 const TopoDS_Shape& F1 = LS1.First();
58 myFaceReference = TopoDS::Face(F1);
60 Standard_Integer iF1 =
63 Standard_Integer iref = BDS.SameDomainRef(F1);
64 TopAbs_Orientation oref = BDS.Shape(iref).Orientation();
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);
74 TopOpeBRepBuild_GTopo G;
75 TopTools_ListIteratorOfListOfShape it;
76 Standard_Boolean gistoreverse1;
79 gistoreverse1 = G.IsToReverse1();
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";
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;
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
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); }
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
122 // rev = Standard_True;
123 // G.SetReverse(rev);
126 G.SetReverse(!gistoreverse1);
127 // Modified by Sergey KHROMOV - Sat Apr 27 14:40:03 2002 End
130 GFillFaceWES(S,LS2,G,WES);
132 else if (Kfill == 2) {
134 if (tSPS) debfctwesmess(iF1);
136 GFillCurveTopologyWES(S,G,WES);
138 else if (Kfill == 3) {
140 if (tSPS) debffwesON(iF1);
142 GFillONPartsWES(S,G,LS2,WES);
150 G = G1.CopyPermuted();
151 gistoreverse1 = G.IsToReverse1();
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";
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;
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); }
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
186 // rev = Standard_True;
187 // G.SetReverse(rev);
190 G.SetReverse(!gistoreverse1);
191 // Modified by Sergey KHROMOV - Sat Apr 27 14:39:08 2002 End
194 GFillFaceWES(S,LS1,G,WES);
196 else if (Kfill == 2) {
197 GFillCurveTopologyWES(S,G,WES);
199 else if (Kfill == 3) {
201 if(tSPS) debffwesON(iF1);
203 GFillONPartsWES(S,G,LS1,WES);