summaryrefslogtreecommitdiff
path: root/inc/IGESCAFControl_Writer.hxx
blob: 09cf476b8b19bcb711f61311935bbaf5696601ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _IGESCAFControl_Writer_HeaderFile
#define _IGESCAFControl_Writer_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _IGESControl_Writer_HeaderFile
#include <IGESControl_Writer.hxx>
#endif
#ifndef _Handle_XSControl_WorkSession_HeaderFile
#include <Handle_XSControl_WorkSession.hxx>
#endif
#ifndef _Handle_TDocStd_Document_HeaderFile
#include <Handle_TDocStd_Document.hxx>
#endif
#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
class XSControl_WorkSession;
class TDocStd_Document;
class TCollection_AsciiString;
class TopoDS_Shape;
class XCAFPrs_DataMapOfShapeStyle;
class XCAFPrs_DataMapOfStyleTransient;
class TopTools_MapOfShape;
class XCAFPrs_Style;


//! Provides a tool to write DECAF document to the <br>
//! IGES file. Besides transfer of shapes (including <br>
//! assemblies) provided by IGESControl, supports also <br>
//! colors and part names <br>
//! IGESCAFControl_Writer writer(); <br>
//!   Methods for writing IGES file: <br>
//! writer.Transfer (Document); <br>
//! writer.Write("filename") or writer.Write(OStream)  or <br>
//! writer.Perform(Document,"filename"); <br>
//!   Methods for managing the writing of attributes. <br>
//!   Colors <br>
//! writer.SetColorMode(colormode); <br>
//! Standard_Boolean colormode = writer.GetColorMode(); <br>
//!   Layers <br>
//! writer.SetLayerMode(layermode); <br>
//! Standard_Boolean layermode = writer.GetLayerMode(); <br>
//! Names <br>
//! writer.SetNameMode(namemode); <br>
//! Standard_Boolean namemode = writer.GetNameMode(); <br>
class IGESCAFControl_Writer  : public IGESControl_Writer {
public:

  void* operator new(size_t,void* anAddress) 
  {
    return anAddress;
  }
  void* operator new(size_t size) 
  {
    return Standard::Allocate(size); 
  }
  void  operator delete(void *anAddress) 
  {
    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
  }

  //! Creates a writer with an empty <br>
//! IGES model and sets ColorMode, LayerMode and NameMode to Standard_True. <br>
  Standard_EXPORT   IGESCAFControl_Writer();
  //! Creates a reader tool and attaches it to an already existing Session <br>
//!          Clears the session if it was not yet set for IGES <br>
  Standard_EXPORT   IGESCAFControl_Writer(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True);
  //! Transfers a document to a IGES model <br>
//!          Returns True if translation is OK <br>
  Standard_EXPORT     Standard_Boolean Transfer(const Handle(TDocStd_Document)& doc) ;
  
  Standard_EXPORT     Standard_Boolean Perform(const Handle(TDocStd_Document)& doc,const TCollection_AsciiString& filename) ;
  //! Transfers a document and writes it to a IGES file <br>
//!           Returns True if translation is OK <br>
  Standard_EXPORT     Standard_Boolean Perform(const Handle(TDocStd_Document)& doc,const Standard_CString filename) ;
  //! Set ColorMode for indicate write Colors or not. <br>
  Standard_EXPORT     void SetColorMode(const Standard_Boolean colormode) ;
  
  Standard_EXPORT     Standard_Boolean GetColorMode() const;
  //! Set NameMode for indicate write Name or not. <br>
  Standard_EXPORT     void SetNameMode(const Standard_Boolean namemode) ;
  
  Standard_EXPORT     Standard_Boolean GetNameMode() const;
  //! Set LayerMode for indicate write Layers or not. <br>
  Standard_EXPORT     void SetLayerMode(const Standard_Boolean layermode) ;
  
  Standard_EXPORT     Standard_Boolean GetLayerMode() const;





protected:

  //! Reads colors from DECAF document and assigns them <br>
//!          to corresponding IGES entities <br>
  Standard_EXPORT     Standard_Boolean WriteAttributes(const Handle(TDocStd_Document)& doc) ;
  //! Reads layers from DECAF document and assigns them <br>
//!          to corresponding IGES entities <br>
  Standard_EXPORT     Standard_Boolean WriteLayers(const Handle(TDocStd_Document)& doc) ;
  //! Recursivile iterates on subshapes and assign names <br>
//!          to IGES entity <br>
  Standard_EXPORT     Standard_Boolean WriteNames(const Handle(TDocStd_Document)& doc) ;




private:

  //! Recursively iterates on subshapes and assigns colors <br>
//!          to faces and edges (if set) <br>
  Standard_EXPORT     void MakeColors(const TopoDS_Shape& S,const XCAFPrs_DataMapOfShapeStyle& settings,XCAFPrs_DataMapOfStyleTransient& colors,TopTools_MapOfShape& Map,const XCAFPrs_Style& inherit) ;


Standard_Boolean myColorMode;
Standard_Boolean myNameMode;
Standard_Boolean myLayerMode;


};





// other Inline functions and methods (like "C++: function call" methods)


#endif