42cf5bc1 |
1 | // Created on: 2000-08-15 |
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 | #ifndef _IGESCAFControl_Reader_HeaderFile |
17 | #define _IGESCAFControl_Reader_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_DefineAlloc.hxx> |
21 | #include <Standard_Handle.hxx> |
22 | |
42cf5bc1 |
23 | #include <IGESControl_Reader.hxx> |
7f56eba8 |
24 | #include <TCollection_AsciiString.hxx> |
42cf5bc1 |
25 | class XSControl_WorkSession; |
26 | class TDocStd_Document; |
42cf5bc1 |
27 | |
28 | |
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. |
38 | //! Colors |
39 | //! reader.SetColorMode(colormode); |
40 | //! Standard_Boolean colormode = reader.GetColorMode(); |
41 | //! Layers |
42 | //! reader.SetLayerMode(layermode); |
43 | //! Standard_Boolean layermode = reader.GetLayerMode(); |
44 | //! Names |
45 | //! reader.SetNameMode(namemode); |
46 | //! Standard_Boolean namemode = reader.GetNameMode(); |
47 | class IGESCAFControl_Reader : public IGESControl_Reader |
48 | { |
7f56eba8 |
49 | public: |
42cf5bc1 |
50 | |
51 | DEFINE_STANDARD_ALLOC |
52 | |
42cf5bc1 |
53 | //! Creates a reader with an empty |
54 | //! IGES model and sets ColorMode, LayerMode and NameMode to Standard_True. |
7f56eba8 |
55 | IGESCAFControl_Reader() |
56 | : myColorMode( Standard_True ), |
57 | myNameMode ( Standard_True ), |
58 | myLayerMode( Standard_True ) |
59 | {} |
42cf5bc1 |
60 | |
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 |
7f56eba8 |
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); } |
42cf5bc1 |
68 | |
69 | //! Translates currently loaded IGES file into the document |
70 | //! Returns True if succeeded, and False in case of fail |
7e785937 |
71 | Standard_EXPORT Standard_Boolean Transfer (Handle(TDocStd_Document)& theDoc, |
72 | const Message_ProgressRange& theProgress = Message_ProgressRange()); |
42cf5bc1 |
73 | |
7e785937 |
74 | Standard_Boolean Perform (const TCollection_AsciiString& theFileName, |
75 | Handle(TDocStd_Document)& theDoc, |
76 | const Message_ProgressRange& theProgress = Message_ProgressRange()) |
77 | { return Perform (theFileName.ToCString(), theDoc, theProgress); } |
42cf5bc1 |
78 | |
79 | //! Translate IGES file given by filename into the document |
80 | //! Return True if succeeded, and False in case of fail |
7e785937 |
81 | Standard_EXPORT Standard_Boolean Perform (const Standard_CString theFileName, |
82 | Handle(TDocStd_Document)& theDoc, |
83 | const Message_ProgressRange& theProgress = Message_ProgressRange()); |
42cf5bc1 |
84 | |
85 | //! Set ColorMode for indicate read Colors or not. |
7f56eba8 |
86 | void SetColorMode (const Standard_Boolean theMode) |
87 | { myColorMode = theMode; } |
88 | |
89 | Standard_Boolean GetColorMode() const |
90 | { return myColorMode; } |
42cf5bc1 |
91 | |
92 | //! Set NameMode for indicate read Name or not. |
7f56eba8 |
93 | void SetNameMode (const Standard_Boolean theMode) |
94 | { myNameMode = theMode; } |
42cf5bc1 |
95 | |
7f56eba8 |
96 | Standard_Boolean GetNameMode() const |
97 | { return myNameMode; } |
42cf5bc1 |
98 | |
7f56eba8 |
99 | //! Set LayerMode for indicate read Layers or not. |
100 | void SetLayerMode (const Standard_Boolean theMode) |
101 | { myLayerMode = theMode; } |
42cf5bc1 |
102 | |
7f56eba8 |
103 | Standard_Boolean GetLayerMode() const |
104 | { return myLayerMode; } |
42cf5bc1 |
105 | |
7f56eba8 |
106 | private: |
42cf5bc1 |
107 | |
108 | Standard_Boolean myColorMode; |
109 | Standard_Boolean myNameMode; |
110 | Standard_Boolean myLayerMode; |
42cf5bc1 |
111 | }; |
112 | |
42cf5bc1 |
113 | #endif // _IGESCAFControl_Reader_HeaderFile |