Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-12-03 10:57:11

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