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