1 // Created on: 2000-08-15
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _IGESCAFControl_Reader_HeaderFile
17 #define _IGESCAFControl_Reader_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
23 #include <IGESControl_Reader.hxx>
24 #include <TCollection_AsciiString.hxx>
25 class XSControl_WorkSession;
26 class TDocStd_Document;
29 //! Provides a tool to read IGES file and put it into
30 //! DECAF document. Besides transfer of shapes (including
31 //! assemblies) provided by IGESControl, supports also
32 //! colors and part names
33 //! IGESCAFControl_Reader reader; Methods for translation of an IGES file:
34 //! reader.ReadFile("filename");
35 //! reader.Transfer(Document); or
36 //! reader.Perform("filename",doc);
37 //! Methods for managing reading attributes.
39 //! reader.SetColorMode(colormode);
40 //! Standard_Boolean colormode = reader.GetColorMode();
42 //! reader.SetLayerMode(layermode);
43 //! Standard_Boolean layermode = reader.GetLayerMode();
45 //! reader.SetNameMode(namemode);
46 //! Standard_Boolean namemode = reader.GetNameMode();
47 class IGESCAFControl_Reader : public IGESControl_Reader
53 //! Creates a reader with an empty
54 //! IGES model and sets ColorMode, LayerMode and NameMode to Standard_True.
55 IGESCAFControl_Reader()
56 : myColorMode( Standard_True ),
57 myNameMode ( Standard_True ),
58 myLayerMode( Standard_True )
61 //! Creates a reader tool and attaches it to an already existing Session
62 //! Clears the session if it was not yet set for IGES
63 IGESCAFControl_Reader(const Handle(XSControl_WorkSession)& theWS, const Standard_Boolean FromScratch = Standard_True)
64 : myColorMode( Standard_True ),
65 myNameMode ( Standard_True ),
66 myLayerMode( Standard_True )
67 { SetWS (theWS,FromScratch); }
69 //! Translates currently loaded IGES file into the document
70 //! Returns True if succeeded, and False in case of fail
71 Standard_EXPORT Standard_Boolean Transfer (Handle(TDocStd_Document)& theDoc);
73 Standard_Boolean Perform (const TCollection_AsciiString& theFileName, Handle(TDocStd_Document)& theDoc)
74 { return Perform (theFileName.ToCString(), theDoc); }
76 //! Translate IGES file given by filename into the document
77 //! Return True if succeeded, and False in case of fail
78 Standard_EXPORT Standard_Boolean Perform (const Standard_CString theFileName, Handle(TDocStd_Document)& theDoc);
80 //! Set ColorMode for indicate read Colors or not.
81 void SetColorMode (const Standard_Boolean theMode)
82 { myColorMode = theMode; }
84 Standard_Boolean GetColorMode() const
85 { return myColorMode; }
87 //! Set NameMode for indicate read Name or not.
88 void SetNameMode (const Standard_Boolean theMode)
89 { myNameMode = theMode; }
91 Standard_Boolean GetNameMode() const
92 { return myNameMode; }
94 //! Set LayerMode for indicate read Layers or not.
95 void SetLayerMode (const Standard_Boolean theMode)
96 { myLayerMode = theMode; }
98 Standard_Boolean GetLayerMode() const
99 { return myLayerMode; }
103 Standard_Boolean myColorMode;
104 Standard_Boolean myNameMode;
105 Standard_Boolean myLayerMode;
108 #endif // _IGESCAFControl_Reader_HeaderFile