File: STEPCAFControl_Reader.hxx

package info (click to toggle)
opencascade 6.2-7
  • links: PTS
  • area: non-free
  • in suites: lenny
  • size: 444,652 kB
  • ctags: 256,750
  • sloc: cpp: 1,150,123; ansic: 225,762; tcl: 30,130; makefile: 12,619; sh: 7,958; xml: 3,981; lisp: 283; java: 212; csh: 203; perl: 15
file content (298 lines) | stat: -rw-r--r-- 12,119 bytes parent folder | download | duplicates (2)
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
// File generated by CPPExt (Value)
//
//                     Copyright (C) 1991 - 2000 by  
//                      Matra Datavision SA.  All rights reserved.
//  
//                     Copyright (C) 2001 - 2004 by
//                     Open CASCADE SA.  All rights reserved.
// 
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//  
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.

#ifndef _STEPCAFControl_Reader_HeaderFile
#define _STEPCAFControl_Reader_HeaderFile

#ifndef _STEPControl_Reader_HeaderFile
#include <STEPControl_Reader.hxx>
#endif
#ifndef _Handle_STEPCAFControl_DictionaryOfExternFile_HeaderFile
#include <Handle_STEPCAFControl_DictionaryOfExternFile.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Handle_XSControl_WorkSession_HeaderFile
#include <Handle_XSControl_WorkSession.hxx>
#endif
#ifndef _IFSelect_ReturnStatus_HeaderFile
#include <IFSelect_ReturnStatus.hxx>
#endif
#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Handle_TDocStd_Document_HeaderFile
#include <Handle_TDocStd_Document.hxx>
#endif
#ifndef _Handle_STEPCAFControl_ExternFile_HeaderFile
#include <Handle_STEPCAFControl_ExternFile.hxx>
#endif
#ifndef _Handle_XCAFDoc_ShapeTool_HeaderFile
#include <Handle_XCAFDoc_ShapeTool.hxx>
#endif
#ifndef _Handle_TColStd_HSequenceOfTransient_HeaderFile
#include <Handle_TColStd_HSequenceOfTransient.hxx>
#endif
#ifndef _Handle_StepRepr_NextAssemblyUsageOccurrence_HeaderFile
#include <Handle_StepRepr_NextAssemblyUsageOccurrence.hxx>
#endif
class STEPCAFControl_DictionaryOfExternFile;
class XSControl_WorkSession;
class TDocStd_Document;
class TCollection_AsciiString;
class STEPCAFControl_ExternFile;
class STEPControl_Reader;
class TDF_LabelSequence;
class TDF_Label;
class TopoDS_Shape;
class XCAFDoc_ShapeTool;
class TopTools_MapOfShape;
class STEPCAFControl_DataMapOfShapePD;
class STEPCAFControl_DataMapOfPDExternFile;
class STEPCAFControl_DataMapOfShapeLabel;
class TColStd_HSequenceOfTransient;
class StepRepr_NextAssemblyUsageOccurrence;
class STEPConstruct_Tool;


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

//! Provides a tool to read STEP file and put it into <br>
//!          DECAF document. Besides transfer of shapes (including <br>
//!          assemblies) provided by STEPControl, supports also <br>
//!          colors and part names <br>
class STEPCAFControl_Reader  {

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); 
      }
 // Methods PUBLIC
 // 

//! Creates a reader with an empty <br>
//! STEP model and sets ColorMode, LayerMode, NameMode and <br>
//! PropsMode to Standard_True. <br>
Standard_EXPORT STEPCAFControl_Reader();

//! Creates a reader tool and attaches it to an already existing Session <br>
//! 	    Clears the session if it was not yet set for STEP <br>
Standard_EXPORT STEPCAFControl_Reader(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True);

//! Clears the internal data structures and attaches to a new session <br>
//!          Clears the session if it was not yet set for STEP <br>
Standard_EXPORT   void Init(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch = Standard_True) ;

//! Loads a file and returns the read status <br>
//!          Provided for use like single-file reader <br>
Standard_EXPORT   IFSelect_ReturnStatus ReadFile(const Standard_CString filename) ;

//! Returns number of roots recognized for transfer <br>
//!          Shortcut for Reader().NbRootsForTransfer() <br>
Standard_EXPORT   Standard_Integer NbRootsForTransfer() ;

//! Translates currently loaded STEP file into the document <br>
//!          Returns True if succeeded, and False in case of fail <br>
//!          Provided for use like single-file reader <br>
Standard_EXPORT   Standard_Boolean TransferOneRoot(const Standard_Integer num,Handle(TDocStd_Document)& doc) ;

//! Translates currently loaded STEP file into the document <br>
//!          Returns True if succeeded, and False in case of fail <br>
//!          Provided for use like single-file reader <br>
Standard_EXPORT   Standard_Boolean Transfer(Handle(TDocStd_Document)& doc) ;


Standard_EXPORT   Standard_Boolean Perform(const TCollection_AsciiString& filename,Handle(TDocStd_Document)& doc) ;

//! Translate STEP file given by filename into the document <br>
//!          Return True if succeeded, and False in case of fail <br>
Standard_EXPORT   Standard_Boolean Perform(const Standard_CString filename,Handle(TDocStd_Document)& doc) ;

//! Returns data on external files <br>
//!          Returns Null handle if no external files are read <br>
Standard_EXPORT  const Handle_STEPCAFControl_DictionaryOfExternFile& ExternFiles() const;

//! Returns data on external file by its name <br>
//!          Returns False if no external file with given name is read <br>
Standard_EXPORT   Standard_Boolean ExternFile(const Standard_CString name,Handle(STEPCAFControl_ExternFile)& ef) const;

//! Returns basic reader <br>
Standard_EXPORT   STEPControl_Reader& Reader() ;

//! Returns basic reader as const <br>
Standard_EXPORT  const STEPControl_Reader& Reader() const;

//! Returns label of instance of an assembly component <br>
//!          corresponding to a given NAUO <br>
Standard_EXPORT static  TDF_Label FindInstance(const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO,const Handle(XCAFDoc_ShapeTool)& STool,const STEPConstruct_Tool& Tool,const STEPCAFControl_DataMapOfPDExternFile& PDRFileMap,const STEPCAFControl_DataMapOfShapeLabel& ShapeLabelMap) ;

//! Set ColorMode for indicate read Colors or not. <br>
Standard_EXPORT   void SetColorMode(const Standard_Boolean colormode) ;


Standard_EXPORT   Standard_Boolean GetColorMode() const;

//! Set NameMode for indicate read Name or not. <br>
Standard_EXPORT   void SetNameMode(const Standard_Boolean namemode) ;


Standard_EXPORT   Standard_Boolean GetNameMode() const;

//! Set LayerMode for indicate read Layers or not. <br>
Standard_EXPORT   void SetLayerMode(const Standard_Boolean layermode) ;


Standard_EXPORT   Standard_Boolean GetLayerMode() const;

//! PropsMode for indicate read Validation properties or not. <br>
Standard_EXPORT   void SetPropsMode(const Standard_Boolean propsmode) ;


Standard_EXPORT   Standard_Boolean GetPropsMode() const;

//! Set SHUO mode for indicate write SHUO or not. <br>
Standard_EXPORT   void SetSHUOMode(const Standard_Boolean shuomode) ;


Standard_EXPORT   Standard_Boolean GetSHUOMode() const;

//! Set GDT mode for indicate write GDT or not. <br>
Standard_EXPORT   void SetGDTMode(const Standard_Boolean gdtmode) ;


Standard_EXPORT   Standard_Boolean GetGDTMode() const;

//! Set Material mode <br>
Standard_EXPORT   void SetMatMode(const Standard_Boolean matmode) ;


Standard_EXPORT   Standard_Boolean GetMatMode() const;





protected:

 // Methods PROTECTED
 // 

//! Translates STEP file already loaded into the reader <br>
//!          into the document <br>
//!          If num==0, translates all roots, else only root number num <br>
//!          Returns True if succeeded, and False in case of fail <br>
//!          If asOne is True, in case of multiple results composes <br>
//!          them into assembly. Fills sequence of produced labels <br>
Standard_EXPORT   Standard_Boolean Transfer(STEPControl_Reader& rd,const Standard_Integer num,Handle(TDocStd_Document)& doc,TDF_LabelSequence& Lseq,const Standard_Boolean asOne = Standard_False) ;

//! Add a shape to a document <br>
//!          Depending on a case, this shape can be added as one, or <br>
//!          as assembly, or (in case if it is associated with external <br>
//!          reference) taken as that referred shape <br>
Standard_EXPORT   TDF_Label AddShape(const TopoDS_Shape& S,const Handle(XCAFDoc_ShapeTool)& STool,const TopTools_MapOfShape& NewShapesMap,const STEPCAFControl_DataMapOfShapePD& ShapePDMap,const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,STEPCAFControl_DataMapOfShapeLabel& ShapeLabelMap) const;

//! Reads (or if returns already read) extern file with <br>
//!          given name <br>
Standard_EXPORT   Handle_STEPCAFControl_ExternFile ReadExternFile(const Standard_CString file,const Standard_CString fullpath,Handle(TDocStd_Document)& doc) ;

//! Reads style assignments from STEP model and sets <br>
//!          corresponding color assignments in the DECAF document <br>
Standard_EXPORT   Standard_Boolean ReadColors(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc,const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,const STEPCAFControl_DataMapOfShapeLabel& ShapeLabelMap) const;

//! Reads names of parts defined in the STEP model and <br>
//!          assigns them to corresponding labels in the DECAF document <br>
Standard_EXPORT   Standard_Boolean ReadNames(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc,const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,const STEPCAFControl_DataMapOfShapeLabel& ShapeLabelMap) const;

//! Reads validation properties assigned to shapes in the STEP <br>
//!          model and assigns them to corresponding labels in the DECAF <br>
//!          document <br>
Standard_EXPORT   Standard_Boolean ReadValProps(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc,const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,const STEPCAFControl_DataMapOfShapeLabel& ShapeLabelMap) const;

//! Reads layers of parts defined in the STEP model and <br>
//!          set reference between shape and layers in the DECAF document <br>
Standard_EXPORT   Standard_Boolean ReadLayers(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc) const;

//! Reads SHUO for instances defined in the STEP model and <br>
//!          set reference between shape instances from different assemblyes <br>
Standard_EXPORT   Standard_Boolean ReadSHUOs(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc,const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,const STEPCAFControl_DataMapOfShapeLabel& ShapeLabelMap) const;

//! Reads D&GT for instances defined in the STEP model and <br>
//!          set reference between shape instances from different assemblyes <br>
Standard_EXPORT   Standard_Boolean ReadGDTs(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc) const;

//! Reads materials for instances defined in the STEP model and <br>
//!          set reference between shape instances from different assemblyes <br>
Standard_EXPORT   Standard_Boolean ReadMaterials(const Handle(XSControl_WorkSession)& WS,Handle(TDocStd_Document)& doc,const Handle(TColStd_HSequenceOfTransient)& SeqPDS) const;


 // Fields PROTECTED
 //


private: 

 // Methods PRIVATE
 // 


 // Fields PRIVATE
 //
STEPControl_Reader myReader;
Handle_STEPCAFControl_DictionaryOfExternFile myFiles;
Standard_Boolean myColorMode;
Standard_Boolean myNameMode;
Standard_Boolean myLayerMode;
Standard_Boolean myPropsMode;
Standard_Boolean mySHUOMode;
Standard_Boolean myGDTMode;
Standard_Boolean myMatMode;


};





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


#endif