1 // Created on: 1997-09-03
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
23 #include <TNaming_Naming.ixx>
25 #include <TNaming_Builder.hxx>
26 #include <TNaming_Tool.hxx>
27 #include <TNaming_ListIteratorOfListOfNamedShape.hxx>
28 #include <TNaming_Iterator.hxx>
29 #include <TNaming_Scope.hxx>
30 #include <TNaming_NamingTool.hxx>
31 #include <TNaming_Name.hxx>
32 #include <TNaming_Identifier.hxx>
33 #include <TNaming_Localizer.hxx>
34 #include <TNaming_NewShapeIterator.hxx>
35 #include <TNaming_OldShapeIterator.hxx>
36 #include <TNaming_Selector.hxx>
37 #include <TNaming.hxx>
38 #include <TDF_ChildIterator.hxx>
39 #include <TDF_LabelList.hxx>
40 #include <TDF_Data.hxx>
41 #include <TDF_LabelMap.hxx>
42 #include <TDF_TagSource.hxx>
43 #include <TopoDS_Iterator.hxx>
44 #include <TopTools_MapOfShape.hxx>
46 #include <TopExp_Explorer.hxx>
47 #include <TopTools_MapIteratorOfMapOfShape.hxx>
48 #include <Standard_DomainError.hxx>
49 #include <TopTools_ListOfShape.hxx>
50 #include <TopTools_ListIteratorOfListOfShape.hxx>
51 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
52 #include <TColStd_MapOfInteger.hxx>
53 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
54 #include <TopTools_MapIteratorOfMapOfOrientedShape.hxx>
55 #include <TopTools_HArray1OfShape.hxx>
56 #include <BRepTools.hxx>
57 #include <BRep_Tool.hxx>
59 #include <TopoDS_Wire.hxx>
60 #include <TopoDS_Face.hxx>
61 #include <TopoDS_Shell.hxx>
62 #include <TopoDS_Solid.hxx>
63 // #include <TNaming_NCollections.hxx>
64 #include <NCollection_Map.hxx>
65 #include <NCollection_DataMap.hxx>
66 typedef NCollection_Map<TopoDS_Shape> TNaming_MapOfShape;
67 typedef TNaming_MapOfShape::Iterator TNaming_MapIteratorOfMapOfShape;
68 typedef NCollection_DataMap<TopoDS_Shape, TNaming_MapOfShape> TNaming_DataMapOfShapeMapOfShape;
69 typedef TNaming_DataMapOfShapeMapOfShape::Iterator TNaming_DataMapIteratorOfDataMapOfShapeMapOfShape;
70 // The bug concerns access to a null object in the method Filter():
76 #define ALLOW_CHILD_NBS
79 //#define MDTV_DEB_MOD
81 //#define MDTV_DEB_INNS
82 //#define MDTV_DEB_NBS
84 //#define MDTV_DEB_WIN
86 #include <TDF_MapIteratorOfLabelMap.hxx>
87 #include <TCollection_AsciiString.hxx>
88 #include <TDF_Tool.hxx>
89 #include <BRepTools.hxx>
90 #include <TNaming_Tool.hxx>
91 #include <DbgTools.hxx>
94 #include <TDF_Tool.hxx>
95 #include <TDF_MapIteratorOfLabelMap.hxx>
97 #include <TCollection_AsciiString.hxx>
98 #include <BRepTools.hxx>
99 void Print_Entry(const TDF_Label& label)
101 TCollection_AsciiString entry;
102 TDF_Tool::Entry(label, entry);
103 cout << "LabelEntry = "<< entry << endl;
105 static void Write(const TopoDS_Shape& shape,
106 const Standard_CString filename)
109 if(strlen(filename) > 256) return;
110 strcpy (buf, filename);
119 cout << "File " << buf << " was not created: rdstate = " << save.rdstate() << endl;
120 save << "DBRep_DrawableShape" << endl << endl;
121 if(!shape.IsNull()) BRepTools::Write(shape, save);
124 void WriteNSOnLabel(const Handle(TNaming_NamedShape) & NS, const TCollection_AsciiString& Nam)
127 TCollection_AsciiString entry;
128 TDF_Tool::Entry(NS->Label(), entry);
129 TopoDS_Shape Sh = TNaming_Tool::GetShape (NS);
131 TCollection_AsciiString Entry = Nam + entry + ".brep";
132 Write(Sh, Entry.ToCString());
135 cout << "WriteNSOnLabel>>> TopoDS_Shape IS NULL on Entry = "<< entry << endl;
138 cout << "WriteNSOnLabel >>> NamedShape IS NULL" << endl;
140 //=======================================================================
141 static void Write(const TopTools_MapOfShape& MS, const Standard_CString filename)
143 if (!MS.IsEmpty ()) {
144 TCollection_AsciiString aNam (filename);
145 Standard_Integer i(0);
146 TopTools_MapIteratorOfMapOfShape it(MS);
147 for(;it.More();it.Next(),i++) {
148 TCollection_AsciiString aName = aNam + "_" + i + ".brep";
149 Write ( it.Key(), aName.ToCString());
155 //==========================================================================================
156 static Handle(TNaming_NamedShape) BuildName (const TDF_Label& F,
158 const TopoDS_Shape& S,
159 const TopoDS_Shape& Context,
160 const Handle(TNaming_NamedShape)& Stop,
161 const Standard_Boolean Geometry);
163 //=======================================================================
164 static Standard_Integer RepeatabilityInContext(const TopoDS_Shape& Selection,
165 const TopoDS_Shape& Context);
166 //=======================================================================
167 extern Standard_Boolean IsEqual (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
169 //=======================================================================
171 //purpose : voir avec YFR comment retrouver le bon resulat et le mettre
172 // : dans le NamedShape de L
173 //=======================================================================
174 Standard_Boolean TNaming_Naming::Solve (TDF_LabelMap& Valid)
176 Handle(TNaming_Naming) subname;
177 for (TDF_ChildIterator it (Label(),Standard_False); it.More(); it.Next()) {
179 TCollection_AsciiString anEntry;
180 TDF_Tool::Entry(it.Value(), anEntry);
181 cout << "TNaming_Naming::Solve: Label to be solved = " << anEntry << endl;
183 if (it.Value().FindAttribute(TNaming_Naming::GetID(),subname)) {
184 if (!subname->Solve (Valid)) {
185 return Standard_False; // not necessary to continue
190 TDF_MapIteratorOfLabelMap anItr(Valid);
191 cout << "TNaming_Naming::Solve:: Valid label Map" << endl;
192 for (; anItr.More(); anItr.Next()) {
193 const TDF_Label& aLabel = anItr.Key();
194 TCollection_AsciiString anEntry;
195 TDF_Tool::Entry(aLabel, anEntry);
196 cout << "Label = " << anEntry << endl;
199 if (Regenerate(Valid)) {
200 if (!Valid.IsEmpty()) Valid.Add(Label());
201 return Standard_True;
203 return Standard_False;
207 //=======================================================================
210 //=======================================================================
212 const Standard_GUID& TNaming_Naming::GetID ()
214 static Standard_GUID TNaming_NamingID("c0a19201-5b78-11d1-8940-080009dc3333");
215 return TNaming_NamingID;
218 //=======================================================================
221 //=======================================================================
223 Handle(TNaming_Naming) TNaming_Naming::Insert (const TDF_Label& under)
225 Handle(TNaming_Naming) N;
226 TDF_Label child = TDF_TagSource::NewChild(under);
227 N = new TNaming_Naming ();
228 child.AddAttribute (N);
232 //=======================================================================
234 //purpose : returns a new NamedShape, which is built as selection:
235 // : TNaming_Builder::Select("S","S") at the new child label of the label <F>.
236 //=======================================================================
238 static Handle(TNaming_NamedShape) BuildNS (const TDF_Label& F,
239 const TopoDS_Shape& S,
240 const TNaming_NameType& Name)
242 Handle (TNaming_Naming) Naming = TNaming_Naming::Insert (F);
244 TNaming_Name& theName = Naming->ChangeName();
245 theName.ShapeType(S.ShapeType());
248 TNaming_Builder B(Naming->Label());
250 return B.NamedShape();
253 //=======================================================================
254 //function : FindIndex
256 //=======================================================================
258 static Standard_Integer FindIndex(const Handle(TNaming_NamedShape)& NS,
259 const TopoDS_Shape& S)
261 TDF_LabelList Labels;
262 TopoDS_Shape IS = TNaming_Tool::InitialShape(S,NS->Label(),Labels);
263 Standard_Integer Index = 1;
264 for (TNaming_Iterator itNS(NS); itNS.More(); itNS.Next(),Index++) {
265 if (IS.IsSame(itNS.NewShape())) break;
271 //=======================================================================
272 //function : CompareInGeneration
273 //purpose : returns true, only if the specified NS contains only <S> in
274 // : the "new shapes" set.
275 //=======================================================================
277 static Standard_Boolean CompareInGeneration (const Handle(TNaming_NamedShape)& NS,
278 const TopoDS_Shape& S)
280 for (TNaming_Iterator it(NS); it.More(); it.Next()) {
281 if (!it.NewShape().IsSame(S)) return 0;
288 //=======================================================================
289 //function : GetShapeEvolutions
290 //purpose : returns Standard_True, if target has parent in source; list contains inheritance chain
291 //=======================================================================
292 static Standard_Boolean GetShapeEvolutions(const TopoDS_Shape& theTarget, // this is changed in recursion
293 const Handle(TNaming_NamedShape)& theSource,
294 TopTools_ListOfShape& aList) // returns list in the backward order
296 Handle(TNaming_NamedShape) aTarget = TNaming_Tool::NamedShape(theTarget,theSource->Label());
297 if (!aTarget.IsNull()) {
299 cout <<"GetShapeEvolutions: target NS = ";
300 Print_Entry(aTarget->Label());
301 cout <<"GetShapeEvolutions: Source NS = ";
302 Print_Entry(theSource->Label());
303 TCollection_AsciiString aNam("GetShapeEvolutions");
304 WriteNSOnLabel(aTarget,aNam);
306 if (aTarget->Label() == theSource->Label()) return Standard_True; // check if target is in the source
307 } else return Standard_False;
309 TNaming_Iterator anIter(aTarget);
310 for(;anIter.More();anIter.Next()) { // check all appropriate old shapes of target
312 if(!anIter.OldShape().IsNull()) {
313 Write(anIter.OldShape(), "Target_OldS.brep");
314 cout <<"Target OldS TS =" <<anIter.OldShape().TShape()->This() <<endl;
316 if(!anIter.NewShape().IsNull()) {
317 Write(anIter.NewShape(), "Target_NewS.brep");
318 cout <<"Target NewS TS =" <<anIter.NewShape().TShape()->This() <<endl;
321 if (anIter.OldShape().IsNull() || anIter.NewShape().IsNull()) continue;
322 if (!anIter.NewShape().IsSame(theTarget)) continue;
323 if (GetShapeEvolutions(anIter.OldShape(),theSource,aList)) { // recursion: now target is old shape
324 aList.Append(theTarget); // if oldshape has the source as parent (or belongs to it) , fill the list
325 return Standard_True;
328 return Standard_False;
331 //=======================================================================
332 //function : CompareInModification
333 //purpose : returns empty named shape if naming is already done
334 //=======================================================================
336 static Handle(TNaming_NamedShape) CompareInModification (const Handle(TNaming_NamedShape)& NS, // parent
337 const TopoDS_Shape& S) // target
339 Handle(TNaming_NamedShape) aResult;
340 if (S.IsNull() || NS.IsNull()) return aResult;
342 cout <<"CompareInModification: parent NS = ";
343 Print_Entry(NS->Label());
344 Write(S, "CompareInM_S.brep");
345 TCollection_AsciiString aNam("CompareInM");
346 WriteNSOnLabel(NS,aNam);
348 Handle(TNaming_NamedShape) aSource; // parent NamedShape, which can be found by TopoDS shape
349 TNaming_Iterator anIt(NS);
350 for(;anIt.More() && aSource.IsNull();anIt.Next()) {
351 if (!anIt.NewShape().IsNull()) {
352 aSource = TNaming_Tool::NamedShape(anIt.NewShape(),NS->Label());
354 TCollection_AsciiString aNam("CompareInM_Source");
355 WriteNSOnLabel(aSource,aNam);
359 // searching for 1:n to the same label modifications (in this case current naming is insufficient)
360 TopTools_ListOfShape aList;
361 if (GetShapeEvolutions(S,aSource,aList) && aList.Extent() > 0) {
362 TopTools_ListIteratorOfListOfShape anIter(aList);
363 for(;anIter.More();anIter.Next()) {
364 aResult = TNaming_Tool::NamedShape(anIter.Value(),NS->Label());
365 if (aResult->Evolution()!=TNaming_MODIFY) { // evolution must be modify, otherwise everything is OK
369 TopTools_MapOfShape aMap; // collection of the old shapes of the shape from list
370 TNaming_Iterator aNIter1(aResult);
372 for(;aNIter1.More();aNIter1.Next()) {
373 if (aNIter1.NewShape().IsSame(anIter.Value())) {// if isSame
374 aMap.Add(aNIter1.OldShape());
377 TNaming_Iterator aNIter2(aResult); // if some another shapes has oldshape from map, return namedshape with this oldshape
379 for(;aNIter2.More();aNIter2.Next()) {
380 if (aNIter2.NewShape().IsSame(anIter.Value())) continue;
381 if (aMap.Contains(aNIter2.OldShape())) { // if one shape was modified to the two at the shared label, return this one
382 aResult = TNaming_Tool::NamedShape(aNIter2.OldShape(),NS->Label());
383 if (!aResult.IsNull()) return aResult;
393 //=======================================================================
394 static Standard_Boolean FillSMap(const TopoDS_Shape& S, TopTools_MapOfShape& MS)
396 if(S.IsNull()) return Standard_False;
397 Standard_Boolean isHomogen(Standard_True);
398 TopAbs_ShapeEnum aPrevType(TopAbs_SHAPE);
399 TopoDS_Iterator it(S);
400 for (; it.More(); it.Next()) {
401 const TopAbs_ShapeEnum aType = it.Value().ShapeType();
403 cout <<"TestSolution_FillMap: S_Type = :" << it.Value().ShapeType() <<" TShape = " << it.Value().TShape()->This() <<endl;
405 if(aType > TopAbs_COMPSOLID) {
407 if(aPrevType == TopAbs_SHAPE)
409 else if(aPrevType != aType)
410 isHomogen = Standard_False;
413 if(!FillSMap(it.Value(), MS))
414 isHomogen = Standard_False;
418 //=======================================================================
420 //purpose : checks naming of the shape <S> in the NamedShape <NS>.
421 // : Returns true, if it's correct. Details ==>
422 // : The method takes all modifications of the "NS" (see CurrentShape method),
423 // : which are in the "MDF" (if it's not empty) before <Stop> shape and check them.
424 // : whether these modifications contain only "S". If yes then the method
425 // : returns true, otherwise it returns false.
426 //=======================================================================
428 static Standard_Boolean Compare (const Handle(TNaming_NamedShape)& NS,
429 const TNaming_Scope& MDF,
430 const Handle(TNaming_NamedShape)& Stop,
431 const TopoDS_Shape& S)
433 TDF_LabelMap Forbiden;
434 TopTools_MapOfShape MS;
435 if (!Stop.IsNull()) TNaming_NamingTool::BuildDescendants(Stop,Forbiden);
436 TNaming_NamingTool::CurrentShape(MDF.GetValid(),Forbiden,NS,MS);
438 Write(S, "Compare_S.brep");
439 cout << "S: TShape = " <<S.TShape()->This() <<endl;
440 Standard_Integer i =1;
441 TopTools_MapIteratorOfMapOfShape it(MS);
442 TCollection_AsciiString aNam("Compare_MS_");
443 TCollection_AsciiString ext(".brep");
444 for(;it.More();it.Next(), i++) {
445 TCollection_AsciiString aName = aNam + i + ext;
446 Write(it.Key(), aName.ToCString()) ;
447 cout << aName.ToCString()<< ": TShape = " <<it.Key().TShape()->This() <<endl;
450 return (MS.Contains(S) && MS.Extent() == 1);
452 //=======================================================================
453 //function : TestSolution
454 //purpose : returns true, if last modification of shape from "NS" is equal to "S":
455 // : If shape "S" has atomic type (TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX),
456 // : then returns S.IsSame(shape from "NS").
457 // : Otherwise the result of exploration of these shapes must be same.
458 //=======================================================================
460 static Standard_Boolean TestSolution(const TNaming_Scope& MDF,
461 const Handle(TNaming_NamedShape)& NS,
462 const TopoDS_Shape& S)
465 if (NS.IsNull()) return Standard_False;
466 TopoDS_Shape Res = MDF.CurrentShape(NS);// last modification of NS taken into account Valid map
467 if(S.IsNull() || Res.IsNull()) return Standard_False;
469 Write(S, "TSol_S.brep");
470 Write(Res, "TSol_Res.brep");
474 if ((S.ShapeType() == TopAbs_FACE ||
475 S.ShapeType() == TopAbs_EDGE ||
476 S.ShapeType() == TopAbs_VERTEX ) &&
477 Res.ShapeType() != TopAbs_COMPOUND) {
478 return (Res.IsSame(S));
479 } else if (S.ShapeType() == TopAbs_SOLID ||
480 S.ShapeType() == TopAbs_COMPSOLID) {
481 TopTools_MapOfShape aMS;
483 for (exp.Init(S,TopAbs_FACE) ; exp.More(); exp.Next()) {
484 aMS.Add(exp.Current());
486 for (exp.Init(Res,TopAbs_FACE) ; exp.More(); exp.Next()) { //content of MS and Res should be the same
487 if (aMS.Contains(exp.Current())) {
488 aMS.Remove(exp.Current());
492 return aMS.IsEmpty();
497 if (S.ShapeType() == TopAbs_SOLID ||
498 S.ShapeType() == TopAbs_FACE ||
499 S.ShapeType() == TopAbs_EDGE ||
500 S.ShapeType() == TopAbs_VERTEX ) {
501 return (Res.IsSame(S));
507 TopTools_MapOfShape MS;
508 Standard_Boolean isHom = FillSMap(S, MS);
509 TopAbs_ShapeEnum aType(TopAbs_SHAPE);
510 TColStd_MapOfInteger aView;
511 TopTools_MapIteratorOfMapOfShape itm(MS);
512 for(;itm.More();itm.Next()) {
513 aType = itm.Key().ShapeType();
517 aView.Add(itm.Key().ShapeType());
520 if (MS.Contains(Res)) {
522 if (MS.IsEmpty()) return 1;
524 if (Res.ShapeType() == TopAbs_SOLID ||
525 Res.ShapeType() == TopAbs_COMPSOLID ||
526 Res.ShapeType() == TopAbs_COMPOUND)
530 for (exp.Init(Res,aType) ; exp.More(); exp.Next()) {
531 if (MS.Contains(exp.Current())) {
532 MS.Remove(exp.Current());
535 TColStd_MapIteratorOfMapOfInteger itm(aView);
536 for(;itm.More();itm.Next()) {
537 TopAbs_ShapeEnum aType = (TopAbs_ShapeEnum)itm.Key();
538 for (exp.Init(Res,aType) ; exp.More(); exp.Next()) {
539 if (MS.Contains(exp.Current())) {
540 MS.Remove(exp.Current());
547 return Standard_True;
548 TopoDS_Iterator it(Res);
549 for (; it.More(); it.Next()) { //content of MS and Res should be the same
550 if (MS.Contains(it.Value())) {
551 MS.Remove(it.Value());
560 //=======================================================================
561 //function : FindNewShapeInFather
563 //=======================================================================
565 static void FindNewShapeInFather (const Handle(TNaming_NamedShape)& NS,
568 TDF_Label Father = NS->Label().Father();
569 TNaming_Iterator itLab(Father);
570 for (; itLab.More(); itLab.Next()) {
571 SC= itLab.NewShape();
576 //=======================================================================
577 //function : NextModif
579 //=======================================================================
581 static Handle(TNaming_NamedShape) NextModif(const Handle(TNaming_NamedShape)& NS)
583 Handle (TNaming_NamedShape) Next;
585 TNaming_NewShapeIterator it(NS);
586 if (it.More()&& it.IsModification()) Next = it.NamedShape();
590 //=======================================================================
591 // C1 - cand shape of the father, C2 - shape of rebuild child Naming attr.
592 // (to be Compound of elementary shapes)
593 //=======================================================================
594 static Standard_Boolean IsContSame(const TopoDS_Shape& C1, const TopoDS_Shape& C2)
596 Standard_Boolean aRes(Standard_False);
597 if(!C1.IsNull() && !C2.IsNull()) {
598 TopTools_MapOfShape aMap;
599 if(FillSMap(C1, aMap)) {
600 aRes = Standard_True;
601 TopoDS_Iterator it(C2);
602 for(;it.More();it.Next()) {
603 if(!aMap.Contains(it.Value())) {
604 aRes = Standard_False;
613 //=======================================================================
614 // Identifies the case when Filter haven't sense because of multiplicity
615 //=======================================================================
616 static Standard_Boolean IsMultipleCase(const TopoDS_Shape& S,
617 const TopoDS_Shape& Context,
618 const TopTools_MapOfShape& Neighbourgs) {
620 TopTools_IndexedDataMapOfShapeListOfShape aDM;
621 TNaming_MapOfShape aM;
622 TopTools_MapOfShape aNbs;
623 aNbs.Assign(Neighbourgs);
625 TNaming_DataMapOfShapeMapOfShape aDMM;
626 TopExp::MapShapesAndAncestors (Context, TopAbs_EDGE, TopAbs_FACE, aDM);
627 TopTools_MapIteratorOfMapOfShape it(aNbs);
628 for(;it.More();it.Next()) {
629 if(aDM.Contains(it.Key())) {
630 TNaming_MapOfShape aMS;
631 const TopTools_ListOfShape& aL = aDM.FindFromKey(it.Key());
632 TopTools_ListIteratorOfListOfShape lit(aL);
633 for(;lit.More();lit.Next()) {
635 aMS.Add(lit.Value());
638 aDMM.Bind(it.Key(), aMS);
641 cout << "Key is not BOUND!" <<endl;
643 return Standard_False;
647 Standard_Boolean isCommon(Standard_True);
648 TNaming_MapIteratorOfMapOfShape itm(aM);
649 for(;itm.More();itm.Next()) {
650 isCommon = Standard_True; // statement: this shape (itm.Key()) is common (to be checked below)
651 TNaming_DataMapIteratorOfDataMapOfShapeMapOfShape itdm(aDMM);
652 for (;itdm.More();itdm.Next()) {
653 const TNaming_MapOfShape& aMap = itdm.Value();
654 if(!aMap.Contains(itm.Key())) {
655 isCommon = Standard_False;
659 if(isCommon) break; // common single face found
661 if(isCommon && aM.Extent() < aNbs.Extent()) {// number of unique faces (to have single solution)
662 //should be at least no less than (Nb of Neighbourgs) +1
663 return Standard_True;
665 return Standard_False;
667 //=======================================================================
669 //purpose : sets the name with type "FILTERBYNEIGHBOURGS" and returns true,
670 // : if it was correctly done.
673 //=======================================================================
675 static Standard_Boolean Filter (const TDF_Label& F,
677 const TopoDS_Shape& S,
678 const TopoDS_Shape& Context,
679 TNaming_Localizer& Localizer,
680 Handle(TNaming_NamedShape)& NS,
681 const Standard_Integer Lev)
683 // 1. Localizer.FindNeighbourg("Context", "S", "Neighbourg") - looks for neighbourgs of "S" with the same shape type in the "Context"
684 // shape and adds them to the "Neighbourg" map;
685 // 2. If "Neighbourg" map is empty, tries to do the same with the new context shape: shape from the father label of the "S" named shape;
686 // 3. If "Neighbourg" map is still empty, returns false;
687 // 4. Adds to the new child of label "L" new TNaming_Naming attribute with the next properties name: shape type is shape type of the "S",
688 // type is TNaming_FILTERBYNEIGHBOURGS, stop shape ( "Until" ) is "Context" of corresponding NamedShape;
689 // first argument of name is "NS" NamedShape.
690 // 5. Adds to the Name all shapes from "Neighbourg" map: build it with the BuildName( new generated TNaming_Naming attribute, MDF,
691 // argument shape from "Neighbourg", "Context", NextModif( "Until" ), true ) method.
692 // 6. Creates resulting NamedShape with the "Regenerate" ( it just calls TName::Solve method ) method from TNaming_Naming class.
693 // 7. If Compare( result NamedShape, MDF, stop, "S" ) returns true, "Filter" method returns true, else returns false.
695 //------------------------------
696 // Construction des voisins ==> of neighbors.
697 //------------------------------
698 Standard_Integer aLev(Lev);
699 TopTools_MapOfShape Neighbourg;
700 Localizer.FindNeighbourg (Context,S,Neighbourg);
702 //DbgTools::DisplayShape(Context, F, Quantity_NOC_GREEN);
703 //DbgTools::DisplayShape(S, F, Quantity_NOC_BLUE1);
704 Write(Context, "FNBS_Context.brep");
705 Write(S, "FNBS_S.brep");
706 Write(Neighbourg, "NBS");
709 // mpv : NS and shape must be the same
710 Standard_Boolean isIn = Standard_False;
711 TNaming_Iterator anIter(NS);
712 for(;anIter.More();anIter.Next()) {
714 //DbgTools::DisplayShape(anIter.NewShape(), F, Quantity_NOC_RED);
716 if (anIter.NewShape().IsSame(S)) {
717 isIn = Standard_True;
721 if (!isIn) if (!TNaming_Tool::NamedShape(S,F).IsNull()) NS = TNaming_Tool::NamedShape(S,F);
722 // if (!TNaming_Tool::NamedShape(S,F).IsNull()) NS = TNaming_Tool::NamedShape(S,F);
725 if (Neighbourg.IsEmpty()) {
726 // Recherche du vrai context. (Research of context truth)
727 Handle(TNaming_NamedShape) GenS = TNaming_Tool::NamedShape(S,NS->Label());
729 if (GenS.IsNull()) return Standard_False;
731 TDF_Label Father = (GenS->Label()).Father();
732 Father.FindAttribute(TNaming_NamedShape::GetID(),GenS);
733 TopoDS_Shape GoodContext = TNaming_Tool::GetShape(GenS);
734 Localizer.FindNeighbourg (GoodContext,S,Neighbourg);
738 if (Neighbourg.IsEmpty()) {
740 cout <<"FindNeighbourg: impossible"<<endl;
745 Write(Neighbourg, "Neighbourgs");
748 //cout <<"Filter: Lev = " << aLev << endl;
750 if(aLev > 3) return 0;
751 #ifdef ALLOW_CHILD_NBS
752 Handle(TNaming_Naming) aFNaming;
753 TopoDS_Shape aFatherCandSh;
754 F.FindAttribute(TNaming_Naming::GetID(), aFNaming);
755 if(!aFNaming.IsNull()) {
756 const TNaming_Name& aName = aFNaming->GetName();
757 if (aName.Type() == TNaming_FILTERBYNEIGHBOURGS) {
758 aFatherCandSh = aName.Arguments().First()->Get();
761 if(S.ShapeType() == TopAbs_EDGE && aFatherCandSh.IsNull()) {
762 //check the applicability
763 if(!NS.IsNull() && !NS->Get().IsNull() && NS->Get().ShapeType() == TopAbs_COMPOUND)
764 if(IsMultipleCase(S, Context, Neighbourg)) {
765 //cout << "Filter: ==> MultipleCase!" << endl;
766 NS->Label().FindAttribute(TNaming_Naming::GetID(), aFNaming);
767 if(!aFNaming.IsNull()) {
768 TNaming_Name& aName = aFNaming->ChangeName();
769 if (aName.Type() == TNaming_INTERSECTION) {
770 Standard_Integer ij(1);
771 TNaming_ListIteratorOfListOfNamedShape itA(aName.Arguments());
772 for (; itA.More(); itA.Next(), ij++) {
773 const TopoDS_Shape& aFace = TNaming_Tool::CurrentShape(itA.Value());
775 Write(aFace, "First_Face.brep");
776 cout <<"Selection TS = " << S.TShape()->This() <<endl;
778 Standard_Integer i(1), indxW(0),indxE(0),nbW(0),nbE(0), indxF(0);
779 Standard_Boolean isFound(Standard_False);
780 TopoDS_Iterator it(aFace);
781 for (;it.More();it.Next(),i++) {
784 Write(it.Value(), "First_Wire.brep");
787 Standard_Integer j(1);
788 TopoDS_Iterator it2(it.Value());
789 for (;it2.More();it2.Next(),j++) {
792 Write(it2.Value(), "First_Wire.brep");
793 cout <<"Edge TS = " << it2.Value().TShape()->This() <<endl;
795 if(S.IsEqual(it2.Value())) {
799 isFound = Standard_True;
805 Standard_Integer Index = indxE & 0x000000FF;
806 Index = Index | (nbE << 8);
807 Index = Index | (indxW << 16);
808 Index = Index | (nbW << 20);
809 Index = Index | (indxF << 24);
811 //------------------------------
812 // Compute the TNaming_NamedShape
813 //------------------------------
814 aFNaming->Regenerate(MDF.ChangeValid());
815 aFNaming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
816 Handle (TNaming_NamedShape) Until = TNaming_Tool::NamedShape(Context,NS->Label());
817 Handle (TNaming_NamedShape) Stop = NextModif(Until);
818 if (Compare (NS,MDF,Stop,S)) return 1;
829 //-----------------------------------------------------
830 // Construction function de naming. et insertion sous F
831 //-----------------------------------------------------
832 Handle (TNaming_Naming) NF = TNaming_Naming::Insert (F);
834 Handle (TNaming_NamedShape) Until = TNaming_Tool::NamedShape(Context,NS->Label());
835 Handle (TNaming_NamedShape) Stop = NextModif(Until);
836 TNaming_Name& theName = NF->ChangeName();
837 theName.ShapeType(S.ShapeType());
839 theName.Type(TNaming_FILTERBYNEIGHBOURGS);
841 theName.StopNamedShape (Until);
843 cout << "FilterByNBS: ";
844 Print_Entry(NF->Label());
845 cout <<"AppendNS = " ;
846 Print_Entry(NS->Label());
848 //---------------------
849 // Naming des voisins.
850 //---------------------
852 TopTools_MapIteratorOfMapOfShape itN(Neighbourg);
853 for (; itN.More(); itN.Next()) {
854 #ifdef ALLOW_CHILD_NBS
855 const TopoDS_Shape& aS = itN.Key();
856 Handle (TNaming_NamedShape) aNS =
857 BuildName(NF->Label(), MDF, aS, Context, Stop, 1);
859 const TopoDS_Shape& aS2 = aNS->Get();
861 cout << "Shape arg type = " << aS.ShapeType() <<" TSH = " << aS.TShape()->This()<<endl;
863 cout << "Build shape type = " << aS2.ShapeType() <<" TSH = " << aS2.TShape()->This()<<endl;
864 Write (aS2, "NBS_BuildShape.brep");
867 cout <<"AppendNS = " ;
868 Print_Entry(aNS->Label());
872 const TopoDS_Shape aSNS = aNS->Get(); //allow child level
873 Standard_Boolean allowChild(Standard_True);
874 if(!aSNS.IsNull() && aSNS.ShapeType() == TopAbs_COMPOUND && !aFatherCandSh.IsNull())
875 allowChild = !IsContSame(aFatherCandSh, aSNS);
876 if(allowChild && !aSNS.IsNull() && aS.ShapeType() != aSNS.ShapeType() &&
877 aSNS.ShapeType() == TopAbs_COMPOUND)
880 cout <<"Father label = ";
881 Print_Entry(aNS->Label().Father());
882 Write(aS,"SelectionS.brep");
883 Write(aSNS,"SelectionSNS.brep");
885 Handle(TNaming_Naming) aNaming;
886 Standard_Boolean StandardFilter(Standard_True);
887 aNS->FindAttribute(TNaming_Naming::GetID(), aNaming);
888 if(!aNaming.IsNull()) {
889 const TNaming_Name& aName = aNaming->GetName();
890 if (aName.Type() == TNaming_GENERATION)
891 StandardFilter = Standard_False;
893 if (!Compare (aNS,MDF,Stop,aS)) {
894 TNaming_Localizer aLocalizer;
895 Filter (NF->Label(), MDF,aS,Context, aLocalizer,aNS, aLev);
901 theName.Append(BuildName(NF->Label(), MDF, itN.Key(), Context, Stop, 1));
904 //------------------------------
905 // Compute the TNaming_NamedShape
906 //------------------------------
907 NF->Regenerate(MDF.ChangeValid());
908 NF->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
913 if (Compare (NS,MDF,Stop,S)) return 1;
915 cout <<"TNaming_Naming::Name Filter insufficient"<<endl;
921 //=======================================================================
922 //function : BuildNameInNS
923 //purpose : Calls BuildName method, but with new context and new stop shape.
924 // : Context is searched at the father label of the "Context" label :
925 // : old shapes from the NamedShape at the defined father label.
926 // : If it's impossible, then "S" set as context.
927 // : If "S" is in new context, then stop shape is named shape,
928 // : which belongs to the father label of the "Context" named shape.
929 // : For example, face (F2) of prism (P) is generated from the edge (E)
930 // : of primitive face (F1) of box (B). F2 is named as GENERATION from E.
931 // : Naming of E is done with help BuildNameInNS function:
932 // : with context B and stop shape P.
933 //=======================================================================
934 static Handle(TNaming_NamedShape) BuildNameInNS (const TDF_Label& F,
936 const TopoDS_Shape& S,
937 const Handle(TNaming_NamedShape)& Context,
938 const Handle(TNaming_NamedShape)& Stop,
939 const Standard_Boolean Geometry)
942 // il faut determiner un nouveau context et un nouveau Stop.
943 // it is necessary to determine a new context and a new Stop
945 Handle(TNaming_NamedShape) NewStop = Stop;
947 TNaming_Localizer::FindShapeContext (Context,S,SC);
950 // <Context> is Ident.NamedShapeOfGeneration() ==
951 TDF_Label Father = Context->Label().Father();
952 Father.FindAttribute(TNaming_NamedShape::GetID(),NewStop);
955 {cout <<" Stop NS : "; Print_Entry( Stop->Label());}
956 if(!NewStop.IsNull())
957 {cout <<" NewStop : "; Print_Entry( NewStop->Label());}
958 cout <<"ContextLabel: "; Print_Entry( Context->Label());
959 cout <<"Father : "; Print_Entry( Father);
964 cout <<"BuildNameInNS:: NewStop shape is NULL" << endl;
966 return BuildName (F,MDF,S,SC,NewStop,Geometry);
969 //=======================================================================
972 //=======================================================================
974 static Handle(TNaming_NamedShape) BuildName (const TDF_Label& F,
976 const TopoDS_Shape& Selection,
977 const TopoDS_Shape& Context,
978 const Handle(TNaming_NamedShape)& Stop,
979 const Standard_Boolean Geom)
984 // Create an identifier
985 Standard_Boolean OnlyOne = !Geom;
986 Standard_Boolean IsGeneration = Standard_False;
988 cout <<"BuildName: F => ";
990 cout <<" Selection type = " << Selection.ShapeType() << " TS = " << Selection.TShape()->This() << endl;
991 Write(Selection, "BName_Selection.brep");
992 Write(Context, "BName_Context.brep");
994 TNaming_Identifier Ident(F, Selection, Context,OnlyOne);
996 Handle (TNaming_Naming) Naming;
997 Handle (TNaming_NamedShape) NS;
999 if (!Ident.IsDone()) {
1000 return BuildNS (F,Selection, TNaming_UNKNOWN);
1002 if (Ident.IsFeature() && Stop.IsNull()) {
1006 if (!OnlyOne) return Ident.FeatureArg();
1007 else NS = Ident.FeatureArg();
1010 //---------------------------------------------
1011 // Construction de la fonction d identification.
1012 //---------------------------------------------
1013 //Standard_Boolean NotOnlyOne = 0;
1015 Naming = TNaming_Naming::Insert(F);
1017 TNaming_Name& theName = Naming->ChangeName();
1018 theName.ShapeType(Selection.ShapeType());
1019 theName.Shape(Selection);
1020 theName.Type(Ident.Type());
1022 cout <<"BuildName: Inserted Naming Att at ";
1023 Print_Entry(Naming->Label());
1024 cout <<" NameType = " << theName.Type() <<endl;
1026 if (Ident.IsFeature()) {
1027 theName.Append(Ident.FeatureArg());
1029 if (theName.Type() == TNaming_GENERATION) {
1030 theName.Append(Ident.NamedShapeOfGeneration());
1031 IsGeneration = Standard_True;
1033 if (theName.Type() == TNaming_CONSTSHAPE) {
1034 theName.Index(FindIndex(Ident.FeatureArg(),Selection));
1036 //------------------------------------
1037 // Renseignement du NamedShape d arret.
1038 //------------------------------------
1039 theName.StopNamedShape (Stop);
1041 if(!Stop.IsNull()) {
1042 TCollection_AsciiString Es;
1043 TDF_Tool::Entry(Stop->Label(), Es);
1044 cout <<"StopNS at Label = "<< Es << endl;
1047 //---------------------------------
1048 // Identification des arguments.
1049 //---------------------------------
1051 for (Ident.InitArgs(); Ident.MoreArgs(); Ident.NextArg()) {
1052 if (Ident.ArgIsFeature()) {
1053 theName.Append(Ident.FeatureArg());
1055 if(!Ident.FeatureArg().IsNull()) {
1056 TCollection_AsciiString E;
1057 TDF_Tool::Entry(Ident.FeatureArg()->Label(), E);
1058 cout <<"Added argument NS from Label = "<< E << endl;
1064 cout <<"BuildName: NameType = " <<theName.Type() << " NS ";
1065 Print_Entry(Naming->Label());
1066 cout <<"Ident.ShapeArg() type = " << Ident.ShapeArg().ShapeType() << " TS = " << Ident.ShapeArg().TShape()->This() << endl;
1067 Write(Ident.ShapeArg(), "BName_ShapeArg.brep");
1069 if (theName.Type() == TNaming_GENERATION)
1070 theName.Append(BuildNameInNS(Naming->Label(),MDF,Ident.ShapeArg(),Ident.NamedShapeOfGeneration(),Stop,Geom));
1072 theName.Append(BuildName(Naming->Label(),MDF,Ident.ShapeArg(),Context,Stop,Geom));
1076 //------------------------
1077 // Reconstruction of Name
1078 //------------------------
1079 Naming->Regenerate(MDF.ChangeValid());
1081 TCollection_AsciiString E2;
1082 TDF_Tool::Entry(Naming->Label(), E2);
1083 cout <<"Regenerated Naming Att at Label = "<< E2 << endl;
1085 Naming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
1086 if(NS.IsNull()) return NS;
1087 if (MDF.WithValid()) MDF.Valid(NS->Label());
1090 TCollection_AsciiString E;
1091 TDF_Tool::Entry(NS->Label(), E);
1092 cout <<"Regenerated NS at Label = "<< E << endl;
1098 //-------------------------------------------------
1099 // Filtre par les voisins
1100 // pour construire le nom correspondant a S.
1101 //-------------------------------------------------
1104 if(NS.IsNull()) return NS;
1107 TNaming_Localizer Localizer;
1108 TNaming_Iterator itNS(NS);
1116 Standard_Boolean StandardFilter = !IsGeneration;
1118 if (!CompareInGeneration (NS,Selection)) {
1120 TopoDS_Shape NewContext;
1121 Handle(TNaming_NamedShape) NewStop;
1122 FindNewShapeInFather (Ident.NamedShapeOfGeneration(),NewContext);
1123 Filter (F,MDF,Selection,NewContext,Localizer,NS,0);
1125 } else if (Ident.Type() == TNaming_MODIFUNTIL ||
1126 (Ident.Type() == TNaming_INTERSECTION && Naming->ChangeName().Arguments().Extent() == 1)) {
1128 cout <<"BuildName(CompareInModification): NameType = " <<Ident.Type() << " NS ";
1129 Print_Entry(Ident.Type() == TNaming_MODIFUNTIL ? NS->Label() : Naming->ChangeName().Arguments().First()->Label());
1130 cout <<"Selection type = " << Selection.ShapeType() << " TS = " << Selection.TShape()->This() << endl;
1132 Handle(TNaming_NamedShape) NewNS =
1133 CompareInModification(Ident.Type() == TNaming_MODIFUNTIL ? NS : Naming->ChangeName().Arguments().First(), Selection);
1134 if (!NewNS.IsNull()) { // there is need to describe name in detail: modification with type 1:n in the same label
1135 StandardFilter = Standard_False;
1136 if (Ident.IsFeature()) { // for MODIFUNTIL: change it to the GENERATION
1137 Naming = TNaming_Naming::Insert(F);
1138 TNaming_Name& theName = Naming->ChangeName();
1139 theName.ShapeType(Selection.ShapeType());
1140 theName.Shape(Selection); //szy 21.10.03
1141 theName.Type(TNaming_GENERATION);
1142 theName.Append(TNaming_Tool::NamedShape(Selection,F));
1143 theName.Append(NewNS);
1144 Naming->Regenerate(MDF.ChangeValid());
1145 Naming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
1148 Filter (F,MDF,Selection,Context,Localizer,NS,0);
1151 if (StandardFilter) if (!Compare (NS,MDF,Stop,Selection)) {
1152 Filter (F,MDF,Selection,Context,Localizer,NS,0);
1158 if (!CompareInGeneration (NS,Selection)) {
1159 TopoDS_Shape NewContext;
1160 Handle(TNaming_NamedShape) NewStop;
1161 FindNewShapeInFather (Ident.NamedShapeOfGeneration(),NewContext);
1162 Filter (F,MDF,Selection,NewContext,Localizer,NS,0);
1166 if (!Compare (NS,MDF,Stop,Selection))
1167 Filter (F,MDF,Selection,Context,Localizer,NS,0);
1174 if (MDF.WithValid()) MDF.Valid(NS->Label());
1177 TCollection_AsciiString E;
1178 TDF_Tool::Entry(NS->Label(), E);
1179 cout <<"Returned NS from Label = "<< E << endl;
1185 //=======================================================================
1186 //function : Validate
1188 //=======================================================================
1190 static void Validate(TNaming_Scope& MDF,
1191 TNaming_OldShapeIterator& it)
1193 MDF.Valid(it.Label());
1194 MDF.ValidChildren(it.Label());
1196 TNaming_OldShapeIterator it2(it);
1197 for (; it2.More(); it2.Next()) {
1202 //=======================================================================
1203 //function : UnValidate
1205 //=======================================================================
1207 static void UnValidate(TNaming_Scope& MDF,
1208 TNaming_NewShapeIterator& it)
1210 MDF.Unvalid(it.Label());
1211 MDF.UnvalidChildren(it.Label());
1213 TNaming_NewShapeIterator it2(it);
1214 for (; it2.More(); it2.Next()) {
1215 UnValidate (MDF,it2);
1219 //=======================================================================
1220 //function : BuildScope
1221 //purpose : adds to the MDF the label of <Context> NamedShape,
1222 // : its children, all its oldShapes and its children.
1223 // : unvalidates all newShapes and it's children.
1224 // : If <Context> is null or next modification has an empty newShape
1225 // : ( this shape was deleted ), then MDF.WithValid(Standard_False)
1226 // : and nothing is added to the scope.
1227 //=======================================================================
1229 static void BuildScope (TNaming_Scope& MDF,
1230 const TopoDS_Shape& Context,
1231 const TDF_Label& Acces)
1233 if (Context.IsNull()) {
1234 MDF.WithValid(Standard_False);
1238 //----------------------------------------------------
1239 // Is context the current state
1240 //----------------------------------------------------
1241 Handle(TNaming_NamedShape) NS = TNaming_Tool::NamedShape(Context,Acces);
1242 Handle(TNaming_NamedShape) Next = NextModif(NS); // if NS has subsequent evolution = MODIFY, return it
1243 if (Next.IsNull()) {
1244 MDF.WithValid(Standard_False);
1247 //-----------------------------
1248 // a posteriori naming
1249 //-----------------------------
1250 MDF.WithValid(Standard_True);
1251 MDF.Valid(NS->Label());
1252 MDF.ValidChildren(NS->Label());
1253 TNaming_OldShapeIterator it(Context,Acces);
1255 for (; it.More(); it.Next()) {
1259 TNaming_NewShapeIterator it2(Context,Acces);
1260 for (;it2.More(); it2.Next()) {
1261 UnValidate (MDF,it2);
1265 //=======================================================================
1266 //function : HasAncFace
1267 //purpose : Returns True & <Face> if ancestor face is found
1268 //=======================================================================
1269 static Standard_Boolean HasAncFace(const TopoDS_Shape& Context,
1270 const TopoDS_Shape& W, TopoDS_Shape& Face, Standard_Boolean& isOuter)
1272 Standard_Boolean hasFace(Standard_False);
1273 if(W.ShapeType() != TopAbs_WIRE)
1275 TopExp_Explorer exp(Context, TopAbs_FACE);
1276 for(;exp.More(); exp.Next()) {
1277 for (TopoDS_Iterator it(exp.Current()) ; it.More(); it.Next()) {
1278 if(it.Value().IsEqual(W)) {// is the Wire ?
1279 Face = exp.Current();
1280 if(!Face.IsNull()) {
1281 hasFace = Standard_True;
1282 // cout << "HasAncFace: TS = " <<theFace.TShape()->This() <<endl;
1283 const TopoDS_Face aFace(TopoDS::Face(Face));
1284 TopoDS_Wire anOuterW;
1285 if(TNaming::OuterWire(aFace, anOuterW)) {
1286 if(!anOuterW.IsNull() && anOuterW.IsEqual(W))
1287 isOuter = Standard_True;
1289 isOuter = Standard_False;
1300 //=======================================================================
1301 //function : BuildNameWire
1302 //purpose : Names Wire
1303 //=======================================================================
1305 static Handle(TNaming_NamedShape) BuildNameWire (const TDF_Label& F,
1307 const TopoDS_Shape& Selection,
1308 const TopoDS_Shape& Context,
1309 const Handle(TNaming_NamedShape)& Stop,
1310 const Standard_Boolean Geom)
1312 Handle (TNaming_NamedShape) NS;
1313 Standard_Boolean found(Standard_False);
1314 Handle (TNaming_Naming) Naming;
1315 if(!F.FindAttribute(TNaming_Naming::GetID(), Naming)) {
1316 Naming = new TNaming_Naming ();
1317 F.AddAttribute (Naming);
1318 TNaming_Name& theName = Naming->ChangeName();
1319 theName.ShapeType(Selection.ShapeType());
1320 theName.Shape(Selection);
1323 TNaming_Name& theName = Naming->ChangeName();
1325 Standard_Boolean isOuter(Standard_False);
1326 Standard_Boolean hasFace = HasAncFace(Context, Selection, aFace, isOuter);
1327 if(hasFace && Selection.ShapeType() > Context.ShapeType()) {
1328 theName.Type(TNaming_WIREIN);
1329 if(Context.ShapeType() == TopAbs_FACE) {
1330 for (TopoDS_Iterator it(Context) ; it.More(); it.Next()) {
1331 if(it.Value().IsEqual(Selection)) {
1332 if (TNaming_Selector::IsIdentified (F, Context, NS, Geom)) {
1334 found = Standard_True;
1340 theName.Append(BuildName (Naming->Label(),MDF,aFace,Context,Stop,Geom));
1345 for (TopExp_Explorer exp(Selection,TopAbs_EDGE) ; exp.More(); exp.Next()) {
1346 if(exp.Current().IsNull()) continue;
1347 if (BRep_Tool::Degenerated(TopoDS::Edge(exp.Current()))) continue;
1348 theName.Append(TNaming_Naming::Name(Naming->Label(),exp.Current(),Context, Geom, 1, 0));
1352 return BuildNS (F,Selection, TNaming_UNKNOWN);
1354 } else { // context is not Face
1355 theName.Append(BuildName (Naming->Label(),MDF,aFace,Context,Stop,Geom));
1359 for (TopExp_Explorer exp(Selection,TopAbs_EDGE) ; exp.More(); exp.Next()) {
1360 if(exp.Current().IsNull()) continue;
1361 if (BRep_Tool::Degenerated(TopoDS::Edge(exp.Current()))) continue;
1362 theName.Append(TNaming_Naming::Name(Naming->Label(),exp.Current(),Context, Geom, 1, 0));
1367 else { // => no Face
1368 theName.Type(TNaming_UNION);
1369 for (TopExp_Explorer exp(Selection,TopAbs_EDGE) ; exp.More(); exp.Next()) {
1370 if(exp.Current().IsNull()) continue;
1371 if (BRep_Tool::Degenerated(TopoDS::Edge(exp.Current()))) continue;
1372 theName.Append(BuildName (Naming->Label(),MDF,exp.Current(),Context,Stop,Geom));
1375 //Naming->GetName().Solve(Naming->Label(),MDF.GetValid());
1376 Naming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
1380 //=======================================================================
1381 static Standard_Boolean IsOneIn (const TopoDS_Shape& S, const TopoDS_Shape& Context)
1383 Standard_Boolean found(Standard_False);
1384 if(S.IsNull() || Context.IsNull()) return found;
1385 for (TopExp_Explorer exp(Context,S.ShapeType()); exp.More(); exp.Next()) {
1386 if (exp.Current().IsEqual(S)) {
1387 found = Standard_True;
1394 //=======================================================================
1395 static Standard_Boolean IsAllIn (const TopoDS_Shape& S, const TopoDS_Shape& Context)
1398 Write(S, "IsAllIn_Sel.brep");
1400 Standard_Boolean found(Standard_False);
1401 if(S.IsNull() || Context.IsNull()) return found;
1402 Standard_Integer num1(0), num2(0);
1403 for(TopoDS_Iterator it(S);it.More();it.Next(),num1++) {
1405 cout <<"S sub-shape type = " << it.Value().ShapeType() <<endl;
1406 Write (it.Value(), "Sel_ItValue.brep");
1408 if(it.Value().ShapeType() != TopAbs_COMPOUND)
1409 for (TopExp_Explorer exp(Context,it.Value().ShapeType()); exp.More(); exp.Next()) {
1411 cout <<"Context sub-shape type = " << exp.Current().ShapeType() <<endl;
1412 Write(exp.Current(), "Contex_Curnt.brep");
1414 if (exp.Current().IsEqual(it.Value())) {
1419 Standard_Boolean isAll = IsAllIn(it.Value(), Context);
1425 found = Standard_True;
1428 cout <<"Compound case : selected num1 = " << num1 << " context contains num2 = " << num2 << endl;
1432 //=======================================================================
1433 //function : RepeatabilityInContext
1435 //=======================================================================
1436 static Standard_Integer RepeatabilityInContext(const TopoDS_Shape& Selection,
1437 const TopoDS_Shape& Context)
1439 Standard_Integer aNum(0);
1440 if (!Context.IsNull() && !Selection.IsNull()) {
1441 // Write(Selection, "Repeat_Selection.brep");
1442 // Write(Context, "Repeat_Context.brep");
1443 if (Context.ShapeType() < Selection.ShapeType()) {
1444 if(Selection.ShapeType() != TopAbs_SHELL) {
1445 for (TopExp_Explorer exp(Context,Selection.ShapeType()); exp.More(); exp.Next()) {
1446 if (exp.Current().IsSame(Selection))
1451 else if(Selection.ShapeType() == TopAbs_COMPOUND) {
1452 TopoDS_Iterator it(Selection);
1453 for(;it.More();it.Next()) {
1454 Standard_Integer n(0);
1455 for (TopExp_Explorer exp(Context,it.Value().ShapeType()); exp.More(); exp.Next()) {
1456 if (exp.Current().IsSame(it.Value())) {
1460 if(n > aNum) aNum = n;
1465 cout <<"RepeatabilityInContext: = " <<aNum <<endl;
1470 //=======================================================================
1471 //function : HasAncSolid
1472 //purpose : Returns true if Sh has ancestor solid in this context
1473 //=======================================================================
1474 static Standard_Boolean HasAncSolid(const TopoDS_Shape& Context,
1475 const TopoDS_Shape& Sh, TopoDS_Shape& Solid,
1476 Standard_Boolean& isOuter)
1478 Standard_Boolean hasSolid(Standard_False);
1479 if(Sh.ShapeType() != TopAbs_SHELL)
1481 TopExp_Explorer exp(Context, TopAbs_SOLID);
1482 for(;exp.More(); exp.Next()) {
1483 for (TopoDS_Iterator it(exp.Current()) ; it.More(); it.Next()) {
1484 if(it.Value().IsEqual(Sh)) {// is the Solid ?
1485 Solid = exp.Current();
1486 if(!Solid.IsNull()) {
1487 hasSolid = Standard_True;
1488 TopoDS_Shell anOuterShell;
1489 if(TNaming::OuterShell(TopoDS::Solid(Solid), anOuterShell)) {
1490 #ifdef MDTV_DEB_TSOL
1491 Write(anOuterShell, "OuterShell.brep");
1493 if(!anOuterShell.IsNull() && anOuterShell.IsEqual(Sh))
1494 isOuter = Standard_True;
1496 isOuter = Standard_False;
1506 //=======================================================================
1507 //function : BuildNameShell
1508 //purpose : Names Shell
1509 //=======================================================================
1511 static Handle(TNaming_NamedShape) BuildNameShell (const TDF_Label& F,
1513 const TopoDS_Shape& Selection,
1514 const TopoDS_Shape& Context,
1515 const Handle(TNaming_NamedShape)& Stop,
1516 const Standard_Boolean Geom)
1518 Handle (TNaming_NamedShape) NS;
1519 Standard_Boolean found(Standard_False);
1520 Handle (TNaming_Naming) Naming;
1521 if(!F.FindAttribute(TNaming_Naming::GetID(), Naming)) {
1522 Naming = new TNaming_Naming ();
1523 F.AddAttribute (Naming);
1524 TNaming_Name& theName = Naming->ChangeName();
1525 theName.ShapeType(Selection.ShapeType());
1526 theName.Shape(Selection);
1529 TNaming_Name& theName = Naming->ChangeName();
1530 TopoDS_Shape aSolid;
1531 Standard_Boolean isOuter(Standard_False);
1532 Standard_Boolean hasSolid = HasAncSolid(Context, Selection, aSolid, isOuter);
1533 if(hasSolid && Selection.ShapeType() > Context.ShapeType()) {
1534 theName.Type(TNaming_SHELLIN);// SHELLIN
1536 if(Context.ShapeType() == TopAbs_SOLID) {
1537 for (TopoDS_Iterator it(Context) ; it.More(); it.Next()) {
1538 #ifdef MDTV_DEB_TSOL
1539 Write(it.Value(), "Shell_inSo.brep");
1541 if(it.Value().IsEqual(Selection)) {
1542 found = Standard_True;
1547 // solid => aSolid which is also a context
1548 Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(Context,F);
1550 theName.ContextLabel(aNS->Label());
1551 theName.Append(aNS);
1554 } else { //not OuterShell
1556 for (TopExp_Explorer exp(Selection,TopAbs_FACE) ; exp.More(); exp.Next()) {
1557 if(exp.Current().IsNull()) continue;
1558 theName.Append(BuildName (Naming->Label(),MDF,exp.Current(),Context,Stop,Geom));
1562 return BuildNS (F,Selection, TNaming_UNKNOWN);
1564 // context is not SOLID
1565 //theName.Append(BuildName (Naming->Label(),MDF,aSolid,Context,Stop,Geom));//###########
1567 #ifdef MDTV_DEB_TSOL
1568 Write(aSolid, "foundSolid.brep");
1571 Handle (TNaming_Naming) NamingSo = TNaming_Naming::Insert(F);
1572 TNaming_Name& theNameSo = NamingSo->ChangeName();
1573 theNameSo.ShapeType(aSolid.ShapeType());
1574 theNameSo.Shape(aSolid);
1575 theNameSo.Type(TNaming_UNION);
1576 Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(Context,F);
1578 theNameSo.ContextLabel(aNS->Label());
1579 for (TopExp_Explorer exp(aSolid,TopAbs_FACE) ; exp.More(); exp.Next())
1580 theNameSo.Append(BuildName (NamingSo->Label(),MDF,exp.Current(),Context,Stop,Geom));
1581 NamingSo->GetName().Solve(NamingSo->Label(),MDF.GetValid());
1583 NamingSo->Label().FindAttribute(TNaming_NamedShape::GetID(),aNS);
1584 theName.Append(aNS);
1587 // - name Solid: theName.Append(BuildName (Naming->Label(),MDF, aSolid,Context,Stop,Geom));
1588 Handle (TNaming_Naming) NamingSo = TNaming_Naming::Insert(F);
1589 TNaming_Name& theNameSo = NamingSo->ChangeName();
1590 theNameSo.ShapeType(aSolid.ShapeType());
1591 theNameSo.Shape(aSolid);
1592 theNameSo.Type(TNaming_UNION);
1593 Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(Context,F);
1595 theNameSo.ContextLabel(aNS->Label());
1596 for (TopExp_Explorer exp(aSolid,TopAbs_FACE) ; exp.More(); exp.Next())
1597 theNameSo.Append(BuildName (NamingSo->Label(),MDF,exp.Current(),Context,Stop,Geom));
1598 NamingSo->GetName().Solve(NamingSo->Label(),MDF.GetValid());
1600 NamingSo->Label().FindAttribute(TNaming_NamedShape::GetID(),aNS);
1601 theName.Append(aNS);
1603 for (TopExp_Explorer exp(Selection,TopAbs_FACE) ; exp.More(); exp.Next()) {
1604 if(exp.Current().IsNull()) continue;
1605 theName.Append(BuildName (Naming->Label(),MDF,exp.Current(),Context,Stop,Geom));
1610 else { // => no Solid
1611 theName.Type(TNaming_UNION);
1612 Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(Context,F);
1614 theName.ContextLabel(aNS->Label());
1615 for (TopExp_Explorer exp(Selection,TopAbs_FACE) ; exp.More(); exp.Next()) {
1616 if(exp.Current().IsNull()) continue;
1617 theName.Append(BuildName (Naming->Label(),MDF,exp.Current(),Context,Stop,Geom));
1620 //Naming->GetName().Solve(Naming->Label(),MDF.GetValid());
1621 Naming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
1625 //=======================================================================
1626 //function : BuildAggregationNam
1628 //=======================================================================
1629 static void BuildAggregationName (const TDF_Label& F,
1631 const TopoDS_Shape& S,
1632 const TopoDS_Shape& Context,
1633 const Handle(TNaming_NamedShape)& Stop,
1634 const Standard_Boolean Geom)
1636 const Standard_Boolean found2 = IsAllIn(S, Context);
1637 Handle (TNaming_Naming) Naming;
1638 if(!F.FindAttribute(TNaming_Naming::GetID(), Naming)) {
1639 Naming = new TNaming_Naming ();
1640 F.AddAttribute (Naming);
1641 TNaming_Name& theName = Naming->ChangeName();
1642 theName.ShapeType(S.ShapeType());
1646 cout <<"BuildAggregationName ==> ";
1647 Print_Entry(Naming->Label());
1649 TNaming_Name& theName = Naming->ChangeName();
1650 for (TopoDS_Iterator itc(S) ; itc.More(); itc.Next()) {
1651 const TopoDS_Shape& aS = itc.Value();
1652 if ((aS.ShapeType() == TopAbs_SOLID && !TNaming_Tool::NamedShape(aS,Naming->Label()).IsNull()) ||
1653 aS.ShapeType() == TopAbs_FACE ||
1654 aS.ShapeType() == TopAbs_EDGE ||
1655 aS.ShapeType() == TopAbs_VERTEX ) {
1656 theName.Append(BuildName (F, MDF, aS,Context,Stop,Geom));
1657 } else { // ==> union of union || union of wires
1658 TopAbs_ShapeEnum atomTyp;
1659 switch (aS.ShapeType())
1663 atomTyp = TopAbs_FACE;
1666 atomTyp = TopAbs_EDGE;
1669 atomTyp = TopAbs_SHAPE;
1672 Handle(TNaming_NamedShape) aNS;
1673 Handle (TNaming_Naming) aNaming = TNaming_Naming::Insert(F);
1674 TNaming_Name& aName = aNaming->ChangeName();
1675 aName.ShapeType(aS.ShapeType());
1677 aName.Type(TNaming_UNION);
1679 if (atomTyp != TopAbs_SHAPE) {
1680 if(aS.ShapeType() == TopAbs_WIRE) {
1681 aNS = BuildNameWire (aNaming->Label(), MDF, aS, Context,Stop,Geom);
1683 else if(aS.ShapeType() == TopAbs_SHELL)
1684 aNS = BuildNameShell (aNaming->Label(), MDF, aS, Context,Stop,Geom);
1686 for (TopExp_Explorer exp(aS,atomTyp) ; exp.More(); exp.Next()) {
1687 aName.Append(BuildName (aNaming->Label(),MDF,exp.Current(),Context,Stop,Geom));
1692 cout << "atomic type is NOT defined ... ==> Aggregation" <<endl;
1694 BuildAggregationName(aNaming->Label(),MDF, aS, Context,Stop,Geom);
1697 aNS = TNaming_Tool::NamedShape(Context, F);
1699 aNaming->ChangeName().ContextLabel(aNS->Label());
1702 aNaming->GetName().Solve(aNaming->Label(),MDF.GetValid());
1703 if(aNaming->Label().FindAttribute(TNaming_NamedShape::GetID(),aNS))
1704 if (!Geom && TestSolution(MDF,aNS,aS)) {
1705 theName.Append(aNS);
1712 //=======================================================================
1715 //=======================================================================
1717 Handle(TNaming_NamedShape) TNaming_Naming::Name (const TDF_Label& F,
1718 const TopoDS_Shape& S,
1719 const TopoDS_Shape& Context,
1720 const Standard_Boolean Geom,
1721 const Standard_Boolean KeepOrientation,
1722 const Standard_Boolean BNProblem)
1725 Handle(TNaming_NamedShape) NS;
1726 if (KeepOrientation) {
1727 #ifdef MDTV_DEB_INNS
1728 cout <<"KeepOR = 1: "; Print_Entry(F);
1730 Standard_Integer aNum = RepeatabilityInContext(S, Context);
1732 Standard_Boolean aBNproblem = (BNProblem) ? (aNum /*== 1*/ && S != Context) : Standard_False;
1734 if (aNum > 1 || aBNproblem) {
1735 TopoDS_Shape UC = TNaming::FindUniqueContext(S, Context);
1736 Handle(TopTools_HArray1OfShape) Arr;
1737 if (UC.IsNull() && S.ShapeType() == TopAbs_COMPOUND) {
1738 UC = TNaming::FindUniqueContextSet(S, Context, Arr);
1740 Write(UC, "UniqueContextSet.brep");
1741 Write(S, "InitialSelection.brep");
1742 if(S.ShapeType()==TopAbs_COMPOUND) {
1743 TCollection_AsciiString aNam("S_");
1744 TopoDS_Iterator it(S);
1745 for(int i=1;it.More();it.Next(),i++) {
1746 TCollection_AsciiString aName = aNam + i + ".brep";
1747 Write(it.Value(), aName.ToCString());
1753 Handle (TNaming_Naming) Naming = TNaming_Naming::Insert(F);
1754 TNaming_Name& theName = Naming->ChangeName();
1755 theName.ShapeType(S.ShapeType());
1757 theName.Type(TNaming_ORIENTATION);
1759 if (!TNaming_Selector::IsIdentified (F, S, NS, Geom))
1760 NS = TNaming_Naming::Name(Naming->Label(),S,Context,Geom,0);
1761 theName.Append (NS);
1763 cout << " Sel Label ==> "; Print_Entry(NS->Label());
1766 if(S.ShapeType() == TopAbs_EDGE && UC.ShapeType() == TopAbs_FACE) {
1767 if(RepeatabilityInContext(S, UC) == 2) { //sim. edge
1768 TopoDS_Iterator itw(UC);
1769 for(;itw.More();itw.Next()) {
1770 Standard_Boolean found(Standard_False);
1771 TopoDS_Iterator it(itw.Value());
1772 for(int i=1;it.More();it.Next(),i++) {
1773 if(it.Value().IsEqual(S)) {
1774 theName.Index(i);//We use this field to save a Seam Shape Index; Before this field was used for GENERATED only
1775 found = Standard_True;
1777 cout << "ORDER = " << i <<endl;
1787 if(S.ShapeType() == TopAbs_COMPOUND && Arr->Length() > 1) {
1788 // N arguments: to be optimized to avoid duplication of the same Context shape
1789 for(Standard_Integer i = Arr->Lower(); i <= Arr->Upper(); i++) {
1790 NS = TNaming_Naming::Name(Naming->Label(), Arr->Value(i), Context, Geom, 1, aBNproblem);
1791 theName.Append (NS);
1794 NS = TNaming_Naming::Name(Naming->Label(),UC,Context, Geom, 1, aBNproblem);
1795 theName.Append (NS);
1797 cout << " Cont Label ==> "; Print_Entry(NS->Label());
1802 BuildScope (MDF,Context,F);
1803 Naming->GetName().Solve(Naming->Label(),MDF.GetValid());
1804 Naming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
1805 theName.ContextLabel(NS->Label());
1806 if (Geom) return NS;
1808 cout <<" %%% WARNING: TNaming_Naming::Name: FAILED"<<endl;
1809 return BuildNS (F,S, TNaming_UNKNOWN);
1812 if (!Geom && TestSolution(MDF,NS,S)) return NS;
1813 cout <<" %%% WARNING: TNaming_Naming::Name: FAILED"<<endl;
1815 // Naming n is unsatisfactory
1816 return BuildNS (F,S, TNaming_UNKNOWN);
1819 if (TNaming_Selector::IsIdentified (F, S, NS, Geom))
1823 //------------------------------------------------------------
1824 // Construction du MDF tel que <Context> soit le dernier etat
1826 // Ceci pour les localisation a posteriori par exemple.
1827 //------------------------------------------------------------
1830 BuildScope (MDF,Context,F);
1831 Handle(TNaming_NamedShape) Stop;
1835 if ((S.ShapeType() == TopAbs_SOLID && !TNaming_Tool::NamedShape(S,F).IsNull()) ||
1839 if (S.ShapeType() == TopAbs_SOLID ||
1843 S.ShapeType() == TopAbs_FACE ||
1844 S.ShapeType() == TopAbs_EDGE ||
1845 S.ShapeType() == TopAbs_VERTEX ) {
1846 //---------------------------------------
1847 // Localisation de S comme element simple.
1848 //---------------------------------------
1849 Handle(TNaming_NamedShape) NS = BuildName (F,MDF,S,Context,Stop,Geom);
1850 if (Geom) return NS;
1851 if (!Geom && TestSolution(MDF,NS,S)) return NS;
1854 //----------------------------------------------------
1855 // Localisation de S comme ensemble d elements simples.
1856 //-----------------------------------------------------
1857 Handle(TNaming_NamedShape) NS;
1858 Handle (TNaming_Naming) Naming = TNaming_Naming::Insert(F);
1859 TNaming_Name& theName = Naming->ChangeName();
1861 theName.ShapeType(S.ShapeType());// modified by vro 05.09.00
1863 if(S.ShapeType() != TopAbs_WIRE)
1864 theName.Type(TNaming_UNION);
1867 TopAbs_ShapeEnum atomType;
1868 switch (S.ShapeType()) {
1869 case TopAbs_COMPSOLID:
1872 atomType = TopAbs_FACE;
1875 atomType = TopAbs_EDGE;
1878 atomType = TopAbs_SHAPE;
1880 Standard_Boolean found(Standard_False);
1881 if (!Context.IsNull()) {
1882 if (Context.ShapeType() < S.ShapeType())
1883 found = IsOneIn(S, Context);
1885 NS = TNaming_Tool::NamedShape(Context, F);
1887 theName.ContextLabel(NS->Label());
1890 if (atomType == TopAbs_SHAPE) {
1891 if(S.ShapeType() == TopAbs_COMPOUND) {
1892 BuildAggregationName(Naming->Label(),MDF, S, Context,Stop,Geom);
1894 for (TopoDS_Iterator it(S) ; it.More(); it.Next()) {
1895 theName.Append(BuildName (Naming->Label(),MDF,it.Value(),Context,Stop,Geom));
1899 if(S.ShapeType() == TopAbs_WIRE)
1900 NS = BuildNameWire (Naming->Label(), MDF, S, Context,Stop,Geom);
1901 else if(S.ShapeType() == TopAbs_SHELL) {
1902 NS = BuildNameShell (Naming->Label(), MDF, S, Context,Stop,Geom);
1905 theName.Type(TNaming_UNION);
1906 for (TopExp_Explorer exp(S,atomType) ; exp.More(); exp.Next()) {
1907 theName.Append(BuildName (Naming->Label(),MDF,exp.Current(),Context,Stop,Geom));
1912 for (TopoDS_Iterator it(S) ; it.More(); it.Next()) {
1913 theName.Append(BuildName (Naming->Label(),MDF,it.Value(),Context,Stop,Geom));
1918 Naming->GetName().Solve(Naming->Label(),MDF.GetValid());
1919 Naming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
1920 if (Geom) return NS;
1923 if(NS.IsNull()) return BuildNS (F,S, TNaming_UNKNOWN);
1926 if (!Geom && TestSolution(MDF,NS,S)) return NS;
1929 cout <<" %%% WARNING: TNaming_Naming::Name: FAILED"<<endl;
1931 // Naming n is not satisfactory
1932 return BuildNS (F,S, TNaming_UNKNOWN);
1936 //=======================================================================
1937 //function : TNaming_Naming
1939 //=======================================================================
1941 TNaming_Naming::TNaming_Naming() {}
1943 //=======================================================================
1946 //=======================================================================
1948 const Standard_GUID& TNaming_Naming::ID () const
1954 //=======================================================================
1955 //function : IsDefined
1957 //=======================================================================
1959 Standard_Boolean TNaming_Naming::IsDefined() const
1961 return (myName.Type() != TNaming_UNKNOWN);
1964 //=======================================================================
1965 //function : GetName
1967 //=======================================================================
1969 const TNaming_Name& TNaming_Naming::GetName() const
1974 //=======================================================================
1975 //function : ChangeName
1977 //=======================================================================
1979 TNaming_Name& TNaming_Naming::ChangeName()
1984 //=======================================================================
1985 //function : Regenerate
1986 //purpose : idem designer
1987 //=======================================================================
1989 Standard_Boolean TNaming_Naming::Regenerate (TDF_LabelMap& MDF)
1992 return myName.Solve(Label(),MDF);
1996 //=======================================================================
1997 //function : NewEmpty
1999 //=======================================================================
2001 Handle(TDF_Attribute) TNaming_Naming::NewEmpty () const
2003 return new TNaming_Naming ();
2007 //=======================================================================
2008 //function : Restore
2010 //=======================================================================
2012 void TNaming_Naming::Restore(const Handle(TDF_Attribute)& other)
2014 Handle(TNaming_Naming) OtherNaming = Handle(TNaming_Naming)::DownCast(other);
2015 myName = OtherNaming->ChangeName();
2018 //=======================================================================
2021 //=======================================================================
2023 void TNaming_Naming::Paste (const Handle(TDF_Attribute)& into,
2024 const Handle(TDF_RelocationTable)& RT) const
2026 Handle(TNaming_Naming) NewNaming = Handle(TNaming_Naming)::DownCast(into);
2027 myName.Paste(NewNaming->ChangeName(),RT);
2030 //=======================================================================
2031 //function : References
2032 //purpose : Redefined from TDF_Attribute
2033 //=======================================================================
2035 void TNaming_Naming::References(const Handle(TDF_DataSet)& DataSet) const
2037 // Iteration on NamedShape of the name
2038 TNaming_ListIteratorOfListOfNamedShape it(myName.Arguments());
2039 for (;it.More();it.Next()) DataSet->AddAttribute(it.Value());
2040 if (!myName.StopNamedShape().IsNull()) DataSet->AddAttribute(myName.StopNamedShape());
2042 //=======================================================================
2045 //=======================================================================
2047 Standard_OStream& TNaming_Naming::Dump (Standard_OStream& anOS) const
2049 anOS << "TNaming_Naming";
2054 //=======================================================================
2055 //function :ExtendedDump
2057 //=======================================================================
2059 void TNaming_Naming::ExtendedDump(Standard_OStream& anOS,
2060 const TDF_IDFilter& /*aFilter*/,
2061 TDF_AttributeIndexedMap& /*aMap*/) const
2063 anOS << "TNaming_Naming ExtendedDump ";
2064 //anOS<<"myContext: #" <<aMap.Add(myContext)<<endl;