42cf5bc1 |
1 | // Created on: 1994-10-03 |
2 | // Created by: Christian CAILLET |
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 _TransferBRep_HeaderFile |
18 | #define _TransferBRep_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <TopTools_HSequenceOfShape.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <TColStd_HSequenceOfTransient.hxx> |
27 | #include <TopAbs_Orientation.hxx> |
28 | #include <TransferBRep_HSequenceOfTransferResultInfo.hxx> |
29 | #include <TColStd_HSequenceOfInteger.hxx> |
30 | #include <Standard_Integer.hxx> |
31 | class TopoDS_Shape; |
32 | class Transfer_Binder; |
33 | class Transfer_TransientProcess; |
34 | class Standard_Transient; |
35 | class Transfer_FinderProcess; |
36 | class TransferBRep_ShapeMapper; |
37 | class Message_Printer; |
38 | class Message_Msg; |
39 | class TransferBRep_TransferResultInfo; |
40 | class Interface_CheckIterator; |
41 | class Interface_InterfaceModel; |
42 | class TransferBRep_Reader; |
43 | class TransferBRep_ShapeInfo; |
44 | class TransferBRep_BinderOfShape; |
45 | class TransferBRep_ShapeBinder; |
46 | class TransferBRep_ShapeListBinder; |
47 | class TransferBRep_ShapeMapper; |
48 | class TransferBRep_OrientedShapeMapper; |
49 | class TransferBRep_TransferResultInfo; |
50 | |
51 | |
52 | //! This package gathers services to simply read files and convert |
53 | //! them to Shapes from CasCade. IE. it can be used in conjunction |
54 | //! with purely CasCade software |
55 | class TransferBRep |
56 | { |
57 | public: |
58 | |
59 | DEFINE_STANDARD_ALLOC |
60 | |
61 | |
62 | //! Get the Shape recorded in a Binder |
63 | //! If the Binder brings a multiple result, search for the Shape |
64 | Standard_EXPORT static TopoDS_Shape ShapeResult (const Handle(Transfer_Binder)& binder); |
65 | |
66 | //! Get the Shape recorded in a TransientProcess as result of the |
67 | //! Transfer of an entity. I.E. in the binder bound to that Entity |
68 | //! If no result or result not a single Shape, returns a Null Shape |
69 | Standard_EXPORT static TopoDS_Shape ShapeResult (const Handle(Transfer_TransientProcess)& TP, const Handle(Standard_Transient)& ent); |
70 | |
71 | //! Sets a Shape as a result for a starting entity <ent> |
72 | //! (reverse of ShapeResult) |
73 | //! It simply creates a ShapeBinder then binds it to the entity |
74 | Standard_EXPORT static void SetShapeResult (const Handle(Transfer_TransientProcess)& TP, const Handle(Standard_Transient)& ent, const TopoDS_Shape& result); |
75 | |
76 | //! Gets the Shapes recorded in a TransientProcess as result of a |
77 | //! Transfer, considers roots only or all results according |
78 | //! <rootsonly>, returns them as a HSequence |
79 | Standard_EXPORT static Handle(TopTools_HSequenceOfShape) Shapes (const Handle(Transfer_TransientProcess)& TP, const Standard_Boolean rootsonly = Standard_True); |
80 | |
81 | //! Gets the Shapes recorded in a TransientProcess as result of a |
82 | //! Transfer, for a given list of starting entities, returns |
83 | //! the shapes as a HSequence |
84 | Standard_EXPORT static Handle(TopTools_HSequenceOfShape) Shapes (const Handle(Transfer_TransientProcess)& TP, const Handle(TColStd_HSequenceOfTransient)& list); |
85 | |
86 | //! Returns a Status regarding a Shape in a FinderProcess |
87 | //! - FORWARD means bound with SAME Orientation |
88 | //! - REVERSED means bound with REVERSE Orientation |
89 | //! - EXTERNAL means NOT BOUND |
90 | //! - INTERNAL is not used |
91 | Standard_EXPORT static TopAbs_Orientation ShapeState (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape); |
92 | |
93 | //! Returns the result (as a Binder) attached to a given Shape |
94 | //! Null if none |
95 | Standard_EXPORT static Handle(Transfer_Binder) ResultFromShape (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape); |
96 | |
97 | //! Returns the result as pure Transient attached to a Shape |
98 | //! first one if multiple result |
99 | Standard_EXPORT static Handle(Standard_Transient) TransientFromShape (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape); |
100 | |
101 | //! Binds a Transient Result to a Shape in a FinderProcess |
102 | //! (as first result if multiple : does not add it to existing one) |
103 | Standard_EXPORT static void SetTransientFromShape (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape, const Handle(Standard_Transient)& result); |
104 | |
105 | //! Returns a ShapeMapper for a given Shape (location included) |
106 | //! Either <shape> is already mapped, then its Mapper is returned |
107 | //! Or it is not, then a new one is created then returned, BUT |
108 | //! it is not mapped here (use Bind or FindElseBind to do this) |
109 | Standard_EXPORT static Handle(TransferBRep_ShapeMapper) ShapeMapper (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape); |
110 | |
111 | //! Fills sequence of TransferResultInfo for each type of entity |
112 | //! given in the EntityTypes (entity are given as objects). |
113 | //! Method IsKind applied to the entities in TP is used to |
114 | //! compare with entities in EntityTypes. |
115 | //! TopAbs_ShapeEnum). |
116 | Standard_EXPORT static void TransferResultInfo (const Handle(Transfer_TransientProcess)& TP, const Handle(TColStd_HSequenceOfTransient)& EntityTypes, Handle(TransferBRep_HSequenceOfTransferResultInfo)& InfoSeq); |
117 | |
118 | //! Fills sequence of TransferResultInfo for each type of shape |
119 | //! given in the ShapeTypes (which are in fact considered as |
120 | //! TopAbs_ShapeEnum). |
121 | //! The Finders in the FP are considered as ShapeMappers. |
122 | Standard_EXPORT static void TransferResultInfo (const Handle(Transfer_FinderProcess)& FP, const Handle(TColStd_HSequenceOfInteger)& ShapeTypes, Handle(TransferBRep_HSequenceOfTransferResultInfo)& InfoSeq); |
123 | |
124 | //! Prints the results of transfer to given priner with given header. |
125 | Standard_EXPORT static void PrintResultInfo (const Handle(Message_Printer)& Printer, const Message_Msg& Header, const Handle(TransferBRep_TransferResultInfo)& ResultInfo, const Standard_Boolean printEmpty = Standard_True); |
126 | |
127 | //! Performs a heavy check by calling the Analyser from BRepCheck |
a25d5aaa |
128 | //! This tool computes a lot of information about integrity of a |
42cf5bc1 |
129 | //! Shape. This method uses it and converts its internal result |
130 | //! to a classic check-list. |
a25d5aaa |
131 | //! <lev> allows to get more information : |
42cf5bc1 |
132 | //! 0 : BRepCheck only |
133 | //! 1(D) + Curves/Surfaces not C0 ; 2 + SameParameter on Edges |
134 | //! Warning : entities to which checks are bound are the Shapes themselves, |
135 | //! embedded in ShapeMapper |
136 | Standard_EXPORT static Interface_CheckIterator BRepCheck (const TopoDS_Shape& shape, const Standard_Integer lev = 1); |
137 | |
138 | //! Takes a starting CheckIterator which brings checks bound with |
139 | //! starting objects (Shapes, Transient from an Imagine appli ...) |
140 | //! and converts it to a CheckIterator in which checks are bound |
141 | //! with results in an InterfaceModel |
142 | //! Mapping is recorded in the FinderProcess |
143 | //! Starting objects for which no individual result is recorded |
144 | //! remain in their state |
145 | Standard_EXPORT static Interface_CheckIterator ResultCheckList (const Interface_CheckIterator& chl, const Handle(Transfer_FinderProcess)& FP, const Handle(Interface_InterfaceModel)& model); |
146 | |
147 | //! Returns the list of objects to which a non-empty Check is |
148 | //! bound in a check-list. Objects are transients, they can then |
149 | //! be either Imagine objects entities for an Interface Norm. |
150 | //! <alsoshapes> commands Shapes to be returned too |
151 | //! (as ShapeMapper), see also CheckedShapes |
152 | Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) Checked (const Interface_CheckIterator& chl, const Standard_Boolean alsoshapes = Standard_False); |
153 | |
154 | //! Returns the list of shapes to which a non-empty Check is bound |
155 | //! in a check-list |
156 | Standard_EXPORT static Handle(TopTools_HSequenceOfShape) CheckedShapes (const Interface_CheckIterator& chl); |
157 | |
158 | //! Returns the check-list bound to a given object, generally none |
159 | //! (if OK) or one check. <obj> can be, either a true Transient |
160 | //! object or entity, or a ShapeMapper, in that case the Shape is |
161 | //! considered |
162 | Standard_EXPORT static Interface_CheckIterator CheckObject (const Interface_CheckIterator& chl, const Handle(Standard_Transient)& obj); |
163 | |
164 | |
165 | |
166 | |
167 | protected: |
168 | |
169 | |
170 | |
171 | |
172 | |
173 | private: |
174 | |
175 | |
176 | |
177 | |
178 | friend class TransferBRep_Reader; |
179 | friend class TransferBRep_ShapeInfo; |
180 | friend class TransferBRep_BinderOfShape; |
181 | friend class TransferBRep_ShapeBinder; |
182 | friend class TransferBRep_ShapeListBinder; |
183 | friend class TransferBRep_ShapeMapper; |
184 | friend class TransferBRep_OrientedShapeMapper; |
185 | friend class TransferBRep_TransferResultInfo; |
186 | |
187 | }; |
188 | |
189 | |
190 | |
191 | |
192 | |
193 | |
194 | |
195 | #endif // _TransferBRep_HeaderFile |