0025748: Parallel version of progress indicator
[occt.git] / src / STEPControl / STEPControl_ActorRead.hxx
1 // Created on: 1994-12-21
2 // Created by: Dieter THIEMANN
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 _STEPControl_ActorRead_HeaderFile
18 #define _STEPControl_ActorRead_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <StepToTopoDS_NMTool.hxx>
24 #include <Standard_Real.hxx>
25 #include <Transfer_ActorOfTransientProcess.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Standard_Integer.hxx>
28 #include <TopTools_ListOfShape.hxx>
29 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
30 #include <Message_ProgressRange.hxx>
31
32 class StepRepr_Representation;
33 class Standard_Transient;
34 class Transfer_Binder;
35 class Transfer_TransientProcess;
36 class StepGeom_Axis2Placement3d;
37 class gp_Trsf;
38 class StepRepr_RepresentationRelationship;
39 class TransferBRep_ShapeBinder;
40 class StepBasic_ProductDefinition;
41 class StepRepr_NextAssemblyUsageOccurrence;
42 class StepShape_ShapeRepresentation;
43 class StepShape_ContextDependentShapeRepresentation;
44 class StepRepr_ShapeRepresentationRelationship;
45 class StepGeom_GeometricRepresentationItem;
46 class StepRepr_MappedItem;
47 class StepShape_FaceSurface;
48 class TopoDS_Shell;
49 class TopoDS_Compound;
50 class StepRepr_ConstructiveGeometryRepresentationRelationship;
51
52
53 class STEPControl_ActorRead;
54 DEFINE_STANDARD_HANDLE(STEPControl_ActorRead, Transfer_ActorOfTransientProcess)
55
56 //! This class performs the transfer of an Entity from
57 //! AP214 and AP203, either Geometric or Topologic.
58 //!
59 //! I.E. for each type of Entity, it invokes the appropriate Tool
60 //! then returns the Binder which contains the Result
61 class STEPControl_ActorRead : public Transfer_ActorOfTransientProcess
62 {
63
64 public:
65
66   
67   Standard_EXPORT STEPControl_ActorRead();
68   
69   Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
70   
71   Standard_EXPORT virtual Handle(Transfer_Binder) Transfer
72                    (const Handle(Standard_Transient)& start,
73                     const Handle(Transfer_TransientProcess)& TP,
74                     const Message_ProgressRange& theProgress = Message_ProgressRange()) Standard_OVERRIDE;
75   
76   //! theUseTrsf - special flag for using Axis2Placement from ShapeRepresentation for transform root shape
77   Standard_EXPORT Handle(Transfer_Binder) TransferShape (
78       const Handle(Standard_Transient)& start,
79       const Handle(Transfer_TransientProcess)& TP,
80       const Standard_Boolean isManifold = Standard_True,
81       const Standard_Boolean theUseTrsf = Standard_False,
82       const Message_ProgressRange& theProgress = Message_ProgressRange());
83   
84   //! set units and tolerances context by given ShapeRepresentation
85   Standard_EXPORT void PrepareUnits (const Handle(StepRepr_Representation)& rep, const Handle(Transfer_TransientProcess)& TP);
86   
87   //! reset units and tolerances context to default
88   //! (mm, radians, read.precision.val, etc.)
89   Standard_EXPORT void ResetUnits();
90   
91   //! Computes transformation defined by two axis placements (in MAPPED_ITEM
92   //! or ITEM_DEFINED_TRANSFORMATION) taking into account their
93   //! representation contexts (i.e. units, which may be different)
94   //! Returns True if transformation is computed and is not an identity.
95   Standard_EXPORT Standard_Boolean ComputeTransformation (const Handle(StepGeom_Axis2Placement3d)& Origin, const Handle(StepGeom_Axis2Placement3d)& Target, const Handle(StepRepr_Representation)& OrigContext, const Handle(StepRepr_Representation)& TargContext, const Handle(Transfer_TransientProcess)& TP, gp_Trsf& Trsf);
96   
97   //! Computes transformation defined by given
98   //! REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION
99   Standard_EXPORT Standard_Boolean ComputeSRRWT (const Handle(StepRepr_RepresentationRelationship)& SRR, const Handle(Transfer_TransientProcess)& TP, gp_Trsf& Trsf);
100
101
102
103
104   DEFINE_STANDARD_RTTIEXT(STEPControl_ActorRead,Transfer_ActorOfTransientProcess)
105
106 protected:
107
108   
109   //! Transfers product definition entity
110   //! theUseTrsf - special flag for using Axis2Placement from ShapeRepresentation for transform root shape
111     Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity (
112       const Handle(StepBasic_ProductDefinition)& PD,
113       const Handle(Transfer_TransientProcess)& TP,
114       const Standard_Boolean theUseTrsf = Standard_False,
115       const Message_ProgressRange& theProgress = Message_ProgressRange());
116   
117   //! Transfers next assembly usage occurence entity
118   Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity
119                    (const Handle(StepRepr_NextAssemblyUsageOccurrence)& NAUO,
120                     const Handle(Transfer_TransientProcess)& TP,
121                     const Message_ProgressRange& theProgress = Message_ProgressRange());
122   
123   //! Transfers shape representation entity
124   //! theUseTrsf - special flag for using Axis2Placement from ShapeRepresentation for transform root shape
125   Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity (
126       const Handle(StepShape_ShapeRepresentation)& sr,
127       const Handle(Transfer_TransientProcess)& TP,
128       Standard_Boolean& isBound,
129       const Standard_Boolean theUseTrsf = Standard_False,
130       const Message_ProgressRange& theProgress = Message_ProgressRange());
131   
132   //! Transfers context dependent shape representation entity
133   Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity
134                    (const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR,
135                     const Handle(Transfer_TransientProcess)& TP,
136                     const Message_ProgressRange& theProgress = Message_ProgressRange());
137   
138   //! Transfers  shape representation relationship entity
139   //! theUseTrsf - special flag for using Axis2Placement from ShapeRepresentation for transform root shape
140   Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity (
141       const Handle(StepRepr_ShapeRepresentationRelationship)& und,
142       const Handle(Transfer_TransientProcess)& TP,
143       const Standard_Integer nbrep = 0,
144       const Standard_Boolean theUseTrsf = Standard_False,
145       const Message_ProgressRange& theProgress = Message_ProgressRange());
146   
147   //! Transfers  geometric representation item entity such as ManifoldSolidBRep ,...etc
148   Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity
149                    (const Handle(StepGeom_GeometricRepresentationItem)& git,
150                     const Handle(Transfer_TransientProcess)& TP,
151                     const Standard_Boolean isManifold,
152                     const Message_ProgressRange& theProgress);
153   
154   //! Transfers  mapped item
155   Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity
156                    (const Handle(StepRepr_MappedItem)& mapit,
157                     const Handle(Transfer_TransientProcess)& TP,
158                     const Message_ProgressRange& theProgress);
159   
160   //! Transfers  FaceSurface entity
161   Standard_EXPORT Handle(TransferBRep_ShapeBinder) TransferEntity
162                    (const Handle(StepShape_FaceSurface)& fs,
163                     const Handle(Transfer_TransientProcess)& TP,
164                     const Message_ProgressRange& theProgress);
165
166   Handle(TransferBRep_ShapeBinder) TransferEntity( const Handle(StepRepr_ConstructiveGeometryRepresentationRelationship)& theCGRR,
167     const Handle(Transfer_TransientProcess)& theTP);
168   
169   //! Tranlates file by old way when CDSR are roots . Acts only if "read.step.product_mode" is equal Off.
170   Standard_EXPORT Handle(TransferBRep_ShapeBinder) OldWay
171                    (const Handle(Standard_Transient)& start,
172                     const Handle(Transfer_TransientProcess)& TP,
173                     const Message_ProgressRange& theProgress);
174
175
176
177 private:
178
179   
180   Standard_EXPORT TopoDS_Shell closeIDEASShell (const TopoDS_Shell& shell, const TopTools_ListOfShape& closingShells);
181   
182   Standard_EXPORT void computeIDEASClosings (const TopoDS_Compound& comp, TopTools_IndexedDataMapOfShapeListOfShape& shellClosingMap);
183
184   StepToTopoDS_NMTool myNMTool;
185   Standard_Real myPrecision;
186   Standard_Real myMaxTol;
187   Handle(StepRepr_Representation) mySRContext;
188
189
190 };
191
192
193
194
195
196
197
198 #endif // _STEPControl_ActorRead_HeaderFile