Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:57

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 
0029 //! Provides a tool to read IGES file and put it into
0030 //! DECAF document. Besides transfer of shapes (including
0031 //! assemblies) provided by IGESControl, supports also
0032 //! colors and part names
0033 //! IGESCAFControl_Reader reader; Methods for translation of an IGES file:
0034 //! reader.ReadFile("filename");
0035 //! reader.Transfer(Document); or
0036 //! reader.Perform("filename",doc);
0037 //! Methods for managing reading attributes.
0038 //! Colors
0039 //! reader.SetColorMode(colormode);
0040 //! Standard_Boolean colormode = reader.GetColorMode();
0041 //! Layers
0042 //! reader.SetLayerMode(layermode);
0043 //! Standard_Boolean layermode = reader.GetLayerMode();
0044 //! Names
0045 //! reader.SetNameMode(namemode);
0046 //! Standard_Boolean namemode = reader.GetNameMode();
0047 class IGESCAFControl_Reader  : public IGESControl_Reader
0048 {
0049  public:
0050 
0051   DEFINE_STANDARD_ALLOC
0052 
0053   //! Creates a reader with an empty
0054   //! IGES model and sets ColorMode, LayerMode and NameMode to Standard_True.
0055   IGESCAFControl_Reader()
0056   : myColorMode( Standard_True ),
0057     myNameMode ( Standard_True ),
0058     myLayerMode( Standard_True )
0059   {}
0060   
0061   //! Creates a reader tool and attaches it to an already existing Session
0062   //! Clears the session if it was not yet set for IGES
0063   IGESCAFControl_Reader(const Handle(XSControl_WorkSession)& theWS, const Standard_Boolean FromScratch = Standard_True)
0064   : myColorMode( Standard_True ),
0065     myNameMode ( Standard_True ),
0066     myLayerMode( Standard_True )
0067   { SetWS (theWS,FromScratch); }
0068   
0069   //! Translates currently loaded IGES file into the document
0070   //! Returns True if succeeded, and False in case of fail
0071   Standard_EXPORT Standard_Boolean Transfer (const Handle(TDocStd_Document)& theDoc,
0072                                              const Message_ProgressRange& theProgress = Message_ProgressRange());
0073   
0074   Standard_Boolean Perform (const TCollection_AsciiString& theFileName,
0075                             const Handle(TDocStd_Document)& theDoc,
0076                             const Message_ProgressRange& theProgress = Message_ProgressRange())
0077   { return Perform (theFileName.ToCString(), theDoc, theProgress); }
0078   
0079   //! Translate IGES file given by filename into the document
0080   //! Return True if succeeded, and False in case of fail
0081   Standard_EXPORT Standard_Boolean Perform (const Standard_CString theFileName,
0082                                             const Handle(TDocStd_Document)& theDoc,
0083                                             const Message_ProgressRange& theProgress = Message_ProgressRange());
0084   
0085   //! Set ColorMode for indicate read Colors or not.
0086   void SetColorMode (const Standard_Boolean theMode)
0087   { myColorMode = theMode; }
0088 
0089   Standard_Boolean GetColorMode() const
0090   { return myColorMode; }
0091   
0092   //! Set NameMode for indicate read Name or not.
0093   void SetNameMode (const Standard_Boolean theMode)
0094   { myNameMode = theMode; }
0095 
0096   Standard_Boolean GetNameMode() const
0097   { return myNameMode; }
0098   
0099   //! Set LayerMode for indicate read Layers or not.
0100   void SetLayerMode (const Standard_Boolean theMode)
0101   { myLayerMode = theMode; }
0102 
0103   Standard_Boolean GetLayerMode() const
0104   { return myLayerMode; }
0105 
0106  private:
0107 
0108   Standard_Boolean myColorMode;
0109   Standard_Boolean myNameMode;
0110   Standard_Boolean myLayerMode;
0111 };
0112 
0113 #endif // _IGESCAFControl_Reader_HeaderFile