0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / IGESToBRep / IGESToBRep_Reader.hxx
1 // Created on: 1994-09-01
2 // Created by: Marie Jose MARTZ
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _IGESToBRep_Reader_HeaderFile
18 #define _IGESToBRep_Reader_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Boolean.hxx>
25 #include <TopTools_SequenceOfShape.hxx>
26 #include <Standard_Integer.hxx>
27 #include <Standard_CString.hxx>
28 #include <Standard_Real.hxx>
29 class IGESData_IGESModel;
30 class IGESToBRep_Actor;
31 class Transfer_TransientProcess;
32 class TopoDS_Shape;
33
34
35 //! A simple way to read geometric IGES data.
36 //! Encapsulates reading file and calling transfer tools
37 class IGESToBRep_Reader 
38 {
39 public:
40
41   DEFINE_STANDARD_ALLOC
42
43   
44   //! Creates a Reader
45   Standard_EXPORT IGESToBRep_Reader();
46   
47   //! Loads a Model from a file.Returns 0 if success.
48   //! returns 1 if the file could not be opened,
49   //! returns -1 if an error occurred while the file was being loaded.
50   Standard_EXPORT Standard_Integer LoadFile (const Standard_CString filename);
51   
52   //! Specifies a Model to work on
53   //! Also clears the result and Done status, sets TransientProcess
54   Standard_EXPORT void SetModel (const Handle(IGESData_IGESModel)& model);
55   
56   //! Returns the Model to be worked on.
57   Standard_EXPORT Handle(IGESData_IGESModel) Model() const;
58   
59   //! Allows to set an already defined TransientProcess
60   //! (to be called after LoadFile or SetModel)
61   Standard_EXPORT void SetTransientProcess (const Handle(Transfer_TransientProcess)& TP);
62   
63   //! Returns the TransientProcess
64   Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const;
65   
66   //! Returns "theActor"
67   Standard_EXPORT Handle(IGESToBRep_Actor) Actor() const;
68   
69   //! Clears the results between two translation operations.
70   Standard_EXPORT void Clear();
71   
72   //! Checks the IGES file that was
73   //! loaded into memory. Displays error messages in the default
74   //! message file if withprint is true. Returns True if no fail
75   //! message was found and False if there was at least one fail message.
76   Standard_EXPORT Standard_Boolean Check (const Standard_Boolean withprint) const;
77   
78   //! Translates root entities in an
79   //! IGES file. Standard_True is the default value and means that only
80   //! visible root entities are translated. Standard_False
81   //! translates all of the roots (visible and invisible).
82   Standard_EXPORT void TransferRoots (const Standard_Boolean onlyvisible = Standard_True);
83   
84   //! Transfers an Entity given its rank in the Model (Root or not)
85   //! Returns True if it is recognized as Geom-Topol.
86   //! (But it can have failed : see IsDone)
87   Standard_EXPORT Standard_Boolean Transfer (const Standard_Integer num);
88   
89   //! Returns True if the LAST Transfer/TransferRoots was a success
90   Standard_EXPORT Standard_Boolean IsDone() const;
91   
92   //! Returns the Tolerance which has been actually used, converted
93   //! in millimeters
94   //! (either that from File or that from Session, according the mode)
95   Standard_EXPORT Standard_Real UsedTolerance() const;
96   
97   //! Returns the number of shapes produced by the translation.
98   Standard_EXPORT Standard_Integer NbShapes() const;
99   
100   //! Returns the num the resulting shape in a translation operation.
101   Standard_EXPORT TopoDS_Shape Shape (const Standard_Integer num = 1) const;
102   
103   //! Returns all of the results in a
104   //! single shape which is:
105   //! - a null shape if there are no results,
106   //! - a shape if there is one result,
107   //! - a compound containing the resulting shapes if there are several.
108   Standard_EXPORT TopoDS_Shape OneShape() const;
109
110
111
112
113 protected:
114
115
116
117
118
119 private:
120
121
122
123   Handle(IGESData_IGESModel) theModel;
124   Standard_Boolean theDone;
125   TopTools_SequenceOfShape theShapes;
126   Handle(IGESToBRep_Actor) theActor;
127   Handle(Transfer_TransientProcess) theProc;
128
129
130 };
131
132
133
134
135
136
137
138 #endif // _IGESToBRep_Reader_HeaderFile