0025938: BRepBuilderAPI_Transform is not thread safe
[occt.git] / src / TNaming / TNaming_Tool.cxx
CommitLineData
b311480e 1// Created on: 1997-01-06
2// Created by: Yves FRICAUD
3// Copyright (c) 1997-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#include <TDF_LabelList.hxx>
18#include <TNaming_Tool.ixx>
19#include <TNaming_NamedShape.hxx>
20#include <TNaming_NewShapeIterator.hxx>
21#include <TNaming_OldShapeIterator.hxx>
22#include <TNaming_Iterator.hxx>
23#include <TNaming_RefShape.hxx>
24#include <TopoDS_Compound.hxx>
25#include <BRep_Builder.hxx>
26#include <TopTools_MapOfShape.hxx>
27#include <TopTools_MapIteratorOfMapOfShape.hxx>
28
29#include <Standard_NoSuchObject.hxx>
30
7fd59977 31#include <TNaming_Naming.hxx>
32#include <TNaming_ListOfNamedShape.hxx>
33#include <TDF_AttributeMap.hxx>
34#include <TDF_Tool.hxx>
35#include <TDF_MapIteratorOfAttributeMap.hxx>
7dcac1df 36#include <TDF_ChildIterator.hxx>
7fd59977 37#include <TopExp_Explorer.hxx>
38#include <TNaming_ListIteratorOfListOfNamedShape.hxx>
7fd59977 39
40//=======================================================================
41//function : LastModif
42//purpose :
43//=======================================================================
44
45static void LastModif( TNaming_NewShapeIterator& it,
46 const TopoDS_Shape& S,
47 TopTools_MapOfShape& MS,
48 const TDF_LabelMap& Updated,
49 TDF_LabelList& Deleted)
50{
51 Standard_Boolean YaModif = Standard_False;
52 for (; it.More(); it.Next()) {
53 const TDF_Label& Lab = it.Label();
54 if (!Updated.Contains(Lab)) continue;
55
56 if (it.IsModification()) {
57 YaModif = Standard_True;
58 TNaming_NewShapeIterator it2(it);
59 if (!it2.More()) {
60 const TopoDS_Shape& S1 = it.Shape();
61 if (S1.IsNull()) {
62 Deleted.Append(Lab);
63 }
64 else {
65 MS.Add (S1); // Modified
66 }
67 }
68 else
69 LastModif(it2,it.Shape(),MS,Updated,Deleted);
70 }
71 }
72 if (!YaModif)
73 MS.Add(S);
74}
75
76//=======================================================================
77//function : LastModif
78//purpose :
79//=======================================================================
80
81static void LastModif(TNaming_NewShapeIterator& it,
82 TopTools_MapOfShape& MS,
83 const TopoDS_Shape& S,
84 TDF_LabelList& Deleted)
85{
86 Standard_Boolean YaModif = Standard_False;
87 for (; it.More(); it.Next()) {
88 const TDF_Label& Lab = it.Label();
89 if (it.IsModification()) {
90 YaModif = Standard_True;
91 TNaming_NewShapeIterator it2(it);
92 if (!it2.More()) {
93 const TopoDS_Shape& S1 = it.Shape();
94 if (S1.IsNull()) {
95 Deleted.Append(Lab);
96 }
97 else {
98 MS.Add (S1); // Modified
99 }
100 }
101 else
102 LastModif(it2,MS,it.Shape(), Deleted);
103 }
104 }
105 if (!YaModif)
106 MS.Add(S);
107}
108
109//=======================================================================
110//function : MakeShape
111//purpose :
112//=======================================================================
113
114static TopoDS_Shape MakeShape (const TopTools_MapOfShape& MS)
115{
116 if (!MS.IsEmpty ()) {
117 TopTools_MapIteratorOfMapOfShape it(MS);
118 if (MS.Extent() == 1) {
119 return it.Key();
120 }
121 else {
122 TopoDS_Compound C;
123 BRep_Builder B;
124 B.MakeCompound(C);
125 for (; it.More(); it.Next()){
126 B.Add(C,it.Key());
127 }
128 return C;
129 }
130 }
131 return TopoDS_Shape();
132}
133
134//=======================================================================
135//function : GetShape
136//purpose :
137//=======================================================================
7fd59977 138TopoDS_Shape TNaming_Tool::GetShape(const Handle(TNaming_NamedShape)& NS)
139{
140 TNaming_Iterator itL (NS);
141 TopTools_MapOfShape MS;
142 if(NS->Evolution() == TNaming_SELECTED) {
143 for (; itL.More(); itL.Next()) {
144 if(!itL.NewShape().IsNull()) {
7dcac1df 145 if(itL.NewShape().ShapeType() != TopAbs_VERTEX ) { //OR-N
146 Handle (TNaming_Naming) aNaming;
147 NS->Label().FindAttribute(TNaming_Naming::GetID(), aNaming);
148 if(!aNaming.IsNull()) {
149 if(aNaming->GetName().Orientation() == TopAbs_FORWARD ||
150 aNaming->GetName().Orientation() == TopAbs_REVERSED) {
151 TopoDS_Shape aS = itL.NewShape();
152 if(aNaming->GetName().Type() == TNaming_ORIENTATION) {
153 aS.Orientation(aNaming->GetName().Orientation());
154 } else {
155 Handle (TNaming_Naming) aNaming2;
156 TDF_ChildIterator it(aNaming->Label());
157 for(;it.More();it.Next()) {
158 const TDF_Label& aLabel = it.Value();
159 aLabel.FindAttribute(TNaming_Naming::GetID(), aNaming2);
160 if(!aNaming2.IsNull()) {
161 if(aNaming2->GetName().Type() == TNaming_ORIENTATION) {
162 aS.Orientation(aNaming2->GetName().Orientation());
163 break;
164 }
165 }
166 }
167 }
168 MS.Add(aS);
169 } else
170 MS.Add(itL.NewShape());
171 } else
172 MS.Add(itL.NewShape());
173 } //
174 else
175 MS.Add(itL.NewShape());
176 }
177 }
7fd59977 178 } else
179 for (; itL.More(); itL.Next()) {
180 if (!itL.NewShape().IsNull()) MS.Add(itL.NewShape());
181 }
182 return MakeShape(MS);
183}
184
185//=======================================================================
186//function : InitialShape
187//purpose :
188//=======================================================================
189
190TopoDS_Shape TNaming_Tool::OriginalShape (const Handle(TNaming_NamedShape)& NS)
191{
192 TNaming_Iterator itL (NS);
193 TopTools_MapOfShape MS;
194 for (; itL.More(); itL.Next()) {
195 MS.Add(itL.OldShape());
196 }
197 return MakeShape(MS);
198}
199
200//=======================================================================
201static void ApplyOrientation (TopTools_MapOfShape& MS,
202 const TopAbs_Orientation OrientationToApply)
203{
204 if (!MS.IsEmpty ()) {
205 TopTools_MapOfShape aMS;
206 aMS.Assign(MS);
207 TopTools_MapIteratorOfMapOfShape it(aMS);
208 for (; it.More(); it.Next()) {
209 if(it.Key().Orientation() != OrientationToApply) {
210 TopoDS_Shape aS = it.Key();
211 MS.Remove(aS);
212 aS.Orientation(OrientationToApply);
213 MS.Add(aS);
214 }
215 }
216 }
217}
218
219//=======================================================================
220//function : CurrentShape
221//purpose :
222//=======================================================================
223
224TopoDS_Shape TNaming_Tool::CurrentShape(const Handle(TNaming_NamedShape)& Att)
225{
226 TopTools_MapOfShape MS;
227 TDF_LabelList Deleted;
228
229 TNaming_Iterator itL (Att);
230 for (; itL.More(); itL.Next()) {
231 const TopoDS_Shape& S = itL.NewShape();
232 if (S.IsNull()) continue;
7dcac1df 233//OR-N
7fd59977 234 Standard_Boolean YaOrientationToApply(Standard_False);
235 TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
236 if(Att->Evolution() == TNaming_SELECTED) {
7dcac1df 237 if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX) {
238 Handle (TNaming_Naming) aNaming;
239 Att->Label().FindAttribute(TNaming_Naming::GetID(), aNaming);
240 if(!aNaming.IsNull()) {
241 if(aNaming->GetName().Type() == TNaming_ORIENTATION) {
242 OrientationToApply = aNaming->GetName().Orientation();
243 } else {
244 Handle (TNaming_Naming) aNaming2;
245 TDF_ChildIterator it(aNaming->Label());
246 for(;it.More();it.Next()) {
247 const TDF_Label& aLabel = it.Value();
248 aLabel.FindAttribute(TNaming_Naming::GetID(), aNaming2);
249 if(!aNaming2.IsNull()) {
250 if(aNaming2->GetName().Type() == TNaming_ORIENTATION) {
251 OrientationToApply = aNaming2->GetName().Orientation();
252 break;
253 }
254 }
255 }
256 }
257 if(OrientationToApply == TopAbs_FORWARD || OrientationToApply == TopAbs_REVERSED)
258 YaOrientationToApply = Standard_True;
259 }
260 }
261 } //
7fd59977 262 TNaming_NewShapeIterator it(itL);
263 if (!it.More()) {
264 MS.Add(S);
265 }
266 else {
267// LastModif(it, MS, S, Deleted);
268 TopTools_MapOfShape MS2; // to be optimized later
269 LastModif(it, MS2, S, Deleted);
270 if (YaOrientationToApply) ApplyOrientation (MS2, OrientationToApply);
271 for (TopTools_MapIteratorOfMapOfShape itMS2(MS2); itMS2.More();itMS2.Next())
272 MS.Add(itMS2.Key());
273 }
274 }
275 return MakeShape (MS);
276}
277
278//=======================================================================
279//function : CurrentShape
280//purpose :
281//=======================================================================
282TopoDS_Shape TNaming_Tool::CurrentShape(const Handle(TNaming_NamedShape)& Att,
283 const TDF_LabelMap& Updated)
284{
285 TDF_Label Lab = Att->Label();
286
287 TopTools_MapOfShape MS;
288 TDF_LabelList Deleted;
289
290 if (!Updated.Contains(Lab)) {
291 return TopoDS_Shape();
292 }
293
294 TNaming_Iterator itL (Att);
295 for (; itL.More(); itL.Next()) {
296 const TopoDS_Shape& S = itL.NewShape();
297 if (S.IsNull()) continue;
7dcac1df 298//OR-N
7fd59977 299 Standard_Boolean YaOrientationToApply(Standard_False);
300 TopAbs_Orientation OrientationToApply(TopAbs_FORWARD);
301 if(Att->Evolution() == TNaming_SELECTED) {
7dcac1df 302 if (itL.More() && itL.NewShape().ShapeType() != TopAbs_VERTEX) {
303 Handle (TNaming_Naming) aNaming;
304 Att->Label().FindAttribute(TNaming_Naming::GetID(), aNaming);
305 if(!aNaming.IsNull()) {
306 if(aNaming->GetName().Type() == TNaming_ORIENTATION) {
307 OrientationToApply = aNaming->GetName().Orientation();
308 } else {
309 Handle (TNaming_Naming) aNaming2;
310 TDF_ChildIterator it(aNaming->Label());
311 for(;it.More();it.Next()) {
312 const TDF_Label& aLabel = it.Value();
313 aLabel.FindAttribute(TNaming_Naming::GetID(), aNaming2);
314 if(!aNaming2.IsNull()) {
315 if(aNaming2->GetName().Type() == TNaming_ORIENTATION) {
316 OrientationToApply = aNaming2->GetName().Orientation();
317 break;
318 }
319 }
320 }
321 }
322 if(OrientationToApply == TopAbs_FORWARD || OrientationToApply == TopAbs_REVERSED)
323 YaOrientationToApply = Standard_True;
324 }
7fd59977 325 }
7dcac1df 326 } //
7fd59977 327 TNaming_NewShapeIterator it(itL);
328 if (!it.More()) {
329 MS.Add(S);
330 }
331 else {
332// LastModif(it, S, MS, Updated, Deleted);
333 TopTools_MapOfShape MS2; // to be optimized later
334 LastModif(it, S, MS2, Updated, Deleted);
335 if (YaOrientationToApply) ApplyOrientation (MS2, OrientationToApply);
336 for (TopTools_MapIteratorOfMapOfShape itMS2(MS2); itMS2.More();itMS2.Next())
337 MS.Add(itMS2.Key());
338 }
339 }
340 return MakeShape (MS);
341}
342
343//=======================================================================
344//function : CurrentNamedShape
345//purpose :
346//=======================================================================
347Handle(TNaming_NamedShape) TNaming_Tool::CurrentNamedShape(const Handle(TNaming_NamedShape)& Att,
348 const TDF_LabelMap& Updated)
349{
350 TopoDS_Shape CS = CurrentShape(Att,Updated);
351 if (CS.IsNull()) {
352 Handle(TNaming_NamedShape) NS;
353 return NS;
354 }
355 return NamedShape(CS,Att->Label());
356}
357
358//=======================================================================
359//function : CurrentNamedShape
360//purpose :
361//=======================================================================
362Handle(TNaming_NamedShape) TNaming_Tool::CurrentNamedShape(const Handle(TNaming_NamedShape)& Att)
363
364{
365 TopoDS_Shape CS = CurrentShape(Att);
366 if (CS.IsNull()) {
367 Handle(TNaming_NamedShape) NS;
368 return NS;
369 }
370 return NamedShape(CS,Att->Label());
371}
372
373//=======================================================================
374//function : FindModifUntil
375//purpose :
376//=======================================================================
377
378static void FindModifUntil (TNaming_NewShapeIterator& it,
379 TopTools_MapOfShape& MS,
380 const Handle(TNaming_NamedShape)& Context)
381{
382 for (; it.More(); it.Next()) {
383 if (!it.Shape().IsNull()) {
384 if (it.NamedShape() == Context) {
385 MS.Add(it.Shape());
386 }
387 else {
388 TNaming_NewShapeIterator it2(it);
389 FindModifUntil (it2,MS,Context);
390 }
391 }
392 }
393}
394
395//=======================================================================
396//function : GeneratedShape
397//purpose :
398//=======================================================================
399TopoDS_Shape TNaming_Tool::GeneratedShape(const TopoDS_Shape& S,
400 const Handle(TNaming_NamedShape)& Generation)
401
402{
403 TopTools_MapOfShape MS;
404 Handle(TNaming_UsedShapes) US;
405 Generation->Label().Root().FindAttribute(TNaming_UsedShapes::GetID(),US);
406
407 for (TNaming_NewShapeIterator it(S,US); it.More(); it.Next()) {
408 if (!it.Shape().IsNull() && it.NamedShape() == Generation) {
409 MS.Add(it.Shape());
410 }
411 }
412 if (MS.IsEmpty()) {
413 TNaming_NewShapeIterator it2(S,US);
414 FindModifUntil (it2,MS,Generation);
415 }
416 return MakeShape (MS);
417}
418
419//=======================================================================
420//function : FirstOlds
421//purpose :
422//=======================================================================
423void TNaming_Tool::FirstOlds (const Handle(TNaming_UsedShapes)& US,
424 const TopoDS_Shape& S,
425 TNaming_OldShapeIterator& it,
426 TopTools_MapOfShape& MS,
427 TDF_LabelList& Labels)
428{
429 Standard_Integer TransDef;
430 Standard_Boolean YaModif = 0;
431
432 for (; it.More(); it.Next()) {
433 if (it.IsModification()) {
434 YaModif = 1;
435 TNaming_OldShapeIterator it2(it);
436 if (!it2.More()) {
437 Labels.Append(TNaming_Tool::Label(US,it.Shape(),TransDef));
438 MS.Add (it.Shape());
439 }
440 else {
441 FirstOlds(US,it.Shape(),it2,MS,Labels);
442 }
443 }
444 }
445 if (!YaModif) MS.Add(S);
446}
447
448//=======================================================================
449//function : InitialShape
450//purpose :
451//=======================================================================
452
453TopoDS_Shape TNaming_Tool::InitialShape(const TopoDS_Shape& S,
454 const TDF_Label& Acces,
455 TDF_LabelList& Labels)
456{
457 Handle(TNaming_UsedShapes) US;
458 Acces.Root().FindAttribute(TNaming_UsedShapes::GetID(),US);
459 TopoDS_Shape Res;
460
461 if (!TNaming_Tool::HasLabel(US,S)) return Res;
462
463 Standard_Integer Transdef;
464 Label(US,S,Transdef);
465 TopTools_MapOfShape MS;
466 TNaming_OldShapeIterator it(S,Transdef,US);
467 if (!it.More()) {
468 return S;
469 }
470 else {
471 FirstOlds(US,S,it,MS,Labels);
472 }
473 return MakeShape(MS);
474}
475
476
477
478//=======================================================================
479//function : Back
480//purpose :
481//=======================================================================
482
483static void Back (const Handle(TNaming_NamedShape)& NS,
484 TNaming_MapOfNamedShape& MNS)
485{
486 for (TNaming_Iterator it(NS); it.More(); it.Next()) {
487 if (it.NewShape().IsNull()) continue;
488 for (TNaming_OldShapeIterator Oldit(it); Oldit.More(); Oldit.Next()) {
489 const TopoDS_Shape& OS = Oldit.Shape();
490 if (!OS.IsNull()) {
491 Handle(TNaming_NamedShape) NOS = TNaming_Tool::NamedShape(OS,NS->Label());
492 // Continue de remonter
493 if (!NOS.IsNull()) {
494 if (MNS.Add(NOS)) Back (NOS,MNS);
495 }
496 }
497 }
498 }
499}
500
501//=======================================================================
502//function : Collect
503//purpose :
504//=======================================================================
505
506void TNaming_Tool::Collect(const Handle(TNaming_NamedShape)& NS,
507 TNaming_MapOfNamedShape& MNS,
508 const Standard_Boolean OnlyModif)
509{
510 MNS.Add(NS);
511 Back (NS,MNS);
512
513 for (TNaming_Iterator it(NS); it.More(); it.Next()) {
514 if (it.NewShape().IsNull()) continue;
515 for (TNaming_NewShapeIterator NewIt(it); NewIt.More(); NewIt.Next()) {
516 if (!OnlyModif || NewIt.IsModification()) {
517 // Continue la descente
518 Collect(NewIt.NamedShape(),MNS,OnlyModif);
519 }
520 }
521 }
522}
523
524
525// Pour DEBUGGER
0797d9d3 526#ifdef OCCT_DEBUG
7fd59977 527
528//=======================================================================
529//function : TNamingTool_Label
530//purpose :
531//=======================================================================
532void TNamingTool_DumpLabel (const TopoDS_Shape& S,
533 const TDF_Label& Acces)
534{
535 Handle(TNaming_NamedShape) NS = TNaming_Tool::NamedShape(S,Acces);
536 NS->Label().EntryDump(cout);
537 cout<<endl;
538}
539
540#include <BRepTools.hxx>
541//=======================================================================
542//function :
543//purpose :
544//=======================================================================
545void TNamingTool_Write (const TopoDS_Shape& S,
546 const Standard_CString File)
547{
548 BRepTools::Write (S,File);
549}
550
551#endif
552
553
7fd59977 554//=======================================================================
555//function : FindShape
556//purpose : ANaming
557//=======================================================================
558
559void TNaming_Tool::FindShape(const TDF_LabelMap& Valid,
560 const TDF_LabelMap& /*Forbiden*/,
561 const Handle(TNaming_NamedShape)& Arg,
562 TopoDS_Shape& S)
563{
564 if (!Valid.IsEmpty() && !Valid.Contains(Arg->Label())) return;
565 if (Arg.IsNull() || Arg->IsEmpty()) return;
566
567 // Which type of shape is being expected?
568 Handle(TNaming_Naming) aNaming;
569 if (!Arg->FindAttribute(TNaming_Naming::GetID(), aNaming)) {
0797d9d3 570#ifdef OCCT_DEBUG
7fd59977 571// cout<<"TNaming_Tool::FindShape(): Naming attribute hasn't been found attached at the Argument label"<<endl;
572#endif
573 return;
574 }
575
576 // Looking for sub shapes of the result shape
577 TopTools_MapOfShape subShapes;
578 TopExp_Explorer anExpl(Arg->Get(), (TopAbs_ShapeEnum)((int)(aNaming->GetName().ShapeType()) + 1));
579 for (; anExpl.More(); anExpl.Next()) subShapes.Add(anExpl.Current());
0797d9d3 580#ifdef OCCT_DEBUG
7fd59977 581// cout<<"TNaming_Tool::FindShape(): Nb of sub shapes = "<<subShapes.Extent()<<endl;
582#endif
583
584 // Looking for external arguments:
585 TNaming_ListOfNamedShape extArgs;
586 TDF_AttributeMap outRefs;
587 TDF_Tool::OutReferences(Arg->Label(), outRefs);
588 if (outRefs.IsEmpty()) {
0797d9d3 589#ifdef OCCT_DEBUG
7fd59977 590// cout<<"TNaming_Tool::FindShape(): No out references have been found"<<endl;
591#endif
592 return;
593 }
594 for (TDF_MapIteratorOfAttributeMap itr(outRefs); itr.More(); itr.Next()) {
595 if (itr.Key()->DynamicType() == STANDARD_TYPE(TNaming_NamedShape)) {
0797d9d3 596#ifdef OCCT_DEBUG
7fd59977 597// Standard_Integer nbExtArgs = extArgs.Extent();
598#endif
599 const Handle(TNaming_NamedShape)& anExtArg = Handle(TNaming_NamedShape)::DownCast(itr.Key());
600 const Handle(TNaming_NamedShape)& aCurrentExtArg = TNaming_Tool::CurrentNamedShape(anExtArg);
601 if (!aCurrentExtArg.IsNull() && !aCurrentExtArg->IsEmpty())
602 extArgs.Append(aCurrentExtArg);
0797d9d3 603#ifdef OCCT_DEBUG
7fd59977 604// if (extArgs.Extent() - 1 == nbExtArgs) {
605// cout<<"TNaming_Tool::FindShape(): An external reference has been found at ";
606// itr.Key()->Label().EntryDump(cout); cout<<endl;
607// }
608#endif
609 }
610 }
611
612 // The iterator on external arguments:
613 TNaming_ListIteratorOfListOfNamedShape extArgsIterator (extArgs);
614 for(; extArgsIterator.More(); extArgsIterator.Next()) {
615 Handle(TNaming_NamedShape) anExtArg = extArgsIterator.Value();
616
617 // Looking for context:
618 Handle(TNaming_NamedShape) aContextNS;
619 if (anExtArg->Label().Father().IsNull() ||
620 !anExtArg->Label().Father().FindAttribute(TNaming_NamedShape::GetID(), aContextNS)) {
621 aContextNS = anExtArg;
0797d9d3 622// #ifdef OCCT_DEBUG
7fd59977 623// cout<<"TNaming_Tool::FindShape(): A context shape hasn't been found at the father label of the external argument"<<endl;
624// #endif
625// continue;
626 }
627
0797d9d3 628#ifdef OCCT_DEBUG
7fd59977 629// cout<<"TNaming_Tool::FindShape(): Searching in the external reference ";
630// aContextNS->Label().EntryDump(cout); cout<<" ";
631#endif
632
633 // Lets find the sub shape of the context which coincides with our sub shapes (subShapes map):
634 TopExp_Explorer explC(aContextNS->Get(), aNaming->GetName().ShapeType()), explSubC;
635 for (; explC.More(); explC.Next()) {
636 Standard_Integer DoesCoincide = 0;
637 const TopoDS_Shape& possibleResult = explC.Current();
638 TopTools_MapOfShape subShapesOfResult;
639 for (explSubC.Init(possibleResult, (TopAbs_ShapeEnum)((int)(aNaming->GetName().ShapeType()) + 1));
640 explSubC.More(); explSubC.Next()) {
641 subShapesOfResult.Add(explSubC.Current());
642 }
643 if (subShapesOfResult.Extent() != subShapes.Extent()) continue;
644 for (TopTools_MapIteratorOfMapOfShape itrR(subShapesOfResult); itrR.More(); itrR.Next()) {
645 for (TopTools_MapIteratorOfMapOfShape itr1(subShapes); itr1.More(); itr1.Next()) {
646 if (itrR.Key().IsSame(itr1.Key())) {
647 DoesCoincide++; //cout<<".";
648 break;
649 }
650 }
651 }
652 if (DoesCoincide == subShapes.Extent()) {
0797d9d3 653#ifdef OCCT_DEBUG
7fd59977 654// cout<<"TNaming_Tool::FindShape(): Found! ";
655#endif
656 S = possibleResult;
657 break;
658 }
659 }
660
661 if (!S.IsNull()) break;
0797d9d3 662#ifdef OCCT_DEBUG
7fd59977 663// cout<<endl;
664#endif
665
666 }
667
0797d9d3 668#ifdef OCCT_DEBUG
7fd59977 669 if (S.IsNull()) {
670 cout<<"TNaming_Tool::FindShape(): There hasn't been found a sub shape of the context shape coinciding with the sub shapes of naming"<<endl;
671 }
672#endif
673
674}