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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _TransferBRep_HeaderFile
18 #define _TransferBRep_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
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>
32 class Transfer_Binder;
33 class Transfer_TransientProcess;
34 class Standard_Transient;
35 class Transfer_FinderProcess;
36 class TransferBRep_ShapeMapper;
37 class Message_Printer;
39 class TransferBRep_TransferResultInfo;
40 class Interface_CheckIterator;
41 class Interface_InterfaceModel;
44 //! This package gathers services to simply read files and convert
45 //! them to Shapes from CasCade. IE. it can be used in conjunction
46 //! with purely CasCade software
54 //! Get the Shape recorded in a Binder
55 //! If the Binder brings a multiple result, search for the Shape
56 Standard_EXPORT static TopoDS_Shape ShapeResult (const Handle(Transfer_Binder)& binder);
58 //! Get the Shape recorded in a TransientProcess as result of the
59 //! Transfer of an entity. I.E. in the binder bound to that Entity
60 //! If no result or result not a single Shape, returns a Null Shape
61 Standard_EXPORT static TopoDS_Shape ShapeResult (const Handle(Transfer_TransientProcess)& TP, const Handle(Standard_Transient)& ent);
63 //! Sets a Shape as a result for a starting entity <ent>
64 //! (reverse of ShapeResult)
65 //! It simply creates a ShapeBinder then binds it to the entity
66 Standard_EXPORT static void SetShapeResult (const Handle(Transfer_TransientProcess)& TP, const Handle(Standard_Transient)& ent, const TopoDS_Shape& result);
68 //! Gets the Shapes recorded in a TransientProcess as result of a
69 //! Transfer, considers roots only or all results according
70 //! <rootsonly>, returns them as a HSequence
71 Standard_EXPORT static Handle(TopTools_HSequenceOfShape) Shapes (const Handle(Transfer_TransientProcess)& TP, const Standard_Boolean rootsonly = Standard_True);
73 //! Gets the Shapes recorded in a TransientProcess as result of a
74 //! Transfer, for a given list of starting entities, returns
75 //! the shapes as a HSequence
76 Standard_EXPORT static Handle(TopTools_HSequenceOfShape) Shapes (const Handle(Transfer_TransientProcess)& TP, const Handle(TColStd_HSequenceOfTransient)& list);
78 //! Returns a Status regarding a Shape in a FinderProcess
79 //! - FORWARD means bound with SAME Orientation
80 //! - REVERSED means bound with REVERSE Orientation
81 //! - EXTERNAL means NOT BOUND
82 //! - INTERNAL is not used
83 Standard_EXPORT static TopAbs_Orientation ShapeState (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape);
85 //! Returns the result (as a Binder) attached to a given Shape
87 Standard_EXPORT static Handle(Transfer_Binder) ResultFromShape (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape);
89 //! Returns the result as pure Transient attached to a Shape
90 //! first one if multiple result
91 Standard_EXPORT static Handle(Standard_Transient) TransientFromShape (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape);
93 //! Binds a Transient Result to a Shape in a FinderProcess
94 //! (as first result if multiple : does not add it to existing one)
95 Standard_EXPORT static void SetTransientFromShape (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape, const Handle(Standard_Transient)& result);
97 //! Returns a ShapeMapper for a given Shape (location included)
98 //! Either <shape> is already mapped, then its Mapper is returned
99 //! Or it is not, then a new one is created then returned, BUT
100 //! it is not mapped here (use Bind or FindElseBind to do this)
101 Standard_EXPORT static Handle(TransferBRep_ShapeMapper) ShapeMapper (const Handle(Transfer_FinderProcess)& FP, const TopoDS_Shape& shape);
103 //! Fills sequence of TransferResultInfo for each type of entity
104 //! given in the EntityTypes (entity are given as objects).
105 //! Method IsKind applied to the entities in TP is used to
106 //! compare with entities in EntityTypes.
107 //! TopAbs_ShapeEnum).
108 Standard_EXPORT static void TransferResultInfo (const Handle(Transfer_TransientProcess)& TP, const Handle(TColStd_HSequenceOfTransient)& EntityTypes, Handle(TransferBRep_HSequenceOfTransferResultInfo)& InfoSeq);
110 //! Fills sequence of TransferResultInfo for each type of shape
111 //! given in the ShapeTypes (which are in fact considered as
112 //! TopAbs_ShapeEnum).
113 //! The Finders in the FP are considered as ShapeMappers.
114 Standard_EXPORT static void TransferResultInfo (const Handle(Transfer_FinderProcess)& FP, const Handle(TColStd_HSequenceOfInteger)& ShapeTypes, Handle(TransferBRep_HSequenceOfTransferResultInfo)& InfoSeq);
116 //! Prints the results of transfer to given priner with given header.
117 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);
119 //! Performs a heavy check by calling the Analyser from BRepCheck
120 //! This tool computes a lot of information about integrity of a
121 //! Shape. This method uses it and converts its internal result
122 //! to a classic check-list.
123 //! <lev> allows to get more information :
124 //! 0 : BRepCheck only
125 //! 1(D) + Curves/Surfaces not C0 ; 2 + SameParameter on Edges
126 //! Warning : entities to which checks are bound are the Shapes themselves,
127 //! embedded in ShapeMapper
128 Standard_EXPORT static Interface_CheckIterator BRepCheck (const TopoDS_Shape& shape, const Standard_Integer lev = 1);
130 //! Takes a starting CheckIterator which brings checks bound with
131 //! starting objects (Shapes, Transient from an Imagine appli ...)
132 //! and converts it to a CheckIterator in which checks are bound
133 //! with results in an InterfaceModel
134 //! Mapping is recorded in the FinderProcess
135 //! Starting objects for which no individual result is recorded
136 //! remain in their state
137 Standard_EXPORT static Interface_CheckIterator ResultCheckList (const Interface_CheckIterator& chl, const Handle(Transfer_FinderProcess)& FP, const Handle(Interface_InterfaceModel)& model);
139 //! Returns the list of objects to which a non-empty Check is
140 //! bound in a check-list. Objects are transients, they can then
141 //! be either Imagine objects entities for an Interface Norm.
142 //! <alsoshapes> commands Shapes to be returned too
143 //! (as ShapeMapper), see also CheckedShapes
144 Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) Checked (const Interface_CheckIterator& chl, const Standard_Boolean alsoshapes = Standard_False);
146 //! Returns the list of shapes to which a non-empty Check is bound
148 Standard_EXPORT static Handle(TopTools_HSequenceOfShape) CheckedShapes (const Interface_CheckIterator& chl);
150 //! Returns the check-list bound to a given object, generally none
151 //! (if OK) or one check. <obj> can be, either a true Transient
152 //! object or entity, or a ShapeMapper, in that case the Shape is
154 Standard_EXPORT static Interface_CheckIterator CheckObject (const Interface_CheckIterator& chl, const Handle(Standard_Transient)& obj);
170 friend class TransferBRep_Reader;
171 friend class TransferBRep_ShapeInfo;
172 friend class TransferBRep_BinderOfShape;
173 friend class TransferBRep_ShapeBinder;
174 friend class TransferBRep_ShapeListBinder;
175 friend class TransferBRep_ShapeMapper;
176 friend class TransferBRep_OrientedShapeMapper;
177 friend class TransferBRep_TransferResultInfo;
187 #endif // _TransferBRep_HeaderFile