Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:28:15

0001 // Created on: 2000-08-15
0002 // Created by: Andrey BETENEV
0003 // Copyright (c) 2000-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _IGESCAFControl_Reader_HeaderFile
0017 #define _IGESCAFControl_Reader_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 #include <Standard_Handle.hxx>
0022 
0023 #include <IGESControl_Reader.hxx>
0024 #include <TCollection_AsciiString.hxx>
0025 class XSControl_WorkSession;
0026 class TDocStd_Document;
0027 
0028 //! Provides a tool to read IGES file and put it into
0029 //! DECAF document. Besides transfer of shapes (including
0030 //! assemblies) provided by IGESControl, supports also
0031 //! colors and part names
0032 //! IGESCAFControl_Reader reader; Methods for translation of an IGES file:
0033 //! reader.ReadFile("filename");
0034 //! reader.Transfer(Document); or
0035 //! reader.Perform("filename",doc);
0036 //! Methods for managing reading attributes.
0037 //! Colors
0038 //! reader.SetColorMode(colormode);
0039 //! bool colormode = reader.GetColorMode();
0040 //! Layers
0041 //! reader.SetLayerMode(layermode);
0042 //! bool layermode = reader.GetLayerMode();
0043 //! Names
0044 //! reader.SetNameMode(namemode);
0045 //! bool namemode = reader.GetNameMode();
0046 class IGESCAFControl_Reader : public IGESControl_Reader
0047 {
0048 public:
0049   DEFINE_STANDARD_ALLOC
0050 
0051   //! Creates a reader with an empty
0052   //! IGES model and sets ColorMode, LayerMode and NameMode to true.
0053   IGESCAFControl_Reader()
0054       : myColorMode(true),
0055         myNameMode(true),
0056         myLayerMode(true)
0057   {
0058   }
0059 
0060   //! Creates a reader tool and attaches it to an already existing Session
0061   //! Clears the session if it was not yet set for IGES
0062   IGESCAFControl_Reader(const occ::handle<XSControl_WorkSession>& theWS,
0063                         const bool                                FromScratch = true)
0064       : myColorMode(true),
0065         myNameMode(true),
0066         myLayerMode(true)
0067   {
0068     SetWS(theWS, FromScratch);
0069   }
0070 
0071   //! Translates currently loaded IGES file into the document
0072   //! Returns True if succeeded, and False in case of fail
0073   Standard_EXPORT bool Transfer(const occ::handle<TDocStd_Document>& theDoc,
0074                                 const Message_ProgressRange& theProgress = Message_ProgressRange());
0075 
0076   bool Perform(const TCollection_AsciiString&       theFileName,
0077                const occ::handle<TDocStd_Document>& theDoc,
0078                const Message_ProgressRange&         theProgress = Message_ProgressRange())
0079   {
0080     return Perform(theFileName.ToCString(), theDoc, theProgress);
0081   }
0082 
0083   //! Translate IGES file given by filename into the document
0084   //! Return True if succeeded, and False in case of fail
0085   Standard_EXPORT bool Perform(const char* const                    theFileName,
0086                                const occ::handle<TDocStd_Document>& theDoc,
0087                                const Message_ProgressRange& theProgress = Message_ProgressRange());
0088 
0089   //! Set ColorMode for indicate read Colors or not.
0090   void SetColorMode(const bool theMode) { myColorMode = theMode; }
0091 
0092   bool GetColorMode() const { return myColorMode; }
0093 
0094   //! Set NameMode for indicate read Name or not.
0095   void SetNameMode(const bool theMode) { myNameMode = theMode; }
0096 
0097   bool GetNameMode() const { return myNameMode; }
0098 
0099   //! Set LayerMode for indicate read Layers or not.
0100   void SetLayerMode(const bool theMode) { myLayerMode = theMode; }
0101 
0102   bool GetLayerMode() const { return myLayerMode; }
0103 
0104 private:
0105   bool myColorMode;
0106   bool myNameMode;
0107   bool myLayerMode;
0108 };
0109 
0110 #endif // _IGESCAFControl_Reader_HeaderFile