0025748: Parallel version of progress indicator
[occt.git] / src / STEPControl / STEPControl_Reader.hxx
CommitLineData
42cf5bc1 1// Created on: 1996-07-08
2// Created by: Christian CAILLET
3// Copyright (c) 1996-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 _STEPControl_Reader_HeaderFile
18#define _STEPControl_Reader_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <XSControl_Reader.hxx>
25#include <Standard_Boolean.hxx>
26#include <Standard_Integer.hxx>
27#include <TColStd_SequenceOfAsciiString.hxx>
28#include <TColStd_Array1OfAsciiString.hxx>
29#include <TColStd_Array1OfReal.hxx>
30class XSControl_WorkSession;
31class StepData_StepModel;
32class StepRepr_RepresentationContext;
33
34
35//! Reads STEP files, checks them and translates their contents
36//! into Open CASCADE models. The STEP data can be that of
37//! a whole model or that of a specific list of entities in the model.
38//! As in XSControl_Reader, you specify the list using a selection.
39//! For the translation of iges files it is possible to use next sequence:
40//! To change translation parameters
41//! class Interface_Static should be used before beginning of
42//! translation (see STEP Parameters and General Parameters)
43//! Creation of reader - STEPControl_Reader reader;
44//! To load s file in a model use method reader.ReadFile("filename.stp")
45//! To print load results reader.PrintCheckLoad(failsonly,mode)
46//! where mode is equal to the value of enumeration IFSelect_PrintCount
47//! For definition number of candidates :
48//! Standard_Integer nbroots = reader. NbRootsForTransfer();
49//! To transfer entities from a model the following methods can be used:
50//! for the whole model - reader.TransferRoots();
51//! to transfer a list of entities: reader.TransferList(list);
52//! to transfer one entity Handle(Standard_Transient)
53//! ent = reader.RootForTransfer(num);
54//! reader.TransferEntity(ent), or
55//! reader.TransferOneRoot(num), or
56//! reader.TransferOne(num), or
57//! reader.TransferRoot(num)
58//! To obtain the result the following method can be used:
59//! reader.NbShapes() and reader.Shape(num); or reader.OneShape();
60//! To print the results of transfer use method:
61//! reader.PrintCheckTransfer(failwarn,mode);
62//! where printfail is equal to the value of enumeration
63//! IFSelect_PrintFail, mode see above; or reader.PrintStatsTransfer();
64//! Gets correspondence between a STEP entity and a result
65//! shape obtained from it.
66//! Handle(XSControl_WorkSession)
67//! WS = reader.WS();
68//! if ( WS->TransferReader()->HasResult(ent) )
69//! TopoDS_Shape shape = WS->TransferReader()->ShapeResult(ent);
70class STEPControl_Reader : public XSControl_Reader
71{
72public:
73
74 DEFINE_STANDARD_ALLOC
75
76
77 //! Creates a reader object with an empty STEP model.
78 Standard_EXPORT STEPControl_Reader();
79
80 //! Creates a Reader for STEP from an already existing Session
81 //! Clears the session if it was not yet set for STEP
82 Standard_EXPORT STEPControl_Reader(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
83
84 //! Returns the model as a StepModel.
85 //! It can then be consulted (header, product)
86 Standard_EXPORT Handle(StepData_StepModel) StepModel() const;
87
88 //! Transfers a root given its rank in the list of candidate roots
89 //! Default is the first one
90 //! Returns True if a shape has resulted, false else
91 //! Same as inherited TransferOneRoot, kept for compatibility
7e785937 92 Standard_EXPORT Standard_Boolean TransferRoot (const Standard_Integer num = 1,
93 const Message_ProgressRange& theProgress = Message_ProgressRange());
42cf5bc1 94
95 //! Determines the list of root entities from Model which are candidate for
96 //! a transfer to a Shape (type of entities is PRODUCT)
97 Standard_EXPORT virtual Standard_Integer NbRootsForTransfer() Standard_OVERRIDE;
98
99 //! Returns sequence of all unit names for shape representations
100 //! found in file
101 Standard_EXPORT void FileUnits (TColStd_SequenceOfAsciiString& theUnitLengthNames, TColStd_SequenceOfAsciiString& theUnitAngleNames, TColStd_SequenceOfAsciiString& theUnitSolidAngleNames);
102
103
104
105
106protected:
107
108
109
110
111
112private:
113
114
115 //! Returns units for length , angle and solidangle for shape representations
116 Standard_EXPORT Standard_Boolean findUnits (const Handle(StepRepr_RepresentationContext)& theReprContext, TColStd_Array1OfAsciiString& theNameUnits, TColStd_Array1OfReal& theFactorUnits);
117
118
119
120
121};
122
123
124
125
126
127
128
129#endif // _STEPControl_Reader_HeaderFile