0023921: IGES reader cannot map subshapes colors inside nested assemblies
[occt.git] / src / IGESCAFControl / IGESCAFControl_Reader.cxx
1 // Created on: 2000-08-16
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-2012 OPEN CASCADE SAS
4 //
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
9 //
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 //
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
19
20
21 #include <TDF_Label.hxx>
22 #include <IGESCAFControl_Reader.ixx>
23 #include <TopoDS_Shape.hxx>
24 #include <XCAFDoc_ShapeTool.hxx>
25 #include <XSControl_TransferReader.hxx>
26 #include <XCAFDoc_ColorTool.hxx>
27 #include <IGESData_IGESEntity.hxx>
28 #include <Transfer_Binder.hxx>
29 #include <TransferBRep.hxx>
30 #include <Quantity_Color.hxx>
31 #include <IGESCAFControl.hxx>
32 #include <IGESGraph_Color.hxx>
33 #include <Interface_InterfaceModel.hxx>
34 #include <Transfer_TransientProcess.hxx>
35 #include <XCAFDoc_DocumentTool.hxx>
36 #include <TopoDS_Iterator.hxx>
37 #include <TopTools_MapOfShape.hxx>
38 #include <TCollection_ExtendedString.hxx>
39 #include <TDataStd_Name.hxx>
40 #include <XCAFDoc_LayerTool.hxx>
41 #include <IGESData_LevelListEntity.hxx>
42 #include <TCollection_HAsciiString.hxx>
43 #include <XCAFDoc_ShapeMapTool.hxx>
44 #include <IGESBasic_SubfigureDef.hxx>
45 #include <TopoDS_Compound.hxx>
46 #include <BRep_Builder.hxx>
47
48 //=======================================================================
49 //function : IGESCAFControl_Reader
50 //purpose  : 
51 //=======================================================================
52
53 IGESCAFControl_Reader::IGESCAFControl_Reader () :
54        myColorMode( Standard_True ),
55        myNameMode ( Standard_True ),
56        myLayerMode( Standard_True )
57 {
58 }
59
60
61 //=======================================================================
62 //function : IGESCAFControl_Reader
63 //purpose  : 
64 //=======================================================================
65
66 IGESCAFControl_Reader::IGESCAFControl_Reader (const Handle(XSControl_WorkSession)& WS,
67                                               const Standard_Boolean scratch)
68 {
69   SetWS (WS,scratch);
70   myColorMode = Standard_True;
71   myNameMode = Standard_True;
72   myLayerMode = Standard_True;
73 }
74
75
76 //=======================================================================
77 //function : Transfer
78 //purpose  : basic working method
79 //=======================================================================
80 static void checkColorRange (Standard_Real& theCol)
81 {
82   if ( theCol < 0. ) theCol = 0.;
83   if ( theCol > 100. ) theCol = 100.;
84 }
85
86 static inline Standard_Boolean IsComposite (const TopoDS_Shape& theShape)
87 {
88   if( theShape.ShapeType() == TopAbs_COMPOUND)
89   {
90     if(!theShape.Location().IsIdentity())
91       return Standard_True;
92     TopoDS_Iterator anIt( theShape, Standard_False, Standard_False );
93     
94     for (; anIt.More() ; anIt.Next()) 
95     {
96       if( IsComposite (anIt.Value()))
97         return Standard_True;
98     }
99
100   }
101   return Standard_False;
102 }
103
104 //=======================================================================
105 //function : AddCompositeShape
106 //purpose  : Recursively adds composite shapes (TopoDS_Compounds) into the XDE document.
107 //           If the compound does not contain nested compounds then adds it
108 //           as no-assembly (i.e. no individual labels for sub-shapes), as this
109 //           combination is often encountered in IGES (e.g. Group of Trimmed Surfaces).
110 //           If the compound does contain nested compounds then adds it as an
111 //           assembly.
112 //           The construction happens bottom-up, i.e. the most deep sub-shapes are added
113 //           first.
114 //           If theIsTop is False (in a recursive call) then sub-shapes are added without
115 //           a location. This is to ensure that no extra label in the XDE document is
116 //           created for an instance (as otherwise, XDE will consider it as a free
117 //           shape). Correct location and instance will be created when adding a parent
118 //           compound.
119 //           theMap is used to avoid visiting the same compound.
120 //=======================================================================
121 static void AddCompositeShape (const Handle(XCAFDoc_ShapeTool)& theSTool,
122                                const TopoDS_Shape& theShape,
123                                Standard_Boolean theConsiderLoc,
124                                TopTools_MapOfShape& theMap)
125 {
126   TopoDS_Shape aShape = theShape;
127   TopLoc_Location aLoc = theShape.Location();
128   if (!theConsiderLoc && !aLoc.IsIdentity())
129     aShape.Location( TopLoc_Location() );
130   if (!theMap.Add (aShape)) 
131     return;
132
133   TopoDS_Iterator anIt( theShape, Standard_False, Standard_False );
134   Standard_Boolean aHasCompositeSubShape = Standard_False;
135   TopoDS_Compound aSimpleShape;
136   BRep_Builder aB;
137   aB.MakeCompound( aSimpleShape);
138   TopoDS_Compound aCompShape;
139   aB.MakeCompound( aCompShape);
140   Standard_Integer nbSimple = 0;
141
142   for (; anIt.More(); anIt.Next()) {
143     const TopoDS_Shape& aSubShape = anIt.Value();
144     if (IsComposite (aSubShape)) {
145       aHasCompositeSubShape = Standard_True;
146       AddCompositeShape( theSTool, aSubShape,Standard_False ,theMap );
147       aB.Add( aCompShape, aSubShape);
148     }
149     else
150     {
151       aB.Add(aSimpleShape, aSubShape);
152       nbSimple++;
153     }
154   }
155   //case of hybrid shape
156   if( nbSimple && aHasCompositeSubShape)
157   {
158     theSTool->AddShape( aSimpleShape,  Standard_False, Standard_False  );
159     TopoDS_Compound aNewShape;
160     BRep_Builder aB;
161     aB.MakeCompound(aNewShape);
162     aB.Add(aNewShape, aSimpleShape);
163     aB.Add(aNewShape,aCompShape);
164     //if (!aLoc.IsIdentity())
165     //  aNewShape.Location(aLoc );
166     aNewShape.Orientation(theShape.Orientation());
167     theSTool->AddShape( aNewShape,  aHasCompositeSubShape, Standard_False  );
168   }
169   else
170     theSTool->AddShape( aShape,  aHasCompositeSubShape, Standard_False  );
171   return;
172 }
173
174 Standard_Boolean IGESCAFControl_Reader::Transfer (Handle(TDocStd_Document) &doc)
175 {
176   // read all shapes
177   Standard_Integer num;// = NbRootsForTransfer();
178   //if ( num <=0 ) return Standard_False;
179   //for ( Standard_Integer i=1; i <= num; i++ ) {
180   //  TransferOneRoot ( i );
181   //}
182   
183   TransferRoots(); // replaces the above
184   num = NbShapes();
185   if ( num <=0 ) return Standard_False;
186
187   // and insert them to the document
188   Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( doc->Main() );
189   if(STool.IsNull()) return Standard_False;
190   Standard_Integer i;
191   for(i=1; i<=num; i++) {
192     TopoDS_Shape sh = Shape ( i );
193     // ---- HERE -- to add check [ assembly / hybrid model ]
194     if( !IsComposite (sh))
195       STool->AddShape( sh, Standard_False );
196     else {
197       TopTools_MapOfShape aMap;
198       AddCompositeShape( STool, sh,Standard_True, aMap );
199       
200     }
201   }
202   
203   // added by skl 13.10.2003
204   Handle(Interface_InterfaceModel) Model = WS()->Model();
205   //WS()->TransferReader()->SetTransientProcess(TransientProcess());
206   Handle(XSControl_TransferReader) TR = WS()->TransferReader();
207   Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
208   Standard_Boolean IsCTool = Standard_True;
209   Handle(XCAFDoc_ColorTool) CTool = XCAFDoc_DocumentTool::ColorTool(doc->Main());
210   if(CTool.IsNull()) IsCTool = Standard_False;
211   Standard_Boolean IsLTool = Standard_True;
212   Handle(XCAFDoc_LayerTool) LTool = XCAFDoc_DocumentTool::LayerTool(doc->Main());
213   if(LTool.IsNull()) IsLTool = Standard_False;
214
215   Standard_Integer nb = Model->NbEntities();
216   for(i=1; i<=nb; i++) {
217     Handle(IGESData_IGESEntity) ent = Handle(IGESData_IGESEntity)::DownCast ( Model->Value(i) );
218     if ( ent.IsNull() ) continue;
219     Handle(Transfer_Binder) binder = TP->Find ( ent );
220     if ( binder.IsNull() ) continue;
221     TopoDS_Shape S = TransferBRep::ShapeResult (binder);
222     if ( S.IsNull() ) continue;
223
224     Standard_Boolean IsColor = Standard_False;
225     Quantity_Color col;
226     if( GetColorMode() && IsCTool ) {
227       // read colors
228       if(ent->DefColor()==IGESData_DefValue ||
229          ent->DefColor()==IGESData_DefReference) {
230         // color is assigned
231         // decode color and set to document
232         IsColor = Standard_True;
233         if ( ent->DefColor() == IGESData_DefValue ) {
234           col = IGESCAFControl::DecodeColor ( ent->RankColor() );
235         }
236         else {
237           Handle(IGESGraph_Color) color = Handle(IGESGraph_Color)::DownCast ( ent->Color() );
238           if ( color.IsNull() ) {
239 #ifdef DEB
240             cout << "Error: Unrecognized type of color definition" << endl;
241 #endif
242             IsColor = Standard_False;
243           }
244           else {
245             Standard_Real r, g, b;
246             color->RGBIntensity ( r, g, b );
247             checkColorRange ( r );
248             checkColorRange ( g );
249             checkColorRange ( b );
250             col.SetValues ( 0.01*r, 0.01*g, 0.01*b, Quantity_TOC_RGB );
251           }
252         }
253       }
254     }
255
256     TDF_Label L;
257
258     Standard_Boolean IsFound;
259     if(IsColor) {
260       CTool->AddColor(col);
261       IsFound = STool->SearchUsingMap(S,L,Standard_False,Standard_True);
262     }
263     else {
264       IsFound = STool->SearchUsingMap(S,L,Standard_False,Standard_False);
265     }
266     if(!IsFound) {
267       if(IsColor) {
268         for (TopoDS_Iterator it(S); it.More(); it.Next()) {
269           if(STool->SearchUsingMap(it.Value(),L,Standard_False,Standard_True)) {
270             CTool->SetColor(L,col,XCAFDoc_ColorGen);
271             if( GetLayerMode() && IsLTool ) {
272               // read layers
273               // set a layers to the document
274               IGESData_DefList aDeflist = ent->DefLevel();
275               switch (aDeflist) {
276               case IGESData_DefOne : {
277                 TCollection_ExtendedString aLayerName ( ent->Level() );
278                 LTool->SetLayer( L, aLayerName );
279                 break;
280               }
281               case IGESData_DefSeveral : {
282                 Handle(IGESData_LevelListEntity) aLevelList = ent->LevelList();
283                 Standard_Integer layerNb = aLevelList->NbLevelNumbers();
284                 for ( Standard_Integer ilev = 1; ilev <= layerNb; ilev++ ) {
285                   TCollection_ExtendedString aLayerName ( aLevelList->LevelNumber(ilev) );
286                   LTool->SetLayer( L, aLayerName );
287                 }
288                 break;
289               }
290                 default : break;
291               }
292             }
293           }
294         }
295       }
296     }
297     else {
298       if(IsColor) {
299         CTool->SetColor(L,col,XCAFDoc_ColorGen);
300       }
301       if(GetNameMode()) {
302         // read names
303         if(ent->HasName()) {
304           TCollection_AsciiString string = ent->NameValue()->String();
305           string.LeftAdjust();
306           string.RightAdjust();
307           TCollection_ExtendedString str(string);
308           TDataStd_Name::Set(L,str);
309         }
310       }
311       if( GetLayerMode() && IsLTool ) {
312         // read layers
313         // set a layers to the document
314         IGESData_DefList aDeflist = ent->DefLevel();
315         switch (aDeflist) {
316         case IGESData_DefOne : {
317           TCollection_ExtendedString aLayerName ( ent->Level() );
318           LTool->SetLayer( L, aLayerName );
319           break;
320         }
321         case IGESData_DefSeveral : {
322           Handle(IGESData_LevelListEntity) aLevelList = ent->LevelList();
323           Standard_Integer layerNb = aLevelList->NbLevelNumbers();
324           for ( Standard_Integer ilev = 1; ilev <= layerNb; ilev++ ) {
325             TCollection_ExtendedString aLayerName ( aLevelList->LevelNumber(ilev) );
326             LTool->SetLayer( L, aLayerName );
327           }
328           break;
329         }
330           default : break;
331         }
332       }
333     }
334
335     //Checks that current entity is a subfigure
336     Handle(IGESBasic_SubfigureDef) aSubfigure = Handle(IGESBasic_SubfigureDef)::DownCast (ent);
337     if (GetNameMode() && !aSubfigure.IsNull() && STool->Search (S, L, Standard_True, Standard_True))
338     {
339       //In this case we attach subfigure name to the label, instead of default "COMPOUND"
340       Handle(TCollection_HAsciiString) aName = aSubfigure->Name();
341       aName->LeftAdjust();
342       aName->RightAdjust();
343       TCollection_ExtendedString anExtStrName (aName->ToCString());
344       TDataStd_Name::Set (L, anExtStrName);
345     }
346
347   }
348
349   CTool->ReverseChainsOfTreeNodes();
350
351   // end added by skl 13.10.2003
352
353   // read colors
354 //  if ( GetColorMode() )
355 //    ReadColors ( doc );
356   
357   // read names
358 //  if ( GetNameMode() )
359 //    ReadNames ( doc );
360   
361   // read layers
362 //  if ( GetLayerMode() )
363 //    ReadLayers ( doc );
364     
365
366   return Standard_True;
367 }
368   
369
370 //=======================================================================
371 //function : Perform
372 //purpose  : 
373 //=======================================================================
374
375 Standard_Boolean IGESCAFControl_Reader::Perform (const Standard_CString filename,
376                                                  Handle(TDocStd_Document) &doc)
377 {
378   if ( ReadFile ( filename ) != IFSelect_RetDone ) return Standard_False;
379   return Transfer ( doc );
380 }
381   
382
383 //=======================================================================
384 //function : Perform
385 //purpose  : 
386 //=======================================================================
387
388 Standard_Boolean IGESCAFControl_Reader::Perform (const TCollection_AsciiString &filename,
389                                                  Handle(TDocStd_Document) &doc)
390 {
391   if ( ReadFile ( filename.ToCString() ) != IFSelect_RetDone ) return Standard_False;
392   return Transfer ( doc );
393 }
394
395
396 //=======================================================================
397 //function : ReadColors
398 //purpose  : 
399 //=======================================================================
400
401 Standard_Boolean IGESCAFControl_Reader::ReadColors (Handle(TDocStd_Document)& Doc) const
402 {
403
404   Handle(Interface_InterfaceModel) Model = WS()->Model();
405
406   //WS()->TransferReader()->SetTransientProcess(TransientProcess()); // !!!!!!!!!
407   
408   Handle(XSControl_TransferReader) TR = WS()->TransferReader();
409   Handle(Transfer_TransientProcess) TP = /*TransientProcess();*/TR->TransientProcess();
410   Handle(XCAFDoc_ColorTool) CTool = XCAFDoc_DocumentTool::ColorTool( Doc->Main() );
411 /*
412   Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() );
413   if ( STool.IsNull() ) return Standard_False;
414   Handle(XCAFDoc_ShapeMapTool) SMTool = XCAFDoc_ShapeMapTool::Set(STool->Label());
415   SMTool->ComputeMaps();
416
417   Standard_Integer nb = Model->NbEntities();
418   for (Standard_Integer i = 1; i <= nb; i ++) {
419     Handle(IGESData_IGESEntity) ent = Handle(IGESData_IGESEntity)::DownCast ( Model->Value(i) );
420     if ( ent.IsNull() ) continue;
421     if ( ent->DefColor() != IGESData_DefValue && 
422          ent->DefColor() != IGESData_DefReference ) continue; // no color assigned
423
424     // find tartet shape
425     Handle(Transfer_Binder) binder = TP->Find ( ent );
426     if ( binder.IsNull() ) continue;
427     TopoDS_Shape S = TransferBRep::ShapeResult (binder);
428     if ( S.IsNull() ) continue;
429
430     // decode color and set to document
431     Quantity_Color col;
432     if ( ent->DefColor() == IGESData_DefValue ) {
433       col = IGESCAFControl::DecodeColor ( ent->RankColor() );
434     }
435     else {
436       Handle(IGESGraph_Color) color = Handle(IGESGraph_Color)::DownCast ( ent->Color() );
437       if ( color.IsNull() ) {
438         cout << "Error: Unrecognized type of color definition" << endl;
439         continue;
440       }
441       
442       Standard_Real r, g, b;
443       color->RGBIntensity ( r, g, b );
444       col.SetValues ( 0.01*r, 0.01*g, 0.01*b, Quantity_TOC_RGB );
445     }
446     
447     TDF_Label L;
448     cout<<"i="<<i<<endl;
449     if(SMTool->Search(S,L)) {
450       cout<<"      find Instance"<<endl;
451       CTool->SetColor(L, col, XCAFDoc_ColorGen);
452     }
453     if(L.IsNull()) {
454       cout<<"L1 is Null"<<endl;
455       if(STool->Search(S,L,Standard_False,Standard_False,Standard_True)) {
456         cout<<"     add new label1 :"<<L<<endl;
457         CTool->SetColor(L, col, XCAFDoc_ColorGen);
458       }
459     }
460     if(L.IsNull()) {
461     //else {
462       cout<<"      try to find splitting"<<endl;
463       // may be S is compound of shapes resulting from splitting
464       for (TopoDS_Iterator it(S); it.More(); it.Next()) {
465         //TDF_Label L1;
466         if(!SMTool->Search(it.Value(),L)) continue; //break-?
467         cout<<"      find splitting"<<endl;
468         CTool->SetColor(L, col, XCAFDoc_ColorGen);
469       }
470       if(L.IsNull()) {
471         for (TopoDS_Iterator it(S); it.More(); it.Next()) {
472           if(STool->Search(S,L,Standard_False,Standard_False,Standard_True)) {
473             cout<<"     add new label2 :"<<L<<endl;
474             CTool->SetColor(L, col, XCAFDoc_ColorGen);
475           }
476         }
477       }
478     }
479 //    cout<<"L.Dump():"<<L<<endl;
480 //    if(L.IsNull()) {
481 //      cout<<"L2 is Null"<<endl;
482 //      if(STool->Search(S,L,Standard_False,Standard_False,Standard_True)) {
483 //        cout<<"     add new label2 :"<<L<<endl;
484 //      CTool->SetColor(L, col, XCAFDoc_ColorGen);
485 //      }
486 //    }
487   }
488 */  
489   return Standard_True;
490 }
491
492 //=======================================================================
493 //function : ReadNames
494 //purpose  : 
495 //=======================================================================
496
497 Standard_Boolean IGESCAFControl_Reader::ReadNames (Handle(TDocStd_Document)& /*Doc*/) const
498 {
499   Handle(Interface_InterfaceModel) Model = WS()->Model();
500
501   //WS()->TransferReader()->SetTransientProcess(TransientProcess()); // !!!!!!!!!
502   
503   Handle(XSControl_TransferReader) TR = WS()->TransferReader();
504   Handle(Transfer_TransientProcess) TP = /*TransientProcess();*/TR->TransientProcess();
505 /*
506   Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() );
507   if ( STool.IsNull() ) return Standard_False;
508   Handle(XCAFDoc_ShapeMapTool) SMTool = XCAFDoc_ShapeMapTool::Set(STool->Label());
509   SMTool->ComputeMaps();
510
511   Standard_Integer nb = Model->NbEntities();
512   for (Standard_Integer i = 1; i <= nb; i ++) {
513     Handle(IGESData_IGESEntity) ent = Handle(IGESData_IGESEntity)::DownCast ( Model->Value(i) );
514     if ( ent.IsNull() || ! ent->HasName() ) continue; //not only Entity Label (f.18) but Name Property also
515
516     // find target shape
517     Handle(Transfer_Binder) binder = TP->Find ( ent );
518     if ( binder.IsNull() ) continue;
519     TopoDS_Shape S = TransferBRep::ShapeResult (binder);
520     if ( S.IsNull() ) continue;
521
522     TDF_Label L;
523     //if ( ! STool->Search ( S, L, Standard_True, Standard_True, Standard_False ) ) continue;
524     if ( ! SMTool->Search ( S, L, Standard_True, Standard_True) ) continue;
525     
526     // set a name to the document
527     TCollection_AsciiString string = ent->NameValue()->String();
528     string.LeftAdjust();
529     string.RightAdjust();
530     TCollection_ExtendedString str ( string );
531     TDataStd_Name::Set ( L, str );
532   }
533 */
534   return Standard_True;
535 }
536
537 //=======================================================================
538 //function : ReadLayers
539 //purpose  : 
540 //=======================================================================
541
542 Standard_Boolean IGESCAFControl_Reader::ReadLayers (Handle(TDocStd_Document)& /*Doc*/) const
543 {
544   Handle(Interface_InterfaceModel) Model = WS()->Model();
545
546   //WS()->TransferReader()->SetTransientProcess(TransientProcess()); // !!!!!!!!!
547   
548   Handle(XSControl_TransferReader) TR = WS()->TransferReader();
549   Handle(Transfer_TransientProcess) TP = /*TransientProcess();*/TR->TransientProcess();
550 /*
551   Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() );
552   if ( STool.IsNull() ) return Standard_False;
553   Handle(XCAFDoc_ShapeMapTool) SMTool = XCAFDoc_ShapeMapTool::Set(STool->Label());
554   SMTool->ComputeMaps();
555
556   Handle(XCAFDoc_LayerTool) LTool = XCAFDoc_DocumentTool::LayerTool( Doc->Main() );
557   if ( LTool.IsNull() ) return Standard_False;
558
559   Standard_Integer nb = Model->NbEntities();
560   for (Standard_Integer i = 1; i <= nb; i ++) {
561     Handle(IGESData_IGESEntity) ent = Handle(IGESData_IGESEntity)::DownCast ( Model->Value(i) );
562
563     if ( ent.IsNull() ) continue;
564
565     // find target shape
566     Handle(Transfer_Binder) binder = TP->Find ( ent );
567     if ( binder.IsNull() ) continue;
568     TopoDS_Shape S = TransferBRep::ShapeResult (binder);
569     if ( S.IsNull() ) continue;
570
571     TDF_Label L;
572     //if ( ! STool->Search ( S, L, Standard_True, Standard_True, Standard_False ) ) continue;
573     if( !SMTool->Search(S, L, Standard_True, Standard_True) ) continue;
574     
575     // set a layers to the document
576     IGESData_DefList aDeflist = ent->DefLevel();
577     
578     switch (aDeflist) {
579     case IGESData_DefOne : {
580       TCollection_ExtendedString aLayerName ( ent->Level() );
581       LTool->SetLayer( L, aLayerName );
582 #ifdef DEB
583 //      cout << "Added layer " << aLayerName << endl;
584 #endif
585       break;
586     }
587     case IGESData_DefSeveral : {
588       Handle(IGESData_LevelListEntity) aLevelList = ent->LevelList();
589       Standard_Integer layerNb = aLevelList->NbLevelNumbers();
590       for ( Standard_Integer ilev = 1; ilev <= layerNb; ilev++ ) {
591         TCollection_ExtendedString aLayerName ( aLevelList->LevelNumber(ilev) );
592         LTool->SetLayer( L, aLayerName );
593 #ifdef DEB
594 //      cout << "Added layer " << aLayerName << endl;
595 #endif
596       }
597       break;
598     }
599       default : break;
600     }
601           
602   }
603 */
604   return Standard_True;
605 }
606
607
608 //=======================================================================
609 //function : SetColorMode
610 //purpose  : 
611 //=======================================================================
612
613 void IGESCAFControl_Reader::SetColorMode (const Standard_Boolean colormode)
614 {
615   myColorMode = colormode;
616 }
617
618 //=======================================================================
619 //function : GetColorMode
620 //purpose  : 
621 //=======================================================================
622
623 Standard_Boolean IGESCAFControl_Reader::GetColorMode () const
624 {
625   return myColorMode;
626 }
627
628 //=======================================================================
629 //function : SetNameMode
630 //purpose  : 
631 //=======================================================================
632
633 void IGESCAFControl_Reader::SetNameMode (const Standard_Boolean namemode)
634 {
635   myNameMode = namemode;
636 }
637
638 //=======================================================================
639 //function : GetNameMode
640 //purpose  : 
641 //=======================================================================
642
643 Standard_Boolean IGESCAFControl_Reader::GetNameMode () const
644 {
645   return myNameMode;
646 }
647
648 //=======================================================================
649 //function : SetLayerMode
650 //purpose  : 
651 //=======================================================================
652
653 void IGESCAFControl_Reader::SetLayerMode (const Standard_Boolean layermode)
654 {
655   myLayerMode = layermode;
656 }
657
658 //=======================================================================
659 //function : GetLayerMode
660 //purpose  : 
661 //=======================================================================
662
663 Standard_Boolean IGESCAFControl_Reader::GetLayerMode () const
664 {
665   return myLayerMode;
666 }
667