| 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 | |
| 23 | #include <IGESControl_Reader.hxx> |
| 24 | #include <TCollection_AsciiString.hxx> |
| 25 | class XSControl_WorkSession; |
| 26 | class TDocStd_Document; |
| 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 | { |
| 49 | public: |
| 50 | |
| 51 | DEFINE_STANDARD_ALLOC |
| 52 | |
| 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 ) |
| 59 | {} |
| 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 |
| 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); } |
| 68 | |
| 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); |
| 72 | |
| 73 | Standard_EXPORT Standard_Boolean Perform (const TCollection_AsciiString& theFileName, Handle(TDocStd_Document)& theDoc) |
| 74 | { return Perform (theFileName.ToCString(), theDoc); } |
| 75 | |
| 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); |
| 79 | |
| 80 | //! Set ColorMode for indicate read Colors or not. |
| 81 | void SetColorMode (const Standard_Boolean theMode) |
| 82 | { myColorMode = theMode; } |
| 83 | |
| 84 | Standard_Boolean GetColorMode() const |
| 85 | { return myColorMode; } |
| 86 | |
| 87 | //! Set NameMode for indicate read Name or not. |
| 88 | void SetNameMode (const Standard_Boolean theMode) |
| 89 | { myNameMode = theMode; } |
| 90 | |
| 91 | Standard_Boolean GetNameMode() const |
| 92 | { return myNameMode; } |
| 93 | |
| 94 | //! Set LayerMode for indicate read Layers or not. |
| 95 | void SetLayerMode (const Standard_Boolean theMode) |
| 96 | { myLayerMode = theMode; } |
| 97 | |
| 98 | Standard_Boolean GetLayerMode() const |
| 99 | { return myLayerMode; } |
| 100 | |
| 101 | private: |
| 102 | |
| 103 | Standard_Boolean myColorMode; |
| 104 | Standard_Boolean myNameMode; |
| 105 | Standard_Boolean myLayerMode; |
| 106 | }; |
| 107 | |
| 108 | #endif // _IGESCAFControl_Reader_HeaderFile |