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