0025748: Parallel version of progress indicator
[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 #include <Message_ProgressRange.hxx>
30
31 class IGESData_IGESModel;
32 class IGESToBRep_Actor;
33 class Transfer_TransientProcess;
34 class TopoDS_Shape;
35
36 //! A simple way to read geometric IGES data.
37 //! Encapsulates reading file and calling transfer tools
38 class IGESToBRep_Reader 
39 {
40 public:
41
42   DEFINE_STANDARD_ALLOC
43
44   
45   //! Creates a Reader
46   Standard_EXPORT IGESToBRep_Reader();
47   
48   //! Loads a Model from a file.Returns 0 if success.
49   //! returns 1 if the file could not be opened,
50   //! returns -1 if an error occurred while the file was being loaded.
51   Standard_EXPORT Standard_Integer LoadFile (const Standard_CString filename);
52   
53   //! Specifies a Model to work on
54   //! Also clears the result and Done status, sets TransientProcess
55   Standard_EXPORT void SetModel (const Handle(IGESData_IGESModel)& model);
56   
57   //! Returns the Model to be worked on.
58   Standard_EXPORT Handle(IGESData_IGESModel) Model() const;
59   
60   //! Allows to set an already defined TransientProcess
61   //! (to be called after LoadFile or SetModel)
62   Standard_EXPORT void SetTransientProcess (const Handle(Transfer_TransientProcess)& TP);
63   
64   //! Returns the TransientProcess
65   Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const;
66   
67   //! Returns "theActor"
68   Standard_EXPORT Handle(IGESToBRep_Actor) Actor() const;
69   
70   //! Clears the results between two translation operations.
71   Standard_EXPORT void Clear();
72   
73   //! Checks the IGES file that was
74   //! loaded into memory. Displays error messages in the default
75   //! message file if withprint is true. Returns True if no fail
76   //! message was found and False if there was at least one fail message.
77   Standard_EXPORT Standard_Boolean Check (const Standard_Boolean withprint) const;
78   
79   //! Translates root entities in an
80   //! IGES file. Standard_True is the default value and means that only
81   //! visible root entities are translated. Standard_False
82   //! translates all of the roots (visible and invisible).
83   Standard_EXPORT void TransferRoots (const Standard_Boolean onlyvisible = Standard_True,
84                                       const Message_ProgressRange& theProgress = Message_ProgressRange());
85   
86   //! Transfers an Entity given its rank in the Model (Root or not)
87   //! Returns True if it is recognized as Geom-Topol.
88   //! (But it can have failed : see IsDone)
89   Standard_EXPORT Standard_Boolean Transfer (const Standard_Integer num,
90                                              const Message_ProgressRange& theProgress = Message_ProgressRange());
91   
92   //! Returns True if the LAST Transfer/TransferRoots was a success
93   Standard_EXPORT Standard_Boolean IsDone() const;
94   
95   //! Returns the Tolerance which has been actually used, converted
96   //! in millimeters
97   //! (either that from File or that from Session, according the mode)
98   Standard_EXPORT Standard_Real UsedTolerance() const;
99   
100   //! Returns the number of shapes produced by the translation.
101   Standard_EXPORT Standard_Integer NbShapes() const;
102   
103   //! Returns the num the resulting shape in a translation operation.
104   Standard_EXPORT TopoDS_Shape Shape (const Standard_Integer num = 1) const;
105   
106   //! Returns all of the results in a
107   //! single shape which is:
108   //! - a null shape if there are no results,
109   //! - a shape if there is one result,
110   //! - a compound containing the resulting shapes if there are several.
111   Standard_EXPORT TopoDS_Shape OneShape() const;
112
113
114
115
116 protected:
117
118
119
120
121
122 private:
123
124
125
126   Handle(IGESData_IGESModel) theModel;
127   Standard_Boolean theDone;
128   TopTools_SequenceOfShape theShapes;
129   Handle(IGESToBRep_Actor) theActor;
130   Handle(Transfer_TransientProcess) theProc;
131
132
133 };
134
135
136
137
138
139
140
141 #endif // _IGESToBRep_Reader_HeaderFile