Warnings on vc14 were eliminated
[occt.git] / src / TopOpeBRepBuild / TopOpeBRepBuild_ShapeSet.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 under
9 // the terms of the GNU Lesser General Public License 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
18 #include <BRepCheck_Analyzer.hxx>
19 #include <Standard_ProgramError.hxx>
20 #include <TCollection_AsciiString.hxx>
21 #include <TopAbs.hxx>
22 #include <TopoDS_Shape.hxx>
23 #include <TopOpeBRepBuild_define.hxx>
24 #include <TopOpeBRepBuild_ShapeSet.hxx>
25
26 #ifdef DRAW
27 #include <DBRep.hxx>
28 #include <DBRep_DrawableShape.hxx>
29 #include <TestTopOpeDraw_DrawableSHA.hxx>
30 #include <TestTopOpeDraw_TTOT.hxx>
31 #include <TopoDS_Iterator.hxx>
32 #include <TopTools_IndexedMapOfShape.hxx>
33 static TCollection_AsciiString PRODINS("dins ");
34 #endif
35
36 #ifdef OCCT_DEBUG
37 extern Standard_Boolean TopOpeBRepBuild_GettraceCHK();
38 extern Standard_Boolean TopOpeBRepBuild_GettraceCHKOK();
39 extern Standard_Boolean TopOpeBRepBuild_GettraceCHKNOK();
40 Standard_EXPORT void debaddss(){}
41 Standard_IMPORT TopOpeBRepBuild_Builder* LOCAL_PBUILDER_DEB;
42 #endif
43
44 //=======================================================================
45 //function : TopOpeBRepBuild_ShapeSet
46 //purpose  : 
47 //=======================================================================
48 TopOpeBRepBuild_ShapeSet::TopOpeBRepBuild_ShapeSet(const TopAbs_ShapeEnum SubShapeType,const Standard_Boolean checkshape) : 
49  mySubShapeType(SubShapeType), myCheckShape(checkshape) 
50 {
51   if      (SubShapeType == TopAbs_EDGE)   myShapeType = TopAbs_FACE;
52   else if (SubShapeType == TopAbs_VERTEX) myShapeType = TopAbs_EDGE;
53   else throw Standard_ProgramError("ShapeSet : bad ShapeType");
54   myDEBNumber = 0;
55
56   myCheckShape = Standard_False; // temporary NYI
57 }
58
59 TopOpeBRepBuild_ShapeSet::~TopOpeBRepBuild_ShapeSet()
60 {}
61
62 //=======================================================================
63 //function : AddShape
64 //purpose  : 
65 //=======================================================================
66 void TopOpeBRepBuild_ShapeSet::AddShape(const TopoDS_Shape& S)
67 {
68   Standard_Boolean chk = CheckShape(S);
69 #ifdef OCCT_DEBUG
70   DumpCheck(cout," AddShape",S,chk);
71 #endif
72
73   if (!chk) return;
74   ProcessAddShape(S);
75 }
76
77 //=======================================================================
78 //function : AddStartElement
79 //purpose  : 
80 //=======================================================================
81 void TopOpeBRepBuild_ShapeSet::AddStartElement(const TopoDS_Shape& S)
82 {
83   Standard_Boolean chk = CheckShape(S);
84 #ifdef OCCT_DEBUG
85   DumpCheck(cout," AddStartElement",S,chk);
86 #endif
87
88   if (!chk) return;
89   ProcessAddStartElement(S);
90 }
91
92 //=======================================================================
93 //function : AddElement
94 //purpose  : 
95 //=======================================================================
96 void TopOpeBRepBuild_ShapeSet::AddElement(const TopoDS_Shape& S)
97 {
98   Standard_Boolean chk = CheckShape(S);
99 #ifdef OCCT_DEBUG
100   DumpCheck(cout," AddElement",S,chk);
101 #endif
102
103   if (!chk) return;
104   ProcessAddElement(S);
105 }
106
107 //=======================================================================
108 //function : ProcessAddShape
109 //purpose  : 
110 //=======================================================================
111 void TopOpeBRepBuild_ShapeSet::ProcessAddShape(const TopoDS_Shape& S)
112 {
113   if ( !myOMSH.Contains(S) ) {
114     myOMSH.Add(S);
115     myShapes.Append(S);
116   }
117 }
118
119 //=======================================================================
120 //function : ProcessStartElement
121 //purpose  : 
122 //=======================================================================
123 void TopOpeBRepBuild_ShapeSet::ProcessAddStartElement(const TopoDS_Shape& S)
124 {
125   if ( !myOMSS.Contains(S) ) {
126     myOMSS.Add(S);
127     myStartShapes.Append(S);
128     ProcessAddElement(S);
129   }
130 }
131
132 //=======================================================================
133 //function : ProcessAddElement
134 //purpose  : 
135 //=======================================================================
136 void TopOpeBRepBuild_ShapeSet::ProcessAddElement(const TopoDS_Shape& S)
137 {
138   if ( !myOMES.Contains(S) ) {
139     myOMES.Add(S);
140     TopTools_ListOfShape  Lemp;
141     TopOpeBRepTool_ShapeExplorer Ex(S,mySubShapeType);
142     for (; Ex.More(); Ex.Next()) {
143       const TopoDS_Shape& subshape = Ex.Current();
144       Standard_Boolean b = ( ! mySubShapeMap.Contains(subshape) );
145       if ( b ) mySubShapeMap.Add(subshape,Lemp);
146       mySubShapeMap.ChangeFromKey(subshape).Append(S);
147     }
148   }
149 }
150
151 //=======================================================================
152 //function : StartElements
153 //purpose  : 
154 //=======================================================================
155 const TopTools_ListOfShape& TopOpeBRepBuild_ShapeSet::StartElements()const 
156 {
157   return myStartShapes;
158 }
159
160 //=======================================================================
161 //function : InitShapes
162 //purpose  : 
163 //=======================================================================
164 void  TopOpeBRepBuild_ShapeSet::InitShapes()
165 {
166   myShapesIter.Initialize(myShapes);
167 }
168
169 //=======================================================================
170 //function : MoreShapes
171 //purpose  : 
172 //=======================================================================
173 Standard_Boolean  TopOpeBRepBuild_ShapeSet::MoreShapes()const 
174 {
175   Standard_Boolean b = myShapesIter.More();
176   return b;
177 }
178
179 //=======================================================================
180 //function : NextShape
181 //purpose  : 
182 //=======================================================================
183 void  TopOpeBRepBuild_ShapeSet::NextShape()
184 {
185   myShapesIter.Next();
186 }
187
188 //=======================================================================
189 //function : Shape
190 //purpose  : 
191 //=======================================================================
192 const TopoDS_Shape&  TopOpeBRepBuild_ShapeSet::Shape()const 
193 {
194   const TopoDS_Shape& S = myShapesIter.Value();
195   return S;
196 }
197
198 //=======================================================================
199 //function : InitStartElements
200 //purpose  : 
201 //=======================================================================
202 void  TopOpeBRepBuild_ShapeSet::InitStartElements()
203 {
204   myStartShapesIter.Initialize(myStartShapes);
205 }
206
207 //=======================================================================
208 //function : MoreStartElements
209 //purpose  : 
210 //=======================================================================
211 Standard_Boolean  TopOpeBRepBuild_ShapeSet::MoreStartElements()const 
212 {
213   Standard_Boolean b = myStartShapesIter.More();
214   return b;
215 }
216
217 //=======================================================================
218 //function : NextStartElement
219 //purpose  : 
220 //=======================================================================
221 void  TopOpeBRepBuild_ShapeSet::NextStartElement()
222 {
223   myStartShapesIter.Next();
224 }
225
226 //=======================================================================
227 //function : StartElement
228 //purpose  : 
229 //=======================================================================
230 const TopoDS_Shape& TopOpeBRepBuild_ShapeSet::StartElement()const 
231 {
232   const TopoDS_Shape& S = myStartShapesIter.Value();
233   return S;
234 }
235
236 //=======================================================================
237 //function : InitNeighbours
238 //purpose  : 
239 //=======================================================================
240 void  TopOpeBRepBuild_ShapeSet::InitNeighbours(const TopoDS_Shape& S)
241 {
242   mySubShapeExplorer.Init(S,mySubShapeType);
243   myCurrentShape = S;
244   FindNeighbours();
245 }
246
247 //=======================================================================
248 //function : MoreNeighbours
249 //purpose  : 
250 //=======================================================================
251 Standard_Boolean TopOpeBRepBuild_ShapeSet::MoreNeighbours()
252 {
253   Standard_Boolean b = myIncidentShapesIter.More();
254   return b;
255 }
256
257 //=======================================================================
258 //function : NextNeighbour
259 //purpose  : 
260 //=======================================================================
261 void TopOpeBRepBuild_ShapeSet::NextNeighbour()
262 {
263   myIncidentShapesIter.Next();
264   Standard_Boolean noisimore = ! myIncidentShapesIter.More();
265   if ( noisimore ) {
266     Standard_Boolean ssemore = mySubShapeExplorer.More();
267     if ( ssemore ) {
268       mySubShapeExplorer.Next();
269       FindNeighbours();
270     }
271   }
272 }
273
274 //=======================================================================
275 //function : Neighbour
276 //purpose  : 
277 //=======================================================================
278 const TopoDS_Shape&  TopOpeBRepBuild_ShapeSet::Neighbour()const 
279 {
280   const TopoDS_Shape& S = myIncidentShapesIter.Value();
281   return S;
282 }
283
284 //=======================================================================
285 //function : ChangeStartShapes
286 //purpose  : 
287 //=======================================================================
288 TopTools_ListOfShape& TopOpeBRepBuild_ShapeSet::ChangeStartShapes()
289 {
290   return myStartShapes;
291 }
292
293 //=======================================================================
294 //function : FindNeighbours
295 //purpose  : 
296 //=======================================================================
297 void TopOpeBRepBuild_ShapeSet::FindNeighbours()
298 {
299   while (mySubShapeExplorer.More()) {
300     
301     // l = list of edges neighbour of edge myCurrentShape trough
302     // the vertex mySubShapeExplorer.Current(), which is a vertex of the
303     // edge myCurrentShape.
304     const TopoDS_Shape& V = mySubShapeExplorer.Current();
305     const TopTools_ListOfShape & l = MakeNeighboursList(myCurrentShape,V);
306     
307     // myIncidentShapesIter iterates on the neighbour edges of the edge
308     // given as InitNeighbours() argument (this edge has been stored 
309     // in the field myCurrentShape).
310     
311     myIncidentShapesIter.Initialize(l);
312     if (myIncidentShapesIter.More()) break;
313     else mySubShapeExplorer.Next();
314   }
315 }
316
317 //=======================================================================
318 //function : MakeNeighboursList
319 //purpose  : // (Earg = Edge, Varg = Vertex) to find connected to Earg by Varg 
320 //=======================================================================
321 const TopTools_ListOfShape & TopOpeBRepBuild_ShapeSet::MakeNeighboursList(const TopoDS_Shape& /*Earg*/, const TopoDS_Shape& Varg)
322 {
323   const TopTools_ListOfShape& l = mySubShapeMap.FindFromKey(Varg);
324   return l;
325 }
326
327 //=======================================================================
328 //function : MaxNumberSubShape
329 //purpose  : 
330 //=======================================================================
331 Standard_Integer TopOpeBRepBuild_ShapeSet::MaxNumberSubShape(const TopoDS_Shape& Shape)
332 {
333   Standard_Integer i, m = 0;
334   TopOpeBRepTool_ShapeExplorer SE(Shape, mySubShapeType);
335   TopTools_ListIteratorOfListOfShape LI;
336   while(SE.More()) {
337     const TopoDS_Shape& SubShape = SE.Current();
338     if(!mySubShapeMap.Contains(SubShape)) {
339       SE.Next();
340       continue;
341     }
342     const TopTools_ListOfShape& l = mySubShapeMap.FindFromKey(SubShape);
343     LI.Initialize(l);
344     for(i = 0;LI.More();LI.Next(), i++) {}
345     m = Max(m, i);
346     SE.Next();
347   }
348   return m;
349 }
350
351 //=======================================================================
352 //function : CheckShape
353 //purpose  : 
354 //=======================================================================
355 void TopOpeBRepBuild_ShapeSet::CheckShape(const Standard_Boolean checkshape)
356 {
357   myCheckShape = checkshape;
358
359 #ifdef OCCT_DEBUG
360   if (TopOpeBRepBuild_GettraceCHK() && !myCheckShape) {
361     DumpName(cout,"no checkshape set on ");cout<<endl;
362   }
363 #endif
364 }
365
366 //=======================================================================
367 //function : CheckShape
368 //purpose  : 
369 //=======================================================================
370 Standard_Boolean TopOpeBRepBuild_ShapeSet::CheckShape() const
371 {
372   return myCheckShape;
373 }
374
375 //=======================================================================
376 //function : CheckShape
377 //purpose  : 
378 //=======================================================================
379 Standard_Boolean TopOpeBRepBuild_ShapeSet::CheckShape(const TopoDS_Shape& S,const Standard_Boolean checkgeom)
380 {
381   if (!myCheckShape) return Standard_True;
382
383   BRepCheck_Analyzer ana(S,checkgeom);    
384   Standard_Boolean val = ana.IsValid();
385   if ( val ) {
386     return Standard_True;
387   }
388   else {
389     return Standard_False;
390   }
391 }
392
393 //=======================================================================
394 //function : DumpName
395 //purpose  : 
396 //=======================================================================
397 void TopOpeBRepBuild_ShapeSet::DumpName(Standard_OStream& OS,const TCollection_AsciiString& str) const
398 {
399   OS<<str<<"("<<myDEBName<<","<<myDEBNumber<<")";
400 }
401
402 //=======================================================================
403 //function : DumpCheck
404 //purpose  : 
405 //=======================================================================
406
407 #ifdef OCCT_DEBUG
408 void TopOpeBRepBuild_ShapeSet::DumpCheck(Standard_OStream& OS,
409                                          const TCollection_AsciiString& str,
410                                          const TopoDS_Shape& S, 
411                                          const Standard_Boolean chk
412 #else
413 void TopOpeBRepBuild_ShapeSet::DumpCheck(Standard_OStream&,
414                                          const TCollection_AsciiString&,
415                                          const TopoDS_Shape&,
416                                          const Standard_Boolean
417 #endif
418                                                                     ) const
419
420   if (!myCheckShape) return;
421
422 #ifdef OCCT_DEBUG
423   TopAbs_ShapeEnum t = S.ShapeType();
424   if (!chk) {
425     if (TopOpeBRepBuild_GettraceCHK() ||
426         TopOpeBRepBuild_GettraceCHKNOK() ) {
427       DumpName(OS,"*********************** ");
428       OS<<str<<" ";TopAbs::Print(t,OS);OS<<" : incorrect"<<endl;
429     }
430   }
431   else {
432     if (TopOpeBRepBuild_GettraceCHK() ||
433         TopOpeBRepBuild_GettraceCHKOK() ) {
434       DumpName(OS,"");
435       OS<<str<<" ";TopAbs::Print(t,OS);OS<<" : correct"<<endl;
436     }
437   }
438   if (!chk) debaddss();
439 #endif
440 }
441
442 //=======================================================================
443 //function : DumpSS
444 //purpose  : 
445 //=======================================================================
446 void TopOpeBRepBuild_ShapeSet::DumpSS()
447 {
448 #ifdef DRAW
449   DumpName(cout,"\nDumpSS start ");
450   TopTools_ListIteratorOfListOfShape it;
451   Standard_Integer i,j,ne;
452   TCollection_AsciiString s1("   ");
453   InitShapes();
454   cout<<endl<<"#Shapes : ";if (!MoreShapes()) cout<<0;cout<<endl;
455   for (i=1;MoreShapes();NextShape(),i++) {
456     TCollection_AsciiString ns = SNameori(Shape());
457     cout<<PRODINS<<ns<<"; # "<<i<<" draw"<<endl;
458     DBRep::Set(ns.ToCString(),Shape());
459   }
460
461   InitStartElements();
462   cout<<"#StartElements : ";if (!MoreStartElements()) cout<<0;cout<<endl;
463   for (i=1;MoreStartElements();NextStartElement(),i++) {
464     cout<<PRODINS<<SNameori(StartElement())<<"; # "<<i<<" draw"<<endl;
465   }
466
467   InitStartElements();
468   cout<<"#Neighbours of StartElements : ";if (!MoreStartElements()) cout<<0;cout<<endl;
469   for (i=1;MoreStartElements();NextStartElement(),i++) {
470     const TopoDS_Shape& e = StartElement();
471     TCollection_AsciiString enam = SNameori(e);
472     InitNeighbours(e);
473     if (MoreNeighbours()) {
474       TCollection_AsciiString sne("clear; ");sne=sne+PRODINS+enam;
475       for (ne=1; MoreNeighbours(); NextNeighbour(),ne++) {
476         const TopoDS_Shape& N = Neighbour();
477         sne=sne+" "+SNameori(N);
478       }
479       sne=sne+"; wclick; #draw";
480       cout<<sne<<endl;
481     }
482   }
483
484   Standard_Integer ism,nsm=mySubShapeMap.Extent();
485   cout<<"#Incident shapes : ";if (!nsm) cout<<0;cout<<endl;
486   for (i=1,ism=1;ism<=nsm;ism++,i++) {
487     const TopoDS_Shape& v = mySubShapeMap.FindKey(ism);
488     const TopTools_ListOfShape& lsv = mySubShapeMap.FindFromIndex(ism);
489     TopTools_ListIteratorOfListOfShape itle(lsv);
490     if (itle.More()) {
491       TCollection_AsciiString vnam = SName(v);
492       TCollection_AsciiString sle("clear; ");sle=sle+PRODINS+vnam;
493       for (j=1;itle.More();itle.Next(),j++) {
494         const TopoDS_Shape& e = itle.Value();
495         sle=sle+" "+SNameori(e);
496       }
497       sle=sle+"; wclick; #draw";
498       cout<<sle<<endl;
499     } 
500   }
501   DumpName(cout,"DumpSS end ");
502 #endif
503 }
504
505 //=======================================================================
506 //function : DumpBB
507 //purpose  : 
508 //=======================================================================
509 void TopOpeBRepBuild_ShapeSet::DumpBB()
510 {
511 #ifdef DRAW
512   DumpName(cout,"\nDumpBB ");
513   TopTools_ListIteratorOfListOfShape it;
514   Standard_Integer i,j,ne = 0, nb = 1, curr, currloc;
515   TCollection_AsciiString s1("   "),stt,enam,nnam,vnam;
516   InitShapes();
517
518   cout<<endl<<"#Shapes : (block old) ";if (!MoreShapes()) cout<<0;cout<<endl;
519   for (i=1;MoreShapes();NextShape(),i++, nb++) {
520     cout<<"Block number"<<nb<<" (old)."<<endl;
521     const TopoDS_Shape& e = Shape();
522     TopoDS_Iterator ShapIter(e);
523     for(ne = 1;ShapIter.More();ShapIter.Next(), ne++) {
524       const TopoDS_Shape& subsha = ShapIter.Value();
525       TestTopOpeDraw_TTOT::ShapeEnumToString(subsha.ShapeType(),stt);
526       enam = stt+ne+"ShaB"+nb;
527       DBRep::Set(enam.ToCString(),subsha); 
528       cout<<"clear; "<<PRODINS<<enam<<"; #draw"<<endl;
529     }
530   }
531
532   InitStartElements();
533   TopTools_IndexedMapOfShape mos;
534   cout<<"#Elements : (block new) : ";if (!MoreStartElements()) cout<<0;cout<<endl;
535   mos.Clear();
536   for (;MoreStartElements();NextStartElement()) {
537     const TopoDS_Shape& e = StartElement();
538     curr = mos.Extent();
539     if(mos.Add(e) > curr) {
540       cout<<"#Block number"<<nb<<" (new)."<<endl;
541       nb++;ne++;
542       enam = "";
543       enam = enam+"ste"+ne+"newB"+nb;
544       DBRep::Set(enam.ToCString(),e); 
545 //      char* name = enam.ToCString();
546 //      Handle(TestTopOpeDraw_DrawableSHA) D = new TestTopOpeDraw_DrawableSHA
547 //      (e, Draw_blanc, Draw_blanc, Draw_blanc, Draw_blanc, 100., 2, 30, name, Draw_blanc);
548 //      Draw::Set(name,D);
549 //      cout<<"wclick; clear; "<<PRODINS<<enam<<"; #draw"<<endl;
550       while(curr < mos.Extent()) {
551         curr = mos.Extent();
552         currloc = curr;
553         InitNeighbours(mos.FindKey(curr));
554         for (; MoreNeighbours(); NextNeighbour()) {
555           const TopoDS_Shape& N = Neighbour();
556           if(mos.Add(N) > currloc) {
557             currloc++;ne++;
558             // to know if ste or ele is displayed; start
559             const TopTools_ListOfShape& LSE = StartElements();
560             it.Initialize(LSE);
561             while(it.More()) 
562               if(it.Value() == N)
563                 break;
564               else
565                 it.Next();
566             enam = "";
567             if(it.More()) {
568               enam = enam+"ste"+ne+"newB"+nb;
569 //            name = enam.ToCString();
570 //            Handle(TestTopOpeDraw_DrawableSHA) Dloc = 
571 //              new TestTopOpeDraw_DrawableSHA
572 //                (N, Draw_blanc, Draw_blanc, Draw_blanc, Draw_blanc,
573 //                 100., 2, 30, name, Draw_blanc);
574 //            Draw::Set(name,Dloc);
575               DBRep::Set(enam.ToCString(),N); 
576 //            cout<<PRODINS<<enam<<"; #draw"<<endl;
577             } else {
578               enam = enam+"ele"+ne+"newB"+nb;
579               DBRep::Set(enam.ToCString(),N); 
580               cout<<PRODINS<<enam<<"; #draw"<<endl;
581             }     
582           }
583         }
584       }
585     }
586   }
587 #endif
588 }
589
590 //=======================================================================
591 //function : DEBName
592 //purpose  : 
593 //=======================================================================
594 void TopOpeBRepBuild_ShapeSet::DEBName(const TCollection_AsciiString& N)
595
596   myDEBName = N; 
597 }
598
599 //=======================================================================
600 //function : DEBName
601 //purpose  : 
602 //=======================================================================
603 const TCollection_AsciiString& TopOpeBRepBuild_ShapeSet::DEBName() const
604
605   return myDEBName; 
606 }
607
608 //=======================================================================
609 //function : DEBNumber
610 //purpose  : 
611 //=======================================================================
612 void TopOpeBRepBuild_ShapeSet::DEBNumber(const Standard_Integer I)
613
614   myDEBNumber = I; 
615 }
616
617 //=======================================================================
618 //function : DEBNumber
619 //purpose  : 
620 //=======================================================================
621 Standard_Integer TopOpeBRepBuild_ShapeSet::DEBNumber() const
622
623   return myDEBNumber; 
624 }
625
626 //=======================================================================
627 //function : SName
628 //purpose  : 
629 //=======================================================================
630 #ifdef DRAW
631 TCollection_AsciiString TopOpeBRepBuild_ShapeSet::SName(const TopoDS_Shape& /*S*/,
632                                                         const TCollection_AsciiString& sb,
633                                                         const TCollection_AsciiString& sa) const
634 {
635   TCollection_AsciiString str;
636
637   str=sb;
638   TCollection_AsciiString WESi=myDEBName.SubString(1,1)+myDEBNumber;
639   str=str+WESi;
640   TopAbs_ShapeEnum t = S.ShapeType();
641   TCollection_AsciiString sts;TestTopOpeDraw_TTOT::ShapeEnumToString(t,sts);
642   sts.UpperCase();str=str+sts.SubString(1,1);
643   Standard_Integer isub = mySubShapeMap.FindIndex(S);
644   Standard_Integer ista = myOMSS.FindIndex(S);
645   Standard_Integer iele = myOMES.FindIndex(S);
646   Standard_Integer isha = myOMSH.FindIndex(S);
647   if      (isub) str=str+"sub"+isub;
648   if      (ista) str=str+"sta"+ista;
649   else if (iele) str=str+"ele"+iele;
650   if      (isha) str=str+"sha"+isha;
651   str=str+sa;
652
653   return str;
654 }
655 #else
656 TCollection_AsciiString TopOpeBRepBuild_ShapeSet::SName(const TopoDS_Shape&,
657                                                         const TCollection_AsciiString&,
658                                                         const TCollection_AsciiString&) const
659 {
660   TCollection_AsciiString str;
661   return str;
662 }
663 #endif
664
665 //=======================================================================
666 //function : SNameori
667 //purpose  : 
668 //=======================================================================
669 #ifdef DRAW
670 TCollection_AsciiString TopOpeBRepBuild_ShapeSet::SNameori(const TopoDS_Shape& S,
671                                                            const TCollection_AsciiString& sb,
672                                                            const TCollection_AsciiString& sa) const
673 {
674   TCollection_AsciiString str;
675   str=sb+SName(S);
676   TopAbs_Orientation o = S.Orientation();
677   TCollection_AsciiString sto;TestTopOpeDraw_TTOT::OrientationToString(o,sto);
678   str=str+sto.SubString(1,1);
679   str=str+sa;
680   return str;
681 }
682 #else
683 TCollection_AsciiString TopOpeBRepBuild_ShapeSet::SNameori(const TopoDS_Shape&,
684                                                            const TCollection_AsciiString&,
685                                                            const TCollection_AsciiString&) const
686 {
687   TCollection_AsciiString str;
688   return str;
689 }
690 #endif
691
692 //=======================================================================
693 //function : SName
694 //purpose  : 
695 //=======================================================================
696 #ifdef DRAW
697 TCollection_AsciiString TopOpeBRepBuild_ShapeSet::SName(const TopTools_ListOfShape& L,
698                                                         const TCollection_AsciiString& sb,
699                                                         const TCollection_AsciiString& /*sa*/) const
700 {
701   TCollection_AsciiString str;
702   for (TopTools_ListIteratorOfListOfShape it(L);it.More();it.Next()) str=str+sb+SName(it.Value())+sa+" ";
703   return str;
704 }
705 #else
706 TCollection_AsciiString TopOpeBRepBuild_ShapeSet::SName(const TopTools_ListOfShape&,
707                                                         const TCollection_AsciiString&,
708                                                         const TCollection_AsciiString&) const
709 {
710   TCollection_AsciiString str;
711   return str;
712 }
713 #endif
714
715 //=======================================================================
716 //function : SNameori
717 //purpose  : 
718 //=======================================================================
719 TCollection_AsciiString TopOpeBRepBuild_ShapeSet::SNameori(const TopTools_ListOfShape& /*L*/,
720                                                            const TCollection_AsciiString& /*sb*/,
721                                                            const TCollection_AsciiString& /*sa*/) const
722 {
723   TCollection_AsciiString str;
724 #ifdef DRAW
725   for (TopTools_ListIteratorOfListOfShape it(L);it.More();it.Next()) str=str+sb+SNameori(it.Value())+sa+" ";
726 #endif
727   return str;
728 }