0026047: Data Exchange - Lost colors for IGES export
[occt.git] / src / IGESCAFControl / IGESCAFControl_Writer.cxx
1 // Created on: 2000-08-17
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <IGESCAFControl.hxx>
17 #include <IGESCAFControl_Writer.hxx>
18 #include <IGESData_IGESEntity.hxx>
19 #include <IGESData_IGESModel.hxx>
20 #include <IGESData_NameEntity.hxx>
21 #include <IGESGraph_Color.hxx>
22 #include <IGESGraph_DefinitionLevel.hxx>
23 #include <IGESSolid_Face.hxx>
24 #include <IGESBasic_Name.hxx>
25 #include <Message_ProgressScope.hxx>
26 #include <NCollection_DataMap.hxx>
27 #include <Standard_Transient.hxx>
28 #include <TCollection_AsciiString.hxx>
29 #include <TCollection_HAsciiString.hxx>
30 #include <TCollection_HExtendedString.hxx>
31 #include <TColStd_HSequenceOfExtendedString.hxx>
32 #include <TDataStd_Name.hxx>
33 #include <TDF_ChildIterator.hxx>
34 #include <TDF_Label.hxx>
35 #include <TDF_LabelSequence.hxx>
36 #include <TDocStd_Document.hxx>
37 #include <TopAbs.hxx>
38 #include <TopExp_Explorer.hxx>
39 #include <TopoDS.hxx>
40 #include <TopoDS_Face.hxx>
41 #include <TopoDS_Iterator.hxx>
42 #include <TopoDS_Shape.hxx>
43 #include <TopTools_SequenceOfShape.hxx>
44 #include <Transfer_FinderProcess.hxx>
45 #include <Transfer_TransientListBinder.hxx>
46 #include <TransferBRep.hxx>
47 #include <TransferBRep_ShapeMapper.hxx>
48 #include <XCAFDoc_ColorTool.hxx>
49 #include <XCAFDoc_DocumentTool.hxx>
50 #include <XCAFDoc_LayerTool.hxx>
51 #include <XCAFDoc_ShapeTool.hxx>
52 #include <XCAFPrs.hxx>
53 #include <XCAFPrs_Style.hxx>
54 #include <XSControl_WorkSession.hxx>
55
56 namespace
57 {
58   typedef NCollection_DataMap<TopoDS_Shape, TCollection_ExtendedString> DataMapOfShapeNames;
59
60   void  CollectShapeNames (const TDF_Label& theLabel,
61                            const TopLoc_Location& theLocation,
62                            const Handle(TDataStd_Name)& thePrevName,
63                            DataMapOfShapeNames& theMapOfShapeNames)
64   {
65     Standard_Boolean hasReferredShape = Standard_False;
66     Standard_Boolean hasComponents    = Standard_False;
67     TDF_Label aReferredLabel;
68
69     Handle(TDataStd_Name) aName;
70     theLabel.FindAttribute (TDataStd_Name::GetID(), aName);
71
72     if ( XCAFDoc_ShapeTool::GetReferredShape ( theLabel, aReferredLabel ) )
73     {
74       TopLoc_Location aSubLocation = theLocation.Multiplied ( XCAFDoc_ShapeTool::GetLocation ( theLabel ) );
75       CollectShapeNames (aReferredLabel, aSubLocation, aName, theMapOfShapeNames);
76       hasReferredShape = Standard_True;
77     }
78
79     TDF_LabelSequence aSeq;
80     if (XCAFDoc_ShapeTool::GetComponents (theLabel, aSeq))
81     {
82       for (Standard_Integer anIter = 1; anIter <= aSeq.Length(); anIter++)
83       {
84         CollectShapeNames (aSeq.Value (anIter), theLocation, aName, theMapOfShapeNames );
85       }
86       hasComponents = Standard_True;
87     }
88
89     aSeq.Clear();
90     if (XCAFDoc_ShapeTool::GetSubShapes (theLabel, aSeq))
91     {
92       for (Standard_Integer anIter = 1; anIter <= aSeq.Length(); anIter++)
93       {
94         TopoDS_Shape aShape;
95         if (!XCAFDoc_ShapeTool::GetShape (aSeq.Value (anIter), aShape)) continue;
96         if (!aSeq.Value (anIter).FindAttribute (TDataStd_Name::GetID(), aName)) continue;
97         theMapOfShapeNames.Bind (aShape, aName->Get());
98       }
99     }
100
101     if (!hasReferredShape && !hasComponents)
102     {
103       TopoDS_Shape aShape;
104       if (!XCAFDoc_ShapeTool::GetShape (theLabel, aShape)) return;
105       aShape.Move (theLocation);
106       theMapOfShapeNames.Bind (aShape, thePrevName->Get());
107     }
108   }
109 }
110
111 //=======================================================================
112 //function : IGESCAFControl_Writer
113 //purpose  : 
114 //=======================================================================
115
116 IGESCAFControl_Writer::IGESCAFControl_Writer () :
117        myColorMode( Standard_True ),
118        myNameMode ( Standard_True ),
119        myLayerMode( Standard_True )
120 {
121 }
122
123 //=======================================================================
124 //function : IGESCAFControl_Writer
125 //purpose  : 
126 //=======================================================================
127
128 IGESCAFControl_Writer::IGESCAFControl_Writer (const Handle(XSControl_WorkSession)& WS,
129                                               const Standard_Boolean /*scratch*/ )
130 {
131   // this code does things in a wrong way, it should be vice-versa
132   WS->SetModel ( Model() );
133   WS->SetMapWriter ( TransferProcess() );
134   myColorMode = Standard_True;
135   myNameMode = Standard_True;
136   myLayerMode = Standard_True;
137   
138 //  SetWS (WS,scratch); // this should be the only required command here
139 }
140
141 //=======================================================================
142 //function : Transfer
143 //purpose  : 
144 //=======================================================================
145
146 Standard_Boolean IGESCAFControl_Writer::Transfer (const Handle(TDocStd_Document) &doc,
147                                                   const Message_ProgressRange& theProgress)
148 {  
149   // translate free top-level shapes of the DECAF document
150   Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( doc->Main() );
151   if ( STool.IsNull() ) return Standard_False;
152
153   TDF_LabelSequence labels;
154   STool->GetFreeShapes ( labels );
155   return Transfer (labels, theProgress);
156 }  
157
158 //=======================================================================
159 //function : Transfer
160 //purpose  : 
161 //=======================================================================
162
163 Standard_Boolean IGESCAFControl_Writer::Transfer (const TDF_Label& label,
164                                                   const Message_ProgressRange& theProgress)
165 {
166   TDF_LabelSequence labels;
167   labels.Append( label );
168   return Transfer( labels, theProgress );
169 }
170
171 //=======================================================================
172 //function : Transfer
173 //purpose  : 
174 //=======================================================================
175
176 Standard_Boolean IGESCAFControl_Writer::Transfer (const TDF_LabelSequence& labels,
177                                                   const Message_ProgressRange& theProgress)
178 {  
179   if ( labels.Length() <=0 ) return Standard_False;
180   Message_ProgressScope aPS(theProgress, "Labels", labels.Length());
181   for ( Standard_Integer i=1; i <= labels.Length() && aPS.More(); i++ )
182   {
183     TopoDS_Shape shape = XCAFDoc_ShapeTool::GetShape ( labels.Value(i) );
184     if ( ! shape.IsNull() ) 
185       AddShape (shape, aPS.Next());
186 //      IGESControl_Writer::Transfer ( shape );
187   }
188   
189   // write colors
190   if ( GetColorMode() )
191     WriteAttributes ( labels );
192
193   // write layers
194   if ( GetLayerMode() )
195     WriteLayers ( labels );
196   
197   // write names
198   if ( GetNameMode() )
199     WriteNames( labels );
200   
201   // refresh graph
202 //  WS()->ComputeGraph ( Standard_True );
203   ComputeModel();
204   
205   return Standard_True;
206 }
207
208 //=======================================================================
209 //function : Perform
210 //purpose  : 
211 //=======================================================================
212
213 Standard_Boolean IGESCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc,
214                                                  const Standard_CString filename,
215                                                  const Message_ProgressRange& theProgress)
216 {
217   if ( ! Transfer ( doc, theProgress ) ) return Standard_False;
218   return Write ( filename ) == IFSelect_RetDone;
219 }
220   
221 //=======================================================================
222 //function : Perform
223 //purpose  : 
224 //=======================================================================
225
226 Standard_Boolean IGESCAFControl_Writer::Perform (const Handle(TDocStd_Document) &doc,
227                                                  const TCollection_AsciiString &filename,
228                                                  const Message_ProgressRange& theProgress)
229 {
230   if ( ! Transfer ( doc, theProgress ) ) return Standard_False;
231   return Write ( filename.ToCString() ) == IFSelect_RetDone;
232 }
233   
234 //=======================================================================
235 //function : WriteAttributes
236 //purpose  : 
237 //=======================================================================
238
239 Standard_Boolean IGESCAFControl_Writer::WriteAttributes (const TDF_LabelSequence& labels) 
240 {
241   // Iterate on labels
242   if ( labels.Length() <=0 ) return Standard_False;
243   for ( Standard_Integer i=1; i <= labels.Length(); i++ ) {
244     TDF_Label L = labels.Value(i);
245
246     // collect color settings
247     XCAFPrs_IndexedDataMapOfShapeStyle settings;
248     TopLoc_Location loc;
249     XCAFPrs::CollectStyleSettings ( L, loc, settings );
250     if ( settings.Extent() <=0 ) continue;
251     
252     // get a target shape and try to find corresponding context
253     // (all the colors set under that label will be put into that context)
254     TopoDS_Shape S;
255     if ( ! XCAFDoc_ShapeTool::GetShape ( L, S ) ) continue;
256         
257     // iterate on subshapes and create IGES styles 
258     XCAFPrs_DataMapOfStyleTransient colors;
259     TopTools_MapOfShape Map;
260     const XCAFPrs_Style inherit;
261     MakeColors ( S, settings, colors, Map, inherit );
262   }
263   
264   return Standard_True;
265 }
266
267 //=======================================================================
268 //function : MakeColors
269 //purpose  : 
270 //=======================================================================
271
272 void IGESCAFControl_Writer::MakeColors (const TopoDS_Shape &S, 
273                                         const XCAFPrs_IndexedDataMapOfShapeStyle &settings,
274                                         XCAFPrs_DataMapOfStyleTransient &colors,
275                                         TopTools_MapOfShape &Map,
276                                         const XCAFPrs_Style &inherit) 
277 {
278   // skip already processed shapes
279   if ( ! Map.Add ( S ) ) return;
280   
281   // check if shape has its own style (or inherits from ancestor)
282   XCAFPrs_Style style = inherit;
283   if ( settings.Contains(S) ) {
284     XCAFPrs_Style own = settings.FindFromKey(S);
285     if ( own.IsSetColorCurv() ) style.SetColorCurv ( own.GetColorCurv() );
286     if ( own.IsSetColorSurf() ) style.SetColorSurf ( own.GetColorSurf() );
287     style.SetMaterial (own.Material());
288   }
289   
290   // analyze whether current entity should get a color 
291   Standard_Boolean hasColor = Standard_False;
292   Quantity_Color col;
293   if ( S.ShapeType() == TopAbs_FACE  || S.ShapeType() == TopAbs_SOLID) {
294     if ( style.IsSetColorSurf() ) {
295       hasColor = Standard_True;
296       col = style.GetColorSurf();
297     }
298     else if (!style.Material().IsNull()
299           && !style.Material()->IsEmpty())
300     {
301       hasColor = Standard_True;
302       col = style.Material()->BaseColor().GetRGB();
303     }
304   }
305   else if ( S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE ) {
306     if ( style.IsSetColorCurv() ) {
307       hasColor = Standard_True;
308       col = style.GetColorCurv();
309     }
310   }
311   
312   // if color has to be assigned, try to do this
313   if ( hasColor ) {
314     Handle(IGESGraph_Color) colent;
315     Standard_Integer rank = IGESCAFControl::EncodeColor ( col );
316     if ( ! rank ) {
317       XCAFPrs_Style c; // style used as key in the map
318       c.SetColorSurf ( col );
319       if ( colors.IsBound ( c ) ) {
320         colent = Handle(IGESGraph_Color)::DownCast ( colors.Find(c) );
321       }
322       else {
323         Handle(TCollection_HAsciiString) str = 
324           new TCollection_HAsciiString ( col.StringName ( col.Name() ) );
325         colent = new IGESGraph_Color;
326         NCollection_Vec3<Standard_Real> aColor_sRGB;
327         col.Values (aColor_sRGB.r(), aColor_sRGB.g(), aColor_sRGB.b(), Quantity_TOC_sRGB);
328         colent->Init ( aColor_sRGB.r() * 100., aColor_sRGB.g() * 100., aColor_sRGB.b() * 100., str );
329         AddEntity ( colent );
330         colors.Bind ( c, colent );
331       }
332     }
333     Handle(Transfer_FinderProcess) FP = TransferProcess();
334     Handle(IGESData_IGESEntity) ent;
335     Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, S );
336     Handle(TransferBRep_ShapeMapper) aNoLocMapper = TransferBRep::ShapeMapper(FP, S.Located(TopLoc_Location()));
337     if ( FP->FindTypedTransient ( mapper, STANDARD_TYPE(IGESData_IGESEntity), ent ) || 
338          FP->FindTypedTransient(aNoLocMapper, STANDARD_TYPE(IGESData_IGESEntity), ent)) {
339       ent->InitColor ( colent, rank );
340       Handle(IGESSolid_Face) ent_f = Handle(IGESSolid_Face)::DownCast(ent);
341       if (!ent_f.IsNull())
342       {
343         if (!ent_f->Surface().IsNull())
344           ent_f->Surface()->InitColor ( colent, rank );
345       }
346     }
347     else {
348       // may be S was splited during shape process
349       Handle(Transfer_Binder) bnd = FP->Find ( mapper );
350       if ( ! bnd.IsNull() ) {
351         Handle(Transfer_TransientListBinder) TransientListBinder =
352           //Handle(Transfer_TransientListBinder)::DownCast( bnd->Next(Standard_True) );
353           Handle(Transfer_TransientListBinder)::DownCast( bnd );
354         Standard_Integer i=0, nb=0;
355         if (! TransientListBinder.IsNull() ) {
356           nb = TransientListBinder->NbTransients();
357           for (i=1; i<=nb; i++) {
358             Handle(Standard_Transient) t = TransientListBinder->Transient(i);
359             ent = Handle(IGESData_IGESEntity)::DownCast(t);
360             if (!ent.IsNull())
361       {
362         ent->InitColor ( colent, rank );
363         Handle(IGESSolid_Face) ent_f = Handle(IGESSolid_Face)::DownCast(ent);
364         if (!ent_f.IsNull())
365         {
366           if (!ent_f->Surface().IsNull())
367             ent_f->Surface()->InitColor ( colent, rank );
368         }
369       }
370           }
371         }
372         /* // alternative: consider recursive mapping S -> compound -> entities
373         else {
374           TopoDS_Shape comp = TransferBRep::ShapeResult(bnd);
375           if ( ! comp.IsNull() && comp.ShapeType() < S.ShapeType() ) 
376             for ( TopoDS_Iterator it(comp); it.More(); it.Next() ) {
377               MakeColors ( it.Value(), settings, colors, Map, style );
378             }
379         }
380         */
381       }
382     }
383   }
384
385   // iterate on subshapes (except vertices :)
386   if ( S.ShapeType() == TopAbs_EDGE ) return;
387   for ( TopoDS_Iterator it(S); it.More(); it.Next() ) {
388     MakeColors ( it.Value(), settings, colors, Map, style );
389   }
390 }
391
392
393 static void AttachLayer (const Handle(Transfer_FinderProcess) &FP,
394                          const Handle(XCAFDoc_LayerTool)& LTool,
395                          const TopoDS_Shape& aSh,
396                          const Standard_Integer localIntName)
397 {
398
399   TopTools_SequenceOfShape shseq;
400   if ( aSh.ShapeType() == TopAbs_COMPOUND ) {
401     TopoDS_Iterator aShIt(aSh);
402     for ( ; aShIt.More(); aShIt.Next() ) {
403       TopoDS_Shape newSh = aShIt.Value();
404       Handle(TColStd_HSequenceOfExtendedString) shLayers = new TColStd_HSequenceOfExtendedString;
405       if (! LTool->GetLayers( newSh, shLayers) || newSh.ShapeType() == TopAbs_COMPOUND )
406         AttachLayer(FP, LTool, newSh, localIntName);
407     }
408     return;
409   } else if ( aSh.ShapeType() == TopAbs_SOLID || aSh.ShapeType() == TopAbs_SHELL ) {
410     for (TopExp_Explorer exp(aSh,TopAbs_FACE) ; exp.More(); exp.Next()) {
411       TopoDS_Face entSh = TopoDS::Face (exp.Current());
412       shseq.Append(entSh);
413     }
414   } else {
415     shseq.Append(aSh);
416   }
417   
418   for (Standard_Integer i = 1; i <= shseq.Length(); i++ ) {
419     TopoDS_Shape localShape = shseq.Value(i);
420     Handle(IGESData_IGESEntity) Igesent;
421     Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, localShape );
422     if ( FP->FindTypedTransient ( mapper, STANDARD_TYPE(IGESData_IGESEntity), Igesent ) ) {
423       Igesent->InitLevel( 0, localIntName );
424     }
425 #ifdef OCCT_DEBUG
426     else std::cout << "Warning: Can't find entity for shape in mapper" << std::endl;
427 #endif
428   }
429 }
430
431
432 static void MakeLayers (const Handle(Transfer_FinderProcess) &FP, 
433                         const Handle(XCAFDoc_ShapeTool)& STool,
434                         const Handle(XCAFDoc_LayerTool)& LTool,
435                         const TDF_LabelSequence& aShapeLabels,
436                         const Standard_Integer localIntName) 
437 {
438   for ( Standard_Integer j = 1; j <= aShapeLabels.Length(); j++ ) {
439     TDF_Label aShapeLabel = aShapeLabels.Value(j);
440     TopoDS_Shape aSh;
441     if ( ! STool->GetShape ( aShapeLabel, aSh ) ) continue;
442     AttachLayer (FP, LTool, aSh, localIntName);
443   }
444 }
445
446
447
448 //=======================================================================
449 //function : WriteLayers
450 //purpose  : 
451 //=======================================================================
452
453 Standard_Boolean IGESCAFControl_Writer::WriteLayers (const TDF_LabelSequence& labels) 
454 {
455   if ( labels.Length() <=0 ) return Standard_False;
456   Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( labels(1) );
457   if ( STool.IsNull() ) return Standard_False;
458   Handle(XCAFDoc_LayerTool) LTool = XCAFDoc_DocumentTool::LayerTool( labels(1) );
459   if ( LTool.IsNull() ) return Standard_False;
460   
461   Standard_Integer globalIntName = 0;
462   TDF_LabelSequence aLayerLabels;
463   LTool->GetLayerLabels( aLayerLabels );
464   
465   Handle(Transfer_FinderProcess) FP = TransferProcess();
466   for ( Standard_Integer i = 1; i <= aLayerLabels.Length(); i++ ){
467     TDF_Label aOneLayerL = aLayerLabels.Value(i);
468     if ( aOneLayerL.IsNull() ) continue;
469     TCollection_ExtendedString localName;
470     LTool->GetLayer(aOneLayerL, localName);
471     Standard_Integer localIntName = 0;
472     TCollection_AsciiString asciiName(localName,'?');
473     if (asciiName.IsIntegerValue() ) {
474       localIntName = asciiName.IntegerValue();
475       if (globalIntName < localIntName) globalIntName = localIntName;
476       
477       TDF_LabelSequence aShapeLabels;
478       LTool->GetShapesOfLayer( aOneLayerL, aShapeLabels );
479       if ( aShapeLabels.Length() <= 0 ) continue;
480       MakeLayers(FP, STool, LTool, aShapeLabels, localIntName);
481     }
482   }
483   
484   for ( Standard_Integer i1 = 1; i1 <= aLayerLabels.Length(); i1++ ) {
485     TDF_Label aOneLayerL = aLayerLabels.Value(i1);
486     if ( aOneLayerL.IsNull() ) continue;
487     TCollection_ExtendedString localName; 
488     LTool->GetLayer(aOneLayerL, localName);
489     Standard_Integer localIntName = 0;
490     TCollection_AsciiString asciiName(localName,'?');
491     if (asciiName.IsIntegerValue() ) continue;
492     TDF_LabelSequence aShapeLabels;
493     LTool->GetShapesOfLayer( aOneLayerL, aShapeLabels );
494     if ( aShapeLabels.Length() <= 0 ) continue;
495     localIntName = ++globalIntName;
496     MakeLayers (FP, STool, LTool, aShapeLabels, localIntName);
497   }
498   
499   return Standard_True;
500 }
501
502
503 //=======================================================================
504 //function : WriteNames
505 //purpose  : 
506 //=======================================================================
507
508 Standard_Boolean IGESCAFControl_Writer::WriteNames (const TDF_LabelSequence& theLabels)
509 {
510   if (theLabels.Length() <= 0) return Standard_False;
511
512   DataMapOfShapeNames aMapOfShapeNames;
513
514   for (Standard_Integer anIter = 1; anIter <= theLabels.Length(); anIter++ )
515   {
516     TDF_Label aLabel = theLabels.Value (anIter);
517
518     TopoDS_Shape aShape;
519     Handle(TDataStd_Name) aName;
520     if (!XCAFDoc_ShapeTool::GetShape (aLabel, aShape)) continue;
521     if (!aLabel.FindAttribute (TDataStd_Name::GetID(), aName)) continue;
522
523     aMapOfShapeNames.Bind (aShape, aName->Get());
524
525     // Collect names for subshapes
526     TopLoc_Location aLocation;
527     CollectShapeNames (aLabel, aLocation, aName, aMapOfShapeNames);
528   }
529
530   for (DataMapOfShapeNames::Iterator anIter (aMapOfShapeNames);
531        anIter.More(); anIter.Next())
532   {
533     const TopoDS_Shape& aShape = anIter.Key();
534     const TCollection_ExtendedString& aName = anIter.Value();
535
536     Handle(Transfer_FinderProcess) aFinderProcess = TransferProcess();
537     Handle(IGESData_IGESEntity) anIGESEntity;
538     Handle(TransferBRep_ShapeMapper) aShapeMapper = TransferBRep::ShapeMapper (aFinderProcess, aShape);
539
540     if (aFinderProcess->FindTypedTransient (aShapeMapper, STANDARD_TYPE(IGESData_IGESEntity), anIGESEntity))
541     {
542       Handle(TCollection_HAsciiString) anAsciiName = new TCollection_HAsciiString ("        ");
543       Standard_Integer aNameLength = 8 - aName.Length();
544       if (aNameLength < 0) aNameLength = 0;
545       for (Standard_Integer aCharPos = 1; aNameLength < 8; aCharPos++, aNameLength++)
546       {
547         anAsciiName->SetValue (aNameLength+1, IsAnAscii (aName.Value (aCharPos)) ? (Standard_Character )aName.Value (aCharPos) : '?');
548       }
549       anIGESEntity->SetLabel (anAsciiName);
550
551       // Set long IGES name using 406 form 15 entity
552       Handle(IGESBasic_Name) aLongNameEntity = new IGESBasic_Name;
553       Handle(TCollection_HExtendedString) aTmpStr = new TCollection_HExtendedString(aName);
554       aLongNameEntity->Init(1, new TCollection_HAsciiString(aTmpStr, '_'));
555
556       anIGESEntity->AddProperty(aLongNameEntity);
557       AddEntity(aLongNameEntity);
558     }
559   }
560
561   return Standard_True;
562 }
563
564 //=======================================================================
565 //function : SetColorMode
566 //purpose  : 
567 //=======================================================================
568
569 void IGESCAFControl_Writer::SetColorMode (const Standard_Boolean colormode)
570 {
571   myColorMode = colormode;
572 }
573
574 //=======================================================================
575 //function : GetColorMode
576 //purpose  : 
577 //=======================================================================
578
579 Standard_Boolean IGESCAFControl_Writer::GetColorMode () const
580 {
581   return myColorMode;
582 }
583
584 //=======================================================================
585 //function : SetNameMode
586 //purpose  : 
587 //=======================================================================
588
589 void IGESCAFControl_Writer::SetNameMode (const Standard_Boolean namemode)
590 {
591   myNameMode = namemode;
592 }
593
594 //=======================================================================
595 //function : GetNameMode
596 //purpose  : 
597 //=======================================================================
598
599 Standard_Boolean IGESCAFControl_Writer::GetNameMode () const
600 {
601   return myNameMode;
602 }
603
604 //=======================================================================
605 //function : SetLayerMode
606 //purpose  : 
607 //=======================================================================
608
609 void IGESCAFControl_Writer::SetLayerMode (const Standard_Boolean layermode)
610 {
611   myLayerMode = layermode;
612 }
613
614 //=======================================================================
615 //function : GetLayerMode
616 //purpose  : 
617 //=======================================================================
618
619 Standard_Boolean IGESCAFControl_Writer::GetLayerMode () const
620 {
621   return myLayerMode;
622 }