Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 1996-03-07 |
2 | // Created by: Jean Yves LEBEY | |
3 | // Copyright (c) 1996-1999 Matra Datavision | |
973c2be1 | 4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e | 5 | // |
973c2be1 | 6 | // This file is part of Open CASCADE Technology software library. |
b311480e | 7 | // |
d5f74e42 | 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 | |
973c2be1 | 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. | |
b311480e | 13 | // |
973c2be1 | 14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. | |
7fd59977 | 16 | |
42cf5bc1 | 17 | |
18 | #include <gp_Pnt.hxx> | |
19 | #include <Standard_NoSuchObject.hxx> | |
20 | #include <TCollection_AsciiString.hxx> | |
21 | #include <TopoDS_Edge.hxx> | |
22 | #include <TopoDS_Face.hxx> | |
23 | #include <TopoDS_Shape.hxx> | |
24 | #include <TopoDS_Vertex.hxx> | |
25 | #include <TopOpeBRepBuild_Builder.hxx> | |
7fd59977 | 26 | #include <TopOpeBRepBuild_define.hxx> |
42cf5bc1 | 27 | #include <TopOpeBRepBuild_EdgeBuilder.hxx> |
28 | #include <TopOpeBRepBuild_FaceBuilder.hxx> | |
29 | #include <TopOpeBRepBuild_GTopo.hxx> | |
30 | #include <TopOpeBRepBuild_HBuilder.hxx> | |
31 | #include <TopOpeBRepBuild_PaveSet.hxx> | |
32 | #include <TopOpeBRepBuild_ShapeSet.hxx> | |
33 | #include <TopOpeBRepBuild_ShellFaceSet.hxx> | |
34 | #include <TopOpeBRepBuild_SolidBuilder.hxx> | |
35 | #include <TopOpeBRepBuild_WireEdgeSet.hxx> | |
36 | #include <TopOpeBRepDS_BuildTool.hxx> | |
37 | #include <TopOpeBRepDS_CurveIterator.hxx> | |
7fd59977 | 38 | #include <TopOpeBRepDS_EXPORT.hxx> |
42cf5bc1 | 39 | #include <TopOpeBRepDS_HDataStructure.hxx> |
40 | #include <TopOpeBRepDS_PointIterator.hxx> | |
41 | #include <TopOpeBRepDS_SurfaceIterator.hxx> | |
42 | #include <TopOpeBRepTool_ShapeExplorer.hxx> | |
7fd59977 | 43 | |
44 | #ifdef DRAW | |
45 | #include <TopOpeBRepDS_DRAW.hxx> | |
46 | #endif | |
47 | ||
48 | #include <TopOpeBRepDS_EXPORT.hxx> | |
49 | #include <TopOpeBRepDS_ProcessInterferencesTool.hxx> | |
50 | #include <TopOpeBRepTool_EXPORT.hxx> | |
51 | #include <TopOpeBRepTool_TOOL.hxx> | |
52 | #include <TopOpeBRepDS_TKI.hxx> | |
53 | #include <TopOpeBRepDS.hxx> | |
54 | #include <BRep_Tool.hxx> | |
55 | #include <TopoDS.hxx> | |
56 | #include <Geom_Curve.hxx> | |
57 | #include <Geom2d_Curve.hxx> | |
58 | #include <Geom_Plane.hxx> | |
59 | #include <gp_Pnt.hxx> | |
60 | #include <gp_Pnt2d.hxx> | |
61 | #include <ElCLib.hxx> | |
62 | #include <ElSLib.hxx> | |
63 | #include <Geom2dAdaptor_Curve.hxx> | |
64 | #include <Precision.hxx> | |
65 | #include <BRepAdaptor_Curve.hxx> | |
66 | #include <TopOpeBRepTool_2d.hxx> | |
67 | #include <TopOpeBRepDS_Dumper.hxx> | |
68 | #include <Standard_ProgramError.hxx> | |
ec357c5c | 69 | #include <TopOpeBRepDS_EdgeVertexInterference.hxx> |
7fd59977 | 70 | |
0797d9d3 | 71 | #ifdef OCCT_DEBUG |
7fd59977 | 72 | Standard_EXPORT Standard_Boolean TopOpeBRepBuild_GetcontextNOSG(); |
73 | #endif | |
74 | ||
75 | #define M_FORWARD(st) (st == TopAbs_FORWARD) | |
76 | #define M_REVERSED(st) (st == TopAbs_REVERSED) | |
77 | #define M_INTERNAL(st) (st == TopAbs_INTERNAL) | |
78 | #define M_EXTERNAL(st) (st == TopAbs_EXTERNAL) | |
79 | ||
1d0a9d4d | 80 | Standard_Boolean TopOpeBRepBuild_FUN_aresamegeom(const TopoDS_Shape& S1,const TopoDS_Shape& S2); |
7fd59977 | 81 | |
82 | ||
83 | //======================================================================= | |
84 | //function : GMergeEdges | |
85 | //purpose : | |
86 | //======================================================================= | |
87 | void TopOpeBRepBuild_Builder::GMergeEdges(const TopTools_ListOfShape& LE1,const TopTools_ListOfShape& LE2,const TopOpeBRepBuild_GTopo& G1) | |
88 | { | |
89 | if ( LE1.IsEmpty() ) return; | |
90 | TopAbs_State TB1,TB2; G1.StatesON(TB1,TB2); | |
91 | ||
92 | const TopoDS_Shape& E1 = LE1.First(); | |
0797d9d3 | 93 | #ifdef OCCT_DEBUG |
7fd59977 | 94 | Standard_Integer iE; Standard_Boolean tSPS1 = GtraceSPS(E1,iE); |
95 | if(tSPS1){ | |
96 | cout<<endl;cout<<"--- GMergeEdges "<<endl; | |
97 | GdumpEDG(E1); | |
98 | GdumpSAMDOM(LE1, (char *) "1 : "); | |
99 | GdumpSAMDOM(LE2, (char *) "2 : "); | |
100 | } | |
101 | #endif | |
102 | ||
103 | myEdgeReference = TopoDS::Edge(E1); | |
104 | TopOpeBRepBuild_PaveSet PVS(E1); | |
105 | ||
106 | GFillEdgesPVS(LE1,LE2,G1,PVS); | |
107 | ||
108 | // Create a edge builder EBU | |
109 | TopoDS_Shape E1F = LE1.First(); E1F.Orientation(TopAbs_FORWARD); | |
110 | TopOpeBRepBuild_PaveClassifier VCL(E1F); | |
111 | Standard_Boolean equalpar = PVS.HasEqualParameters(); | |
112 | if (equalpar) VCL.SetFirstParameter(PVS.EqualParameters()); | |
113 | TopOpeBRepBuild_EdgeBuilder EDBU(PVS,VCL); | |
114 | ||
115 | // Build the new edges LEM | |
116 | TopTools_ListOfShape LEM; | |
117 | GEDBUMakeEdges(E1F,EDBU,LEM); | |
118 | ||
119 | // connect new edges as edges built TB1 on LE1 edges | |
120 | TopTools_ListIteratorOfListOfShape it1; | |
121 | for (it1.Initialize(LE1); it1.More(); it1.Next()) { | |
122 | const TopoDS_Shape& E11 = it1.Value(); | |
123 | ChangeMerged(E11,TB1) = LEM; | |
124 | } | |
125 | ||
126 | // connect new edges as edges built TB2 on LE2 edges | |
127 | TopTools_ListIteratorOfListOfShape it2; | |
128 | for (it2.Initialize(LE2); it2.More(); it2.Next()) { | |
129 | const TopoDS_Shape& E2 = it2.Value(); | |
130 | ChangeMerged(E2,TB2) = LEM; | |
131 | } | |
132 | ||
133 | } // GMergeEdges | |
134 | ||
135 | //======================================================================= | |
136 | //function : GFillEdgesPVS | |
137 | //purpose : | |
138 | //======================================================================= | |
139 | void TopOpeBRepBuild_Builder::GFillEdgesPVS(const TopTools_ListOfShape& LE1,const TopTools_ListOfShape& LE2,const TopOpeBRepBuild_GTopo& G1,TopOpeBRepBuild_PaveSet& PVS) | |
140 | { | |
141 | if ( LE1.IsEmpty() ) return; | |
142 | TopAbs_State TB1,TB2; G1.StatesON(TB1,TB2); | |
143 | ||
144 | const TopoDS_Shape& E1 = LE1.First(); | |
145 | myEdgeReference = TopoDS::Edge(E1); | |
146 | ||
147 | TopTools_ListIteratorOfListOfShape it1; | |
148 | for (it1.Initialize(LE1); it1.More(); it1.Next()) { | |
149 | const TopoDS_Shape& E11 = it1.Value(); | |
150 | Standard_Boolean ismerged = IsMerged(E11,TB1); | |
151 | ||
0797d9d3 | 152 | #ifdef OCCT_DEBUG |
7fd59977 | 153 | Standard_Integer i1; Standard_Boolean tSPS1 = GtraceSPS(E11,i1); |
154 | if(tSPS1){ | |
155 | cout<<endl;cout<<"--- GFillEdgesPVS ";GdumpSHA(E11); | |
156 | cout<<" ismerged : "<<ismerged<<" ";TopAbs::Print(TB1,cout);cout<<endl; | |
157 | } | |
158 | #endif | |
159 | ||
160 | if (!ismerged) GFillEdgePVS(E11,LE2,G1,PVS); | |
161 | } | |
162 | ||
163 | TopOpeBRepBuild_GTopo G2 = G1.CopyPermuted(); | |
164 | ||
165 | TopTools_ListIteratorOfListOfShape it2; | |
166 | for (it2.Initialize(LE2); it2.More(); it2.Next() ) { | |
167 | const TopoDS_Shape& E2 = it2.Value(); | |
168 | Standard_Boolean ismerged = IsMerged(E2,TB2); | |
169 | ||
0797d9d3 | 170 | #ifdef OCCT_DEBUG |
7fd59977 | 171 | Standard_Integer i2; Standard_Boolean tSPS2 = GtraceSPS(E2,i2); |
172 | if(tSPS2){ | |
173 | cout<<endl; | |
174 | cout<<"--- GFillEdgesPVS ";GdumpSHA(E2); | |
175 | cout<<" ismerged : "<<ismerged<<" ";TopAbs::Print(TB2,cout);cout<<endl; | |
176 | } | |
177 | #endif | |
178 | ||
179 | if (!ismerged) GFillEdgePVS(E2,LE1,G2,PVS); | |
180 | } | |
181 | ||
182 | } // GFillEdgesPVS | |
183 | ||
184 | //======================================================================= | |
185 | //function : GFillEdgePVS | |
186 | //purpose : | |
187 | //======================================================================= | |
188 | void TopOpeBRepBuild_Builder::GFillEdgePVS(const TopoDS_Shape& E, | |
189 | const TopTools_ListOfShape& /*LE2*/, | |
190 | const TopOpeBRepBuild_GTopo& G, | |
191 | TopOpeBRepBuild_PaveSet& PVS) | |
192 | { | |
96a95605 | 193 | TopAbs_ShapeEnum t1,t2; |
7fd59977 | 194 | G.Type(t1,t2); |
7fd59977 | 195 | TopAbs_State TB1,TB2; |
196 | G.StatesON(TB1,TB2); | |
197 | ||
198 | // work on a FORWARD edge EF | |
199 | TopoDS_Shape EF = E; | |
200 | EF.Orientation(TopAbs_FORWARD); | |
201 | // Add the point/vertex topology build/found on edge EF in PVS | |
202 | GFillPointTopologyPVS(EF,G,PVS); | |
203 | ||
204 | } // GFillEdgePVS | |
205 | ||
206 | // --- iterer sur EPit jusqu'a la prochaine interference dont la | |
207 | // --- transition est definie sur un shape de type SHA Before et After | |
208 | static Standard_Boolean FUN_MoreSHAINT(TopOpeBRepDS_PointIterator& EPit, | |
209 | const TopAbs_ShapeEnum SHA) | |
210 | { | |
211 | Standard_Boolean more = Standard_False; | |
212 | while (EPit.More()) { | |
213 | const Handle(TopOpeBRepDS_Interference)& I = EPit.Value(); | |
214 | const TopOpeBRepDS_Transition& T = I->Transition(); | |
215 | TopOpeBRepDS_Kind GT,ST; Standard_Integer G,S; FDS_data(I,GT,G,ST,S); | |
216 | TopAbs_ShapeEnum SB,SA; Standard_Integer IB,IA; FDS_Tdata(I,SB,IB,SA,IA); | |
217 | ||
218 | TopAbs_ShapeEnum b = T.ShapeBefore(), a = T.ShapeAfter(); | |
219 | Standard_Boolean rejet = ( (b != SHA) || (a != SHA) ); | |
220 | if ( rejet ) EPit.Next(); | |
221 | else { | |
222 | more = Standard_True; | |
223 | break; | |
224 | } | |
225 | } | |
226 | return more; | |
227 | } | |
228 | ||
229 | // Unused : | |
0797d9d3 | 230 | /*#ifdef OCCT_DEBUG |
7fd59977 | 231 | static Standard_Integer FUN_getTRASHA(const Standard_Integer geti, |
232 | const TopOpeBRepDS_ListOfInterference& lFOR, const Standard_Integer FOR, | |
233 | const TopOpeBRepDS_ListOfInterference& lREV, const Standard_Integer REV, | |
234 | const TopOpeBRepDS_ListOfInterference& lINT, const Standard_Integer INT) | |
235 | { | |
236 | Standard_Integer trasha = 0; | |
237 | if (geti == 1) { // get i before | |
238 | if (REV) trasha = lREV.First()->Transition().Before(); | |
239 | if (INT) trasha = lINT.First()->Transition().Before(); | |
240 | } | |
241 | if (geti == 2) { // get i after | |
242 | if (FOR) trasha = lFOR.Last()->Transition().After(); | |
243 | if (INT) trasha = lINT.Last()->Transition().After(); | |
244 | } | |
245 | return trasha; | |
246 | } | |
247 | #endif*/ | |
248 | ||
0797d9d3 | 249 | #ifdef OCCT_DEBUG |
7fd59977 | 250 | void debfillp(const Standard_Integer i) {cout <<"+ + debfillp "<<i<<endl;} |
251 | void debfillpon(const Standard_Integer i) {cout <<"+ + debfillpon "<<i<<endl;} | |
252 | void debfillpin(const Standard_Integer i) {cout <<"+ + debfillpin "<<i<<endl;} | |
253 | void debfillpou(const Standard_Integer i) {cout <<"+ + debfillpou "<<i<<endl;} | |
254 | void debfillp2(const Standard_Integer i) {cout <<"+ + debfillp2 "<<i<<endl;} | |
255 | #endif | |
256 | ||
257 | //Standard_IMPORT extern Standard_Boolean GLOBAL_faces2d; | |
1d0a9d4d | 258 | extern Standard_Boolean GLOBAL_faces2d; |
7fd59977 | 259 | |
260 | Standard_EXPORT Standard_Boolean FDS_SIisGIofIofSBAofTofI(const TopOpeBRepDS_DataStructure& BDS,const Standard_Integer SI,const Handle(TopOpeBRepDS_Interference)& I); | |
261 | //Standard_IMPORT extern Standard_Boolean GLOBAL_IEtoMERGE; // xpu240498 | |
262 | Standard_IMPORT Standard_Boolean GLOBAL_IEtoMERGE; // xpu240498 | |
263 | //Standard_IMPORT extern Standard_Integer GLOBAL_issp; | |
1d0a9d4d | 264 | extern Standard_Integer GLOBAL_issp; |
7fd59977 | 265 | //Standard_IMPORT extern Standard_Integer GLOBAL_hassd; |
266 | Standard_IMPORT Standard_Integer GLOBAL_hassd; | |
267 | ||
268 | static Standard_Boolean FUN_isonbound(const Handle(TopOpeBRepDS_HDataStructure)& HDS, | |
269 | const Handle(TopOpeBRepDS_Interference)& I) | |
270 | { | |
271 | Standard_Integer G = I->Geometry(); | |
272 | TopOpeBRepDS_Kind KG = I->GeometryType(); | |
273 | Standard_Boolean Gb1 = (KG == TopOpeBRepDS_VERTEX); | |
274 | if (Gb1) { | |
275 | Handle(TopOpeBRepDS_EdgeVertexInterference) EVI= Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast(I); | |
276 | Standard_Boolean vhassd = HDS->HasSameDomain(HDS->DS().Shape(G)); | |
277 | Gb1 = (EVI.IsNull()) ? Standard_False : EVI->GBound(); | |
278 | Gb1 = Gb1 && !vhassd; | |
279 | } | |
280 | return Gb1; | |
281 | } | |
282 | ||
283 | #define TheIN (1) | |
284 | #define TheON (2) | |
285 | #define TheOUT (3) | |
286 | #define HASSD2d (2) | |
287 | #define HASSD3d (3) | |
288 | #define FIRST (1) | |
289 | #define LAST (2) | |
290 | ||
291 | //======================================================================= | |
292 | //function : GFillPointTopologyPVS | |
293 | //purpose : | |
294 | //======================================================================= | |
295 | void TopOpeBRepBuild_Builder::GFillPointTopologyPVS(const TopoDS_Shape& E, | |
296 | const TopOpeBRepBuild_GTopo& G, | |
297 | TopOpeBRepBuild_PaveSet& PVS) | |
298 | { | |
0797d9d3 | 299 | #ifdef OCCT_DEBUG |
7fd59977 | 300 | // TopAbs_State TB1,TB2; |
301 | // G.StatesON(TB1,TB2); | |
302 | // TopOpeBRepDS_Config GConf1 = G.Config1(); | |
303 | // TopOpeBRepDS_Config GConf2 = G.Config2(); | |
304 | #endif | |
305 | TopAbs_ShapeEnum t1,t2,ShapeInterf; | |
306 | G.Type(t1,t2); | |
307 | ShapeInterf = t1; | |
308 | const TopOpeBRepDS_DataStructure& BDS = myDataStructure->DS(); | |
309 | const Standard_Integer iEDS = BDS.Shape(E); | |
0797d9d3 | 310 | #ifdef OCCT_DEBUG |
7fd59977 | 311 | // Standard_Integer rkE = BDS.AncestorRank(E); |
312 | #endif | |
313 | Standard_Boolean isSE = BDS.IsSectionEdge(TopoDS::Edge(E)); | |
314 | Standard_Boolean dgE = BRep_Tool::Degenerated(TopoDS::Edge(E)); | |
315 | Standard_Boolean isEd; | |
316 | ||
317 | isEd = BRep_Tool::Degenerated(TopoDS::Edge(E)); | |
0797d9d3 | 318 | #ifdef OCCT_DEBUG |
7fd59977 | 319 | // Standard_Boolean hsd = myDataStructure->HasSameDomain(E); //xpu170498 |
320 | #endif | |
321 | Standard_Boolean isfafa = BDS.Isfafa(); //xpu120598 | |
322 | ||
0797d9d3 | 323 | #ifdef OCCT_DEBUG |
7fd59977 | 324 | Standard_Boolean tSPSE=GtraceSPS(iEDS); |
325 | TCollection_AsciiString striE=TopOpeBRepDS::SPrint(TopAbs_EDGE,iEDS); | |
326 | const TopoDS_Shape& EPVS=PVS.Edge();Standard_Integer iEPVS;Standard_Boolean tSPSEPVS=GtraceSPS(EPVS,iEPVS); | |
327 | Standard_Boolean tSPS = tSPSE || tSPSEPVS; | |
328 | if(tSPS){ | |
329 | cout<<endl; | |
330 | cout<<"--- GFillPointTopologyPVS : ShapeInterf ";TopAbs::Print(ShapeInterf,cout); | |
331 | cout<<",efil ";GdumpSHA(E);cout<<",eref ";GdumpSHA(myEdgeReference); | |
332 | cout<<",ffil ";GdumpSHA(myFaceToFill);cout<<",fref ";GdumpSHA(myFaceReference); | |
333 | cout<<endl; | |
334 | debfillp(iEDS); | |
335 | } | |
336 | #endif | |
337 | ||
338 | Standard_Boolean isspin=(GLOBAL_issp==TheIN), isspou=(GLOBAL_issp==TheOUT), isspon=(GLOBAL_issp==TheON); | |
339 | if (isSE && (GLOBAL_issp == 0)) return; // splits done in process ProcessSectionEdges | |
340 | ||
0797d9d3 | 341 | #ifdef OCCT_DEBUG |
7fd59977 | 342 | // Standard_Integer iefil = BDS.Shape(E); |
343 | // Standard_Integer iffil = BDS.Shape(myFaceToFill); | |
344 | // Standard_Integer ieref = BDS.Shape(myEdgeReference); | |
345 | // Standard_Integer ifref = BDS.Shape(myFaceReference); | |
346 | if(tSPS) { | |
347 | if (isspon) debfillpon(iEDS); | |
348 | if (isspin) debfillpin(iEDS); | |
349 | if (isspou) debfillpou(iEDS); | |
350 | } | |
351 | #endif | |
352 | ||
353 | // 0. | |
354 | //--- | |
355 | const TopOpeBRepDS_ListOfInterference& lIE = BDS.ShapeInterferences(E); | |
356 | Standard_Boolean scanall = (isspin || isspou || isspon); // xpu161198: BUC60382 //xpu011098: CTS21180(e8on); cto900I7(e12on) | |
357 | ||
358 | // loiSHAINT = interferences avec les 2 proprietes | |
359 | // - fournies par un PointIterator | |
360 | // - dont la transition est definie / shape = ShapeInterf | |
361 | TopOpeBRepDS_ListOfInterference loiSHAINT; | |
362 | if (scanall) FDS_assign(lIE,loiSHAINT); | |
363 | else { | |
364 | TopOpeBRepDS_PointIterator EPit(lIE); | |
365 | EPit.Init(BDS.ShapeInterferences(E)); | |
366 | Standard_Boolean addi = FUN_MoreSHAINT(EPit,ShapeInterf); | |
367 | while (addi) { | |
368 | const Handle(TopOpeBRepDS_Interference)& II = EPit.Value(); | |
369 | loiSHAINT.Append(II); | |
370 | EPit.Next(); | |
371 | addi = FUN_MoreSHAINT(EPit,ShapeInterf); | |
372 | } | |
373 | } | |
374 | ||
375 | TopOpeBRepDS_TKI tki; | |
376 | tki.FillOnGeometry(loiSHAINT); // groupage par geometrie d'interference | |
377 | ||
378 | // - kp1 - | |
379 | // BUC60093 : only 2 G : 1 point && 1 vertex | |
380 | // deleting interfs on G = vertex sdm && closingE | |
381 | TopoDS_Vertex vclo; Standard_Boolean closedE = TopOpeBRepTool_TOOL::ClosedE(TopoDS::Edge(E),vclo); | |
96a95605 | 382 | Standard_Integer kp1 = 0; |
7fd59977 | 383 | if (closedE) { |
384 | tki.Init(); | |
385 | Standard_Integer nG = 0; | |
386 | while (tki.More()) { | |
387 | nG++; | |
388 | TopOpeBRepDS_Kind Kcur;Standard_Integer Gcur; | |
389 | tki.Value(Kcur,Gcur); | |
390 | if (Kcur == TopOpeBRepDS_POINT) {tki.Next();continue;} | |
391 | const TopoDS_Shape& v = BDS.Shape(Gcur); | |
392 | TopoDS_Shape oov; | |
393 | FUN_ds_getoov(v,myDataStructure,oov); | |
394 | Standard_Boolean samev = v.IsSame(vclo), sameoov = oov.IsSame(vclo); | |
96a95605 | 395 | if (samev || sameoov) {kp1 = Gcur;} |
7fd59977 | 396 | tki.Next(); |
397 | } | |
398 | if (nG == 1) kp1 = 0; // we have only one interf on vGclo -> keep the interf | |
399 | } //kp1 | |
400 | ||
401 | // - kp6 - nyiReducing | |
402 | // xpu250998 : cto900M5 (e5,p1) | |
403 | // prequesitory : if we have I3d on Gb0 FORWARD or REVERSED, we do NOT need | |
404 | // interference on Gb1 to determinate split IN/OUT of edge. | |
405 | Standard_Boolean kp6 = (!isSE); | |
406 | if (kp6) { | |
407 | kp6 = Standard_False; | |
408 | TopOpeBRepDS_ListIteratorOfListOfInterference it(loiSHAINT); | |
409 | for (; it.More(); it.Next()){ | |
410 | const Handle(TopOpeBRepDS_Interference)& I = it.Value(); | |
411 | TopOpeBRepDS_Kind ST = I->SupportType(); | |
412 | if (ST != TopOpeBRepDS_FACE) continue; | |
413 | TopAbs_Orientation O = I->Transition().Orientation(TopAbs_IN); | |
414 | Standard_Boolean FORREV = (O == TopAbs_FORWARD) || (O == TopAbs_REVERSED); | |
415 | if (!FORREV) continue; | |
416 | Standard_Boolean Gb1 = ::FUN_isonbound(myDataStructure,I); | |
417 | if (!Gb1) {kp6 = Standard_True; break;} | |
418 | } // it(l3dFOR+l3dREV) | |
419 | } | |
420 | ||
421 | // 1. | |
422 | //--- | |
423 | tki.Init(); | |
424 | while (tki.More()) { | |
425 | ||
426 | // lieu courant : Kcur,Gcur; Interferences : LICur | |
427 | TopOpeBRepDS_Kind Kcur; | |
428 | Standard_Integer Gcur; | |
429 | const TopOpeBRepDS_ListOfInterference& LICur = tki.Value(Kcur,Gcur); | |
430 | Standard_Boolean point = (Kcur == TopOpeBRepDS_POINT); //xpu170498 | |
431 | Standard_Boolean vertex = (Kcur == TopOpeBRepDS_VERTEX);//xpu170498 | |
0797d9d3 | 432 | #ifdef OCCT_DEBUG |
7fd59977 | 433 | // Standard_Integer nLICur = LICur.Extent(); |
434 | Standard_Boolean trcI = Standard_False; | |
435 | if(trcI) {TopOpeBRepDS_Dumper DSD(myDataStructure); TCollection_AsciiString aa("lI"); | |
436 | aa += TCollection_AsciiString(Gcur); DSD.DumpLOI(LICur,cout,aa);} | |
437 | #endif | |
438 | ||
96a95605 DB |
439 | TopoDS_Shape vGsd; |
440 | if (vertex) FUN_ds_getoov(BDS.Shape(Gcur), myDataStructure, vGsd); //xpu221098 | |
7fd59977 | 441 | |
442 | // recall : I3d=(I3dF,I3dFE) : I3dF=(T(F),G,F), I3dFE=(T(F),G,E) | |
443 | // I2d=I2dFE | |
444 | // I1d=(T(E),V,E) | |
445 | ||
446 | if ((Kcur == TopOpeBRepDS_VERTEX) && (kp1 == Gcur)) {tki.Next();continue;} | |
447 | const Handle(TopOpeBRepDS_Interference)& I = LICur.First(); | |
448 | Standard_Real parSE = FDS_Parameter(I); | |
449 | TopOpeBRepDS_ListOfInterference LICurcopy; | |
450 | TopOpeBRepDS_ListOfInterference l3dFcur; FDS_assign(LICur,LICurcopy); Standard_Integer n3d=FUN_selectSKinterference(LICurcopy,TopOpeBRepDS_FACE,l3dFcur); | |
451 | TopOpeBRepDS_ListOfInterference l2dFEcur; FDS_assign(LICur,LICurcopy); Standard_Integer n2d=FUN_ds_hasI2d(iEDS,LICurcopy,l2dFEcur); | |
452 | TopOpeBRepDS_ListOfInterference l1dEcur; FDS_assign(LICur,LICurcopy); | |
453 | FUN_selectTRASHAinterference(LICurcopy,TopAbs_EDGE,l1dEcur); | |
454 | ||
455 | TopAbs_State stb; Standard_Integer isb; Standard_Integer bdim; | |
456 | TopAbs_State sta; Standard_Integer isa; Standard_Integer adim; | |
457 | FUN_ds_GetTr(BDS,iEDS,Gcur,LICur, | |
458 | stb,isb,bdim, | |
459 | sta,isa,adim); | |
460 | if (isSE) { | |
461 | // before | |
462 | Standard_Boolean bIN1d = (stb==TopAbs_IN)&&(bdim==1); | |
463 | Standard_Boolean bIN2d = (stb==TopAbs_IN)&&(bdim==2); | |
464 | Standard_Boolean bIN3d = (stb==TopAbs_IN)&&(bdim==3); | |
465 | ||
466 | Standard_Boolean bOUT2d = (stb==TopAbs_OUT)&&(bdim==2); | |
467 | Standard_Boolean bOUT3d = (stb==TopAbs_OUT)&&(bdim==3); | |
468 | // after | |
469 | Standard_Boolean aIN1d = (sta==TopAbs_IN)&&(adim==1); | |
470 | Standard_Boolean aIN2d = (sta==TopAbs_IN)&&(adim==2); | |
471 | Standard_Boolean aIN3d = (sta==TopAbs_IN)&&(adim==3); | |
472 | ||
473 | Standard_Boolean aOUT2d = (sta==TopAbs_OUT)&&(adim==2); | |
474 | Standard_Boolean aOUT3d = (sta==TopAbs_OUT)&&(adim==3); | |
475 | ||
476 | TopOpeBRepDS_Transition newT; Standard_Boolean INb=Standard_False,INa=Standard_False; | |
477 | if (isfafa) { | |
478 | if (isspon) { | |
479 | if ((stb == TopAbs_OUT)&&(sta == TopAbs_OUT)) {tki.Next(); continue;} | |
480 | INb = bIN1d; | |
481 | INa = aIN1d; | |
482 | newT.Index(isb); newT.ShapeBefore(TopAbs_EDGE); newT.ShapeAfter(TopAbs_EDGE); | |
483 | } else if (isspin) { | |
484 | INb = bIN2d; | |
485 | INa = aIN2d; | |
486 | newT.ShapeBefore(TopAbs_FACE); newT.ShapeAfter(TopAbs_FACE); | |
487 | } else if (isspou) { | |
488 | INb = !bOUT2d; | |
489 | INa = !aOUT2d; | |
490 | newT.ShapeBefore(TopAbs_FACE); newT.ShapeAfter(TopAbs_FACE); | |
491 | } | |
492 | } | |
493 | else { | |
494 | if (isspon) { | |
495 | if ((stb == TopAbs_OUT)&&(sta == TopAbs_OUT)) {tki.Next(); continue;} | |
496 | INb = bIN1d || bIN2d; | |
497 | INa = aIN1d || aIN2d; | |
498 | newT.Index(isb); newT.ShapeBefore(TopAbs_EDGE); newT.ShapeAfter(TopAbs_EDGE); | |
499 | } else if (isspin) { | |
500 | if ((stb == TopAbs_OUT)&&(sta == TopAbs_OUT)) {tki.Next(); continue;} | |
501 | INb = bIN3d; | |
502 | INa = aIN3d; | |
503 | if (INb) newT.Index(isb); | |
504 | else newT.Index(isa); | |
505 | newT.ShapeBefore(TopAbs_FACE); newT.ShapeAfter(TopAbs_FACE); | |
506 | } else if (isspou) { | |
507 | if ((stb == TopAbs_IN)&&(sta == TopAbs_IN)) {tki.Next(); continue;} | |
508 | INb = !bOUT3d; | |
509 | INa = !aOUT3d; | |
510 | if (bOUT3d) newT.Index(isb); | |
511 | else newT.Index(isa); | |
512 | newT.ShapeBefore(TopAbs_FACE); newT.ShapeAfter(TopAbs_FACE); | |
513 | } | |
514 | } | |
515 | TopAbs_State sb = INb ? TopAbs_IN : TopAbs_OUT; | |
516 | TopAbs_State sa = INa ? TopAbs_IN : TopAbs_OUT; | |
517 | newT.StateBefore(sb);newT.StateAfter(sa); | |
518 | Standard_Integer S=0; // dummy | |
519 | Standard_Boolean B = (Kcur == TopOpeBRepDS_POINT) ? Standard_False : (Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast(I)->GBound()); | |
520 | Handle(TopOpeBRepDS_Interference) newI = MakeEPVInterference(newT,S,Gcur,parSE,Kcur,B); | |
521 | ||
522 | TopOpeBRepDS_ListOfInterference li; li.Append(newI); TopOpeBRepDS_PointIterator itCur(li); | |
523 | GFillPointTopologyPVS(E,itCur,G,PVS); | |
0797d9d3 | 524 | #ifdef OCCT_DEBUG |
7fd59977 | 525 | if(tSPS) {newI->Dump(cout,"\nnewinterf ","\n\n"); debfillp2(iEDS);} |
526 | #endif | |
527 | {tki.Next(); continue;} | |
528 | } // isSE | |
529 | ||
530 | // - kp3 - | |
531 | // xpu200598 interference 2d at GPOINT | |
532 | Standard_Boolean kp3 = (n2d > 0) && point; | |
96a95605 | 533 | if (kp3) l2dFEcur.First()->Transition().Orientation(TopAbs_IN); |
7fd59977 | 534 | |
535 | ||
536 | TopOpeBRepDS_PointIterator itCur(LICur); Standard_Integer iICur=0; | |
537 | while ( itCur.More() ) { | |
538 | iICur++; | |
539 | const Handle(TopOpeBRepDS_Interference)& I1=itCur.Value(); | |
540 | const TopOpeBRepDS_Transition& T1=I1->Transition(); | |
541 | T1.Orientation(TopAbs_IN); | |
542 | TopAbs_ShapeEnum SB1,SA1;Standard_Integer IB1,IA1;TopOpeBRepDS_Kind GT1,ST1;Standard_Integer G1,S1; | |
543 | FDS_Idata(I1,SB1,IB1,SA1,IA1,GT1,G1,ST1,S1); | |
544 | ||
0797d9d3 | 545 | #ifdef OCCT_DEBUG |
7fd59977 | 546 | if(tSPS) {I1->Dump(cout,"\n? keepinterf ","\n\n"); debfillp2(iEDS);} |
547 | #endif | |
548 | ||
549 | Standard_Boolean keepinterf1 = Standard_False; | |
550 | if (isEd) { | |
551 | keepinterf1 = Standard_True; | |
552 | } | |
553 | else { | |
554 | if (GLOBAL_faces2d) { // split 2d | |
555 | Standard_Boolean has2d3d = (n2d >0 && n3d >0); // JYL300998 | |
556 | // JYL300998 : traitement correct de cto 100 K1 e27 (chanceux auparavant, schema d'I faux) | |
557 | // e27 n'est PAS arete de section mais doit etre traitee comme telle. | |
558 | // e27 possede des I de nature 2d et 3d en V8 | |
559 | // on privilegie l'info 3d | |
560 | if (has2d3d && !isSE) { | |
0797d9d3 | 561 | #ifdef OCCT_DEBUG |
7fd59977 | 562 | const Handle(TopOpeBRepDS_Interference)& i2d = |
563 | #endif | |
564 | l2dFEcur.First(); | |
565 | const Handle(TopOpeBRepDS_Interference)& i3d = l3dFcur.First(); | |
566 | Standard_Boolean id3d = (I1 == i3d); | |
7fd59977 | 567 | keepinterf1 = id3d; |
0797d9d3 | 568 | #ifdef OCCT_DEBUG |
569 | Standard_Boolean id2d = (I1 == i2d); | |
7fd59977 | 570 | if (tSPS) { |
571 | cout<<"DEB : GFillPointTopologyPVS E"<<iEDS<<" has2d3d"<<endl; | |
572 | i2d->Dump(cout,"2d : ","\n"); | |
573 | i3d->Dump(cout,"3d : ","\n"); | |
574 | I1->Dump (cout,"I1 : ","\n"); | |
575 | if (id3d) cout<<"--> Interference 3d "; | |
576 | if (id2d) cout<<"--> Interference 2d "; | |
577 | if (keepinterf1) cout<<" traitee"<<endl; | |
578 | else cout<<" non traitee"<<endl; | |
579 | cout<<endl; | |
580 | } | |
581 | #endif | |
582 | } | |
583 | else { | |
584 | keepinterf1 = Standard_True; // PRO13075 tspIN(e17) | |
585 | } | |
586 | } // split 2d | |
587 | else { // split 3d | |
588 | keepinterf1 = (ST1 == TopOpeBRepDS_FACE); // (iICur == 1); | |
589 | } | |
590 | } | |
591 | if ( keepinterf1 ) { | |
592 | if (kp6) { | |
593 | Standard_Boolean Gb1 = ::FUN_isonbound(myDataStructure,I1); | |
594 | if (!Gb1) GFillPointTopologyPVS(E,itCur,G,PVS); | |
595 | } | |
596 | else { | |
597 | GFillPointTopologyPVS(E,itCur,G,PVS); | |
598 | } | |
599 | if (!dgE) break; // xpu140498 | |
600 | } // keepinterf1 | |
601 | itCur.Next(); | |
602 | } // itCur.More | |
603 | ||
604 | tki.Next(); | |
605 | } // tki.More() | |
606 | } | |
607 | ||
608 | //======================================================================= | |
609 | //function : GFillPointTopologyPVS | |
610 | //purpose : | |
611 | //======================================================================= | |
612 | void TopOpeBRepBuild_Builder::GFillPointTopologyPVS(const TopoDS_Shape& E, | |
613 | const TopOpeBRepDS_PointIterator& EPit, | |
614 | const TopOpeBRepBuild_GTopo& G1, | |
615 | TopOpeBRepBuild_PaveSet& PVS) const | |
616 | { | |
617 | const TopoDS_Shape& EPVS = PVS.Edge(); | |
618 | ||
619 | //modified by NIZHNY-MZV Mon Feb 21 14:47:34 2000 | |
620 | const Handle(TopOpeBRepDS_Interference)& I1=EPit.Value(); | |
621 | TopOpeBRepDS_Kind ST1 = I1->SupportType(); | |
622 | ||
0797d9d3 | 623 | #ifdef OCCT_DEBUG |
7fd59977 | 624 | Standard_Integer iE; Standard_Boolean tSPSE = GtraceSPS(E,iE); |
625 | Standard_Integer iEPVS; Standard_Boolean tSPSEPVS = GtraceSPS(EPVS,iEPVS); | |
626 | Standard_Boolean tSPS = tSPSE || tSPSEPVS; | |
627 | if ( tSPS ) debfillp(iE); | |
628 | #endif | |
629 | ||
630 | TopAbs_State TB1,TB2; | |
631 | G1.StatesON(TB1,TB2); | |
632 | TopOpeBRepDS_Config Conf = G1.Config1(); | |
633 | TopAbs_State TB = TB1; | |
634 | ||
635 | // iG = index of new point or existing vertex | |
636 | Standard_Integer iG = EPit.Current(); | |
637 | Standard_Boolean ispoint = EPit.IsPoint(); | |
638 | TopoDS_Vertex VIG; // NYI pointer | |
639 | if (ispoint) VIG = TopoDS::Vertex(NewVertex(iG)); | |
640 | else VIG = TopoDS::Vertex(myDataStructure->Shape(iG)); | |
641 | ||
642 | if (VIG.IsNull()) return; //PMN 17/02/99 Nothing to add. | |
643 | ||
644 | Standard_Boolean hasVSD = Standard_False; | |
645 | Standard_Integer iVRE = 0; TopoDS_Shape VRE; // NYI pointer | |
646 | if (!ispoint) { | |
647 | hasVSD = myDataStructure->HasSameDomain(VIG); | |
648 | if (hasVSD) { // on prend VRE = vertex reference de VIG | |
649 | iVRE = myDataStructure->SameDomainReference(VIG); | |
650 | VRE = TopoDS::Vertex(myDataStructure->Shape(iVRE)); | |
651 | } | |
652 | } | |
653 | ||
654 | TopoDS_Vertex VPV; // NYI pointer on VRE or VIG | |
655 | if (hasVSD) VPV = TopoDS::Vertex(VRE); | |
656 | else VPV = VIG; | |
657 | // else VPV = TopoDS::Vertex(VIG); | |
658 | ||
659 | Standard_Real par = EPit.Parameter(); | |
660 | TopAbs_Orientation ori = EPit.Orientation(TB); | |
661 | ||
0797d9d3 | 662 | #ifdef OCCT_DEBUG |
7fd59977 | 663 | if ( tSPS ) debfillp(iE); |
664 | #endif | |
665 | ||
666 | Standard_Boolean samegeom = ::TopOpeBRepBuild_FUN_aresamegeom(E,EPVS); | |
667 | if (Conf == TopOpeBRepDS_DIFFORIENTED) ori = TopAbs::Complement(ori); | |
0797d9d3 | 668 | #ifdef OCCT_DEBUG |
7fd59977 | 669 | if (!TopOpeBRepBuild_GetcontextNOSG()) { |
670 | #endif | |
671 | if (!samegeom) ori = TopAbs::Complement(ori); | |
0797d9d3 | 672 | #ifdef OCCT_DEBUG |
7fd59977 | 673 | } |
674 | #endif | |
675 | ||
676 | ||
677 | Standard_Boolean lesmemes = E.IsEqual(myEdgeReference); | |
678 | if ( !lesmemes ) { | |
679 | Standard_Real parref = par; | |
680 | const TopoDS_Edge& EE = TopoDS::Edge(E); | |
681 | GParamOnReference(VPV,EE,parref); | |
0797d9d3 | 682 | #ifdef OCCT_DEBUG |
7fd59977 | 683 | if(tSPS){ |
684 | cout<<"par "<<par<<" / ";GdumpSHA(E);cout<<" --> parref "<<parref<<" / ";GdumpSHA(EPVS); | |
685 | cout<<endl; | |
686 | } | |
687 | #endif | |
688 | par = parref; | |
689 | } | |
690 | ||
691 | Standard_Boolean kpbound = Standard_False; | |
692 | { | |
693 | TopoDS_Vertex vclo; Standard_Boolean Eclosed = TopOpeBRepTool_TOOL::ClosedE(myEdgeReference,vclo); | |
0797d9d3 | 694 | #ifdef OCCT_DEBUG |
7fd59977 | 695 | // Standard_Integer ivclo = myDataStructure->Shape(vclo); |
696 | #endif | |
697 | TopAbs_Orientation oriI = EPit.Orientation(TopAbs_IN); | |
698 | // kpbound = lesmemes && Eclosed && hasVSD && (ori == TopAbs_INTERNAL) && (TB == TopAbs_OUT); -xpu140898 | |
699 | // xpu110398 cto 009 L2 : e6ou en v11 | |
700 | // xpu140898 USA60111 : e9ou (!=0) + e7ou(=0) | |
701 | Standard_Boolean INTEXT = (oriI == TopAbs_INTERNAL) && (TB == TopAbs_IN); | |
0ebaa4db | 702 | INTEXT = INTEXT || ((oriI == TopAbs_EXTERNAL) && (TB == TopAbs_OUT)); |
7fd59977 | 703 | kpbound = lesmemes && Eclosed && INTEXT; |
704 | if ( kpbound ) { | |
705 | kpbound = vclo.IsSame(VIG); | |
706 | if (!kpbound) { | |
707 | TopoDS_Shape VSD; Standard_Boolean ok = FUN_ds_getoov(VIG,myDataStructure->DS(),VSD); | |
708 | if (ok) kpbound = vclo.IsSame(VSD); | |
709 | } | |
710 | } | |
711 | } | |
712 | ||
713 | if (!kpbound) { | |
714 | VPV.Orientation(ori); | |
715 | Standard_Boolean vofe = Standard_False; | |
716 | Handle(TopOpeBRepBuild_Pave) PV = new TopOpeBRepBuild_Pave(VPV,par,vofe); | |
717 | if (hasVSD) { | |
718 | PV->HasSameDomain(Standard_True); | |
719 | const TopoDS_Shape& VSD = myDataStructure->SameDomain(VPV).Value(); | |
720 | Standard_Integer iVSD = myDataStructure->Shape(VSD); | |
721 | if (iVSD == iVRE) PV->SameDomain(VIG); | |
722 | else PV->SameDomain(VSD); | |
723 | } | |
724 | //modified by NIZHNY-MZV Mon Feb 21 14:48:37 2000 | |
725 | PV -> InterferenceType() = ST1; | |
726 | PVS.Append(PV); | |
727 | ||
728 | ||
0797d9d3 | 729 | #ifdef OCCT_DEBUG |
7fd59977 | 730 | gp_Pnt P = BRep_Tool::Pnt(VPV); |
731 | if(tSPS){cout<<"+";if(ispoint)cout<<" PDS ";else cout<<" VDS ";} | |
732 | if(tSPS){cout<<iG<<" : ";GdumpORIPARPNT(ori,par,P);cout<<endl;} | |
733 | if(tSPS) { | |
734 | // Standard_Boolean trc = Standard_False; | |
735 | #ifdef DRAW | |
736 | if (trc) { | |
737 | FUN_draw2d(par,TopoDS::Edge(E),myEdgeReference,myFaceReference); | |
738 | FUN_draw(VPV); FUN_draw(E); FUN_draw(myFaceReference); | |
739 | } | |
740 | #endif | |
741 | } | |
742 | #endif | |
743 | } | |
744 | else { | |
745 | Standard_Real parf,parl; FUN_tool_bounds(myEdgeReference,parf,parl); | |
746 | TopAbs_Orientation ovpv; | |
747 | ovpv = TopAbs_FORWARD; | |
748 | VPV.Orientation(ovpv); | |
749 | Standard_Boolean vfofe = Standard_False; | |
750 | Handle(TopOpeBRepBuild_Pave) PVF = new TopOpeBRepBuild_Pave(VPV,parf,vfofe); | |
751 | if (hasVSD) { | |
752 | PVF->HasSameDomain(Standard_True); | |
753 | const TopoDS_Shape& VSD = myDataStructure->SameDomain(VPV).Value(); | |
754 | Standard_Integer iVSD = myDataStructure->Shape(VSD); | |
755 | if (iVSD == iVRE) PVF->SameDomain(VIG); | |
756 | else PVF->SameDomain(VSD); | |
757 | } | |
758 | //modified by NIZHNY-MZV Mon Feb 21 14:48:37 2000 | |
759 | PVF -> InterferenceType() = ST1; | |
760 | PVS.Append(PVF); | |
761 | ||
0797d9d3 | 762 | #ifdef OCCT_DEBUG |
7fd59977 | 763 | gp_Pnt PF = BRep_Tool::Pnt(VPV); |
764 | if(tSPS){cout<<"+";if(ispoint)cout<<" PDS ";else cout<<" VDS ";} | |
765 | if(tSPS){cout<<iG<<" : ";GdumpORIPARPNT(ovpv,parf,PF);cout<<endl;} | |
766 | #endif | |
767 | ||
768 | ovpv = TopAbs_REVERSED; | |
769 | VPV.Orientation(ovpv); | |
770 | Standard_Boolean vrofe = Standard_False; | |
771 | Handle(TopOpeBRepBuild_Pave) PVR = new TopOpeBRepBuild_Pave(VPV,parl,vrofe); | |
772 | if (hasVSD) { | |
773 | PVR->HasSameDomain(Standard_True); | |
774 | const TopoDS_Shape& VSD = myDataStructure->SameDomain(VPV).Value(); | |
775 | Standard_Integer iVSD = myDataStructure->Shape(VSD); | |
776 | if (iVSD == iVRE) PVR->SameDomain(VIG); | |
777 | else PVR->SameDomain(VSD); | |
778 | } | |
779 | //modified by NIZHNY-MZV Mon Feb 21 14:48:37 2000 | |
780 | PVR -> InterferenceType() = ST1; | |
781 | PVS.Append(PVR); | |
0797d9d3 | 782 | #ifdef OCCT_DEBUG |
7fd59977 | 783 | gp_Pnt PR = BRep_Tool::Pnt(VPV); |
784 | if(tSPS){cout<<"+";if(ispoint)cout<<" PDS ";else cout<<" VDS ";} | |
785 | if(tSPS){cout<<iG<<" : ";GdumpORIPARPNT(ovpv,parl,PR);cout<<endl;} | |
786 | #endif | |
787 | ||
788 | PVS.RemovePV(Standard_False); // jyl + 980217 | |
789 | } | |
790 | ||
791 | } | |
792 | ||
793 | ||
794 | //======================================================================= | |
795 | //function : GParamOnReference | |
796 | //purpose : calcul du parametre de V sur myEdgeReference de myFaceReference | |
797 | // V est sur la surface de myFaceReference, | |
798 | // V est un vertex de E | |
799 | // E est une arete samedomain de myEdgeReference | |
800 | // retourne true si ok | |
801 | //======================================================================= | |
802 | Standard_Boolean TopOpeBRepBuild_Builder::GParamOnReference(const TopoDS_Vertex& V, | |
803 | const TopoDS_Edge& /*E*/, | |
804 | Standard_Real& P) const | |
805 | { | |
806 | Handle(Geom_Surface) su = BRep_Tool::Surface(myFaceReference); | |
807 | Handle(Geom_Plane) suplan = Handle(Geom_Plane)::DownCast(su); | |
808 | if ( suplan.IsNull() ) { | |
0797d9d3 | 809 | #ifdef OCCT_DEBUG |
7fd59977 | 810 | cout<<"NYI : GParamOnReference : not planar"<<endl; |
811 | #endif | |
812 | return Standard_False; | |
813 | } | |
814 | ||
815 | gp_Pln pln = suplan->Pln(); gp_Pnt p3 = BRep_Tool::Pnt(V); | |
816 | Standard_Real u,v; ElSLib::Parameters(pln,p3,u,v); gp_Pnt2d p2(u,v); | |
817 | Standard_Real f,l,tolpc; Handle(Geom2d_Curve) C2D; | |
818 | C2D = FC2D_CurveOnSurface(myEdgeReference,myFaceReference,f,l,tolpc); | |
819 | if (C2D.IsNull()) Standard_ProgramError::Raise("TopOpeBRepBuild_Builder::GParamOnReference"); | |
820 | ||
821 | // Standard_Real U; | |
822 | Geom2dAdaptor_Curve AC(C2D); | |
823 | switch ( AC.GetType() ) { | |
824 | case GeomAbs_Line: | |
825 | P = ElCLib::Parameter(AC.Line(),p2); break; | |
826 | case GeomAbs_Circle: | |
827 | P = ElCLib::Parameter(AC.Circle(),p2); break; | |
828 | case GeomAbs_Ellipse: | |
829 | P = ElCLib::Parameter(AC.Ellipse(),p2); break; | |
830 | case GeomAbs_Hyperbola: | |
831 | P = ElCLib::Parameter(AC.Hyperbola(),p2); break; | |
832 | case GeomAbs_Parabola: | |
833 | P = ElCLib::Parameter(AC.Parabola(),p2); break; | |
834 | default : | |
0797d9d3 | 835 | #ifdef OCCT_DEBUG |
7fd59977 | 836 | cout<<"NYI : GParamOnReference : OtherCurve on planar surface"<<endl; |
837 | #endif | |
838 | return Standard_False; | |
839 | } | |
840 | ||
841 | return Standard_True; | |
842 | } |