1 // Created on: 1997-09-03
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <BRep_Tool.hxx>
19 #include <BRepTools.hxx>
20 #include <NCollection_DataMap.hxx>
21 #include <NCollection_Map.hxx>
22 #include <Standard_DomainError.hxx>
23 #include <Standard_GUID.hxx>
24 #include <Standard_Type.hxx>
25 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
26 #include <TColStd_MapOfInteger.hxx>
27 #include <TDF_Attribute.hxx>
28 #include <TDF_ChildIterator.hxx>
29 #include <TDF_Data.hxx>
30 #include <TDF_DataSet.hxx>
31 #include <TDF_IDFilter.hxx>
32 #include <TDF_Label.hxx>
33 #include <TDF_LabelList.hxx>
34 #include <TDF_LabelMap.hxx>
35 #include <TDF_RelocationTable.hxx>
36 #include <TDF_TagSource.hxx>
37 #include <TNaming.hxx>
38 #include <TNaming_Builder.hxx>
39 #include <TNaming_Identifier.hxx>
40 #include <TNaming_Iterator.hxx>
41 #include <TNaming_ListIteratorOfListOfNamedShape.hxx>
42 #include <TNaming_Localizer.hxx>
43 #include <TNaming_Name.hxx>
44 #include <TNaming_NamedShape.hxx>
45 #include <TNaming_Naming.hxx>
46 #include <TNaming_NamingTool.hxx>
47 #include <TNaming_NewShapeIterator.hxx>
48 #include <TNaming_OldShapeIterator.hxx>
49 #include <TNaming_Scope.hxx>
50 #include <TNaming_Selector.hxx>
51 #include <TNaming_Tool.hxx>
53 #include <TopExp_Explorer.hxx>
55 #include <TopoDS_Face.hxx>
56 #include <TopoDS_Iterator.hxx>
57 #include <TopoDS_Shape.hxx>
58 #include <TopoDS_Shell.hxx>
59 #include <TopoDS_Solid.hxx>
60 #include <TopoDS_Wire.hxx>
61 #include <TopTools_HArray1OfShape.hxx>
62 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
63 #include <TopTools_IndexedMapOfShape.hxx>
64 #include <TopTools_ListIteratorOfListOfShape.hxx>
65 #include <TopTools_ListOfShape.hxx>
66 #include <TopTools_MapIteratorOfMapOfOrientedShape.hxx>
67 #include <TopTools_MapIteratorOfMapOfShape.hxx>
68 #include <TopTools_MapOfShape.hxx>
70 IMPLEMENT_STANDARD_RTTIEXT(TNaming_Naming,TDF_Attribute)
72 // #include <TNaming_NCollections.hxx>
73 typedef NCollection_Map<TopoDS_Shape> TNaming_MapOfShape;
74 typedef TNaming_MapOfShape::Iterator TNaming_MapIteratorOfMapOfShape;
75 typedef NCollection_DataMap<TopoDS_Shape, TNaming_MapOfShape> TNaming_DataMapOfShapeMapOfShape;
76 typedef TNaming_DataMapOfShapeMapOfShape::Iterator TNaming_DataMapIteratorOfDataMapOfShapeMapOfShape;
77 // The bug concerns access to a null object in the method Filter():
79 #define ALLOW_CHILD_NBS
82 //#define MDTV_DEB_MOD
84 //#define MDTV_DEB_INNS
85 //#define MDTV_DEB_NBS
87 //#define MDTV_DEB_WIN
89 #include <TDF_MapIteratorOfLabelMap.hxx>
90 #include <TCollection_AsciiString.hxx>
91 #include <TDF_Tool.hxx>
92 #include <BRepTools.hxx>
93 #include <TNaming_Tool.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;
142 //==========================================================================================
143 static Handle(TNaming_NamedShape) BuildName (const TDF_Label& F,
145 const TopoDS_Shape& S,
146 const TopoDS_Shape& Context,
147 const Handle(TNaming_NamedShape)& Stop,
148 const Standard_Boolean Geometry);
150 //=======================================================================
151 static Standard_Integer RepeatabilityInContext(const TopoDS_Shape& Selection,
152 const TopoDS_Shape& Context);
154 //=======================================================================
156 //purpose : voir avec YFR comment retrouver le bon resulat et le mettre
157 // : dans le NamedShape de L
158 //=======================================================================
159 Standard_Boolean TNaming_Naming::Solve (TDF_LabelMap& Valid)
161 Handle(TNaming_Naming) subname;
162 for (TDF_ChildIterator it (Label(),Standard_False); it.More(); it.Next()) {
163 #ifdef OCCT_DEBUG_NBS
164 TCollection_AsciiString anEntry;
165 TDF_Tool::Entry(it.Value(), anEntry);
166 cout << "TNaming_Naming::Solve: Label to be solved = " << anEntry << endl;
168 if (it.Value().FindAttribute(TNaming_Naming::GetID(),subname)) {
169 if (!subname->Solve (Valid)) {
170 return Standard_False; // not necessary to continue
175 TDF_MapIteratorOfLabelMap anItr(Valid);
176 cout << "TNaming_Naming::Solve:: Valid label Map" << endl;
177 for (; anItr.More(); anItr.Next()) {
178 const TDF_Label& aLabel = anItr.Key();
179 TCollection_AsciiString anEntry;
180 TDF_Tool::Entry(aLabel, anEntry);
181 cout << "Label = " << anEntry << endl;
184 if (Regenerate(Valid)) {
185 if (!Valid.IsEmpty()) Valid.Add(Label());
186 return Standard_True;
188 return Standard_False;
192 //=======================================================================
195 //=======================================================================
197 const Standard_GUID& TNaming_Naming::GetID ()
199 static Standard_GUID TNaming_NamingID("c0a19201-5b78-11d1-8940-080009dc3333");
200 return TNaming_NamingID;
203 //=======================================================================
206 //=======================================================================
208 Handle(TNaming_Naming) TNaming_Naming::Insert (const TDF_Label& under)
210 Handle(TNaming_Naming) N;
211 TDF_Label child = TDF_TagSource::NewChild(under);
212 N = new TNaming_Naming ();
213 child.AddAttribute (N);
217 //=======================================================================
219 //purpose : returns a new NamedShape, which is built as selection:
220 // : TNaming_Builder::Select("S","S") at the new child label of the label <F>.
221 //=======================================================================
223 static Handle(TNaming_NamedShape) BuildNS (const TDF_Label& F,
224 const TopoDS_Shape& S,
225 const TNaming_NameType& Name)
227 Handle (TNaming_Naming) Naming = TNaming_Naming::Insert (F);
229 TNaming_Name& theName = Naming->ChangeName();
230 theName.ShapeType(S.ShapeType());
232 theName.Orientation(S.Orientation());
234 TNaming_Builder B(Naming->Label());
236 return B.NamedShape();
239 //=======================================================================
240 //function : FindIndex
242 //=======================================================================
244 static Standard_Integer FindIndex(const Handle(TNaming_NamedShape)& NS,
245 const TopoDS_Shape& S)
247 TDF_LabelList Labels;
248 TopoDS_Shape IS = TNaming_Tool::InitialShape(S,NS->Label(),Labels);
249 Standard_Integer Index = 1;
250 for (TNaming_Iterator itNS(NS); itNS.More(); itNS.Next(),Index++) {
251 if (IS.IsSame(itNS.NewShape())) break;
257 //=======================================================================
258 //function : CompareInGeneration
259 //purpose : returns true, only if the specified NS contains only <S> in
260 // : the "new shapes" set.
261 //=======================================================================
263 static Standard_Boolean CompareInGeneration (const Handle(TNaming_NamedShape)& NS,
264 const TopoDS_Shape& S)
266 for (TNaming_Iterator it(NS); it.More(); it.Next()) {
267 if (!it.NewShape().IsSame(S)) return 0;
272 //=======================================================================
273 //function : GetShapeEvolutions
274 //purpose : returns Standard_True, if target has parent in source; list contains inheritance chain
275 //=======================================================================
276 static Standard_Boolean GetShapeEvolutions(const TopoDS_Shape& theTarget, // this is changed in recursion
277 const Handle(TNaming_NamedShape)& theSource,
278 TopTools_ListOfShape& aList) // returns list in the backward order
280 Handle(TNaming_NamedShape) aTarget = TNaming_Tool::NamedShape(theTarget,theSource->Label());
281 if (!aTarget.IsNull()) {
283 cout <<"GetShapeEvolutions: target NS = ";
284 Print_Entry(aTarget->Label());
285 cout <<"GetShapeEvolutions: Source NS = ";
286 Print_Entry(theSource->Label());
287 TCollection_AsciiString aNam("GetShapeEvolutions");
288 WriteNSOnLabel(aTarget,aNam);
290 if (aTarget->Label() == theSource->Label()) return Standard_True; // check if target is in the source
291 } else return Standard_False;
293 TNaming_Iterator anIter(aTarget);
294 for(;anIter.More();anIter.Next()) { // check all appropriate old shapes of target
296 if(!anIter.OldShape().IsNull()) {
297 Write(anIter.OldShape(), "Target_OldS.brep");
298 cout <<"Target OldS TS =" <<anIter.OldShape().TShape()->This() <<endl;
300 if(!anIter.NewShape().IsNull()) {
301 Write(anIter.NewShape(), "Target_NewS.brep");
302 cout <<"Target NewS TS =" <<anIter.NewShape().TShape()->This() <<endl;
305 if (anIter.OldShape().IsNull() || anIter.NewShape().IsNull()) continue;
306 if (!anIter.NewShape().IsSame(theTarget)) continue;
307 if (GetShapeEvolutions(anIter.OldShape(),theSource,aList)) { // recursion: now target is old shape
308 aList.Append(theTarget); // if oldshape has the source as parent (or belongs to it) , fill the list
309 return Standard_True;
312 return Standard_False;
315 //=======================================================================
316 //function : CompareInModification
317 //purpose : returns empty named shape if naming is already done
318 //=======================================================================
320 static Handle(TNaming_NamedShape) CompareInModification (const Handle(TNaming_NamedShape)& NS, // parent
321 const TopoDS_Shape& S) // target
323 Handle(TNaming_NamedShape) aResult;
324 if (S.IsNull() || NS.IsNull()) return aResult;
326 cout <<"CompareInModification: parent NS = ";
327 Print_Entry(NS->Label());
328 Write(S, "CompareInM_S.brep");
329 TCollection_AsciiString aNam("CompareInM");
330 WriteNSOnLabel(NS,aNam);
332 Handle(TNaming_NamedShape) aSource; // parent NamedShape, which can be found by TopoDS shape
333 TNaming_Iterator anIt(NS);
334 for(;anIt.More() && aSource.IsNull();anIt.Next()) {
335 if (!anIt.NewShape().IsNull()) {
336 aSource = TNaming_Tool::NamedShape(anIt.NewShape(),NS->Label());
338 TCollection_AsciiString aNam("CompareInM_Source");
339 WriteNSOnLabel(aSource,aNam);
343 // searching for 1:n to the same label modifications (in this case current naming is insufficient)
344 TopTools_ListOfShape aList;
345 if (GetShapeEvolutions(S,aSource,aList) && aList.Extent() > 0) {
346 TopTools_ListIteratorOfListOfShape anIter(aList);
347 for(;anIter.More();anIter.Next()) {
348 aResult = TNaming_Tool::NamedShape(anIter.Value(),NS->Label());
349 if (aResult->Evolution()!=TNaming_MODIFY) { // evolution must be modify, otherwise everything is OK
353 TopTools_MapOfShape aMap; // collection of the old shapes of the shape from list
354 TNaming_Iterator aNIter1(aResult);
356 for(;aNIter1.More();aNIter1.Next()) {
357 if (aNIter1.NewShape().IsSame(anIter.Value())) {// if isSame
358 aMap.Add(aNIter1.OldShape());
361 TNaming_Iterator aNIter2(aResult); // if some another shapes has oldshape from map, return namedshape with this oldshape
363 for(;aNIter2.More();aNIter2.Next()) {
364 if (aNIter2.NewShape().IsSame(anIter.Value())) continue;
365 if (aMap.Contains(aNIter2.OldShape())) { // if one shape was modified to the two at the shared label, return this one
366 aResult = TNaming_Tool::NamedShape(aNIter2.OldShape(),NS->Label());
367 if (!aResult.IsNull()) return aResult;
376 //=======================================================================
377 static Standard_Boolean FillSMap(const TopoDS_Shape& S, TopTools_MapOfShape& MS)
379 if(S.IsNull()) return Standard_False;
380 Standard_Boolean isHomogen(Standard_True);
381 TopAbs_ShapeEnum aPrevType(TopAbs_SHAPE);
382 TopoDS_Iterator it(S);
383 for (; it.More(); it.Next()) {
384 const TopAbs_ShapeEnum aType = it.Value().ShapeType();
386 cout <<"TestSolution_FillMap: S_Type = :" << it.Value().ShapeType() <<" TShape = " << it.Value().TShape()->This() <<endl;
388 if(aType > TopAbs_COMPSOLID) {
390 if(aPrevType == TopAbs_SHAPE)
392 else if(aPrevType != aType)
393 isHomogen = Standard_False;
396 if(!FillSMap(it.Value(), MS))
397 isHomogen = Standard_False;
401 //=======================================================================
403 //purpose : checks naming of the shape <S> in the NamedShape <NS>.
404 // : Returns true, if it's correct. Details ==>
405 // : The method takes all modifications of the "NS" (see CurrentShape method),
406 // : which are in the "MDF" (if it's not empty) before <Stop> shape and check them.
407 // : whether these modifications contain only "S". If yes then the method
408 // : returns true, otherwise it returns false.
409 //=======================================================================
411 static Standard_Boolean Compare (const Handle(TNaming_NamedShape)& NS,
412 const TNaming_Scope& MDF,
413 const Handle(TNaming_NamedShape)& Stop,
414 const TopoDS_Shape& S)
416 TDF_LabelMap Forbiden;
417 TopTools_IndexedMapOfShape MS;
418 if (!Stop.IsNull()) TNaming_NamingTool::BuildDescendants(Stop,Forbiden);
419 TNaming_NamingTool::CurrentShape(MDF.GetValid(),Forbiden,NS,MS);
420 #ifdef OCCT_DEBUG_NBS
421 Write(S, "Compare_S.brep");
422 cout << "S: TShape = " <<S.TShape()->This() <<endl;
423 TCollection_AsciiString aNam("Compare_MS_");
424 TCollection_AsciiString ext(".brep");
425 for (Standard_Integer anItMS = 1; anItMS <= MS.Extent(); ++anItMS) {
426 TCollection_AsciiString aName = aNam + anItMS + ext;
427 Write (MS (anItMS), aName.ToCString());
428 cout << aName.ToCString()<< ": TShape = " << MS (anItMS).TShape()->This() << endl;
431 return (MS.Contains(S) && MS.Extent() == 1);
433 //=======================================================================
434 //function : TestSolution
435 //purpose : returns true, if last modification of shape from "NS" is equal to "S":
436 // : If shape "S" has atomic type (TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX),
437 // : then returns S.IsSame(shape from "NS").
438 // : Otherwise the result of exploration of these shapes must be same.
439 //=======================================================================
441 static Standard_Boolean TestSolution(const TNaming_Scope& MDF,
442 const Handle(TNaming_NamedShape)& NS,
443 const TopoDS_Shape& S)
446 if (NS.IsNull()) return Standard_False;
447 TopoDS_Shape Res = MDF.CurrentShape(NS);// last modification of NS taken into account Valid map
448 if(S.IsNull() || Res.IsNull()) return Standard_False;
450 Write(S, "TSol_S.brep");
451 Write(Res, "TSol_Res.brep");
454 if ((S.ShapeType() == TopAbs_FACE ||
455 S.ShapeType() == TopAbs_EDGE ||
456 S.ShapeType() == TopAbs_VERTEX ) &&
457 Res.ShapeType() != TopAbs_COMPOUND) {
458 return (Res.IsSame(S));
459 } else if (S.ShapeType() == TopAbs_SOLID ||
460 S.ShapeType() == TopAbs_COMPSOLID) {
461 TopTools_MapOfShape aMS;
463 for (exp.Init(S,TopAbs_FACE) ; exp.More(); exp.Next()) {
464 aMS.Add(exp.Current());
466 for (exp.Init(Res,TopAbs_FACE) ; exp.More(); exp.Next()) { //content of MS and Res should be the same
467 if (aMS.Contains(exp.Current())) {
468 aMS.Remove(exp.Current());
472 return aMS.IsEmpty();
475 TopTools_MapOfShape MS;
476 Standard_Boolean isHom = FillSMap(S, MS);
477 TopAbs_ShapeEnum aType(TopAbs_SHAPE);
478 TColStd_MapOfInteger aView;
479 TopTools_MapIteratorOfMapOfShape itm(MS);
480 for(;itm.More();itm.Next()) {
481 aType = itm.Key().ShapeType();
485 aView.Add(itm.Key().ShapeType());
488 if (MS.Contains(Res)) {
490 if (MS.IsEmpty()) return 1;
492 if (Res.ShapeType() == TopAbs_SOLID ||
493 Res.ShapeType() == TopAbs_COMPSOLID ||
494 Res.ShapeType() == TopAbs_COMPOUND)
498 for (exp.Init(Res,aType) ; exp.More(); exp.Next()) {
499 if (MS.Contains(exp.Current())) {
500 MS.Remove(exp.Current());
503 TColStd_MapIteratorOfMapOfInteger aMapIter(aView);
504 for(; aMapIter.More(); aMapIter.Next()) {
505 TopAbs_ShapeEnum aCurType = (TopAbs_ShapeEnum)aMapIter.Key();
506 for (exp.Init(Res, aCurType) ; exp.More(); exp.Next()) {
507 if (MS.Contains(exp.Current())) {
508 MS.Remove(exp.Current());
515 return Standard_True;
516 TopoDS_Iterator it(Res);
517 for (; it.More(); it.Next()) { //content of MS and Res should be the same
518 if (MS.Contains(it.Value())) {
519 MS.Remove(it.Value());
528 //=======================================================================
529 //function : FindNewShapeInFather
531 //=======================================================================
533 static void FindNewShapeInFather (const Handle(TNaming_NamedShape)& NS,
536 const TDF_Label& Father = NS->Label().Father();
537 TNaming_Iterator itLab(Father);
539 SC = itLab.NewShape();
542 //=======================================================================
543 //function : NextModif
545 //=======================================================================
547 static Handle(TNaming_NamedShape) NextModif(const Handle(TNaming_NamedShape)& NS)
549 Handle (TNaming_NamedShape) Next;
551 TNaming_NewShapeIterator it(NS);
552 if (it.More()&& it.IsModification()) Next = it.NamedShape();
556 //=======================================================================
557 // C1 - cand shape of the father, C2 - shape of rebuild child Naming attr.
558 // (to be Compound of elementary shapes)
559 //=======================================================================
560 static Standard_Boolean IsContSame(const TopoDS_Shape& C1, const TopoDS_Shape& C2)
562 Standard_Boolean aRes(Standard_False);
563 if(!C1.IsNull() && !C2.IsNull()) {
564 TopTools_MapOfShape aMap;
565 if(FillSMap(C1, aMap)) {
566 aRes = Standard_True;
567 TopoDS_Iterator it(C2);
568 for(;it.More();it.Next()) {
569 if(!aMap.Contains(it.Value())) {
570 aRes = Standard_False;
579 //=======================================================================
580 // Identifies the case when Filter haven't sense because of multiplicity
581 //=======================================================================
582 static Standard_Boolean IsMultipleCase(const TopoDS_Shape& S,
583 const TopoDS_Shape& Context,
584 const TopTools_MapOfShape& Neighbourgs) {
586 TopTools_IndexedDataMapOfShapeListOfShape aDM;
587 TNaming_MapOfShape aM;
588 TopTools_MapOfShape aNbs;
589 aNbs.Assign(Neighbourgs);
591 TNaming_DataMapOfShapeMapOfShape aDMM;
592 TopExp::MapShapesAndAncestors (Context, TopAbs_EDGE, TopAbs_FACE, aDM);
593 TopTools_MapIteratorOfMapOfShape it(aNbs);
594 for(;it.More();it.Next()) {
595 if(aDM.Contains(it.Key())) {
596 TNaming_MapOfShape aMS;
597 const TopTools_ListOfShape& aL = aDM.FindFromKey(it.Key());
598 TopTools_ListIteratorOfListOfShape lit(aL);
599 for(;lit.More();lit.Next()) {
601 aMS.Add(lit.Value());
604 aDMM.Bind(it.Key(), aMS);
607 cout << "Key is not BOUND!" <<endl;
609 return Standard_False;
613 Standard_Boolean isCommon(Standard_True);
614 TNaming_MapIteratorOfMapOfShape itm(aM);
615 for(;itm.More();itm.Next()) {
616 isCommon = Standard_True; // statement: this shape (itm.Key()) is common (to be checked below)
617 TNaming_DataMapIteratorOfDataMapOfShapeMapOfShape itdm(aDMM);
618 for (;itdm.More();itdm.Next()) {
619 const TNaming_MapOfShape& aMap = itdm.Value();
620 if(!aMap.Contains(itm.Key())) {
621 isCommon = Standard_False;
625 if(isCommon) break; // common single face found
627 if(isCommon && aM.Extent() < aNbs.Extent()) {// number of unique faces (to have single solution)
628 //should be at least no less than (Nb of Neighbourgs) +1
629 return Standard_True;
631 return Standard_False;
633 //=======================================================================
635 //purpose : sets the name with type "FILTERBYNEIGHBOURGS" and returns true,
636 // : if it was correctly done.
639 //=======================================================================
641 static Standard_Boolean Filter (const TDF_Label& F,
643 const TopoDS_Shape& S,
644 const TopoDS_Shape& Context,
645 TNaming_Localizer& Localizer,
646 Handle(TNaming_NamedShape)& NS,
647 const Standard_Integer Lev)
649 // 1. Localizer.FindNeighbourg("Context", "S", "Neighbourg") - looks for neighbourgs of "S" with the same shape type in the "Context"
650 // shape and adds them to the "Neighbourg" map;
651 // 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;
652 // 3. If "Neighbourg" map is still empty, returns false;
653 // 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",
654 // type is TNaming_FILTERBYNEIGHBOURGS, stop shape ( "Until" ) is "Context" of corresponding NamedShape;
655 // first argument of name is "NS" NamedShape.
656 // 5. Adds to the Name all shapes from "Neighbourg" map: build it with the BuildName( new generated TNaming_Naming attribute, MDF,
657 // argument shape from "Neighbourg", "Context", NextModif( "Until" ), true ) method.
658 // 6. Creates resulting NamedShape with the "Regenerate" ( it just calls TName::Solve method ) method from TNaming_Naming class.
659 // 7. If Compare( result NamedShape, MDF, stop, "S" ) returns true, "Filter" method returns true, else returns false.
661 //------------------------------
662 // Construction des voisins ==> of neighbors.
663 //------------------------------
664 Standard_Integer aLev(Lev);
665 TopTools_MapOfShape Neighbourg;
666 Localizer.FindNeighbourg (Context,S,Neighbourg);
667 #ifdef OCCT_DEBUG_NBS
668 //DbgTools::DisplayShape(Context, F, Quantity_NOC_GREEN);
669 //DbgTools::DisplayShape(S, F, Quantity_NOC_BLUE1);
670 Write(Context, "FNBS_Context.brep");
671 Write(S, "FNBS_S.brep");
672 Write(Neighbourg, "NBS");
674 // mpv : NS and shape must be the same
675 Standard_Boolean isIn = Standard_False;
676 TNaming_Iterator anIter(NS);
677 for(;anIter.More();anIter.Next()) {
679 //DbgTools::DisplayShape(anIter.NewShape(), F, Quantity_NOC_RED);
681 if (anIter.NewShape().IsSame(S)) {
682 isIn = Standard_True;
686 if (!isIn) if (!TNaming_Tool::NamedShape(S,F).IsNull()) NS = TNaming_Tool::NamedShape(S,F);
687 // if (!TNaming_Tool::NamedShape(S,F).IsNull()) NS = TNaming_Tool::NamedShape(S,F);
689 if (Neighbourg.IsEmpty()) {
690 // Recherche du vrai context. (Research of context truth)
691 Handle(TNaming_NamedShape) GenS = TNaming_Tool::NamedShape(S,NS->Label());
692 if (GenS.IsNull()) return Standard_False;
693 TDF_Label Father = (GenS->Label()).Father();
694 Father.FindAttribute(TNaming_NamedShape::GetID(),GenS);
695 TopoDS_Shape GoodContext = TNaming_Tool::GetShape(GenS);
696 Localizer.FindNeighbourg (GoodContext,S,Neighbourg);
700 if (Neighbourg.IsEmpty()) {
702 cout <<"FindNeighbourg: impossible"<<endl;
706 #ifdef OCCT_DEBUG_NBS
707 Write(Neighbourg, "Neighbourgs");
710 //cout <<"Filter: Lev = " << aLev << endl;
712 if(aLev > 3) return 0;
713 #ifdef ALLOW_CHILD_NBS
714 Handle(TNaming_Naming) aFNaming;
715 TopoDS_Shape aFatherCandSh;
716 F.FindAttribute(TNaming_Naming::GetID(), aFNaming);
717 if(!aFNaming.IsNull()) {
718 const TNaming_Name& aName = aFNaming->GetName();
719 if (aName.Type() == TNaming_FILTERBYNEIGHBOURGS) {
720 aFatherCandSh = aName.Arguments().First()->Get();
723 if(S.ShapeType() == TopAbs_EDGE && aFatherCandSh.IsNull()) {
724 //check the applicability
725 if(!NS.IsNull() && !NS->Get().IsNull() && NS->Get().ShapeType() == TopAbs_COMPOUND)
726 if(IsMultipleCase(S, Context, Neighbourg)) {
727 //cout << "Filter: ==> MultipleCase!" << endl;
728 NS->Label().FindAttribute(TNaming_Naming::GetID(), aFNaming);
729 if(!aFNaming.IsNull()) {
730 TNaming_Name& aName = aFNaming->ChangeName();
731 if (aName.Type() == TNaming_INTERSECTION) {
732 Standard_Integer ij(1);
733 TNaming_ListIteratorOfListOfNamedShape itA(aName.Arguments());
734 for (; itA.More(); itA.Next(), ij++) {
735 const TopoDS_Shape& aFace = TNaming_Tool::CurrentShape(itA.Value());
736 #ifdef OCCT_DEBUG_MOD
737 Write(aFace, "First_Face.brep");
738 cout <<"Selection TS = " << S.TShape()->This() <<endl;
740 Standard_Integer i(1), indxW(0),indxE(0),nbW(0),nbE(0), indxF(0);
741 Standard_Boolean isFound(Standard_False);
742 TopoDS_Iterator it(aFace);
743 for (;it.More();it.Next(),i++) {
745 #ifdef OCCT_DEBUG_MOD
746 Write(it.Value(), "First_Wire.brep");
749 Standard_Integer j(1);
750 TopoDS_Iterator it2(it.Value());
751 for (;it2.More();it2.Next(),j++) {
753 #ifdef OCCT_DEBUG_MOD
754 Write(it2.Value(), "First_Wire.brep");
755 cout <<"Edge TS = " << it2.Value().TShape()->This() <<endl;
757 if(S.IsEqual(it2.Value())) {
761 isFound = Standard_True;
767 Standard_Integer Index = indxE & 0x000000FF;
768 Index = Index | (nbE << 8);
769 Index = Index | (indxW << 16);
770 Index = Index | (nbW << 20);
771 Index = Index | (indxF << 24);
773 //------------------------------
774 // Compute the TNaming_NamedShape
775 //------------------------------
776 aFNaming->Regenerate(MDF.ChangeValid());
777 aFNaming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
778 Handle (TNaming_NamedShape) Until = TNaming_Tool::NamedShape(Context,NS->Label());
779 Handle (TNaming_NamedShape) Stop = NextModif(Until);
780 if (Compare (NS,MDF,Stop,S)) return 1;
791 //-----------------------------------------------------
792 // Construction function de naming. et insertion sous F
793 //-----------------------------------------------------
794 Handle (TNaming_Naming) NF = TNaming_Naming::Insert (F);
796 Handle (TNaming_NamedShape) Until = TNaming_Tool::NamedShape(Context,NS->Label());
797 Handle (TNaming_NamedShape) Stop = NextModif(Until);
798 TNaming_Name& theName = NF->ChangeName();
799 theName.ShapeType(S.ShapeType());
801 theName.Orientation(S.Orientation());
802 theName.Type(TNaming_FILTERBYNEIGHBOURGS);
804 theName.StopNamedShape (Until);
805 #ifdef OCCT_DEBUG_NBS
806 cout << "FilterByNBS: ";
807 Print_Entry(NF->Label());
808 cout <<"AppendNS = " ;
809 Print_Entry(NS->Label());
811 //---------------------
812 // Naming des voisins.
813 //---------------------
815 TopTools_MapIteratorOfMapOfShape itN(Neighbourg);
816 for (; itN.More(); itN.Next()) {
817 #ifdef ALLOW_CHILD_NBS
818 const TopoDS_Shape& aS = itN.Key();
819 Handle (TNaming_NamedShape) aNS =
820 BuildName(NF->Label(), MDF, aS, Context, Stop, 1);
821 #ifdef OCCT_DEBUG_NBS
822 const TopoDS_Shape& aS2 = aNS->Get();
824 cout << "Shape arg type = " << aS.ShapeType() <<" TSH = " << aS.TShape()->This()<<endl;
826 cout << "Build shape type = " << aS2.ShapeType() <<" TSH = " << aS2.TShape()->This()<<endl;
827 Write (aS2, "NBS_BuildShape.brep");
830 cout <<"AppendNS = " ;
831 Print_Entry(aNS->Label());
835 const TopoDS_Shape aSNS = aNS->Get(); //allow child level
836 Standard_Boolean allowChild(Standard_True);
837 if(!aSNS.IsNull() && aSNS.ShapeType() == TopAbs_COMPOUND && !aFatherCandSh.IsNull())
838 allowChild = !IsContSame(aFatherCandSh, aSNS);
839 if(allowChild && !aSNS.IsNull() && aS.ShapeType() != aSNS.ShapeType() &&
840 aSNS.ShapeType() == TopAbs_COMPOUND)
842 #ifdef OCCT_DEBUG_NBS
843 cout <<"Father label = ";
844 Print_Entry(aNS->Label().Father());
845 Write(aS,"SelectionS.brep");
846 Write(aSNS,"SelectionSNS.brep");
848 Handle(TNaming_Naming) aNaming;
849 Standard_Boolean StandardFilter(Standard_True);
850 aNS->FindAttribute(TNaming_Naming::GetID(), aNaming);
851 if(!aNaming.IsNull()) {
852 const TNaming_Name& aName = aNaming->GetName();
853 if (aName.Type() == TNaming_GENERATION)
854 StandardFilter = Standard_False;
856 if (!Compare (aNS,MDF,Stop,aS)) {
857 TNaming_Localizer aLocalizer;
858 Filter (NF->Label(), MDF,aS,Context, aLocalizer,aNS, aLev);
864 theName.Append(BuildName(NF->Label(), MDF, itN.Key(), Context, Stop, 1));
867 //------------------------------
868 // Compute the TNaming_NamedShape
869 //------------------------------
870 NF->Regenerate(MDF.ChangeValid());
871 NF->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
876 if (Compare (NS,MDF,Stop,S)) return 1;
878 cout <<"TNaming_Naming::Name Filter insufficient"<<endl;
884 //=======================================================================
885 //function : BuildNameInNS
886 //purpose : Calls BuildName method, but with new context and new stop shape.
887 // : Context is searched at the father label of the "Context" label :
888 // : old shapes from the NamedShape at the defined father label.
889 // : If it's impossible, then "S" set as context.
890 // : If "S" is in new context, then stop shape is named shape,
891 // : which belongs to the father label of the "Context" named shape.
892 // : For example, face (F2) of prism (P) is generated from the edge (E)
893 // : of primitive face (F1) of box (B). F2 is named as GENERATION from E.
894 // : Naming of E is done with help BuildNameInNS function:
895 // : with context B and stop shape P.
896 //=======================================================================
897 static Handle(TNaming_NamedShape) BuildNameInNS (const TDF_Label& F,
899 const TopoDS_Shape& S,
900 const Handle(TNaming_NamedShape)& Context,
901 const Handle(TNaming_NamedShape)& Stop,
902 const Standard_Boolean Geometry)
905 // il faut determiner un nouveau context et un nouveau Stop.
906 // it is necessary to determine a new context and a new Stop
908 Handle(TNaming_NamedShape) NewStop = Stop;
910 TNaming_Localizer::FindShapeContext (Context,S,SC);
913 // <Context> is Ident.NamedShapeOfGeneration() ==
914 TDF_Label Father = Context->Label().Father();
915 Father.FindAttribute(TNaming_NamedShape::GetID(),NewStop);
916 #ifdef OCCT_DEBUG_INNS
918 {cout <<" Stop NS : "; Print_Entry( Stop->Label());}
919 if(!NewStop.IsNull())
920 {cout <<" NewStop : "; Print_Entry( NewStop->Label());}
921 cout <<"ContextLabel: "; Print_Entry( Context->Label());
922 cout <<"Father : "; Print_Entry( Father);
925 #ifdef OCCT_DEBUG_INNS
927 cout <<"BuildNameInNS:: NewStop shape is NULL" << endl;
929 return BuildName (F,MDF,S,SC,NewStop,Geometry);
932 //=======================================================================
935 //=======================================================================
937 static Handle(TNaming_NamedShape) BuildName (const TDF_Label& F,
939 const TopoDS_Shape& Selection,
940 const TopoDS_Shape& Context,
941 const Handle(TNaming_NamedShape)& Stop,
942 const Standard_Boolean Geom)
947 // Create an identifier
948 Standard_Boolean OnlyOne = !Geom;
949 Standard_Boolean IsGeneration = Standard_False;
950 #ifdef OCCT_DEBUG_MOD
951 cout <<"BuildName: F => ";
953 cout <<" Selection type = " << Selection.ShapeType() << " TS = " << Selection.TShape()->This() << endl;
954 Write(Selection, "BName_Selection.brep");
955 Write(Context, "BName_Context.brep");
957 TNaming_Identifier Ident(F, Selection, Context,OnlyOne);
959 Handle (TNaming_Naming) Naming;
960 Handle (TNaming_NamedShape) NS;
962 if (!Ident.IsDone()) {
963 return BuildNS (F,Selection, TNaming_UNKNOWN);
965 if (Ident.IsFeature() && Stop.IsNull()) {
969 if (!OnlyOne) return Ident.FeatureArg();
970 else NS = Ident.FeatureArg();
973 //---------------------------------------------
974 // Construction de la fonction d identification.
975 //---------------------------------------------
976 //Standard_Boolean NotOnlyOne = 0;
978 Naming = TNaming_Naming::Insert(F);
980 TNaming_Name& theName = Naming->ChangeName();
981 theName.ShapeType(Selection.ShapeType());
982 theName.Shape(Selection);
983 theName.Orientation(Selection.Orientation());
984 theName.Type(Ident.Type());
985 #ifdef OCCT_DEBUG_MOD
986 cout <<"BuildName: Inserted Naming Att at ";
987 Print_Entry(Naming->Label());
988 cout <<" NameType = " << theName.Type() <<endl;
990 if (Ident.IsFeature()) {
991 theName.Append(Ident.FeatureArg());
993 if (theName.Type() == TNaming_GENERATION) {
994 theName.Append(Ident.NamedShapeOfGeneration());
995 IsGeneration = Standard_True;
997 if (theName.Type() == TNaming_CONSTSHAPE) {
998 theName.Index(FindIndex(Ident.FeatureArg(),Selection));
1000 //------------------------------------
1001 // Renseignement du NamedShape d arret.
1002 //------------------------------------
1003 theName.StopNamedShape (Stop);
1004 #ifdef OCCT_DEBUG_MOD
1005 if(!Stop.IsNull()) {
1006 TCollection_AsciiString Es;
1007 TDF_Tool::Entry(Stop->Label(), Es);
1008 cout <<"StopNS at Label = "<< Es << endl;
1011 //---------------------------------
1012 // Identification des arguments.
1013 //---------------------------------
1015 for (Ident.InitArgs(); Ident.MoreArgs(); Ident.NextArg()) {
1016 if (Ident.ArgIsFeature()) {
1017 theName.Append(Ident.FeatureArg());
1018 #ifdef OCCT_DEBUG_MOD
1019 if(!Ident.FeatureArg().IsNull()) {
1020 TCollection_AsciiString E;
1021 TDF_Tool::Entry(Ident.FeatureArg()->Label(), E);
1022 cout <<"Added argument NS from Label = "<< E << endl;
1027 #ifdef OCCT_DEBUG_MOD
1028 cout <<"BuildName: NameType = " <<theName.Type() << " NS ";
1029 Print_Entry(Naming->Label());
1030 cout <<"Ident.ShapeArg() type = " << Ident.ShapeArg().ShapeType() << " TS = " << Ident.ShapeArg().TShape()->This() << endl;
1031 Write(Ident.ShapeArg(), "BName_ShapeArg.brep");
1033 if (theName.Type() == TNaming_GENERATION)
1034 theName.Append(BuildNameInNS(Naming->Label(),MDF,Ident.ShapeArg(),Ident.NamedShapeOfGeneration(),Stop,Geom));
1036 theName.Append(BuildName(Naming->Label(),MDF,Ident.ShapeArg(),Context,Stop,Geom));
1040 //------------------------
1041 // Reconstruction of Name
1042 //------------------------
1043 Naming->Regenerate(MDF.ChangeValid());
1044 #ifdef OCCT_DEBUG_MOD
1045 TCollection_AsciiString E2;
1046 TDF_Tool::Entry(Naming->Label(), E2);
1047 cout <<"Regenerated Naming Att at Label = "<< E2 << endl;
1049 Naming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
1050 if(NS.IsNull()) return NS;
1051 if (MDF.WithValid()) MDF.Valid(NS->Label());
1052 #ifdef OCCT_DEBUG_MOD
1054 TCollection_AsciiString E;
1055 TDF_Tool::Entry(NS->Label(), E);
1056 cout <<"Regenerated NS at Label = "<< E << endl;
1062 //-------------------------------------------------
1063 // Filtre par les voisins
1064 // pour construire le nom correspondant a S.
1065 //-------------------------------------------------
1067 if(NS.IsNull()) return NS;
1069 TNaming_Localizer Localizer;
1070 TNaming_Iterator itNS(NS);
1076 Standard_Boolean StandardFilter = !IsGeneration;
1078 if (!CompareInGeneration (NS,Selection)) {
1080 TopoDS_Shape NewContext;
1081 Handle(TNaming_NamedShape) NewStop;
1082 FindNewShapeInFather (Ident.NamedShapeOfGeneration(),NewContext);
1083 Filter (F,MDF,Selection,NewContext,Localizer,NS,0);
1085 } else if (Ident.Type() == TNaming_MODIFUNTIL ||
1086 (Ident.Type() == TNaming_INTERSECTION && Naming->ChangeName().Arguments().Extent() == 1)) {
1087 #ifdef OCCT_DEBUG_MOD
1088 cout <<"BuildName(CompareInModification): NameType = " <<Ident.Type() << " NS ";
1089 Print_Entry(Ident.Type() == TNaming_MODIFUNTIL ? NS->Label() : Naming->ChangeName().Arguments().First()->Label());
1090 cout <<"Selection type = " << Selection.ShapeType() << " TS = " << Selection.TShape()->This() << endl;
1092 Handle(TNaming_NamedShape) NewNS =
1093 CompareInModification(Ident.Type() == TNaming_MODIFUNTIL ? NS : Naming->ChangeName().Arguments().First(), Selection);
1094 if (!NewNS.IsNull()) { // there is need to describe name in detail: modification with type 1:n in the same label
1095 StandardFilter = Standard_False;
1096 if (Ident.IsFeature()) { // for MODIFUNTIL: change it to the GENERATION
1097 Naming = TNaming_Naming::Insert(F);
1098 TNaming_Name& theName = Naming->ChangeName();
1099 theName.ShapeType(Selection.ShapeType());
1100 theName.Shape(Selection);
1101 theName.Orientation(Selection.Orientation());
1102 theName.Type(TNaming_GENERATION);
1103 theName.Append(TNaming_Tool::NamedShape(Selection,F));
1104 theName.Append(NewNS);
1105 Naming->Regenerate(MDF.ChangeValid());
1106 Naming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
1109 Filter (F,MDF,Selection,Context,Localizer,NS,0);
1112 if (StandardFilter) if (!Compare (NS,MDF,Stop,Selection)) {
1113 Filter (F,MDF,Selection,Context,Localizer,NS,0);
1117 if (MDF.WithValid()) MDF.Valid(NS->Label());
1118 #ifdef OCCT_DEBUG_MOD
1120 TCollection_AsciiString E;
1121 TDF_Tool::Entry(NS->Label(), E);
1122 cout <<"Returned NS from Label = "<< E << endl;
1128 //=======================================================================
1129 //function : Validate
1131 //=======================================================================
1133 static void Validate(TNaming_Scope& MDF,
1134 TNaming_OldShapeIterator& it)
1136 MDF.Valid(it.Label());
1137 MDF.ValidChildren(it.Label());
1139 TNaming_OldShapeIterator it2(it);
1140 for (; it2.More(); it2.Next()) {
1145 //=======================================================================
1146 //function : UnValidate
1148 //=======================================================================
1150 static void UnValidate(TNaming_Scope& MDF,
1151 TNaming_NewShapeIterator& it)
1153 MDF.Unvalid(it.Label());
1154 MDF.UnvalidChildren(it.Label());
1156 TNaming_NewShapeIterator it2(it);
1157 for (; it2.More(); it2.Next()) {
1158 UnValidate (MDF,it2);
1162 //=======================================================================
1163 //function : BuildScope
1164 //purpose : adds to the MDF the label of <Context> NamedShape,
1165 // : its children, all its oldShapes and its children.
1166 // : unvalidates all newShapes and it's children.
1167 // : If <Context> is null or next modification has an empty newShape
1168 // : ( this shape was deleted ), then MDF.WithValid(Standard_False)
1169 // : and nothing is added to the scope.
1170 //=======================================================================
1172 static void BuildScope (TNaming_Scope& MDF,
1173 const TopoDS_Shape& Context,
1174 const TDF_Label& Acces)
1176 if (Context.IsNull()) {
1177 MDF.WithValid(Standard_False);
1181 //----------------------------------------------------
1182 // Is context the current state
1183 //----------------------------------------------------
1184 Handle(TNaming_NamedShape) NS = TNaming_Tool::NamedShape(Context,Acces);
1185 Handle(TNaming_NamedShape) Next = NextModif(NS); // if NS has subsequent evolution = MODIFY, return it
1186 if (Next.IsNull()) {
1187 MDF.WithValid(Standard_False);
1190 //-----------------------------
1191 // a posteriori naming
1192 //-----------------------------
1193 MDF.WithValid(Standard_True);
1194 MDF.Valid(NS->Label());
1195 MDF.ValidChildren(NS->Label());
1196 TNaming_OldShapeIterator it(Context,Acces);
1198 for (; it.More(); it.Next()) {
1202 TNaming_NewShapeIterator it2(Context,Acces);
1203 for (;it2.More(); it2.Next()) {
1204 UnValidate (MDF,it2);
1208 //=======================================================================
1209 //function : HasAncFace
1210 //purpose : Returns True & <Face> if ancestor face is found
1211 //=======================================================================
1212 static Standard_Boolean HasAncFace(const TopoDS_Shape& Context,
1213 const TopoDS_Shape& W, TopoDS_Shape& Face, Standard_Boolean& isOuter)
1215 Standard_Boolean hasFace(Standard_False);
1216 if(W.ShapeType() != TopAbs_WIRE)
1218 TopExp_Explorer exp(Context, TopAbs_FACE);
1219 for(;exp.More(); exp.Next()) {
1220 for (TopoDS_Iterator it(exp.Current()) ; it.More(); it.Next()) {
1221 if(it.Value().IsEqual(W)) {// is the Wire ?
1222 Face = exp.Current();
1223 if(!Face.IsNull()) {
1224 hasFace = Standard_True;
1225 // cout << "HasAncFace: TS = " <<theFace.TShape()->This() <<endl;
1226 const TopoDS_Face aFace(TopoDS::Face(Face));
1227 TopoDS_Wire anOuterW;
1228 if(TNaming::OuterWire(aFace, anOuterW)) {
1229 if(!anOuterW.IsNull() && anOuterW.IsEqual(W))
1230 isOuter = Standard_True;
1232 isOuter = Standard_False;
1243 //=======================================================================
1244 //function : BuildNameWire
1245 //purpose : Names Wire
1246 //=======================================================================
1248 static Handle(TNaming_NamedShape) BuildNameWire (const TDF_Label& F,
1250 const TopoDS_Shape& Selection,
1251 const TopoDS_Shape& Context,
1252 const Handle(TNaming_NamedShape)& Stop,
1253 const Standard_Boolean Geom)
1255 Handle (TNaming_NamedShape) NS;
1256 Standard_Boolean found(Standard_False);
1257 Handle (TNaming_Naming) Naming;
1258 if(!F.FindAttribute(TNaming_Naming::GetID(), Naming)) {
1259 Naming = new TNaming_Naming ();
1260 F.AddAttribute (Naming);
1261 TNaming_Name& theName = Naming->ChangeName();
1262 theName.ShapeType(Selection.ShapeType());
1263 theName.Shape(Selection);
1264 theName.Orientation(Selection.Orientation());
1267 TNaming_Name& theName = Naming->ChangeName();
1269 Standard_Boolean isOuter(Standard_False);
1270 Standard_Boolean hasFace = HasAncFace(Context, Selection, aFace, isOuter);
1271 if(hasFace && Selection.ShapeType() > Context.ShapeType()) {
1272 theName.Type(TNaming_WIREIN);
1273 if(Context.ShapeType() == TopAbs_FACE) {
1274 for (TopoDS_Iterator it(Context) ; it.More(); it.Next()) {
1275 if(it.Value().IsEqual(Selection)) {
1276 if (TNaming_Selector::IsIdentified (F, Context, NS, Geom)) {
1278 found = Standard_True;
1284 theName.Append(BuildName (Naming->Label(),MDF,aFace,Context,Stop,Geom));
1289 for (TopExp_Explorer exp(Selection,TopAbs_EDGE) ; exp.More(); exp.Next()) {
1290 if(exp.Current().IsNull()) continue;
1291 if (BRep_Tool::Degenerated(TopoDS::Edge(exp.Current()))) continue;
1292 theName.Append(TNaming_Naming::Name(Naming->Label(),exp.Current(),Context, Geom, 1, 0));
1296 return BuildNS (F,Selection, TNaming_UNKNOWN);
1298 } else { // context is not Face
1299 theName.Append(BuildName (Naming->Label(),MDF,aFace,Context,Stop,Geom));
1303 for (TopExp_Explorer exp(Selection,TopAbs_EDGE) ; exp.More(); exp.Next()) {
1304 if(exp.Current().IsNull()) continue;
1305 if (BRep_Tool::Degenerated(TopoDS::Edge(exp.Current()))) continue;
1306 theName.Append(TNaming_Naming::Name(Naming->Label(),exp.Current(),Context, Geom, 1, 0));
1311 else { // => no Face
1312 theName.Type(TNaming_UNION);
1313 for (TopExp_Explorer exp(Selection,TopAbs_EDGE) ; exp.More(); exp.Next()) {
1314 if(exp.Current().IsNull()) continue;
1315 if (BRep_Tool::Degenerated(TopoDS::Edge(exp.Current()))) continue;
1316 theName.Append(BuildName (Naming->Label(),MDF,exp.Current(),Context,Stop,Geom));
1319 //Naming->GetName().Solve(Naming->Label(),MDF.GetValid());
1320 Naming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
1324 //=======================================================================
1325 static Standard_Boolean IsOneIn (const TopoDS_Shape& S, const TopoDS_Shape& Context)
1327 Standard_Boolean found(Standard_False);
1328 if(S.IsNull() || Context.IsNull()) return found;
1329 for (TopExp_Explorer exp(Context,S.ShapeType()); exp.More(); exp.Next()) {
1330 if (exp.Current().IsEqual(S)) {
1331 found = Standard_True;
1338 //=======================================================================
1339 static Standard_Boolean IsAllIn (const TopoDS_Shape& S, const TopoDS_Shape& Context)
1341 #ifdef OCCT_DEBUG_CC
1342 Write(S, "IsAllIn_Sel.brep");
1344 Standard_Boolean found(Standard_False);
1345 if(S.IsNull() || Context.IsNull()) return found;
1346 Standard_Integer num1(0), num2(0);
1347 for(TopoDS_Iterator it(S);it.More();it.Next(),num1++) {
1348 #ifdef OCCT_DEBUG_CC
1349 cout <<"S sub-shape type = " << it.Value().ShapeType() <<endl;
1350 Write (it.Value(), "Sel_ItValue.brep");
1352 if(it.Value().ShapeType() != TopAbs_COMPOUND)
1353 for (TopExp_Explorer exp(Context,it.Value().ShapeType()); exp.More(); exp.Next()) {
1354 #ifdef OCCT_DEBUG_CC
1355 cout <<"Context sub-shape type = " << exp.Current().ShapeType() <<endl;
1356 Write(exp.Current(), "Contex_Curnt.brep");
1358 if (exp.Current().IsEqual(it.Value())) {
1363 Standard_Boolean isAll = IsAllIn(it.Value(), Context);
1369 found = Standard_True;
1370 #ifdef OCCT_DEBUG_CC
1372 cout <<"Compound case : selected num1 = " << num1 << " context contains num2 = " << num2 << endl;
1376 //=======================================================================
1377 //function : RepeatabilityInContext
1379 //=======================================================================
1380 static Standard_Integer RepeatabilityInContext(const TopoDS_Shape& Selection,
1381 const TopoDS_Shape& Context)
1383 Standard_Integer aNum(0);
1384 if (!Context.IsNull() && !Selection.IsNull()) {
1385 // Write(Selection, "Repeat_Selection.brep");
1386 // Write(Context, "Repeat_Context.brep");
1387 if (Context.ShapeType() < Selection.ShapeType()) {
1388 if(Selection.ShapeType() != TopAbs_SHELL) {
1389 for (TopExp_Explorer exp(Context,Selection.ShapeType()); exp.More(); exp.Next()) {
1390 if (exp.Current().IsSame(Selection))
1395 else if(Selection.ShapeType() == TopAbs_COMPOUND) {
1396 TopoDS_Iterator it(Selection);
1397 for(;it.More();it.Next()) {
1398 Standard_Integer n(0);
1399 for (TopExp_Explorer exp(Context,it.Value().ShapeType()); exp.More(); exp.Next()) {
1400 if (exp.Current().IsSame(it.Value())) {
1404 if(n > aNum) aNum = n;
1408 #ifdef OCCT_DEBUG_OR
1409 cout <<"RepeatabilityInContext: = " <<aNum <<endl;
1414 //=======================================================================
1415 //function : HasAncSolid
1416 //purpose : Returns true if Sh has ancestor solid in this context
1417 //=======================================================================
1418 static Standard_Boolean HasAncSolid(const TopoDS_Shape& Context,
1419 const TopoDS_Shape& Sh, TopoDS_Shape& Solid,
1420 Standard_Boolean& isOuter)
1422 Standard_Boolean hasSolid(Standard_False);
1423 if(Sh.ShapeType() != TopAbs_SHELL)
1425 TopExp_Explorer exp(Context, TopAbs_SOLID);
1426 for(;exp.More(); exp.Next()) {
1427 for (TopoDS_Iterator it(exp.Current()) ; it.More(); it.Next()) {
1428 if(it.Value().IsEqual(Sh)) {// is the Solid ?
1429 Solid = exp.Current();
1430 if(!Solid.IsNull()) {
1431 hasSolid = Standard_True;
1432 TopoDS_Shell anOuterShell;
1433 if(TNaming::OuterShell(TopoDS::Solid(Solid), anOuterShell)) {
1434 #ifdef OCCT_DEBUG_TSOL
1435 Write(anOuterShell, "OuterShell.brep");
1437 if(!anOuterShell.IsNull() && anOuterShell.IsEqual(Sh))
1438 isOuter = Standard_True;
1440 isOuter = Standard_False;
1450 //=======================================================================
1451 //function : BuildNameShell
1452 //purpose : Names Shell
1453 //=======================================================================
1455 static Handle(TNaming_NamedShape) BuildNameShell (const TDF_Label& F,
1457 const TopoDS_Shape& Selection,
1458 const TopoDS_Shape& Context,
1459 const Handle(TNaming_NamedShape)& Stop,
1460 const Standard_Boolean Geom)
1462 Handle (TNaming_NamedShape) NS;
1463 Standard_Boolean found(Standard_False);
1464 Handle (TNaming_Naming) Naming;
1465 if(!F.FindAttribute(TNaming_Naming::GetID(), Naming)) {
1466 Naming = new TNaming_Naming ();
1467 F.AddAttribute (Naming);
1468 TNaming_Name& theName = Naming->ChangeName();
1469 theName.ShapeType(Selection.ShapeType());
1470 theName.Shape(Selection);
1471 theName.Orientation(Selection.Orientation());
1474 TNaming_Name& theName = Naming->ChangeName();
1475 TopoDS_Shape aSolid;
1476 Standard_Boolean isOuter(Standard_False);
1477 Standard_Boolean hasSolid = HasAncSolid(Context, Selection, aSolid, isOuter);
1478 if(hasSolid && Selection.ShapeType() > Context.ShapeType()) {
1479 theName.Type(TNaming_SHELLIN);// SHELLIN
1481 if(Context.ShapeType() == TopAbs_SOLID) {
1482 for (TopoDS_Iterator it(Context) ; it.More(); it.Next()) {
1483 #ifdef OCCT_DEBUG_TSOL
1484 Write(it.Value(), "Shell_inSo.brep");
1486 if(it.Value().IsEqual(Selection)) {
1487 found = Standard_True;
1492 // solid => aSolid which is also a context
1493 Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(Context,F);
1495 theName.ContextLabel(aNS->Label());
1496 theName.Append(aNS);
1499 } else { //not OuterShell
1501 for (TopExp_Explorer exp(Selection,TopAbs_FACE) ; exp.More(); exp.Next()) {
1502 if(exp.Current().IsNull()) continue;
1503 theName.Append(BuildName (Naming->Label(),MDF,exp.Current(),Context,Stop,Geom));
1507 return BuildNS (F,Selection, TNaming_UNKNOWN);
1509 // context is not SOLID
1510 //theName.Append(BuildName (Naming->Label(),MDF,aSolid,Context,Stop,Geom));//###########
1512 #ifdef OCCT_DEBUG_TSOL
1513 Write(aSolid, "foundSolid.brep");
1516 Handle (TNaming_Naming) NamingSo = TNaming_Naming::Insert(F);
1517 TNaming_Name& theNameSo = NamingSo->ChangeName();
1518 theNameSo.ShapeType(aSolid.ShapeType());
1519 theNameSo.Shape(aSolid);
1520 theNameSo.Type(TNaming_UNION);
1521 Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(Context,F);
1523 theNameSo.ContextLabel(aNS->Label());
1524 for (TopExp_Explorer exp(aSolid,TopAbs_FACE) ; exp.More(); exp.Next())
1525 theNameSo.Append(BuildName (NamingSo->Label(),MDF,exp.Current(),Context,Stop,Geom));
1526 NamingSo->GetName().Solve(NamingSo->Label(),MDF.GetValid());
1528 NamingSo->Label().FindAttribute(TNaming_NamedShape::GetID(),aNS);
1529 theName.Append(aNS);
1532 // - name Solid: theName.Append(BuildName (Naming->Label(),MDF, aSolid,Context,Stop,Geom));
1533 Handle (TNaming_Naming) NamingSo = TNaming_Naming::Insert(F);
1534 TNaming_Name& theNameSo = NamingSo->ChangeName();
1535 theNameSo.ShapeType(aSolid.ShapeType());
1536 theNameSo.Shape(aSolid);
1537 theNameSo.Type(TNaming_UNION);
1538 Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(Context,F);
1540 theNameSo.ContextLabel(aNS->Label());
1541 for (TopExp_Explorer exp(aSolid,TopAbs_FACE) ; exp.More(); exp.Next())
1542 theNameSo.Append(BuildName (NamingSo->Label(),MDF,exp.Current(),Context,Stop,Geom));
1543 NamingSo->GetName().Solve(NamingSo->Label(),MDF.GetValid());
1545 NamingSo->Label().FindAttribute(TNaming_NamedShape::GetID(),aNS);
1546 theName.Append(aNS);
1548 for (TopExp_Explorer exp(Selection,TopAbs_FACE) ; exp.More(); exp.Next()) {
1549 if(exp.Current().IsNull()) continue;
1550 theName.Append(BuildName (Naming->Label(),MDF,exp.Current(),Context,Stop,Geom));
1555 else { // => no Solid
1556 theName.Type(TNaming_UNION);
1557 Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(Context,F);
1559 theName.ContextLabel(aNS->Label());
1560 for (TopExp_Explorer exp(Selection,TopAbs_FACE) ; exp.More(); exp.Next()) {
1561 if(exp.Current().IsNull()) continue;
1562 theName.Append(BuildName (Naming->Label(),MDF,exp.Current(),Context,Stop,Geom));
1565 //Naming->GetName().Solve(Naming->Label(),MDF.GetValid());
1566 Naming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
1570 //=======================================================================
1571 //function : BuildAggregationNam
1573 //=======================================================================
1574 static void BuildAggregationName (const TDF_Label& F,
1576 const TopoDS_Shape& S,
1577 const TopoDS_Shape& Context,
1578 const Handle(TNaming_NamedShape)& Stop,
1579 const Standard_Boolean Geom)
1581 const Standard_Boolean found2 = IsAllIn(S, Context);
1582 Handle (TNaming_Naming) Naming;
1583 if(!F.FindAttribute(TNaming_Naming::GetID(), Naming)) {
1584 Naming = new TNaming_Naming ();
1585 F.AddAttribute (Naming);
1586 TNaming_Name& theName = Naming->ChangeName();
1587 theName.ShapeType(S.ShapeType());
1589 theName.Orientation(S.Orientation());
1591 #ifdef OCCT_DEBUG_CC
1592 cout <<"BuildAggregationName ==> ";
1593 Print_Entry(Naming->Label());
1595 TNaming_Name& theName = Naming->ChangeName();
1596 for (TopoDS_Iterator itc(S) ; itc.More(); itc.Next()) {
1597 const TopoDS_Shape& aS = itc.Value();
1598 if ((aS.ShapeType() == TopAbs_SOLID && !TNaming_Tool::NamedShape(aS,Naming->Label()).IsNull()) ||
1599 aS.ShapeType() == TopAbs_FACE ||
1600 aS.ShapeType() == TopAbs_EDGE ||
1601 aS.ShapeType() == TopAbs_VERTEX ) {
1602 theName.Append(BuildName (F, MDF, aS,Context,Stop,Geom));
1603 } else { // ==> union of union || union of wires
1604 TopAbs_ShapeEnum atomTyp;
1605 switch (aS.ShapeType())
1609 atomTyp = TopAbs_FACE;
1612 atomTyp = TopAbs_EDGE;
1615 atomTyp = TopAbs_SHAPE;
1618 Handle(TNaming_NamedShape) aNS;
1619 Handle (TNaming_Naming) aNaming = TNaming_Naming::Insert(F);
1620 TNaming_Name& aName = aNaming->ChangeName();
1621 aName.ShapeType(aS.ShapeType());
1623 theName.Orientation(aS.Orientation());
1624 aName.Type(TNaming_UNION);
1626 if (atomTyp != TopAbs_SHAPE) {
1627 if(aS.ShapeType() == TopAbs_WIRE) {
1628 aNS = BuildNameWire (aNaming->Label(), MDF, aS, Context,Stop,Geom);
1630 else if(aS.ShapeType() == TopAbs_SHELL)
1631 aNS = BuildNameShell (aNaming->Label(), MDF, aS, Context,Stop,Geom);
1633 for (TopExp_Explorer exp(aS,atomTyp) ; exp.More(); exp.Next()) {
1634 aName.Append(BuildName (aNaming->Label(),MDF,exp.Current(),Context,Stop,Geom));
1638 #ifdef OCCT_DEBUG_CC
1639 cout << "atomic type is NOT defined ... ==> Aggregation" <<endl;
1641 BuildAggregationName(aNaming->Label(),MDF, aS, Context,Stop,Geom);
1644 aNS = TNaming_Tool::NamedShape(Context, F);
1646 aNaming->ChangeName().ContextLabel(aNS->Label());
1649 aNaming->GetName().Solve(aNaming->Label(),MDF.GetValid());
1650 if(aNaming->Label().FindAttribute(TNaming_NamedShape::GetID(),aNS))
1651 if (!Geom && TestSolution(MDF,aNS,aS)) {
1652 theName.Append(aNS);
1659 //=======================================================================
1662 //=======================================================================
1664 Handle(TNaming_NamedShape) TNaming_Naming::Name (const TDF_Label& F,
1665 const TopoDS_Shape& S,
1666 const TopoDS_Shape& Context,
1667 const Standard_Boolean Geom,
1668 const Standard_Boolean KeepOrientation,
1669 const Standard_Boolean BNProblem)
1672 Handle(TNaming_NamedShape) aNamedShape;
1673 if (KeepOrientation) {
1674 #ifdef OCCT_DEBUG_INNS
1675 cout <<"KeepOR = 1: "; Print_Entry(F);
1677 Standard_Integer aNum = RepeatabilityInContext(S, Context);
1679 Standard_Boolean aBNproblem = (BNProblem) ? (aNum /*== 1*/ && S != Context) : Standard_False;
1681 if (aNum > 1 || aBNproblem) {
1682 TopoDS_Shape UC = TNaming::FindUniqueContext(S, Context);
1683 Handle(TopTools_HArray1OfShape) Arr;
1684 if (UC.IsNull() && S.ShapeType() == TopAbs_COMPOUND) {
1685 UC = TNaming::FindUniqueContextSet(S, Context, Arr);
1686 #ifdef OCCT_DEBUG_CC
1687 Write(UC, "UniqueContextSet.brep");
1688 Write(S, "InitialSelection.brep");
1689 if(S.ShapeType()==TopAbs_COMPOUND) {
1690 TCollection_AsciiString aNam("S_");
1691 TopoDS_Iterator it(S);
1692 for(int i=1;it.More();it.Next(),i++) {
1693 TCollection_AsciiString aName = aNam + i + ".brep";
1694 Write(it.Value(), aName.ToCString());
1700 Handle (TNaming_Naming) Naming = TNaming_Naming::Insert(F);
1701 TNaming_Name& theName = Naming->ChangeName();
1702 theName.ShapeType(S.ShapeType());
1704 theName.Type(TNaming_ORIENTATION);
1705 theName.Orientation(S.Orientation());
1707 if (!TNaming_Selector::IsIdentified (F, S, aNamedShape, Geom))
1708 aNamedShape = TNaming_Naming::Name(Naming->Label(),S,Context,Geom,0);
1709 theName.Append (aNamedShape);
1711 cout << " Sel Label ==> "; Print_Entry(NS->Label());
1714 if(S.ShapeType() == TopAbs_EDGE && UC.ShapeType() == TopAbs_FACE) {
1715 if(RepeatabilityInContext(S, UC) == 2) { //sim. edge
1716 TopoDS_Iterator itw(UC);
1717 for(;itw.More();itw.Next()) {
1718 Standard_Boolean found(Standard_False);
1719 TopoDS_Iterator it(itw.Value());
1720 for(int i=1;it.More();it.Next(),i++) {
1721 if(it.Value().IsEqual(S)) {
1722 theName.Index(i);//We use this field to save a Seam Shape Index; Before this field was used for GENERATED only
1723 found = Standard_True;
1725 cout << "ORDER = " << i <<endl;
1735 if(S.ShapeType() == TopAbs_COMPOUND && Arr->Length() > 1) {
1736 // N arguments: to be optimized to avoid duplication of the same Context shape
1737 for(Standard_Integer i = Arr->Lower(); i <= Arr->Upper(); i++) {
1738 aNamedShape = TNaming_Naming::Name(Naming->Label(), Arr->Value(i), Context, Geom, 1, aBNproblem);
1739 theName.Append (aNamedShape);
1742 aNamedShape = TNaming_Naming::Name(Naming->Label(),UC,Context, Geom, 1, aBNproblem);
1743 theName.Append (aNamedShape);
1745 cout << " Cont Label ==> "; Print_Entry(NS->Label());
1750 BuildScope (MDF,Context,F);
1751 Naming->GetName().Solve(Naming->Label(),MDF.GetValid());
1752 Naming->Label().FindAttribute(TNaming_NamedShape::GetID(), aNamedShape);
1753 theName.ContextLabel(aNamedShape->Label());
1754 if (Geom) return aNamedShape;
1755 if(aNamedShape.IsNull()) {
1756 cout <<" %%% WARNING: TNaming_Naming::Name: FAILED"<<endl;
1757 return BuildNS (F,S, TNaming_UNKNOWN);
1760 if (!Geom && TestSolution(MDF, aNamedShape,S)) return aNamedShape;
1761 cout <<" %%% WARNING: TNaming_Naming::Name: FAILED"<<endl;
1763 // Naming n is unsatisfactory
1764 return BuildNS (F,S, TNaming_UNKNOWN);
1767 if (TNaming_Selector::IsIdentified (F, S, aNamedShape, Geom))
1771 //------------------------------------------------------------
1772 // Construction du MDF tel que <Context> soit le dernier etat
1774 // Ceci pour les localisation a posteriori par exemple.
1775 //------------------------------------------------------------
1778 BuildScope (MDF,Context,F);
1779 Handle(TNaming_NamedShape) Stop;
1782 if ((S.ShapeType() == TopAbs_SOLID && !TNaming_Tool::NamedShape(S,F).IsNull()) ||
1784 S.ShapeType() == TopAbs_FACE ||
1785 S.ShapeType() == TopAbs_EDGE ||
1786 S.ShapeType() == TopAbs_VERTEX ) {
1787 //---------------------------------------
1788 // Localisation de S comme element simple.
1789 //---------------------------------------
1790 Handle(TNaming_NamedShape) NS = BuildName (F,MDF,S,Context,Stop,Geom);
1791 if (Geom) return NS;
1792 if (!Geom && TestSolution(MDF,NS,S)) return NS;
1795 //----------------------------------------------------
1796 // Localisation de S comme ensemble d elements simples.
1797 //-----------------------------------------------------
1798 Handle(TNaming_NamedShape) NS;
1799 Handle (TNaming_Naming) Naming = TNaming_Naming::Insert(F);
1800 TNaming_Name& theName = Naming->ChangeName();
1802 theName.ShapeType(S.ShapeType());// modified by vro 05.09.00
1804 theName.Orientation(S.Orientation());
1805 if(S.ShapeType() != TopAbs_WIRE)
1806 theName.Type(TNaming_UNION);
1808 TopAbs_ShapeEnum atomType;
1809 switch (S.ShapeType()) {
1810 case TopAbs_COMPSOLID:
1813 atomType = TopAbs_FACE;
1816 atomType = TopAbs_EDGE;
1819 atomType = TopAbs_SHAPE;
1821 Standard_Boolean found(Standard_False);
1822 if (!Context.IsNull()) {
1823 if (Context.ShapeType() < S.ShapeType())
1824 found = IsOneIn(S, Context);
1826 NS = TNaming_Tool::NamedShape(Context, F);
1828 theName.ContextLabel(NS->Label());
1831 if (atomType == TopAbs_SHAPE) {
1832 if(S.ShapeType() == TopAbs_COMPOUND) {
1833 BuildAggregationName(Naming->Label(),MDF, S, Context,Stop,Geom);
1835 for (TopoDS_Iterator it(S) ; it.More(); it.Next()) {
1836 theName.Append(BuildName (Naming->Label(),MDF,it.Value(),Context,Stop,Geom));
1840 if(S.ShapeType() == TopAbs_WIRE)
1841 NS = BuildNameWire (Naming->Label(), MDF, S, Context,Stop,Geom);
1842 else if(S.ShapeType() == TopAbs_SHELL) {
1843 NS = BuildNameShell (Naming->Label(), MDF, S, Context,Stop,Geom);
1846 theName.Type(TNaming_UNION);
1847 for (TopExp_Explorer exp(S,atomType) ; exp.More(); exp.Next()) {
1848 theName.Append(BuildName (Naming->Label(),MDF,exp.Current(),Context,Stop,Geom));
1854 Naming->GetName().Solve(Naming->Label(),MDF.GetValid());
1855 Naming->Label().FindAttribute(TNaming_NamedShape::GetID(),NS);
1856 if (Geom) return NS;
1858 if(NS.IsNull()) return BuildNS (F,S, TNaming_UNKNOWN);
1860 if (!Geom && TestSolution(MDF,NS,S)) return NS;
1863 cout <<" %%% WARNING: TNaming_Naming::Name: FAILED"<<endl;
1865 // Naming n is not satisfactory
1866 return BuildNS (F,S, TNaming_UNKNOWN);
1870 //=======================================================================
1871 //function : TNaming_Naming
1873 //=======================================================================
1875 TNaming_Naming::TNaming_Naming() {}
1877 //=======================================================================
1880 //=======================================================================
1882 const Standard_GUID& TNaming_Naming::ID () const
1888 //=======================================================================
1889 //function : IsDefined
1891 //=======================================================================
1893 Standard_Boolean TNaming_Naming::IsDefined() const
1895 return (myName.Type() != TNaming_UNKNOWN);
1898 //=======================================================================
1899 //function : GetName
1901 //=======================================================================
1903 const TNaming_Name& TNaming_Naming::GetName() const
1908 //=======================================================================
1909 //function : ChangeName
1911 //=======================================================================
1913 TNaming_Name& TNaming_Naming::ChangeName()
1918 //=======================================================================
1919 //function : Regenerate
1920 //purpose : idem designer
1921 //=======================================================================
1923 Standard_Boolean TNaming_Naming::Regenerate (TDF_LabelMap& MDF)
1926 return myName.Solve(Label(),MDF);
1930 //=======================================================================
1931 //function : NewEmpty
1933 //=======================================================================
1935 Handle(TDF_Attribute) TNaming_Naming::NewEmpty () const
1937 return new TNaming_Naming ();
1941 //=======================================================================
1942 //function : Restore
1944 //=======================================================================
1946 void TNaming_Naming::Restore(const Handle(TDF_Attribute)& other)
1948 Handle(TNaming_Naming) OtherNaming = Handle(TNaming_Naming)::DownCast(other);
1949 myName = OtherNaming->ChangeName();
1952 //=======================================================================
1955 //=======================================================================
1957 void TNaming_Naming::Paste (const Handle(TDF_Attribute)& into,
1958 const Handle(TDF_RelocationTable)& RT) const
1960 Handle(TNaming_Naming) NewNaming = Handle(TNaming_Naming)::DownCast(into);
1961 myName.Paste(NewNaming->ChangeName(),RT);
1964 //=======================================================================
1965 //function : References
1966 //purpose : Redefined from TDF_Attribute
1967 //=======================================================================
1969 void TNaming_Naming::References(const Handle(TDF_DataSet)& DataSet) const
1971 // Iteration on NamedShape of the name
1972 TNaming_ListIteratorOfListOfNamedShape it(myName.Arguments());
1973 for (;it.More();it.Next()) DataSet->AddAttribute(it.Value());
1974 if (!myName.StopNamedShape().IsNull()) DataSet->AddAttribute(myName.StopNamedShape());
1976 //=======================================================================
1979 //=======================================================================
1981 Standard_OStream& TNaming_Naming::Dump (Standard_OStream& anOS) const
1983 anOS << "TNaming_Naming";
1988 //=======================================================================
1989 //function :ExtendedDump
1991 //=======================================================================
1993 void TNaming_Naming::ExtendedDump(Standard_OStream& anOS,
1994 const TDF_IDFilter& /*aFilter*/,
1995 TDF_AttributeIndexedMap& /*aMap*/) const
1997 anOS << "TNaming_Naming ExtendedDump ";
1998 //anOS<<"myContext: #" <<aMap.Add(myContext)<<endl;