0028574: Get rid of the TestTopOpe* packages
[occt.git] / src / TopOpeBRepBuild / TopOpeBRepBuild_WireEdgeSet.cxx
CommitLineData
b311480e 1// Created on: 1993-06-17
2// Created by: Jean Yves LEBEY
3// Copyright (c) 1993-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
17#ifdef DRAW
18#include <DBRep.hxx>
7fd59977 19static TCollection_AsciiString PRODINS("dins ");
7868210d 20
21static void OrientationToString(const TopAbs_Orientation o, TCollection_AsciiString& N)
22{
23 switch (o) {
24 case TopAbs_FORWARD : N = "FORWARD" ; break;
25 case TopAbs_REVERSED : N = "REVERSED"; break;
26 case TopAbs_INTERNAL : N = "INTERNAL"; break;
27 case TopAbs_EXTERNAL : N = "EXTERNAL"; break;
28 }
29}
30
7fd59977 31#endif
32
42cf5bc1 33
7fd59977 34#include <BRep_Tool.hxx>
42cf5bc1 35#include <BRepAdaptor_Curve.hxx>
36#include <BRepAdaptor_Surface.hxx>
7fd59977 37#include <Geom2d_Curve.hxx>
38#include <Geom2d_Line.hxx>
7fd59977 39#include <Geom_Curve.hxx>
40#include <Geom_Surface.hxx>
7fd59977 41#include <GeomAbs_CurveType.hxx>
42cf5bc1 42#include <GeomAbs_SurfaceType.hxx>
43#include <GeomAPI_ProjectPointOnSurf.hxx>
44#include <gp_Dir2d.hxx>
45#include <gp_Pnt2d.hxx>
46#include <gp_Vec.hxx>
47#include <gp_Vec2d.hxx>
48#include <Precision.hxx>
49#include <Standard_ProgramError.hxx>
50#include <TCollection_AsciiString.hxx>
51#include <TopAbs.hxx>
52#include <TopoDS.hxx>
53#include <TopoDS_Edge.hxx>
54#include <TopoDS_Face.hxx>
55#include <TopoDS_Shape.hxx>
7fd59977 56#include <TopOpeBRepBuild_define.hxx>
42cf5bc1 57#include <TopOpeBRepBuild_WireEdgeSet.hxx>
7fd59977 58#include <TopOpeBRepTool_2d.hxx>
42cf5bc1 59#include <TopOpeBRepTool_CurveTool.hxx>
7fd59977 60
0797d9d3 61#ifdef OCCT_DEBUG
1d0a9d4d 62extern Standard_Boolean TopOpeBRep_GettraceSHA(const Standard_Integer i);
63extern Standard_Boolean TopOpeBRepBuild_GettraceSS();
64extern Standard_Boolean TopOpeBRepBuild_GetcontextSSCONNEX();
65extern Standard_Boolean TopOpeBRepBuild_GettraceCHK();
66TopOpeBRepBuild_Builder* LOCAL_PBUILDER_DEB = NULL;
7fd59977 67void debwesclo(const Standard_Integer) {}
68#endif
69
70//=======================================================================
71//function : TopOpeBRepBuild_WireEdgeSet
72//purpose :
73//=======================================================================
74TopOpeBRepBuild_WireEdgeSet::TopOpeBRepBuild_WireEdgeSet(const TopoDS_Shape& F,
75 const Standard_Address /*A*/) :
76TopOpeBRepBuild_ShapeSet(TopAbs_VERTEX)
77{
78 myFace = TopoDS::Face(F);
79
80#ifdef DRAW
81 myDEBName = "WES";
82 LOCAL_PBUILDER_DEB = (TopOpeBRepBuild_Builder*)((void*)A);
83 if (LOCAL_PBUILDER_DEB != NULL) {
84 myDEBNumber = LOCAL_PBUILDER_DEB->GdumpSHASETindex();
85 Standard_Integer iF; Standard_Boolean tSPS = LOCAL_PBUILDER_DEB->GtraceSPS(F,iF);
86 if(tSPS){DumpName(cout,"creation ");cout<<" on ";}
87 if(tSPS){LOCAL_PBUILDER_DEB->GdumpSHA(F,NULL);cout<<endl;}
88 }
89 if (TopOpeBRepBuild_GettraceCHK() && !myCheckShape) {
90 DumpName(cout,"no checkshape in creation of ");cout<<endl;
91 }
92#endif
93}
94
95//=======================================================================
96//function : AddShape
97//purpose :
98//=======================================================================
99void TopOpeBRepBuild_WireEdgeSet::AddShape(const TopoDS_Shape& S)
100{
101 Standard_Boolean tocheck = Standard_True;
102 Standard_Boolean iswire = ( S.ShapeType() == TopAbs_WIRE );
103 if ( iswire ) {
104 BRepAdaptor_Surface bas(myFace,Standard_False);
105 Standard_Boolean uc = bas.IsUClosed();
106 Standard_Boolean vc = bas.IsVClosed();
107 if ( uc || vc ) tocheck = Standard_False;
108 }
109 Standard_Boolean chk = Standard_True;
110 if ( tocheck ) chk = CheckShape(S);
111
112#ifdef DRAW
113 if (TopOpeBRepBuild_GettraceCHK() && CheckShape()) {
114 if (!tocheck) DumpCheck(cout," AddShape WIRE on closed face",S,chk);
115 else DumpCheck(cout," AddShape redefined",S,chk);
116 }
117#endif
118
119 if (!chk) return;
120 ProcessAddShape(S);
121}
122
123//=======================================================================
124//function : AddStartElement
125//purpose :
126//=======================================================================
127void TopOpeBRepBuild_WireEdgeSet::AddStartElement(const TopoDS_Shape& S)
128{
0797d9d3 129#ifdef OCCT_DEBUG
7fd59977 130
131#endif
132 Standard_Boolean tocheck = Standard_True;
133 Standard_Boolean isedge = ( S.ShapeType() == TopAbs_EDGE );
134 if ( isedge ) {
135 BRepAdaptor_Curve cac(TopoDS::Edge(S));
136 GeomAbs_CurveType t = cac.GetType();
137 Standard_Boolean b = (t==GeomAbs_BSplineCurve || t==GeomAbs_BezierCurve);
138 tocheck = !b;
139 }
140 Standard_Boolean chk = Standard_True;
141 if ( tocheck ) chk = CheckShape(S);
142
143 if (!chk) return;
144 ProcessAddStartElement(S);
145}
146
147//=======================================================================
148//function : AddElement
149//purpose :
150//=======================================================================
151void TopOpeBRepBuild_WireEdgeSet::AddElement(const TopoDS_Shape& S)
152{
153 TopOpeBRepBuild_ShapeSet::AddElement(S);
154}
155
156//=======================================================================
157//function : Face
158//purpose :
159//=======================================================================
160const TopoDS_Face& TopOpeBRepBuild_WireEdgeSet::Face() const
161{
162 return myFace;
163}
164
165//=======================================================================
166//function : InitNeighbours
167//purpose :
168//=======================================================================
169void TopOpeBRepBuild_WireEdgeSet::InitNeighbours(const TopoDS_Shape& E)
170{
171
172#ifdef DRAW
173 Standard_Boolean traceSS = TopOpeBRepBuild_GettraceSS();
174 Standard_Integer ista=myOMSS.FindIndex(E);Standard_Boolean tsh=(ista)?TopOpeBRep_GettraceSHA(ista) : Standard_False;
175
176 if (traceSS || tsh) {
177 TCollection_AsciiString str("#**** InitNeighbours");
178 if (tsh) str = str + " on WES edge " + SNameori(E);
179 str = str + " #****";
180 cout<<endl<<str<<endl;
181 if (tsh) debwesclo(ista);
182 }
183#endif
184
185 mySubShapeExplorer.Init(E,mySubShapeType);
186 myCurrentShape = E;
187 FindNeighbours();
188}
189
190
191//=======================================================================
192//function : FindNeighbours
193//purpose :
194//=======================================================================
195void TopOpeBRepBuild_WireEdgeSet::FindNeighbours()
196{
197 while (mySubShapeExplorer.More()) {
198
199 // l = list of edges neighbour of edge myCurrentShape trough
200 // the vertex mySubShapeExplorer.Current(), which is a vertex of the
201 // edge myCurrentShape.
202 const TopoDS_Shape& V = mySubShapeExplorer.Current();
203 const TopTools_ListOfShape & l = MakeNeighboursList(myCurrentShape,V);
204
205 // myIncidentShapesIter iterates on the neighbour edges of the edge
206 // given as InitNeighbours() argument (this edge has been stored
207 // in the field myCurrentShape).
208
209 myIncidentShapesIter.Initialize(l);
210 if (myIncidentShapesIter.More()) break;
211 else mySubShapeExplorer.Next();
212 }
213}
214
215
216//=======================================================================
217//function : MakeNeighboursList
218//purpose : recherche des edges connexes a Earg par Varg
219//=======================================================================
220const TopTools_ListOfShape & TopOpeBRepBuild_WireEdgeSet::MakeNeighboursList(const TopoDS_Shape& Earg, const TopoDS_Shape& Varg)
221{
222 const TopoDS_Edge& E = TopoDS::Edge(Earg);
223 const TopoDS_Vertex& V = TopoDS::Vertex(Varg);
224 const TopTools_ListOfShape& l = mySubShapeMap.FindFromKey(V);
225
226 Standard_Integer nclosing = NbClosingShapes(l);
227
228#ifdef DRAW
229 Standard_Boolean traceSS = TopOpeBRepBuild_GettraceSS();
230 if ( traceSS ) {
231 TCollection_AsciiString svel = SNameVEL(V,E,l);
232 cout<<PRODINS<<svel<<"; #---- WES MNL"<<endl;
233 }
234#endif
235
236 if (nclosing) {
237 // build myCurrentShapeNeighbours =
238 // edge list made of connected shapes to Earg through Varg
239
240 myCurrentShapeNeighbours.Clear();
241
242 Standard_Integer iapp = 0;
243 for (TopTools_ListIteratorOfListOfShape it(l); it.More(); it.Next()) {
244 iapp++;
245 const TopoDS_Shape& curn = it.Value(); // current neighbour
246 Standard_Boolean k = VertexConnectsEdgesClosing(V,E,curn);
247 if (k) {
248 myCurrentShapeNeighbours.Append(curn);
249
250#ifdef DRAW
251 if ( traceSS ) {
252 Standard_Integer rang = myCurrentShapeNeighbours.Extent();
253 const TopoDS_Edge& EE = TopoDS::Edge(curn);
254 cout <<"+ EE "<<iapp<<" , rang "<<rang<<" ";
255 TCollection_AsciiString svee=SNameVEE(V,E,EE);cout<<svee<<endl;
256 }
257#endif
258 }
259 }
260
261 Standard_Integer newn = NbClosingShapes(myCurrentShapeNeighbours);
262#ifdef DRAW
263 if ( traceSS ) {
264 cout<<"#~~~~connexes apres VertexConnectsEdgesClosing : ";
265 TCollection_AsciiString svel=SNameVEL(V,E,myCurrentShapeNeighbours);
266 cout<<svel<<endl;
267 }
268#endif
269
270 if (newn >= 2 ) {
271
272 const TopoDS_Face& F = myFace;
273
274 // plusieurs aretes de couture connexes a E par V et telles que :
275 // orientation de V dans E # orientation de V dans ces aretes.
276 // on ne garde,parmi les aretes de couture connexes,
277 // que l'arete A qui verifie tg(E) ^ tg(A) > 0
278
279 gp_Vec2d d1E; gp_Pnt2d pE;
280 Standard_Real parE = BRep_Tool::Parameter(V,E);
281 Standard_Real fiE,laE,tolpc;
282 Standard_Boolean trim3d = Standard_True;
283 Handle(Geom2d_Curve) PCE = FC2D_CurveOnSurface(E,F,fiE,laE,tolpc,trim3d);
284
285 if (!PCE.IsNull()) PCE->D1(parE,pE,d1E);
286 else LocalD1(F,E,V,pE,d1E);
287
288 TopAbs_Orientation Eori = E.Orientation();
289 if (Eori == TopAbs_REVERSED) d1E.Reverse();
290
291 TopTools_ListIteratorOfListOfShape lclo(myCurrentShapeNeighbours);
292 Standard_Integer rang = 0;
293 while (lclo.More()) {
294 rang++;
295
296 if ( ! IsClosed(lclo.Value()) ) {
297 lclo.Next();
298 continue;
299 }
300
301 const TopoDS_Edge& EE = TopoDS::Edge(lclo.Value());
302 gp_Vec2d d1EE; gp_Pnt2d pEE;
303 Standard_Real parEE = BRep_Tool::Parameter(V,EE);
304 Standard_Real fiEE,laEE,tolpc1;
305 Handle(Geom2d_Curve) PCEE = FC2D_CurveOnSurface(EE,F,fiEE,laEE,tolpc1,trim3d);
306
307 if (!PCEE.IsNull()) PCEE->D1(parEE,pEE,d1EE);
308 else LocalD1(F,EE,V,pEE,d1EE);
309
310 TopAbs_Orientation EEori = EE.Orientation();
311 if (EEori == TopAbs_REVERSED) d1EE.Reverse();
312
313 Standard_Real cross = d1E.Crossed(d1EE);
314 TopAbs_Orientation oVE,oVEE;
315 VertexConnectsEdges(V,E,EE,oVE,oVEE);
316
317 Standard_Boolean t2 = ( (cross > 0) && oVE == TopAbs_REVERSED ) ||
318 ( (cross < 0) && oVE == TopAbs_FORWARD );
319
320#ifdef DRAW
321 if ( traceSS ) {
322 cout<<"#-------- rang "<<rang<<endl;
323 TCollection_AsciiString svee=SNameVEE(V,E,EE);cout<<svee<<endl;
324
325 cout<<" fiE,laE : "<<fiE<<" "<<laE<<endl;
326 cout<<" parE "<<parE<<endl;
327 cout<<" puE,pvE "<<pE.X()<<" "<<pE.Y();
328 cout<<" d1uE,d1vE "<<d1E.X()<<" "<<d1E.Y()<<endl;
329 cout<<endl;
330 cout<<" fiEE,laEE : "<<fiEE<<" "<<laEE<<endl;
331 cout<<" parEE "<<parEE<<endl;
332 cout<<" puEE,pvEE "<<pEE.X()<<" "<<pEE.Y();
333 cout<<" d1uEE,d1vEE "<<d1EE.X()<<" "<<d1EE.Y()<<endl;
586db386 334 cout<<" --> cross "<<cross<<endl;
7fd59977 335
336 if ( t2 ) cout<<" t2 --> on garde EE"<<endl<<endl;
337 else cout<<" t2 --> on vire EE"<<endl<<endl;
338 }
339#endif
340
341 if ( t2 ) { //-- t1
342 // c'est la bonne IsClosed,on ne garde qu'elle parmi les IsClosed
343 lclo.Next();
344 }
345 else {
346 // on vire l'arete IsClosed
347 myCurrentShapeNeighbours.Remove(lclo);
348 }
349 }
350
351#ifdef DRAW
352 if ( traceSS ) {
353 cout<<"#~~~~connexes apres filtre geom : ";
354 TCollection_AsciiString svel=SNameVEL(Varg,Earg,myCurrentShapeNeighbours);cout<<svel<<endl;
355 }
356#endif
357
358 }
359 return myCurrentShapeNeighbours;
360 }
361 else {
362 return l;
363 }
364
365} // MakeNeighoursList
366
7fd59977 367//=======================================================================
368//function : VertexConnectsEdges
369//purpose :
370//=======================================================================
371Standard_Boolean TopOpeBRepBuild_WireEdgeSet::VertexConnectsEdges(const TopoDS_Shape& V,const TopoDS_Shape& E1,const TopoDS_Shape& E2,TopAbs_Orientation& o1,TopAbs_Orientation& o2) const
372{
373 TopOpeBRepTool_ShapeExplorer ex1,ex2;
374 for(ex1.Init(E1,TopAbs_VERTEX);ex1.More();ex1.Next()) {
375 if (V.IsSame(ex1.Current())) {
376 for(ex2.Init(E2,TopAbs_VERTEX);ex2.More();ex2.Next()) {
377 if (V.IsSame(ex2.Current())) {
378 o1 = ex1.Current().Orientation();
379 o2 = ex2.Current().Orientation();
380 if ( o1 != o2 ) return Standard_True;
381 }
382 }
383 }
384 }
385 return Standard_False;
386}
387
388
389//=======================================================================
390//function : VertexConnectEdgesClosing
391//purpose :
392//=======================================================================
393Standard_Boolean TopOpeBRepBuild_WireEdgeSet::VertexConnectsEdgesClosing(const TopoDS_Shape& V, const TopoDS_Shape& E1, const TopoDS_Shape& E2) const
394{
395
396//-----------------------------------------------------------------------
397//Standard_Boolean VertexConnectsEdgesClosing :
398// Let S the set of incident edges on vertex V.
399// S contains at least one closed edge on the periodic face to build.
400// (the face implied in closing test of edge is myFace)
401// E1,E2 are S shapes (sharing V).
402//
403// if E1 and E2 are not closed : edges are NOT connected
404// if E1 or E2 is/are closed :
405// if V changes of relative orientation between E1,E2 : edges are connected
406// else : edges are NOT connected
407//
408// example with E1 NOT closed, E2 closed :
409//
410// E1 FORWARD, V REVERSED on E1
411// E2 FORWARD, V FORWARD on E2 --> edges are connected
412//
413// E1 FORWARD, V REVERSED on E1
414// E2 REVERSED, V FORWARD on E2 --> edges are NOT connected
415//-----------------------------------------------------------------------
416
417 Standard_Boolean c1 = IsClosed(E1);
418 Standard_Boolean c2 = IsClosed(E2);
419
420 Standard_Boolean testconnect = c1 || c2;
421 Standard_Boolean resu = Standard_False;
422 TopAbs_Orientation o1,o2;
423
424 // SSCONNEX = False ==> on selectionne E2 de facon a creer ulterieurement
425 // (defaut) autant de faces que de composantes connexes en UV.
426 // SSCONNEX = True ==> on prend toute arete E2 qui partage V avec E1
427 // et telle que orientation(V/E1) # orientation(V/E2)
428 // ==> face de part et d'autre des coutures
429
430#ifdef DRAW
431 if ( TopOpeBRepBuild_GetcontextSSCONNEX() ) {
432 if (testconnect) resu = VertexConnectsEdges(V,E1,E2,o1,o2);
433 return resu;
434 }
435#endif
436
437 if ((c1 && c2)) {
438 Standard_Boolean u1 = c1 ? IsUClosed(E1) : Standard_False;
439 Standard_Boolean v1 = c1 ? IsVClosed(E1) : Standard_False;
440 Standard_Boolean u2 = c2 ? IsUClosed(E2) : Standard_False;
441 Standard_Boolean v2 = c2 ? IsVClosed(E2) : Standard_False;
442 Standard_Boolean uvdiff = (u1 && v2) || (u2 && v1);
443 testconnect = uvdiff;
444 }
445
446 if (testconnect) {
447 resu = VertexConnectsEdges(V,E1,E2,o1,o2);
448 }
449 else {
450 // cto 012 O2 arete de couture de face cylindrique
451 // chainage des composantes splitees ON et OUT de meme orientation
452 TopAbs_Orientation oe1 = E1.Orientation();
453 TopAbs_Orientation oe2 = E2.Orientation();
454 Standard_Boolean iseq = E1.IsEqual(E2);
455 if ( (c1 && c2) && (oe1 == oe2) && (!iseq) ) {
456 resu = VertexConnectsEdges(V,E1,E2,o1,o2);
457 }
458 }
459 return resu;
460}
461
462//=======================================================================
463//function : NbClosingShapes
464//purpose :
465//=======================================================================
466Standard_Integer TopOpeBRepBuild_WireEdgeSet::NbClosingShapes(const TopTools_ListOfShape & L) const
467{
468 Standard_Integer n = 0;
469 for (TopTools_ListIteratorOfListOfShape it(L); it.More(); it.Next()) {
470 const TopoDS_Shape& S = it.Value();
471 if ( IsClosed(S) ) n++;
472 }
473 return n;
474}
475
476//=======================================================================
477//function : LocalD1
478//purpose :
479//=======================================================================
480void TopOpeBRepBuild_WireEdgeSet::LocalD1(const TopoDS_Shape& SF,const TopoDS_Shape& SE,const TopoDS_Shape& SV,
481 gp_Pnt2d& pE, gp_Vec2d& d1E) const
482{
483 const TopoDS_Face& F = TopoDS::Face(SF);
484 const TopoDS_Edge& E = TopoDS::Edge(SE);
485 const TopoDS_Vertex& V = TopoDS::Vertex(SV);
486 Standard_Real parE = BRep_Tool::Parameter(V,E);
487
488 TopLoc_Location Loc; Standard_Real fiE,laE;
489 Handle(Geom_Curve) CE = BRep_Tool::Curve(E,Loc,fiE,laE);
490 CE = Handle(Geom_Curve)::DownCast(CE->Transformed(Loc.Transformation()));
491
492 gp_Pnt p3dE; gp_Vec d3dE;
493 CE->D1(parE,p3dE,d3dE);
494
495 Handle(Geom_Surface) S = BRep_Tool::Surface(F);
496 GeomAPI_ProjectPointOnSurf proj(p3dE,S);
497 Standard_Real u,v;
498 proj.LowerDistanceParameters(u,v);
499 pE.SetCoord(u,v);
500 gp_Pnt bid; gp_Vec d1u,d1v;
501 S->D1(u,v,bid,d1u,d1v);
502 u = d3dE.Dot(d1u);
503 v = d3dE.Dot(d1v);
504 d1E.SetCoord(u,v);
505}
506
507//=======================================================================
508//function : IsClosed
509//purpose :
510//=======================================================================
511Standard_Boolean TopOpeBRepBuild_WireEdgeSet::IsClosed(const TopoDS_Shape& E) const
512{
0797d9d3 513#ifdef OCCT_DEBUG
7fd59977 514 Standard_Integer ista=myOMSS.FindIndex(E);Standard_Boolean tsh=(ista)?TopOpeBRep_GettraceSHA(ista):Standard_False;
515 if (tsh) debwesclo(ista);
516#endif
517
518 const TopoDS_Edge& EE = TopoDS::Edge(E);
519 Standard_Boolean closed = BRep_Tool::IsClosed(EE,myFace);
520 if ( closed ) return Standard_True;
521
522 return Standard_False;
523}
524
525//=======================================================================
526//function : IsUVISO
527//purpose :
528//=======================================================================
529void TopOpeBRepBuild_WireEdgeSet::IsUVISO(const TopoDS_Edge& E,const TopoDS_Face& F,Standard_Boolean& uiso,Standard_Boolean& viso)
530{
531 uiso = viso = Standard_False;
532 Standard_Real fE,lE,tolpc;Handle(Geom2d_Curve) PC;
533 Standard_Boolean trim3d = Standard_True;
534 PC = FC2D_CurveOnSurface(E,F,fE,lE,tolpc,trim3d);
9775fa61 535 if (PC.IsNull()) throw Standard_ProgramError("TopOpeBRepBuild_WireEdgeSet::IsUVISO");
7fd59977 536
7fd59977 537 Handle(Standard_Type) TheType = PC->DynamicType();
538 if (TheType == STANDARD_TYPE(Geom2d_Line)) {
c5f3a425 539 Handle(Geom2d_Line) HL (Handle(Geom2d_Line)::DownCast (PC));
7fd59977 540 const gp_Dir2d& D = HL->Direction();
541 Standard_Real tol = Precision::Angular();
542
543 if (D.IsParallel(gp_Dir2d(0.,1.),tol)) uiso = Standard_True;
544 else if (D.IsParallel(gp_Dir2d(1.,0.),tol)) viso = Standard_True;
545 }
546}
547
548//=======================================================================
549//function : IsUClosed
550//purpose :
551//=======================================================================
552Standard_Boolean TopOpeBRepBuild_WireEdgeSet::IsUClosed(const TopoDS_Shape& E) const
553{
554 const TopoDS_Edge& EE = TopoDS::Edge(E);
555 Standard_Boolean bid,closed;
556 IsUVISO(EE,myFace,closed,bid);
557 return closed;
558}
559
560
561//=======================================================================
562//function : IsVClosed
563//purpose :
564//=======================================================================
565Standard_Boolean TopOpeBRepBuild_WireEdgeSet::IsVClosed(const TopoDS_Shape& E) const
566{
567 const TopoDS_Edge& EE = TopoDS::Edge(E);
568 Standard_Boolean bid,closed;
569 IsUVISO(EE,myFace,bid,closed);
570 return closed;
571}
572
573//=======================================================================
574//function : SNameVEE
575//purpose :
576//=======================================================================
577#ifdef DRAW
578TCollection_AsciiString TopOpeBRepBuild_WireEdgeSet::SNameVEE(const TopoDS_Shape& VV,
579 const TopoDS_Shape& EE1,
580 const TopoDS_Shape& EE2) const
581{
582 TCollection_AsciiString str;
583 const TopoDS_Vertex& V = TopoDS::Vertex(VV);
584 const TopoDS_Shape& E1 = TopoDS::Edge(EE1);
585 const TopoDS_Shape& E2 = TopoDS::Edge(EE2);
586 TopAbs_Orientation oVE1,oVE2; Standard_Boolean conn = VertexConnectsEdges(V,E1,E2,oVE1,oVE2);
587 str=SName(VV)+" ";
588 str=str+SNameori(E1)+" V/E1 : ";
7868210d 589 TCollection_AsciiString so1;OrientationToString(oVE1,so1);so1.UpperCase();
7fd59977 590 str=str+so1.SubString(1,1)+" ";
591 str=str+SNameori(E2)+" V/E2 : ";
7868210d 592 TCollection_AsciiString so2;OrientationToString(oVE2,so2);so2.UpperCase();
7fd59977 593 str=str+so2.SubString(1,1)+" ";
594 return str;
595}
596#else
597TCollection_AsciiString TopOpeBRepBuild_WireEdgeSet::SNameVEE(const TopoDS_Shape&,
598 const TopoDS_Shape&,
599 const TopoDS_Shape&) const
600{
601 TCollection_AsciiString str;
602 return str;
603}
604#endif
605
606//=======================================================================
607//function : SNameVEL
608//purpose :
609//=======================================================================
610#ifdef DRAW
611TCollection_AsciiString TopOpeBRepBuild_WireEdgeSet::SNameVEL(const TopoDS_Shape& V, const TopoDS_Shape& E,
612 const TopTools_ListOfShape& L) const
613#else
614TCollection_AsciiString TopOpeBRepBuild_WireEdgeSet::SNameVEL(const TopoDS_Shape&, const TopoDS_Shape&,
615 const TopTools_ListOfShape&) const
616#endif
617{
618 TCollection_AsciiString str;
619#ifdef DRAW
620 Standard_Integer nc = NbClosingShapes(L), nl = L.Extent();
621 str=SNameori(E)+" "+SName(V)+" "+SNameori(L);
622#endif
623 return str;
624}
625
626//=======================================================================
627//function : DumpSS
628//purpose :
629//=======================================================================
630void TopOpeBRepBuild_WireEdgeSet::DumpSS()
631{
632#ifdef DRAW
633 TopOpeBRepBuild_ShapeSet::DumpSS();
634#endif
635}
636
637//=======================================================================
638//function : SName
639//purpose :
640//=======================================================================
641#ifdef DRAW
642TCollection_AsciiString TopOpeBRepBuild_WireEdgeSet::SName(const TopoDS_Shape& S,
643 const TCollection_AsciiString& sb,
644 const TCollection_AsciiString& sa) const
645#else
646TCollection_AsciiString TopOpeBRepBuild_WireEdgeSet::SName(const TopoDS_Shape&,
647 const TCollection_AsciiString& sb,
648 const TCollection_AsciiString&) const
649#endif
650{
651 TCollection_AsciiString str=sb;
652#ifdef DRAW
653 str=str+TopOpeBRepBuild_ShapeSet::SName(S);
654 str=str+sa;
655 DBRep::Set(str.ToCString(),S);
656#endif
657 return str;
658}
659
660//=======================================================================
661//function : SNameori
662//purpose :
663//=======================================================================
664#ifdef DRAW
665TCollection_AsciiString TopOpeBRepBuild_WireEdgeSet::SNameori(const TopoDS_Shape& S,
666 const TCollection_AsciiString& sb,
667 const TCollection_AsciiString& sa) const
668#else
669TCollection_AsciiString TopOpeBRepBuild_WireEdgeSet::SNameori(const TopoDS_Shape&,
670 const TCollection_AsciiString& sb,
671 const TCollection_AsciiString&) const
672#endif
673{
674 TCollection_AsciiString str=sb;
675#ifdef DRAW
676 str=str+TopOpeBRepBuild_ShapeSet::SNameori(S);
677 if ( S.ShapeType() == TopAbs_EDGE ) {
678 const TopoDS_Shape& E = TopoDS::Edge(S);
679 Standard_Boolean c = IsClosed(E), u = IsUClosed(E), v = IsVClosed(E);
680 if (c) str=str+"c";
681 if (u) str=str+"u";
682 if (v) str=str+"v";
683 str=str+sa;
684 DBRep::Set(str.ToCString(),S);
685 }
686#endif
687 return str;
688}
689
690//=======================================================================
691//function : SName
692//purpose :
693//=======================================================================
694#ifdef DRAW
695TCollection_AsciiString TopOpeBRepBuild_WireEdgeSet::SName(const TopTools_ListOfShape& L,
696 const TCollection_AsciiString& sb,
697 const TCollection_AsciiString& sa) const
698#else
699TCollection_AsciiString TopOpeBRepBuild_WireEdgeSet::SName(const TopTools_ListOfShape&,
700 const TCollection_AsciiString&,
701 const TCollection_AsciiString&) const
702#endif
703{
704 TCollection_AsciiString str;
705#ifdef DRAW
706 for (TopTools_ListIteratorOfListOfShape it(L);it.More();it.Next())
707 str=str+sb+SName(it.Value())+sa+" ";
708#endif
709 return str;
710}
711
712//=======================================================================
713//function : SNameori
714//purpose :
715//=======================================================================
716#ifdef DRAW
717TCollection_AsciiString TopOpeBRepBuild_WireEdgeSet::SNameori(const TopTools_ListOfShape& L,
718 const TCollection_AsciiString& sb,
719 const TCollection_AsciiString& sa) const
720#else
721TCollection_AsciiString TopOpeBRepBuild_WireEdgeSet::SNameori(const TopTools_ListOfShape&,
722 const TCollection_AsciiString&,
723 const TCollection_AsciiString&) const
724#endif
725{
726 TCollection_AsciiString str;
727#ifdef DRAW
728 for (TopTools_ListIteratorOfListOfShape it(L);it.More();it.Next())
729 str=str+sb+SNameori(it.Value())+sa+" ";
730#endif
731 return str;
732}