Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-06 08:37:20

0001 // Created on: 1994-10-03
0002 // Created by: Christian CAILLET
0003 // Copyright (c) 1994-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _TransferBRep_HeaderFile
0018 #define _TransferBRep_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopTools_HSequenceOfShape.hxx>
0025 #include <Standard_Boolean.hxx>
0026 #include <TColStd_HSequenceOfTransient.hxx>
0027 #include <TopAbs_Orientation.hxx>
0028 #include <TransferBRep_HSequenceOfTransferResultInfo.hxx>
0029 #include <TColStd_HSequenceOfInteger.hxx>
0030 #include <Standard_Integer.hxx>
0031 class TopoDS_Shape;
0032 class Transfer_Binder;
0033 class Transfer_TransientProcess;
0034 class Standard_Transient;
0035 class Transfer_FinderProcess;
0036 class TransferBRep_ShapeMapper;
0037 class Message_Printer;
0038 class Message_Msg;
0039 class TransferBRep_TransferResultInfo;
0040 class Interface_CheckIterator;
0041 class Interface_InterfaceModel;
0042 
0043 //! This package gathers services to simply read files and convert
0044 //! them to Shapes from CasCade. IE. it can be used in conjunction
0045 //! with purely CasCade software
0046 class TransferBRep
0047 {
0048 public:
0049   DEFINE_STANDARD_ALLOC
0050 
0051   //! Get the Shape recorded in a Binder
0052   //! If the Binder brings a multiple result, search for the Shape
0053   Standard_EXPORT static TopoDS_Shape ShapeResult(const Handle(Transfer_Binder)& binder);
0054 
0055   //! Get the Shape recorded in a TransientProcess as result of the
0056   //! Transfer of an entity. I.E. in the binder bound to that Entity
0057   //! If no result or result not a single Shape, returns a Null Shape
0058   Standard_EXPORT static TopoDS_Shape ShapeResult(const Handle(Transfer_TransientProcess)& TP,
0059                                                   const Handle(Standard_Transient)&        ent);
0060 
0061   //! Sets a Shape as a result for a starting entity <ent>
0062   //! (reverse of ShapeResult)
0063   //! It simply creates a ShapeBinder then binds it to the entity
0064   Standard_EXPORT static void SetShapeResult(const Handle(Transfer_TransientProcess)& TP,
0065                                              const Handle(Standard_Transient)&        ent,
0066                                              const TopoDS_Shape&                      result);
0067 
0068   //! Gets the Shapes recorded in a TransientProcess as result of a
0069   //! Transfer, considers roots only or all results according
0070   //! <rootsonly>, returns them as a HSequence
0071   Standard_EXPORT static Handle(TopTools_HSequenceOfShape) Shapes(
0072     const Handle(Transfer_TransientProcess)& TP,
0073     const Standard_Boolean                   rootsonly = Standard_True);
0074 
0075   //! Gets the Shapes recorded in a TransientProcess as result of a
0076   //! Transfer, for a given list of starting entities, returns
0077   //! the shapes as a HSequence
0078   Standard_EXPORT static Handle(TopTools_HSequenceOfShape) Shapes(
0079     const Handle(Transfer_TransientProcess)&    TP,
0080     const Handle(TColStd_HSequenceOfTransient)& list);
0081 
0082   //! Returns a Status regarding a Shape in a FinderProcess
0083   //! - FORWARD means bound with SAME Orientation
0084   //! - REVERSED means bound with REVERSE Orientation
0085   //! - EXTERNAL means NOT BOUND
0086   //! - INTERNAL is not used
0087   Standard_EXPORT static TopAbs_Orientation ShapeState(const Handle(Transfer_FinderProcess)& FP,
0088                                                        const TopoDS_Shape&                   shape);
0089 
0090   //! Returns the result (as a Binder) attached to a given Shape
0091   //! Null if none
0092   Standard_EXPORT static Handle(Transfer_Binder) ResultFromShape(
0093     const Handle(Transfer_FinderProcess)& FP,
0094     const TopoDS_Shape&                   shape);
0095 
0096   //! Returns the result as pure Transient attached to a Shape
0097   //! first one if multiple result
0098   Standard_EXPORT static Handle(Standard_Transient) TransientFromShape(
0099     const Handle(Transfer_FinderProcess)& FP,
0100     const TopoDS_Shape&                   shape);
0101 
0102   //! Binds a Transient Result to a Shape in a FinderProcess
0103   //! (as first result if multiple : does not add it to existing one)
0104   Standard_EXPORT static void SetTransientFromShape(const Handle(Transfer_FinderProcess)& FP,
0105                                                     const TopoDS_Shape&                   shape,
0106                                                     const Handle(Standard_Transient)&     result);
0107 
0108   //! Returns a ShapeMapper for a given Shape (location included)
0109   //! Either <shape> is already mapped, then its Mapper is returned
0110   //! Or it is not, then a new one is created then returned, BUT
0111   //! it is not mapped here (use Bind or FindElseBind to do this)
0112   Standard_EXPORT static Handle(TransferBRep_ShapeMapper) ShapeMapper(
0113     const Handle(Transfer_FinderProcess)& FP,
0114     const TopoDS_Shape&                   shape);
0115 
0116   //! Fills sequence of TransferResultInfo for each type of entity
0117   //! given in the EntityTypes (entity are given as objects).
0118   //! Method IsKind applied to the entities in TP is used to
0119   //! compare with entities in EntityTypes.
0120   //! TopAbs_ShapeEnum).
0121   Standard_EXPORT static void TransferResultInfo(
0122     const Handle(Transfer_TransientProcess)&            TP,
0123     const Handle(TColStd_HSequenceOfTransient)&         EntityTypes,
0124     Handle(TransferBRep_HSequenceOfTransferResultInfo)& InfoSeq);
0125 
0126   //! Fills sequence of TransferResultInfo for each type of shape
0127   //! given in the ShapeTypes (which are in fact considered as
0128   //! TopAbs_ShapeEnum).
0129   //! The Finders in the FP are considered as ShapeMappers.
0130   Standard_EXPORT static void TransferResultInfo(
0131     const Handle(Transfer_FinderProcess)&               FP,
0132     const Handle(TColStd_HSequenceOfInteger)&           ShapeTypes,
0133     Handle(TransferBRep_HSequenceOfTransferResultInfo)& InfoSeq);
0134 
0135   //! Prints the results of transfer to given priner with given header.
0136   Standard_EXPORT static void PrintResultInfo(
0137     const Handle(Message_Printer)&                 Printer,
0138     const Message_Msg&                             Header,
0139     const Handle(TransferBRep_TransferResultInfo)& ResultInfo,
0140     const Standard_Boolean                         printEmpty = Standard_True);
0141 
0142   //! Performs a heavy check by calling the Analyser from BRepCheck
0143   //! This tool computes a lot of information about integrity of a
0144   //! Shape. This method uses it and converts its internal result
0145   //! to a classic check-list.
0146   //! <lev> allows to get more information :
0147   //! 0 : BRepCheck only
0148   //! 1(D) + Curves/Surfaces not C0  ;  2 + SameParameter on Edges
0149   //! Warning : entities to which checks are bound are the Shapes themselves,
0150   //! embedded in ShapeMapper
0151   Standard_EXPORT static Interface_CheckIterator BRepCheck(const TopoDS_Shape&    shape,
0152                                                            const Standard_Integer lev = 1);
0153 
0154   //! Takes a starting CheckIterator which brings checks bound with
0155   //! starting objects (Shapes, Transient from an Imagine appli ...)
0156   //! and converts it to a CheckIterator in which checks are bound
0157   //! with results in an InterfaceModel
0158   //! Mapping is recorded in the FinderProcess
0159   //! Starting objects for which no individual result is recorded
0160   //! remain in their state
0161   Standard_EXPORT static Interface_CheckIterator ResultCheckList(
0162     const Interface_CheckIterator&          chl,
0163     const Handle(Transfer_FinderProcess)&   FP,
0164     const Handle(Interface_InterfaceModel)& model);
0165 
0166   //! Returns the list of objects to which a non-empty Check is
0167   //! bound in a check-list. Objects are transients, they can then
0168   //! be either Imagine objects entities for an Interface Norm.
0169   //! <alsoshapes> commands Shapes to be returned too
0170   //! (as ShapeMapper), see also CheckedShapes
0171   Standard_EXPORT static Handle(TColStd_HSequenceOfTransient) Checked(
0172     const Interface_CheckIterator& chl,
0173     const Standard_Boolean         alsoshapes = Standard_False);
0174 
0175   //! Returns the list of shapes to which a non-empty Check is bound
0176   //! in a check-list
0177   Standard_EXPORT static Handle(TopTools_HSequenceOfShape) CheckedShapes(
0178     const Interface_CheckIterator& chl);
0179 
0180   //! Returns the check-list bound to a given object, generally none
0181   //! (if OK) or one check. <obj> can be, either a true Transient
0182   //! object or entity, or a ShapeMapper, in that case the Shape is
0183   //! considered
0184   Standard_EXPORT static Interface_CheckIterator CheckObject(const Interface_CheckIterator&    chl,
0185                                                              const Handle(Standard_Transient)& obj);
0186 };
0187 
0188 #endif // _TransferBRep_HeaderFile