1 // Created on: 1997-03-21
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_Name.ixx>
24 #include <TNaming.hxx>
25 #include <TNaming_NamingTool.hxx>
26 #include <TNaming_Naming.hxx>
27 #include <TNaming_ShapesSet.hxx>
28 #include <TNaming_Builder.hxx>
29 #include <TNaming_NamedShape.hxx>
30 #include <TNaming_Iterator.hxx>
31 #include <TNaming_NewShapeIterator.hxx>
32 #include <TNaming_ListOfNamedShape.hxx>
33 #include <TNaming_ListIteratorOfListOfNamedShape.hxx>
35 #include <TopExp_Explorer.hxx>
36 #include <TopoDS_Compound.hxx>
37 #include <BRep_Builder.hxx>
38 #include <BRepTools.hxx>
40 #include <TopTools_MapOfShape.hxx>
41 #include <TopTools_MapIteratorOfMapOfShape.hxx>
42 #include <TDF_Label.hxx>
43 #include <TDF_LabelList.hxx>
44 #include <TDF_LabelMap.hxx>
45 #include <TNaming_Tool.hxx>
47 #include <Standard_NotImplemented.hxx>
48 #include <Standard_ConstructionError.hxx>
49 #include <TopTools_Array1OfShape.hxx>
50 #include <TColStd_Array1OfInteger.hxx>
51 #include <TopoDS_Wire.hxx>
52 #include <TopoDS_Shell.hxx>
54 // mpv modifications 08.04.2002
55 #include <BRepBuilderAPI_MakeWire.hxx>
56 #include <BRepBuilderAPI_MakeFace.hxx>
58 #include <TopoDS_Shape.hxx>
59 #include <TopoDS_Solid.hxx>
60 #include <TopoDS_Face.hxx>
61 #include <TopoDS_CompSolid.hxx>
62 #include <TopoDS_Compound.hxx>
63 #include <TopoDS_Iterator.hxx>
64 #include <TopTools_ListOfShape.hxx>
65 #include <TopTools_ListIteratorOfListOfShape.hxx>
66 #include <BRepBuilderAPI_MakeSolid.hxx>
67 #include <TopTools_HArray2OfShape.hxx>
68 #include <TopTools_ListOfShape.hxx>
69 #include <TopTools_DataMapOfShapeListOfShape.hxx>
70 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
71 // end of mpv modifications 08.04.2002
73 #include <TNaming_NCollections.hxx>
78 #ifdef DEB_DBGTOOLS_WRITE
85 #define MDTV_DEB_MODUN
89 #define MDTV_DEB_SHELL
92 #include <TCollection_AsciiString.hxx>
93 #include <TDF_Tool.hxx>
94 #include <BRepTools.hxx>
97 #include <TCollection_AsciiString.hxx>
98 #include <TDF_Tool.hxx>
99 #include <TDF_ChildIterator.hxx>
100 #include <TDF_MapIteratorOfLabelMap.hxx>
101 //=======================================================================
102 void PrintEntry(const TDF_Label& label)
104 TCollection_AsciiString entry;
105 TDF_Tool::Entry(label, entry);
106 cout << "LabelEntry = "<< entry << endl;
108 //=======================================================================
109 void PrintEntries(const TDF_LabelMap& map)
111 cout << "=== Labels Map ===" <<endl;
112 TCollection_AsciiString entry;
113 TDF_MapIteratorOfLabelMap it(map);
114 for(;it.More();it.Next()) {
115 TDF_Tool::Entry(it.Key(), entry);
116 cout << "LabelEntry = "<< entry << endl;
119 #ifdef DEB_DBGTOOLS_WRITE
120 //=======================================================================
121 static void DbgTools_Write(const TopoDS_Shape& shape,
122 const Standard_CString filename)
125 if(strlen(filename) > 256) return;
126 strcpy (buf, filename);
135 cout << "File " << buf << " was not created: rdstate = " << save.rdstate() << endl;
136 save << "DBRep_DrawableShape" << endl << endl;
137 if(!shape.IsNull()) BRepTools::Write(shape, save);
140 //=======================================================================
141 static void DbgTools_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 DbgTools_Write ( it.Key(), aName.ToCString());
153 //=======================================================================
154 static void DbgTools_WriteNSOnLabel (const Handle(TNaming_NamedShape)& NS,
155 const Standard_CString filename)
157 if(!NS.IsNull() && !NS->IsEmpty() ) {
158 TCollection_AsciiString aNam (filename);
159 TCollection_AsciiString oldS ("_Old");
160 TCollection_AsciiString newS ("_New_");
161 Standard_Integer i(0);
162 TNaming_Iterator it(NS);
163 for(;it.More(); it.Next(),i++) {
164 TCollection_AsciiString aName1 = aNam + oldS + i + ".brep";
165 TCollection_AsciiString aName2 = aNam + newS + i + ".brep";
166 const TopoDS_Shape& oldShape = it.OldShape();
167 const TopoDS_Shape& newShape = it.NewShape();
168 if(!oldShape.IsNull())
169 DbgTools_Write ( oldShape, aName1.ToCString());
170 if(!newShape.IsNull())
171 DbgTools_Write ( newShape, aName2.ToCString());
178 //====================================================================
179 static Standard_Boolean ValidArgs(const TNaming_ListOfNamedShape& Args)
181 TNaming_ListIteratorOfListOfNamedShape it(Args);
182 for (;it.More();it.Next()) {
183 const Handle(TNaming_NamedShape)& aNS = it.Value();
186 cout << "ValidArgs:: NS (Naming argument) is NULL" <<endl;
188 return Standard_False;
193 TCollection_AsciiString entry;
194 TDF_Tool::Entry(aNS->Label(), entry);
195 cout << "ValidArgs:: Empty NS, Label = " << entry <<endl;
197 return Standard_False;
200 if(!aNS->IsValid()) {
202 TCollection_AsciiString entry;
203 TDF_Tool::Entry(aNS->Label(), entry);
204 cout << "ValidArgs::Not valid NS Label = " << entry <<endl;
206 return Standard_False;
209 return Standard_True;
212 //=======================================================================
213 //function : TNaming_Name
215 //=======================================================================
217 TNaming_Name::TNaming_Name():myIndex(-1)
222 //=======================================================================
225 //=======================================================================
227 void TNaming_Name::Type(const TNaming_NameType aType)
232 //=======================================================================
235 //=======================================================================
237 void TNaming_Name::ShapeType(const TopAbs_ShapeEnum T)
242 //=======================================================================
245 //=======================================================================
247 void TNaming_Name::Shape(const TopoDS_Shape& theShape)
253 //=======================================================================
256 //=======================================================================
258 TopoDS_Shape TNaming_Name::Shape() const
263 //=======================================================================
266 //=======================================================================
268 void TNaming_Name::Append(const Handle(TNaming_NamedShape)& arg)
273 //=======================================================================
274 //function : StopNamedShape
276 //=======================================================================
278 void TNaming_Name::StopNamedShape (const Handle(TNaming_NamedShape)& arg)
283 //=======================================================================
286 //=======================================================================
288 void TNaming_Name::Index (const Standard_Integer I)
294 //=======================================================================
295 //function : TNaming_NameType
297 //=======================================================================
299 TNaming_NameType TNaming_Name::Type() const
304 //=======================================================================
305 //function : TNaming_NameType
307 //=======================================================================
309 TopAbs_ShapeEnum TNaming_Name::ShapeType() const
314 //=======================================================================
317 //=======================================================================
319 void TNaming_Name::Paste (TNaming_Name& into,
320 const Handle(TDF_RelocationTable)& RT) const
322 into.myType = myType;
323 into.myShapeType = myShapeType;
324 into.myShape = myShape;
326 // into.myOrientation = myOrientation;
327 Handle(TNaming_NamedShape) NS;
329 for (TNaming_ListIteratorOfListOfNamedShape it(myArgs); it.More(); it.Next()) {
330 RT->HasRelocation(it.Value(),NS);
331 into.myArgs.Append (NS);
333 if (!myStop.IsNull()) {
334 RT->HasRelocation(myStop,NS);
337 if (!myContextLabel.IsNull()) {
338 RT->HasRelocation(myContextLabel,into.myContextLabel);
342 //=======================================================================
343 //function : Arguments
345 //=======================================================================
347 const TNaming_ListOfNamedShape& TNaming_Name::Arguments() const
352 //=======================================================================
353 //function : Arguments
355 //=======================================================================
357 Handle(TNaming_NamedShape) TNaming_Name::StopNamedShape() const
362 //=======================================================================
365 //=======================================================================
367 Standard_Integer TNaming_Name::Index() const
372 //=======================================================================
373 //function : MakeShape
375 //=======================================================================
377 static TopoDS_Shape MakeShape (const TopTools_MapOfShape& MS)
379 if (!MS.IsEmpty ()) {
380 TopTools_MapIteratorOfMapOfShape it(MS);
381 if (MS.Extent() == 1) {
388 for (; it.More(); it.Next()){
394 return TopoDS_Shape();
399 //=======================================================================
400 //function : ShapeWithType
401 //purpose : Tries to make shape with given type from the given shape
402 //=======================================================================
404 static TopoDS_Shape ShapeWithType(const TopoDS_Shape theShape,
405 const TopAbs_ShapeEnum theType ) {
406 if (theShape.IsNull() || theType == TopAbs_SHAPE) return theShape;
407 Standard_Integer aType = theShape.ShapeType();
408 if (aType == theType) return theShape;
410 TopTools_ListOfShape aShapes;
411 if (aType == TopAbs_COMPOUND) {
412 TopoDS_Iterator anIter(theShape);
413 if (anIter.More()) aType = anIter.Value().ShapeType();
414 for(;anIter.More();anIter.Next()) aShapes.Append(anIter.Value());
415 if (aType == theType) {
416 if (aShapes.Extent() == 1) return aShapes.First();
417 else return theShape;
419 } else aShapes.Append(theShape);
421 TopoDS_Shape aResult;
422 TopTools_ListIteratorOfListOfShape aListIter(aShapes);
424 if (aType < theType) {
425 Standard_Integer aCount;
426 for(aCount=0;aListIter.More();aListIter.Next()) {
427 TopExp_Explorer anExp(aListIter.Value(),theType);
429 if (!anExp.Current().IsNull()) {
430 aResult = anExp.Current();
432 if (aCount > 1) return theShape;
436 if (aCount == 1) return aResult;
437 } else { // if the shape type more complex than shapes from aShapes list, try make it
439 case TopAbs_VERTEX: // can't do something from vertex
441 case TopAbs_EDGE: {// make wire from edges
442 if (theType <= TopAbs_SOLID) break;
443 BRepBuilderAPI_MakeWire aMakeWire;
444 aMakeWire.Add(aShapes);
445 if (!aMakeWire.IsDone()) return theShape;
446 if (theType == TopAbs_WIRE) return aMakeWire.Wire();
447 aShapes.Clear(); // don't break: we can do something more of it
448 aShapes.Append(aMakeWire.Wire());
449 aListIter.Initialize(aShapes);
451 case TopAbs_WIRE: {// make faceS from wires (one per one)
452 if (theType < TopAbs_SOLID) break;
453 TopTools_ListOfShape aFaces;
454 for(;aListIter.More();aListIter.Next()) {
455 BRepBuilderAPI_MakeFace aMakeFace(TopoDS::Wire(aListIter.Value()));
456 if (!aMakeFace.IsDone()) aFaces.Append(aMakeFace.Face());
458 if (theType == TopAbs_FACE) {
459 if (aFaces.Extent() == 1) return aFaces.First();
462 aShapes.Assign(aFaces); // don't break: we can do something more of it
463 aListIter.Initialize(aShapes);
465 case TopAbs_FACE: {// make shell from faces
466 if (theType < TopAbs_SOLID) break;
467 BRep_Builder aShellBuilder;
469 aShellBuilder.MakeShell(aShell);
470 for(;aListIter.More();aListIter.Next()) aShellBuilder.Add(aShell,TopoDS::Face(aListIter.Value()));
471 if (theType == TopAbs_SHELL) return aShell;
472 aShapes.Clear(); // don't break: we can do something more of it
473 aShapes.Append(aShell);
474 aListIter.Initialize(aShapes);
476 case TopAbs_SHELL: {// make solids from shells (one per one)
477 TopTools_ListOfShape aSolids;
478 for(;aListIter.More();aListIter.Next()) {
479 BRepBuilderAPI_MakeSolid aMakeSolid(TopoDS::Shell(aListIter.Value()));
480 if (aMakeSolid.IsDone()) aSolids.Append(aMakeSolid.Solid());
482 if (theType == TopAbs_SOLID) {
483 if (aSolids.Extent() == 1) return aSolids.First();
486 aShapes.Assign(aSolids); // don't break: we can do something more of it
487 aListIter.Initialize(aShapes);
489 case TopAbs_SOLID: {// make compsolid from solids
490 BRep_Builder aCompBuilder;
491 TopoDS_CompSolid aCompSolid;
492 aCompBuilder.MakeCompSolid(aCompSolid);
493 for(;aListIter.More();aListIter.Next()) aCompBuilder.Add(aCompSolid,TopoDS::Solid(aListIter.Value()));
494 if (theType == TopAbs_COMPSOLID) return aCompSolid;
503 //=======================================================================
504 //function : FindModifUntil
506 //=======================================================================
508 static Standard_Boolean FindModifUntil (TNaming_NewShapeIterator& it,
509 TopTools_MapOfShape& MS,
510 const TopoDS_Shape& S,
511 const Handle(TNaming_NamedShape)& Context)
513 #ifdef MDTV_DEB_MODUN
514 if(!Context.IsNull())
515 PrintEntry(Context->Label());
517 Standard_Boolean found = Standard_False;
518 for (; it.More(); it.Next()) {
519 if (!it.Shape().IsNull()) {
520 #ifdef MDTV_DEB_MODUN
521 if(!it.NamedShape().IsNull())
522 PrintEntry(it.NamedShape()->Label());
524 if (it.NamedShape() == Context) {
526 found = Standard_True;
528 else { // New shape != Context
529 TNaming_NewShapeIterator it2(it);
530 found = FindModifUntil (it2,MS,it.Shape(),Context);
537 //=======================================================================
538 //function : ModifUntil
539 //purpose : returns map <theMS> of generators of Target
540 //=======================================================================
542 static void SearchModifUntil (const TDF_LabelMap& /*Valid*/,
543 const Handle(TNaming_NamedShape)& Target,
544 const TNaming_ListOfNamedShape& theListOfGenerators,
545 TopTools_MapOfShape& theMS)
548 #ifdef MDTV_DEB_MODUN
549 DbgTools_WriteNSOnLabel(Target, "SMUntil_"); // Target <== generated
550 Standard_Integer i = 0;
551 TCollection_AsciiString aGen1("Gens_New_"), aGen2("Gented_Old_"), Und("_");
553 // Test si S apparait comme oldshape dans Context. : Test if S appears as oldshape in Context.
554 Standard_Boolean found = Standard_False;
555 for (TNaming_ListIteratorOfListOfNamedShape it(theListOfGenerators); it.More(); it.Next()) {
556 const Handle(TNaming_NamedShape)& aNS = it.Value();
557 #ifdef MDTV_DEB_MODUN
559 Standard_Integer j = 0;
561 for (TNaming_Iterator itL (aNS); itL.More(); itL.Next()) { // <- generators
562 const TopoDS_Shape& S = itL.NewShape();
563 found = Standard_False;
565 #ifdef MDTV_DEB_MODUN
567 Standard_Integer k = 0;
568 TCollection_AsciiString aNam1 = aGen1 + i + Und + j + ".brep";
569 DbgTools_Write(S, aNam1.ToCString());
570 PrintEntry(aNS->Label());//NSLabel
572 TNaming_Iterator itC (Target);
573 for (; itC.More(); itC.Next()) { // <- generated
574 const TopoDS_Shape& OS = itC.OldShape();
575 #ifdef MDTV_DEB_MODUN
577 TCollection_AsciiString aNam2 = aGen2 + i + Und + j + Und + k + ".brep";
578 DbgTools_Write(OS, aNam2.ToCString());
579 PrintEntry(Target->Label());//Target Label
583 found = Standard_True;
584 #ifdef MDTV_DEB_MODUN
585 cout << aNam2 << " is Same with " << aNam1 <<endl;
591 TNaming_NewShapeIterator it1(itL);
592 found = FindModifUntil (it1,theMS,S,Target);
598 //=======================================================================
599 //function : ModifUntil
601 //=======================================================================
602 // NamedShape for this type is assembled from all last modifications of the
603 // last argument shapes (see method TNaming_NamingTool::CurrentShape),
604 // which are not descendants (see method TNaming_NamingTool::BuildDescendants)
605 // of the stop shape. This type of naming is used for identification shapes,
606 // which has only one parent with evolution PRIMITIVE (or itself), which
607 // uniquely identifies it. In most cases stop shape is empty and this algorithm
608 // is equal to the algorithm for IDENTITY.
609 //=======================================================================
610 static Standard_Boolean ModifUntil (const TDF_Label& L,
611 const TDF_LabelMap& Valid,
612 const TNaming_ListOfNamedShape& Args,
613 const Handle(TNaming_NamedShape)& Stop)
615 TopTools_MapOfShape MS;
616 TDF_LabelMap Forbiden;
618 if(!ValidArgs(Args)) return Standard_False;
620 TNaming_NamingTool::BuildDescendants (Stop, Forbiden); // fills Forbidden from Stop
623 cout <<"Regenerating ModifUntil => ";
625 DbgTools_WriteNSOnLabel(Args.Last(), "ModifUntil-");
628 // all last modifications of the last argument
629 TNaming_NamingTool::CurrentShape (Valid, Forbiden,Args.Last(),MS);
631 Standard_Integer i(0);
632 TopTools_MapIteratorOfMapOfShape it(MS);
633 TCollection_AsciiString aNam("ModifUnti_MS_");
634 TCollection_AsciiString ext(".brep");
636 TNaming_Builder B(L);
637 for (TopTools_MapIteratorOfMapOfShape itM(MS); itM.More(); itM.Next()) {
638 const TopoDS_Shape& S = itM.Key();
641 TCollection_AsciiString aName = aNam + ++i + ext;
642 DbgTools_Write(S, aName.ToCString()) ;
643 cout << aName.ToCString() << " TS = " << S.TShape()->This() <<endl;
646 return Standard_True;
649 //=======================================================================
650 //function : ContShape
652 //=======================================================================
653 // from the NS of the first argument TNaming_Iterator is started, shape "S"
654 // is the NewShape from Iterator with index "myIndex" of the Name, this
655 // shape and all last modifications (except NamedShapes - descendants of
656 // the stop shape) are the parts of resulting NamedShape.
657 //=======================================================================
658 static Standard_Boolean ConstShape (const TDF_Label& L,
659 const TDF_LabelMap& Valid,
660 const TNaming_ListOfNamedShape& Args,
661 const Handle(TNaming_NamedShape)& Stop,
662 const Standard_Integer Index)
664 TopTools_MapOfShape MS;
665 TDF_LabelMap Forbiden;
667 if(!ValidArgs(Args)) return Standard_False;
669 TNaming_NamingTool::BuildDescendants (Stop, Forbiden);
672 Standard_Integer i = 1;
673 for (TNaming_Iterator it(Args.First()); it.More(); it.Next(), i++) {
679 if (S.IsNull()) return Standard_False;
681 TNaming_NamingTool::CurrentShapeFromShape (Valid,Forbiden,L,S,MS);
684 TNaming_Builder B(L);
685 for (TopTools_MapIteratorOfMapOfShape itM(MS); itM.More(); itM.Next()) {
686 const TopoDS_Shape& SS = itM.Key();
689 return Standard_True;
692 //=======================================================================
693 //function : Intersection
695 //=======================================================================
696 //algorithm does next steps:
697 // 1. Sets to the "Forbiden" map all shapes, which are descendants of stop
698 // shape. Named shapes at these labels can't be used.
699 // 2. Takes first argument (with method CurrentShape) and sets map "S" of
700 // ancestors (shapes, which belong to this one) of its shape with type
701 // "ShapeType" of Name.
702 // 3. Takes next argument of Name (with method CurrentShape) and removes
703 // from the map "S" all ancestors, which not belongs to the shape of
704 // this argument. This step is repeated for all arguments of this Name.
705 // 4. Adds to the result NamedShape all rest of shapes from the map "S".
706 //=======================================================================
707 static Standard_Boolean Intersection (const TDF_Label& L,
708 const TDF_LabelMap& Valid,
709 const TNaming_ListOfNamedShape& Args,
710 const Handle(TNaming_NamedShape)& Stop,
711 const TopAbs_ShapeEnum ShapeType,
712 const Standard_Integer Index)
714 if (Args.IsEmpty()) return Standard_False;
716 if(!ValidArgs(Args)) return Standard_False;
718 TNaming_ListIteratorOfListOfNamedShape it(Args);
719 TopTools_MapOfShape MS;
720 TDF_LabelMap Forbiden;
723 if(!Stop.IsNull() && !Stop->Get().IsNull()) {
724 DbgTools_Write(Stop->Get(), "Ints_Stop.brep");
725 PrintEntry(Stop->Label());
727 cout <<"Ints: ShapeType = " << ShapeType << endl;
728 cout <<"Argument 1 at ";
729 PrintEntry(it.Value()->Label());
732 TNaming_NamingTool::BuildDescendants (Stop, Forbiden); // <==<1>
735 cout << "Intersection:: Valid Map: "<<endl;
737 cout << "Intersection:: Forbidden Map: "<<endl;
738 PrintEntries(Forbiden);
740 TopTools_ListOfShape aListOfAnc;
741 TNaming_NamingTool::CurrentShape (Valid, Forbiden,it.Value(),MS); // first argument
742 TopoDS_Shape CS = MakeShape(MS);
743 TNaming_ShapesSet S(CS,ShapeType); // <==<2>
744 aListOfAnc.Append(CS);
747 DbgTools_Write(CS, "Int_CS_1.brep");
748 Standard_Integer i=2;
749 TCollection_AsciiString aNam("Int_CS_");
750 TCollection_AsciiString ext(".brep");
753 it.Next(); // <<===<3.1>
754 for (; it.More(); it.Next()) {
756 TNaming_NamingTool::CurrentShape (Valid,Forbiden,it.Value(),MS);
758 aListOfAnc.Append(CS);
760 TCollection_AsciiString aName = aNam + i++ + ext;
761 DbgTools_Write(CS, aName.ToCString()) ;
762 cout <<"Argument " << i << " at ";
763 PrintEntry(it.Value()->Label());
766 TNaming_ShapesSet OS(CS,ShapeType);
767 S.Filter(OS); //<<===<3.2>
769 Standard_Integer j = 1;
770 TCollection_AsciiString aNam2("SSMap_"), aName3;
771 TopTools_MapIteratorOfMapOfShape itm(S.Map());
772 for(;itm.More();itm.Next(), j++) {
773 aName3 = aNam2 + i + "_" + j + ".brep";
774 DbgTools_Write(itm.Key(), aName3.ToCString());
784 TNaming_Builder B(L); //<<===<4>
785 Standard_Boolean isOK(Standard_False);
786 if(S.Map().Extent() > 1 && Index > 0 && ShapeType == TopAbs_EDGE) {
787 Standard_Integer indxE(0), nbE(0), indxW(0),nbW(0), indxF(0);
788 indxE = Index & 0x000000FF;
789 nbE = (Index & 0x0000FF00) >> 8;
790 indxW = (Index & 0x000F0000) >> 16;
791 nbW = (Index & 0x00F00000) >> 20;
792 indxF = (Index & 0x0F000000) >> 24;
793 Standard_Integer i(1);
795 TopTools_ListIteratorOfListOfShape itl(aListOfAnc);
796 for(;itl.More();itl.Next(),i++) {
803 cout <<"Kept: indxE = " << indxE <<" maxENum = " << nbE << " indxW = " <<indxW << " nbW = " <<nbW<<endl;
805 Standard_Integer aNbW(0), aCaseW(0);
806 TopoDS_Iterator it2(aS);
807 for (;it2.More();it2.Next()) aNbW++;
808 if(aNbW == nbW) aCaseW = 1;//exact solution for wire (nb of wires is kept)
809 else aCaseW = 2; // indefinite description ==> compound which can include expected wire
812 Standard_Integer i(1);
814 for (;it2.More();it2.Next(),i++) {
820 Standard_Integer aNbE(0), aCaseE(0);
821 it2.Initialize(aWire);
822 for (;it2.More();it2.Next()) aNbE++;
823 if(aNbE == nbE) aCaseE = 1;//exact solution for edge
828 it2.Initialize(aWire);
829 for (;it2.More();it2.Next(),i++) {
831 anEdge = it2.Value();
835 if(!anEdge.IsNull()) {
836 B.Select(anEdge, anEdge);
837 isOK = Standard_True;
844 for (TopTools_MapIteratorOfMapOfShape itM(S.Map()); itM.More(); itM.Next(),i++) {
847 for (TopTools_MapIteratorOfMapOfShape itM(S.Map()); itM.More(); itM.Next()) {
849 const TopoDS_Shape& S1 = itM.Key();
851 TCollection_AsciiString aName = aNam + i + ext;
852 DbgTools_Write(S1, aName.ToCString()) ;
856 isOK = Standard_True;
860 //=======================================================================
861 static void KeepInList(const TopoDS_Shape& CS, const TopAbs_ShapeEnum Type, TopTools_ListOfShape& aList)
863 if (CS.IsNull()) return;
865 if (Type == TopAbs_SHAPE) {
866 if (CS.ShapeType() == TopAbs_SOLID ||
867 CS.ShapeType() == TopAbs_FACE ||
868 CS.ShapeType() == TopAbs_EDGE ||
869 CS.ShapeType() == TopAbs_VERTEX ) {
873 for (TopoDS_Iterator it(CS) ; it.More(); it.Next()) {
874 aList.Append(it.Value());
879 if (Type > CS.ShapeType()) {
880 for (TopExp_Explorer exp(CS,Type) ; exp.More(); exp.Next()) {
881 aList.Append(exp.Current());
889 //=======================================================================
892 //=======================================================================
893 // Resulting NamedShape contains compound of next shapes:
894 // compound of last modifications of each argument (see CurrentShape method)
895 // without descendants of the stop shape.
896 //=======================================================================
897 static Standard_Boolean Union (const TDF_Label& L,
898 const TDF_LabelMap& Valid,
899 const TNaming_ListOfNamedShape& Args,
900 const Handle(TNaming_NamedShape)& Stop,
901 const TopAbs_ShapeEnum ShapeType,
902 const TDF_Label& ContextLabel)
904 if (Args.IsEmpty()) return Standard_False;
906 if(!ValidArgs(Args)) return Standard_False;
908 // temporary solution for Orientation name
909 Standard_Boolean isOr(Standard_True);
911 const TDF_Label& aLabel = L.Father();
912 if(!aLabel.IsNull()) {
915 Handle (TNaming_Naming) Naming;
916 if(aLabel.FindAttribute(TNaming_Naming::GetID(), Naming)) {
917 const TNaming_Name& aName = Naming->GetName();
918 if(aName.Type() == TNaming_ORIENTATION) {
919 const TNaming_ListOfNamedShape& Args = aName.Arguments();
920 if(Args.Extent() > 2) {
921 const Handle(TNaming_NamedShape)& A = Args.First();
923 PrintEntry(A->Label());
925 isOr = Standard_True;
929 isOr = Standard_True;
936 TNaming_ListIteratorOfListOfNamedShape it(Args);
937 TopTools_MapOfShape MS;
938 TDF_LabelMap Forbiden;
940 TNaming_NamingTool::BuildDescendants (Stop, Forbiden);//fill Forbidden
941 TNaming_NamingTool::CurrentShape (Valid, Forbiden,it.Value(),MS); // fill MS with last modifications of the first argument
942 TopoDS_Shape CS = MakeShape(MS);
944 TopTools_ListOfShape aListS;
946 KeepInList(CS,ShapeType,aListS);
947 TNaming_ShapesSet S(CS,ShapeType);//fill internal map of shapeset by shapes of the specified type
949 TCollection_AsciiString entry;
950 TDF_Tool::Entry(it.Value()->Label(), entry);
951 TCollection_AsciiString Nam("Arg_");
952 TCollection_AsciiString aNam = Nam + entry + "_" + "1.brep";
953 DbgTools_Write(CS, aNam.ToCString());
954 Standard_Integer ii = 1;
957 for (; it.More(); it.Next()) {
959 TDF_Tool::Entry(it.Value()->Label(), entry);
962 TNaming_NamingTool::CurrentShape (Valid, Forbiden,it.Value(),MS);// fill MS with last modifications of the it.Value()
965 KeepInList(CS,ShapeType,aListS);
966 TNaming_ShapesSet OS(CS,ShapeType);
967 S.Add(OS); //concatenate both shapesets
971 TCollection_AsciiString aNm = Nam + entry + "_" + ii + ".brep";
972 DbgTools_Write(CS, aNm.ToCString());
973 cout <<"Arg: Entry = " <<entry <<" TShape = " << CS.TShape() <<endl;
977 // start szy 27.05.08
979 Standard_Boolean found = Standard_False;
980 if(!ContextLabel.IsNull()) {
981 Handle(TNaming_NamedShape) CNS;
982 ContextLabel.FindAttribute(TNaming_NamedShape::GetID(),CNS);
983 TopoDS_Shape aContext;
986 TNaming_NamingTool::CurrentShape (Valid, Forbiden, CNS, MS);
987 aContext = MakeShape(MS);
989 TCollection_AsciiString anEntry;
990 TDF_Tool::Entry(ContextLabel, anEntry);
991 cout << "UNION: Context Label = " << anEntry << endl;
992 DbgTools_Write(aContext, "Union_Context.brep");
993 TCollection_AsciiString aN ("aMap_");
994 TopTools_MapIteratorOfMapOfShape it(S.Map());
995 for(Standard_Integer i=1; it.More();it.Next(), i++) {
996 TCollection_AsciiString aName = aN + i + ".brep";
997 DbgTools_Write(it.Key(), aName.ToCString());
1001 TopTools_ListOfShape aList;
1002 TopExp_Explorer anExpl(aContext, ShapeType);
1003 for(;anExpl.More(); anExpl.Next())
1004 aList.Append(anExpl.Current());
1006 cout <<"UNION: ShapeType = " << ShapeType << " List ext = " << aList.Extent()<<endl;
1007 TopAbs_ShapeEnum aTyp = TopAbs_SHAPE;
1008 TopTools_MapIteratorOfMapOfShape it1 (S.Map());
1009 for (int i=1;it1.More();it1.Next(),i++) {
1010 cout << "Map("<<i<<"): TShape = " << it1.Key().TShape() << " Orient = " << it1.Key().Orientation() <<endl;
1011 aTyp = it1.Key().ShapeType();
1014 TopExp_Explorer exp(aContext, aTyp);
1015 for(int i =1;exp.More();exp.Next(), i++) {
1016 cout << "Context("<<i<<"): TShape = " << exp.Current().TShape() << " Orient = " << exp.Current().Orientation() <<endl;
1020 TopTools_ListIteratorOfListOfShape itl(aList);
1021 for(;itl.More();itl.Next()) {
1022 aCand = itl.Value();
1024 DbgTools_Write(aCand, "Cand.brep");
1026 Standard_Integer num = S.Map().Extent();
1027 anExpl.Init(aCand, (ShapeType == TopAbs_WIRE) ? TopAbs_EDGE : TopAbs_FACE);
1028 for(;anExpl.More();anExpl.Next()) {
1029 if(S.Map().Contains(anExpl.Current()))
1033 found = Standard_True;
1040 TNaming_Builder B(L);
1042 if(!ContextLabel.IsNull()) {
1043 if(found) cout << "UNION: Shape is found in Context" <<endl;
1044 else cout << "UNION: Shape is NOT found in Context" <<endl;
1049 B.Select(aCand, aCand);
1051 BRep_Builder aCompoundBuilder;
1052 TopoDS_Compound aCompound;
1053 aCompoundBuilder.MakeCompound(aCompound);
1055 for (TopTools_MapIteratorOfMapOfShape itM(S.Map()); itM.More(); itM.Next()) {
1056 aCompoundBuilder.Add(aCompound,itM.Key());
1059 for (TopTools_ListIteratorOfListOfShape itL(aListS); itL.More(); itL.Next()) {
1060 aCompoundBuilder.Add(aCompound,itL.Value());
1062 TopoDS_Shape aShape = ShapeWithType(aCompound,ShapeType);
1064 DbgTools_Write(aShape, "Union_Selected.brep");
1065 DbgTools_Write(aCompound, "Union_Compound.brep");
1067 B.Select(aShape,aShape);
1071 for (TopTools_MapIteratorOfMapOfShape itM(S.Map()); itM.More(); itM.Next()) {
1072 const TopoDS_Shape& S = itM.Key();
1078 return Standard_True;
1081 //=======================================================================
1082 static TopoDS_Shape FindShape(const TNaming_DataMapOfShapeMapOfShape& DM)
1084 TopoDS_Shape aResult;
1085 Standard_Integer aNum = DM.Extent();
1086 if(aNum < 1) return aResult;
1087 TopTools_ListOfShape List;
1088 TNaming_DataMapIteratorOfDataMapOfShapeMapOfShape it(DM);
1089 for (;it.More();it.Next()) {
1090 const TopoDS_Shape& aKey1 = it.Key();
1091 const TNaming_MapOfShape& aMap = it.Value();
1093 TNaming_MapIteratorOfMapOfShape itm(aMap); // iterate first map
1094 for (;itm.More();itm.Next()) {
1095 const TopoDS_Shape& aS = itm.Key(); // element of the first map
1096 Standard_Boolean isCand(Standard_True); // aS is a Candidate
1097 TNaming_DataMapIteratorOfDataMapOfShapeMapOfShape it2(DM);
1098 for (;it2.More();it2.Next()) {
1099 const TopoDS_Shape& aKey2 = it2.Key();
1100 if(aKey2 == aKey1) continue;
1101 const TNaming_MapOfShape& aMap2 = it2.Value();
1102 if(!aMap2.Contains(aS)) isCand = Standard_False;
1109 if(List.IsEmpty()) return aResult;
1110 if(List.Extent() == 1) return List.First();
1111 TopTools_ListIteratorOfListOfShape itl (List);
1112 TopoDS_Compound Compound;
1114 B.MakeCompound(Compound);
1115 for (; itl.More(); itl.Next()){
1116 B.Add(Compound,itl.Value());
1121 //=======================================================================
1122 //function : Generation
1123 //purpose : Resolves Name from arguments: arg1 - generated (target shape)
1124 // : arg2 - the generator: the oldest ancestor (usually NS with
1125 // : PRIMITIVE evolution. (See TNaming_Localizer::FindGenerator).
1126 // : Resulting NamedShape contains shape, which is in the first
1127 // : argument NamedShape and is modification of the last argument NS.
1128 //=======================================================================
1130 static Standard_Boolean Generated (const TDF_Label& L,
1131 const TDF_LabelMap& Valid,
1132 const TNaming_ListOfNamedShape& Args)
1134 if (Args.Extent() < 2) {
1135 Standard_ConstructionError::Raise("TNaming_Name::Solve: => Generated");
1137 // First argument : label of generation
1138 // Next arguments : generators.
1141 if(!ValidArgs(Args)) return Standard_False;
1144 TDF_Label LabelOfGeneration = Args.First()->Label();
1146 DbgTools_Write(Args.First()->Get(), "Generated.brep") ;
1148 // Nouvell valeurs des generateurs dans l attribut de generation
1149 TopTools_MapOfShape aMS;
1150 TNaming_ListOfNamedShape aGenerators;
1151 aGenerators.Assign(Args);
1152 aGenerators.RemoveFirst();
1154 DbgTools_Write(aGenerators.First()->Get(), "Generators.brep") ;
1156 SearchModifUntil (Valid, Args.First(), aGenerators, aMS);
1157 Handle(TNaming_Naming) aNaming;
1158 TopoDS_Shape aSelection;
1159 L.FindAttribute(TNaming_Naming::GetID(),aNaming);
1160 if(!aNaming.IsNull())
1161 aSelection = aNaming->GetName().Shape();
1163 DbgTools_Write(aSelection, "G_Selection.brep") ;
1164 cout << "Generated::SearchModifUntil aMS.Extent() = " << aMS.Extent() <<endl;
1165 DbgTools_Write(aMS, "SearchModifUntil_Result");
1167 Handle(TNaming_NamedShape) anOldNS;
1168 Standard_Integer aVer = -1;// Initial build of name
1169 L.FindAttribute(TNaming_NamedShape::GetID(),anOldNS);
1170 if(!anOldNS.IsNull())
1171 aVer = anOldNS->Version();
1174 Standard_Integer i = 0, j=1;
1175 TCollection_AsciiString aNam2("Gen_New_");
1176 TCollection_AsciiString aNam1("Gen_Old_");
1177 TCollection_AsciiString ext(".brep");
1179 TNaming_Builder B(L); // NS
1180 TopTools_ListOfShape aList;
1181 TNaming_DataMapOfShapeMapOfShape aDM;
1182 for (TopTools_MapIteratorOfMapOfShape itMS(aMS); itMS.More(); itMS.Next()) {
1183 const TopoDS_Shape& OS = itMS.Key();
1185 TCollection_AsciiString aName = aNam1 + ++i + ext;
1186 DbgTools_Write(OS, aName.ToCString()) ;
1187 Standard_Integer j=0;
1189 TNaming_MapOfShape aMapDM;
1190 for (TNaming_NewShapeIterator itNew(OS,L); itNew.More(); itNew.Next())
1191 if (itNew.Label() == LabelOfGeneration) {
1192 aMapDM.Add(itNew.Shape());
1193 aList.Append(itNew.Shape());//szy 21.10.03
1195 TCollection_AsciiString aName = aNam2 + i + "_" + ++j + ext;
1196 DbgTools_Write(itNew.Shape(), aName.ToCString()) ;
1200 aDM.Bind(OS, aMapDM);
1203 if(aVer == -1) { //initial
1204 Standard_Integer i = 1;
1205 TNaming_Name& aName = aNaming->ChangeName();
1206 TopTools_ListIteratorOfListOfShape it(aList);
1207 if(!aSelection.IsNull()) {
1208 for(;it.More();it.Next(),i++) {
1209 if(it.Value().IsSame(aSelection)) {
1210 B.Select(it.Value(), it.Value());
1211 aName.Index(i); // for debug - index of selection in the list
1215 } else {// Selection == Null
1216 for(;it.More();it.Next())
1217 B.Select(it.Value(), it.Value());
1221 // *** Regeneration *** //
1222 if(aList.Extent() == 1) { // trivial case
1223 B.Select(aList.Last(), aList.Last());
1226 TNaming_Name& aName = aNaming->ChangeName();
1227 const TopAbs_ShapeEnum aType = aName.ShapeType();
1228 TopTools_ListOfShape aList2;
1229 TopTools_ListIteratorOfListOfShape it(aList);
1230 for(;it.More();it.Next()) {
1231 if(it.Value().ShapeType() == aType) //collect only the same type
1232 aList2.Append(it.Value());
1234 if(!aList2.Extent()) return Standard_False; // Empty
1236 Standard_Boolean found = Standard_False;
1237 TopoDS_Shape aShape = FindShape(aDM);
1239 if(!aShape.IsNull())
1240 DbgTools_Write(aShape, "G_FindShape.brep") ;
1242 if(!aShape.IsNull()) found = Standard_True;
1244 cout << "Generated ==>aGenerators.Extent() = " <<aGenerators.Extent() <<" aMS.Extent()= " <<aMS.Extent()<<endl;
1248 cout << "Generated ==> Shape is found!" <<endl;
1250 TopTools_ListOfShape aLM;
1251 Standard_Boolean aHas = Standard_False;
1252 Standard_Boolean a1NB = Standard_False;
1253 if(aGenerators.Extent() != aMS.Extent()) { //missed generators
1254 aHas = Standard_True;//has lost generatos
1256 cout << "Generated ==> has lost generatos!" <<endl;
1258 for (TNaming_ListIteratorOfListOfNamedShape itg(aGenerators); itg.More(); itg.Next()) {
1259 if(!aMS.Contains(itg.Value()->Get()))
1260 aLM.Append(itg.Value()->Get());
1262 if(aLM.Extent() == 1) {//lost 1
1263 TopTools_ListIteratorOfListOfShape itm(aLM);
1264 TopoDS_Shape aSM = itm.Value(); // Missed
1265 for (TopTools_MapIteratorOfMapOfShape itMS1(aMS); itMS1.More(); itMS1.Next()) {
1266 const TopoDS_Shape& aS = itMS1.Key();
1267 if(aSM.ShapeType() == aS.ShapeType()) {
1268 if(aS.ShapeType() == TopAbs_EDGE) {
1269 TopoDS_Vertex aVCom;
1270 if(TopExp::CommonVertex(TopoDS::Edge(aS), TopoDS::Edge(aSM), aVCom))
1271 {a1NB = Standard_True;
1272 break;} //lost only 1 neigbour
1273 } else if(aS.ShapeType() == TopAbs_FACE) {
1274 TopExp_Explorer expl1(aS, TopAbs_EDGE);
1275 for(;expl1.More();expl1.Next()) {
1276 TopExp_Explorer expl2(aSM, TopAbs_EDGE);
1277 for(;expl2.More();expl2.Next()) {
1278 if(expl1.Current().IsSame(expl2.Current()))
1279 {a1NB = Standard_True;
1280 break;} //lost only 1 neigbour
1286 // if(aShape.ShapeType() == TopAbs_VERTEX && a1NBE) {
1287 // //if atleast 1 Gen was missed and the Gen is Edge
1288 // TopTools_ListIteratorOfListOfShape it(aList);
1289 // for(;it.More();it.Next()) {
1290 // if(it.Value().ShapeType() == TopAbs_EDGE) {
1291 // const TopoDS_Shape& aV1 = TopExp::FirstVertex(TopoDS::Edge(it.Value()));
1292 // const TopoDS_Shape& aV2 = TopExp::LastVertex(TopoDS::Edge(it.Value()));
1293 // if(aShape.IsSame(aV1)) {aShape2 = aV2; cout << "##### => V2 " <<endl;break;}
1295 // if(aShape.IsSame(aV2)) {aShape2 = aV1; cout << "##### => V1 " <<endl;break;}
1301 if(!aHas) // all arguments were kept
1302 B.Select(aShape, aShape); //only this case is correct on 100%
1304 if (a1NB) //Has, but may be ...
1305 B.Select(aShape, aShape);
1307 // put Compound, may be if possible processed later in Sel. Driver
1308 TopTools_ListIteratorOfListOfShape it1(aList2);
1309 for(;it1.More();it1.Next())
1310 B.Select(it1.Value(), it1.Value());
1316 cout << "Generated ==> Shape is NOT found! Probably Compound will be built" <<endl;
1319 TopTools_ListIteratorOfListOfShape it2(aList2);
1320 for(;it2.More();it2.Next())
1321 B.Select(it2.Value(), it2.Value());
1325 return Standard_True;
1328 //=======================================================================
1329 //function : Identity
1330 //purpose : Regenerates Naming attribute with Name = IDENTITY
1331 //=======================================================================
1332 // Name with this type must contain only one NamedShape attribute as argument.
1333 // Algorithm takes all last modifications of NamedShape of this argument
1334 // starting with this one ( see method TNaming_NamingTool::CurrentShape ).
1335 // Algorithm takes only NamedShapes belonging to the labels from the Valid
1336 // labels map (if it's not empty) and put to the resulting NamedShape as compound.
1337 //=======================================================================
1338 static Standard_Boolean Identity (const TDF_Label& L,
1339 const TDF_LabelMap& Valid,
1340 const TNaming_ListOfNamedShape& Args,
1341 const TopAbs_ShapeEnum ShapeType)
1343 if (Args.Extent() > 2) {
1344 Standard_ConstructionError::Raise("TNaming_Name::Solve");
1347 if(!ValidArgs(Args)) return Standard_False;
1349 const Handle(TNaming_NamedShape)& A = Args.First();
1350 TopTools_MapOfShape MS;
1351 TDF_LabelMap Forbiden;
1352 TNaming_NamingTool::CurrentShape (Valid,Forbiden,A,MS);
1353 #ifdef MDTV_DEB_SOL2
1354 //TCollection_AsciiString entry;
1355 //TDF_Tool::Entry(L, entry);
1356 //TDF_Tool::Entry(A->Label(), entry);
1358 TNaming_Builder B(L);
1359 for (TopTools_MapIteratorOfMapOfShape itM(MS); itM.More(); itM.Next()) {
1361 const TopoDS_Shape& S = ShapeWithType(itM.Key(),ShapeType);
1363 const TopoDS_Shape& S = itM.Key();
1365 #ifdef MDTV_DEB_SOL2
1366 //TopAbs_Orientation Or = S.Orientation();
1370 return Standard_True;
1373 //=======================================================================
1374 //function : FilterByNeighbourgs
1375 //purpose : regenerated the specified shape with help of its neighbours
1376 //=======================================================================
1377 // result - is a subshape of the first argument of the Name with type =
1378 // ShapeType of this Name, which has a common subshapes (boundaries) with
1379 // each neighbour - shapes from the other arguments of the Name.
1380 //=======================================================================
1381 static Standard_Boolean FilterByNeighbourgs (const TDF_Label& L,
1382 const TDF_LabelMap& Valid,
1383 const TNaming_ListOfNamedShape& Args,
1384 const Handle(TNaming_NamedShape)& Stop,
1385 const TopAbs_ShapeEnum ShapeType)
1388 TNaming_Builder B(L);
1390 TDF_LabelMap Forbiden;
1392 if(!ValidArgs(Args)) return Standard_False;
1394 TNaming_NamingTool::BuildDescendants (Stop, Forbiden); //all descendants of Stop (New shapes) are forbidden
1395 if (!Stop.IsNull()) Forbiden.Remove(Stop->Label());
1396 //----------------------------------------
1397 // First argument: collection has to be filtered.
1398 //----------------------------------------
1399 Handle(TNaming_NamedShape) Cand = Args.First(); //collection of candidates
1402 Standard_Integer i = 1;
1403 TCollection_AsciiString aNam("Cand_");
1404 TCollection_AsciiString ext(".brep");
1405 DbgTools_WriteNSOnLabel(Cand, aNam.ToCString());
1406 cout << "Cand (Args.First()) Label = ";
1407 PrintEntry(Cand->Label());
1408 cout << "Valid Label map:" <<endl;
1409 PrintEntries(Valid);
1412 TopTools_MapOfShape SCand;
1413 TNaming_NamingTool::CurrentShape (Valid, Forbiden,Cand,SCand);//fills SCand with last modifications of Cand. CandNS should be at the same level (before) as NS of FilterByNBS
1416 TCollection_AsciiString aNam2("SCand");
1417 DbgTools_Write(SCand, aNam2.ToCString());
1418 cout <<"SCand Extent = " << SCand.Extent() << " Expected ShapeType = " << ShapeType << endl;
1421 //------------------------------------------------------------
1422 // Autres arguments : contiennent les voisins du bon candidat.
1423 // Other arguments : contains the neighbors of the good candidate.
1424 //------------------------------------------------------------
1425 TopAbs_ShapeEnum TC = TopAbs_EDGE;
1426 if (ShapeType == TopAbs_EDGE) TC = TopAbs_VERTEX;
1427 if (ShapeType == TopAbs_VERTEX) TC = TopAbs_VERTEX; // szy 31.03.10 - to process case when Candidate is of type Vertex
1431 aNam = "Boundaries";
1433 Standard_Boolean isDone = Standard_False;
1434 if(SCand.Extent() == 1) { // check if a collection is inside
1435 TopTools_MapIteratorOfMapOfShape it(SCand);
1436 const TopoDS_Shape& aS = it.Key();
1438 if(aS.ShapeType() == TopAbs_COMPOUND && aS.ShapeType() != ShapeType) {
1439 TopoDS_Iterator itt(aS);
1440 for(;itt.More();itt.Next())
1441 SCand.Add(itt.Value());
1445 for (TopTools_MapIteratorOfMapOfShape itCand(SCand); itCand.More(); itCand.Next()) { //1
1446 const TopoDS_Shape& S = itCand.Key();
1447 TopTools_MapOfShape Boundaries;
1448 if(S.ShapeType() == TopAbs_VERTEX) //# szy 31.03.10
1449 Boundaries.Add (S); //#
1451 for (TopExp_Explorer exp(S,TC); exp.More(); exp.Next()) { //put boundaries of each candidate (from SCand) to the Boundaries map
1452 Boundaries.Add (exp.Current());
1454 TCollection_AsciiString aName = aNam + i++ + ext;
1455 DbgTools_Write(exp.Current(), aName.ToCString()) ;
1459 TNaming_ListIteratorOfListOfNamedShape it(Args);
1461 Standard_Boolean Keep = 1;
1463 cout <<"Args number = " << Args.Extent() <<endl;
1465 aNam = "Boundaries";
1467 for ( ; it.More(); it.Next()) { //2 ==> for each Arg
1468 Standard_Boolean Connected = Standard_False;
1469 // Le candidat doit etre connexe a au moins un shape de
1470 // chaque NamedShape des voisins.
1471 // The candidate should be connectedand and have at least one shape of NamedShape
1472 // of each neighbor.
1473 const Handle(TNaming_NamedShape)& NSVois = it.Value(); //neighbor
1476 DbgTools_WriteNSOnLabel(NSVois, "Next_Neighbor_") ;
1479 TopTools_MapOfShape SVois;
1480 TNaming_NamingTool::CurrentShape (Valid, Forbiden,NSVois,SVois); // fills SVois with last modifications of NSVois
1483 TCollection_AsciiString aNam2("SVois");
1484 DbgTools_Write(SVois, aNam2.ToCString());
1487 for (TopTools_MapIteratorOfMapOfShape itVois(SVois); itVois.More(); itVois.Next()) { //6
1488 const TopoDS_Shape& Vois = itVois.Key();
1489 for (TopExp_Explorer exp1(Vois,TC); exp1.More(); exp1.Next()) { //7
1490 if (Boundaries.Contains(exp1.Current())) {
1491 Connected = Standard_True; // has common boundaries with candidate shape
1493 DbgTools_Write(Vois, "Neighbor_Connected.brep");
1498 if (Connected) break;
1507 isDone = Standard_True;
1509 DbgTools_Write(S, "FilterByNbs_Sel.brep") ;
1516 //=======================================================================
1517 static const TopoDS_Shape FindSubShapeInAncestor(const TopoDS_Shape& Selection, const TopoDS_Shape& Context )
1519 #ifdef MDTV_DEB_OR_AG
1520 DbgTools_Write(Selection, "Orientation_Selection.brep");
1521 DbgTools_Write(Context, "Orientation_Context.brep");
1522 TopExp_Explorer expl1(Context, Selection.ShapeType());
1524 TCollection_AsciiString SS( "Orientation_Current_");
1525 for(;expl1.More(); expl1.Next()) {
1526 if(expl1.Current().IsSame(Selection)) {
1528 cout <<"FindSubShape: = " <<expl1.Current().ShapeType() << " TS = " <<expl1.Current().TShape() << endl;
1529 TCollection_AsciiString nam = SS + i + ".brep";
1530 DbgTools_Write(expl1.Current(), nam.ToCString());
1534 if(Selection.ShapeType() != TopAbs_COMPOUND) {
1535 TopExp_Explorer anExpl(Context, Selection.ShapeType());
1536 for(;anExpl.More(); anExpl.Next()) {
1537 #ifdef MDTV_DEB_OR_AG
1538 cout <<"FindSubShape: = " <<anExpl.Current().ShapeType() << " TS = " <<anExpl.Current().TShape()->This() << endl;
1539 DbgTools_Write(anExpl.Current(), "Orientation_Current.brep");
1541 if(anExpl.Current().IsSame(Selection))
1542 return anExpl.Current();
1546 return TopoDS_Shape();
1549 //=======================================================================
1550 //static Standard_Integer Count(const TopoDS_Shape& S)
1552 // Standard_Integer N(0);
1553 // TopoDS_Iterator it(S);
1554 // for(;it.More();it.Next()) {
1555 // if(it.Value().ShapeType() != TopAbs_COMPOUND && it.Value().ShapeType() != TopAbs_COMPSOLID)
1558 // N += Count(it.Value());
1563 //=======================================================================
1564 static Standard_Integer Aggregation (const TopoDS_Shape& S, const TopoDS_Shape& AS, TNaming_Builder& B)
1566 Standard_Integer N(0);
1567 TopoDS_Iterator it(S);
1568 for(;it.More();it.Next()) {
1569 const TopoDS_Shape& sel = it.Value();
1570 if(sel.ShapeType() > TopAbs_COMPSOLID) {
1571 const TopoDS_Shape& CS = FindSubShapeInAncestor(sel, AS);
1577 N += Aggregation(sel, AS, B);
1582 //==========================================================================
1583 //function : Orientation
1584 //purpose : to solve ORIENTATION name
1585 // this function explores the second argument | arguments (Context) and
1586 // keeps at the label (L) the first argument (S) with the orientation it
1587 // has in the context. Index is used only for Seam edge recomputing
1588 //==========================================================================
1589 static Standard_Boolean ORientation (const TDF_Label& L,
1590 const TDF_LabelMap& Valid,
1591 const TNaming_ListOfNamedShape& Args,
1592 const Handle(TNaming_NamedShape)& Stop,
1593 const Standard_Integer Index)
1596 if(!ValidArgs(Args)) return Standard_False;
1598 const Handle(TNaming_NamedShape)& A = Args.First();
1599 TopTools_MapOfShape MS;
1600 TDF_LabelMap Forbiden;
1601 TNaming_NamingTool::BuildDescendants (Stop, Forbiden);
1602 TNaming_NamingTool::CurrentShape (Valid,Forbiden,A,MS);
1605 Standard_Boolean isSplit(Standard_False);
1606 if (!MS.IsEmpty ()) {
1607 TopTools_MapIteratorOfMapOfShape it(MS);
1608 if (MS.Extent() == 1) {
1612 isSplit = Standard_True;
1615 for(Standard_Integer i=1;it.More();it.Next(), i++) {
1616 TCollection_AsciiString aNam("OR_Selection_");
1617 TCollection_AsciiString aName = aNam + i + ".brep";
1618 DbgTools_Write(it.Key(), aName.ToCString());
1624 TNaming_Builder B(L);
1626 return Standard_False;
1628 DbgTools_Write(S, "Orientation_S.brep");
1631 TopTools_ListOfShape aSList;
1633 if(S.ShapeType() == TopAbs_COMPOUND && !isSplit) {
1634 TopoDS_Iterator it(S);
1635 for(;it.More();it.Next())
1636 aSList.Append(it.Value());
1639 TopTools_MapOfShape MSC;
1640 if(aSList.Extent() == 0) {
1641 const Handle(TNaming_NamedShape)& Anc = Args.Last();
1643 cout << "### ORIENTATION: Ancestor ";
1644 PrintEntry(Anc->Label());
1647 TNaming_NamingTool::CurrentShape (Valid,Forbiden,Anc,MSC);
1648 if(MSC.Extent() == 1) {
1649 for (TopTools_MapIteratorOfMapOfShape itM(MSC); itM.More(); itM.Next()) {
1650 const TopoDS_Shape& AS = itM.Key();
1651 // <=== start 21.10.2009
1653 if(Index > 0) { //only for seam edge
1654 TopoDS_Iterator itw(AS);
1655 for(;itw.More();itw.Next()) {
1656 Standard_Boolean found(Standard_False);
1657 TopoDS_Iterator it(itw.Value());
1658 for(int i=1;it.More();it.Next(),i++) {
1659 if(i == Index && it.Value().IsSame(S)) {
1661 found = Standard_True;
1663 cout << "ORIENTATION => ORDER = " << i <<endl;
1671 CS = FindSubShapeInAncestor(S, AS);
1672 // <=== end 21.10.2009
1674 cout << "ORIENTATION: Selection" <<" TShape = " <<CS.TShape() <<" Orientation = " << CS.Orientation() <<endl;
1675 cout << "ORIENTATION: Context " << "ShapeType = "<<AS.ShapeType() << " TShape = " <<AS.TShape() <<endl;
1676 DbgTools_Write(AS, "Orientation_Cnt.brep");
1681 if(!Aggregation(S, AS, B))
1682 return Standard_False;
1686 const TopoDS_Shape AS = MakeShape(MSC);
1687 const TopoDS_Shape& CS = FindSubShapeInAncestor(S, AS);
1691 if(!Aggregation(S, AS, B))
1692 return Standard_False;
1696 TNaming_ListIteratorOfListOfNamedShape it(Args);
1697 it.Next(); //skip first
1699 // temporary solution. To be optimized (+ has connection with Union name)
1700 Handle(TopTools_HArray2OfShape) Arr; // Arr(1,1) - selection; Arr(1,2) - Context shape
1701 Arr = new TopTools_HArray2OfShape (1, aSList.Extent(), 1, 2);
1702 TopTools_ListIteratorOfListOfShape it1(aSList);
1703 Standard_Integer i = 1;
1704 for(; it1.More(); it1.Next(), it.Next(), i++) {
1705 Arr->SetValue(i, 1, it1.Value());
1707 TNaming_NamingTool::CurrentShape (Valid,Forbiden,it.Value(),MSC);
1708 if(MSC.Extent() == 1) {
1709 for (TopTools_MapIteratorOfMapOfShape itM(MSC); itM.More(); itM.Next()) {
1710 const TopoDS_Shape& AS = itM.Key();
1711 Arr->SetValue(i, 2, AS);
1714 const TopoDS_Shape AS = MakeShape(MSC);
1715 Arr->SetValue(i, 2, AS);
1719 if(aSList.Extent() == 1) {
1720 const TopoDS_Shape& S = Arr->Value(1,1);
1721 if(S.ShapeType() != TopAbs_COMPOUND) {
1722 const TopoDS_Shape& CS = FindSubShapeInAncestor(S, Arr->Value(1,2));
1726 return Standard_False;
1730 DbgTools_Write(Arr->Value(1,2), "Ancestor.brep");
1732 if(!Aggregation(S, Arr->Value(1,2), B)) {
1733 return Standard_False;
1738 for(Standard_Integer i = Arr->LowerRow();i <= Arr->UpperRow();i++) {
1739 const TopoDS_Shape& S = Arr->Value(i,1);
1740 const TopoDS_Shape& AC = Arr->Value(i,2);
1741 if(S.ShapeType() != TopAbs_COMPOUND) {
1742 const TopoDS_Shape& CS = FindSubShapeInAncestor(S, AC);
1746 return Standard_False;
1750 DbgTools_Write(AC, "Aggregation.brep");
1752 if(!Aggregation(S, AC, B)) {
1753 return Standard_False;
1758 } // end of tmp. solution
1760 return Standard_True;
1763 //===========================================================================
1765 //purpose : to solve WIREIN name
1766 //=======================================================================
1767 static Standard_Boolean WireIN(const TDF_Label& L,
1768 const TDF_LabelMap& Valid,
1769 const TNaming_ListOfNamedShape& Args,
1770 const Handle(TNaming_NamedShape)& Stop,
1771 Standard_Integer Index)
1773 Standard_Boolean aResult(Standard_False);
1774 if(!ValidArgs(Args)) return aResult;
1775 TopTools_MapOfShape MS;
1776 TDF_LabelMap Forbiden;
1777 if (Args.Extent() < 1 )
1778 Standard_ConstructionError::Raise("TNaming_Name::Solve");
1779 const Handle(TNaming_NamedShape)& A = Args.First();
1780 TNaming_NamingTool::CurrentShape (Valid,Forbiden,A,MS);
1781 if (MS.Extent() != 1) return aResult;
1782 TopTools_MapIteratorOfMapOfShape itM(MS);
1783 const TopoDS_Shape& aCF = itM.Key() ;
1785 cout <<"MS Extent = " <<MS.Extent() <<endl;
1786 DbgTools_Write(aCF, "Context_Face.brep");
1788 TNaming_Builder B(L);
1789 if(Index == 1 ){ //Outer wire case
1790 TopoDS_Wire anOuterWire;
1791 TNaming::OuterWire(TopoDS::Face(aCF), anOuterWire);
1792 if(!anOuterWire.IsNull()) {
1793 B.Select(anOuterWire, anOuterWire);
1794 aResult = Standard_True;
1796 } else { //has internal wires
1797 TNaming_ListOfNamedShape ArgsE;
1799 ArgsE.RemoveFirst();
1800 // fill Map with edges
1801 TNaming_ListIteratorOfListOfNamedShape it(ArgsE);
1802 TopTools_MapOfShape MS;
1803 TDF_LabelMap Forbiden;
1805 TNaming_NamingTool::BuildDescendants (Stop, Forbiden);//fill Forbidden
1806 TNaming_NamingTool::CurrentShape (Valid, Forbiden,it.Value(),MS); // fill MS with last modifications of the first additional argument
1807 TopoDS_Shape CS = MakeShape(MS);
1809 TNaming_ShapesSet aSet(CS,TopAbs_EDGE);//fill internal map of shapeset by shapes of the specified type
1811 TCollection_AsciiString entry;
1812 TDF_Tool::Entry(it.Value()->Label(), entry);
1813 TCollection_AsciiString Nam("Arg_");
1814 TCollection_AsciiString aNam = Nam + entry + "_" + "2.brep";
1815 DbgTools_Write(CS, aNam.ToCString());
1816 Standard_Integer ii = 2;
1819 for (; it.More(); it.Next()) {
1821 TDF_Tool::Entry(it.Value()->Label(), entry);
1824 TNaming_NamingTool::CurrentShape (Valid, Forbiden,it.Value(),MS);// fill MS with last modifications of the it.Value()
1826 TNaming_ShapesSet OS(CS,TopAbs_EDGE);
1827 aSet.Add(OS); //concatenate both shapesets
1831 TCollection_AsciiString aNm = Nam + entry + "_" + ii + ".brep";
1832 DbgTools_Write(CS, aNm.ToCString());
1833 cout <<"Arg: Entry = " <<entry <<" TShape = " << CS.TShape() <<endl;
1838 cout <<"WIREIN: " << " Internal Map ext = " << aSet.Map().Extent()<<endl;
1839 TopTools_MapIteratorOfMapOfShape it1 (aSet.Map());
1840 for (int i=1;it1.More();it1.Next(),i++) {
1841 cout << "Map("<<i<<"): TShape = " << it1.Key().TShape() << " Orient = " << it1.Key().Orientation() <<" Type = " <<
1842 it1.Key().ShapeType()<<endl;
1845 TopExp_Explorer exp(aCF, TopAbs_EDGE);
1846 for(int i =1;exp.More();exp.Next(), i++) {
1847 cout << "Context_Face("<<i<<"): TShape = " << exp.Current().TShape() << " Orient = " << exp.Current().Orientation() <<endl;
1852 for (TopoDS_Iterator itF(aCF); itF.More(); itF.Next()) {// find the expected wire in the face
1853 const TopoDS_Shape& S = itF.Value();//wire
1856 DbgTools_Write(S, "WireIN_S.brep");
1857 cout <<"WIREIN: ShapeType = " << S.ShapeType() << " TS = " << S.TShape()->This() <<endl;
1859 if(S.ShapeType() == TopAbs_WIRE) {
1860 TopTools_MapOfShape aView;
1861 Standard_Integer aNum(0x7FFFFFFF);
1862 for (TopoDS_Iterator it(S);it.More();it.Next())
1863 aView.Add(it.Value());// edges of wire of the face in map
1865 TopTools_MapIteratorOfMapOfShape it (aSet.Map());
1866 aNum = aView.Extent();
1867 if(aNum == aSet.Map().Extent()) {
1868 for (;it.More();it.Next()) {
1869 if(aView.Contains(it.Key())) {
1876 aResult = Standard_True;
1884 TopoDS_Wire anOuterWire;
1885 TNaming::OuterWire(TopoDS::Face(aCF), anOuterWire);
1886 if(!anOuterWire.IsNull()) {
1887 for (TopoDS_Iterator itF(aCF); itF.More(); itF.Next()) {
1888 const TopoDS_Shape& S = itF.Value();//wire
1889 if(!S.IsNull()&& S.ShapeType() == TopAbs_WIRE) {
1890 if(S.IsEqual(anOuterWire)) continue;
1899 //===========================================================================
1900 //function : ShellIN
1901 //purpose : to solve SHELLIN name
1902 //===========================================================================
1903 static Standard_Boolean ShellIN(const TDF_Label& L,
1904 const TDF_LabelMap& Valid,
1905 const TNaming_ListOfNamedShape& Args,
1906 const Handle(TNaming_NamedShape)& Stop,
1907 Standard_Integer Index)
1909 Standard_Boolean aResult(Standard_False);
1910 if(!ValidArgs(Args))
1912 TopTools_MapOfShape MS;
1913 TDF_LabelMap Forbiden;
1914 if (Args.Extent() < 1 )
1915 Standard_ConstructionError::Raise("TNaming_Name::Solve");
1916 const Handle(TNaming_NamedShape)& A = Args.First();
1917 TNaming_NamingTool::CurrentShape (Valid,Forbiden,A,MS);
1918 if (MS.Extent() != 1) return aResult;
1919 TopTools_MapIteratorOfMapOfShape itM(MS);
1920 const TopoDS_Shape& aCSO = itM.Key() ;
1921 #ifdef MDTV_DEB_SHELL
1922 cout <<"MS Extent = " <<MS.Extent() <<endl;
1923 DbgTools_Write(aCSO, "Context_Solid.brep");
1925 TNaming_Builder B(L);
1926 if(Index == 1 ){ //Outer Shell case
1927 TopoDS_Shell anOuterShell;
1928 TNaming::OuterShell(TopoDS::Solid(aCSO), anOuterShell);
1929 if(!anOuterShell.IsNull()) {
1930 B.Select(anOuterShell, anOuterShell);
1931 aResult = Standard_True;
1932 #ifdef MDTV_DEB_SHELL
1933 cout << "Outer Shell case" <<endl;
1935 DbgTools_Write(anOuterShell, "ShellOut_S.brep");
1936 it.Initialize(aCSO);
1937 for(;it.More();it.Next()){
1938 DbgTools_Write(it.Value(), "ShOut_S.brep");
1942 } else { //has internal Shells
1943 TNaming_ListOfNamedShape ArgsF;
1945 ArgsF.RemoveFirst();
1946 // fill Map with faces
1947 TNaming_ListIteratorOfListOfNamedShape it(ArgsF);
1948 TopTools_MapOfShape MS;
1949 TDF_LabelMap Forbiden;
1951 TNaming_NamingTool::BuildDescendants (Stop, Forbiden);//fill Forbidden
1952 TNaming_NamingTool::CurrentShape (Valid, Forbiden,it.Value(),MS); // fill MS with last modifications of the first additional argument
1953 TopoDS_Shape CS = MakeShape(MS);
1955 TNaming_ShapesSet aSet(CS,TopAbs_FACE);//fill internal map of shapeset by shapes of the specified type
1956 #ifdef MDTV_DEB_SHELL
1957 TCollection_AsciiString entry;
1958 TDF_Tool::Entry(it.Value()->Label(), entry);
1959 TCollection_AsciiString Nam("Arg_");
1960 TCollection_AsciiString aNam = Nam + entry + "_" + "2.brep";
1961 DbgTools_Write(CS, aNam.ToCString());
1962 Standard_Integer ii = 2;
1965 for (; it.More(); it.Next()) {
1966 #ifdef MDTV_DEB_SHELL
1967 TDF_Tool::Entry(it.Value()->Label(), entry);
1970 TNaming_NamingTool::CurrentShape (Valid, Forbiden,it.Value(),MS);// fill MS with last modifications of the it.Value()
1972 TNaming_ShapesSet OS(CS,TopAbs_FACE);
1973 aSet.Add(OS); //concatenate both shapesets
1975 #ifdef MDTV_DEB_SHELL
1977 TCollection_AsciiString aNm = Nam + entry + "_" + ii + ".brep";
1978 DbgTools_Write(CS, aNm.ToCString());
1979 cout <<"Arg: Entry = " <<entry <<" TShape = " << CS.TShape() <<endl;
1983 #ifdef MDTV_DEB_SHELL
1984 cout <<"SHELLIN: " << " Internal Map ext = " << aSet.Map().Extent()<<endl;
1985 TopTools_MapIteratorOfMapOfShape it1 (aSet.Map());
1986 for (int i=1;it1.More();it1.Next(),i++) {
1987 cout << "Map("<<i<<"): TShape = " << it1.Key().TShape() << " Orient = " << it1.Key().Orientation() <<" Type = " <<
1988 it1.Key().ShapeType()<<endl;
1991 TopExp_Explorer exp(aCSO, TopAbs_FACE);
1992 for(int i = 1;exp.More();exp.Next(), i++) {
1993 cout << "Context_Solid("<<i<<"): TShape = " << exp.Current().TShape() << " Orient = " << exp.Current().Orientation() <<endl;
1998 for (TopoDS_Iterator itS(aCSO); itS.More(); itS.Next()) {// find the expected shell in the solid
1999 const TopoDS_Shape& S = itS.Value();//shell
2001 #ifdef MDTV_DEB_SHELL
2002 DbgTools_Write(S, "ShellIN_S.brep");
2003 cout <<"SHELLIN: ShapeType = " << S.ShapeType() << " TS = " << S.TShape()->This() <<endl;
2005 if(S.ShapeType() == TopAbs_SHELL) {
2006 TopTools_MapOfShape aView;
2007 Standard_Integer aNum(0x7FFFFFFF);
2008 for (TopoDS_Iterator it(S);it.More();it.Next())
2009 aView.Add(it.Value());// faces of shell of the solid in map
2011 aNum = aView.Extent();
2012 if(aNum == aSet.Map().Extent()) {
2013 TopTools_MapIteratorOfMapOfShape it (aSet.Map());
2014 for (;it.More();it.Next()) {
2015 if(aView.Contains(it.Key())) {
2022 aResult = Standard_True;
2030 TopoDS_Shell anOuterShell;
2031 TNaming::OuterShell(TopoDS::Solid(aCSO), anOuterShell);
2032 if(!anOuterShell.IsNull()) {
2033 for (TopoDS_Iterator itS(aCSO); itS.More(); itS.Next()) {
2034 const TopoDS_Shape& S = itS.Value();//shell
2035 if(!S.IsNull()&& S.ShapeType() == TopAbs_SHELL) {
2036 if(S.IsEqual(anOuterShell)) continue;
2046 //=======================================================================
2047 static Standard_CString NameTypeToString (const TNaming_NameType Type)
2051 case TNaming_UNKNOWN : return "UNKNOWN";
2052 case TNaming_IDENTITY : return "IDENTITY";
2053 case TNaming_MODIFUNTIL : return "MODIFUNTIL";
2054 case TNaming_GENERATION : return "GENERATION";
2055 case TNaming_INTERSECTION : return "INTERSECTION";
2056 case TNaming_UNION : return "UNION";
2057 case TNaming_SUBSTRACTION : return "SUBSTRACTION";
2058 case TNaming_CONSTSHAPE : return "CONSTSHAPE";
2059 case TNaming_FILTERBYNEIGHBOURGS : return "FILTERBYNEIGHBOURGS";
2060 case TNaming_ORIENTATION : return "ORIENTATION";
2061 case TNaming_WIREIN : return "WIREIN";
2063 Standard_DomainError::Raise("TNaming_NameType; enum term unknown ");
2068 //=======================================================================
2071 //=======================================================================
2073 Standard_Boolean TNaming_Name::Solve(const TDF_Label& aLab,
2074 const TDF_LabelMap& Valid) const
2076 Standard_Boolean Done = 0;
2082 case TNaming_UNKNOWN :
2086 case TNaming_IDENTITY :
2088 Done = Identity(aLab,Valid,myArgs,myShapeType);
2091 case TNaming_MODIFUNTIL:
2093 Done = ModifUntil (aLab,Valid,myArgs,myStop);
2096 case TNaming_GENERATION:
2098 Done = Generated (aLab,Valid,myArgs);
2101 case TNaming_INTERSECTION:
2103 Done = Intersection (aLab,Valid,myArgs,myStop,myShapeType,myIndex);
2108 Done = Union (aLab,Valid,myArgs,myStop,myShapeType, myContextLabel);
2111 case TNaming_SUBSTRACTION:
2113 Standard_NotImplemented::Raise();
2114 // Done = Substraction (aLab,Valid,myArgs);
2117 case TNaming_CONSTSHAPE:
2119 Done = ConstShape (aLab,Valid,myArgs,myStop,myIndex);
2122 case TNaming_FILTERBYNEIGHBOURGS:
2124 Done = FilterByNeighbourgs (aLab,Valid,myArgs,myStop,myShapeType);
2127 case TNaming_ORIENTATION:
2129 Done = ORientation (aLab,Valid,myArgs,myStop,myIndex);
2132 case TNaming_WIREIN:
2135 cout << "Name::Solve: NameType = " << myType << " ";
2138 Done = WireIN (aLab,Valid,myArgs,myStop,myIndex);
2141 case TNaming_SHELLIN:
2143 #ifdef MDTV_DEB_SHELL
2144 cout << "Name::Solve: NameType = " << myType << " ";
2147 Done = ShellIN (aLab,Valid,myArgs,myStop,myIndex);
2153 cout << "Name::Solve: EXCEPTION==> NameType = " << NameTypeToString(myType) << " ";
2160 //=======================================================================
2161 //function : ContextLabel
2163 //=======================================================================
2165 void TNaming_Name::ContextLabel(const TDF_Label& theLabel)
2167 myContextLabel = theLabel;
2170 //=======================================================================
2171 //function : ContextLabel
2173 //=======================================================================
2175 const TDF_Label& TNaming_Name::ContextLabel() const
2177 return myContextLabel;
2180 //=======================================================================
2181 //function : Orientation
2183 //=======================================================================
2184 void TNaming_Name::Orientation(const TopAbs_Orientation theOrientation)
2186 myOrientation = theOrientation;