|
|
|||
File indexing completed on 2026-09-09 09:17:23
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_Reader_HeaderFile 0018 #define _TransferBRep_Reader_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <Standard_Integer.hxx> 0025 #include <TopTools_HSequenceOfShape.hxx> 0026 #include <TColStd_HSequenceOfTransient.hxx> 0027 #include <Message_ProgressRange.hxx> 0028 0029 class Interface_Protocol; 0030 class Transfer_ActorOfTransientProcess; 0031 class Interface_InterfaceModel; 0032 class Transfer_TransientProcess; 0033 class Interface_CheckIterator; 0034 class TopoDS_Shape; 0035 class Standard_Transient; 0036 0037 //! This class offers a simple, easy to call, way of transferring 0038 //! data from interface files to Shapes from CasCade 0039 //! It must be specialized according to each norm/protocol, by : 0040 //! - defining how to read a file (specific method with protocol) 0041 //! - definig transfer, by providing an Actor 0042 class TransferBRep_Reader 0043 { 0044 public: 0045 DEFINE_STANDARD_ALLOC 0046 0047 //! Initializes a non-specialised Reader. Typically, for each norm 0048 //! or protocol, is will be required to define a specific Create 0049 //! to load a file and transfer it 0050 Standard_EXPORT TransferBRep_Reader(); 0051 0052 //! Records the protocol to be used for read and transfer roots 0053 Standard_EXPORT void SetProtocol(const Handle(Interface_Protocol)& protocol); 0054 0055 //! Returns the recorded Protocol 0056 Standard_EXPORT virtual Handle(Interface_Protocol) Protocol() const; 0057 0058 //! Records the actor to be used for transfers 0059 Standard_EXPORT void SetActor(const Handle(Transfer_ActorOfTransientProcess)& actor); 0060 0061 //! Returns the recorded Actor 0062 Standard_EXPORT virtual Handle(Transfer_ActorOfTransientProcess) Actor() const; 0063 0064 //! Sets File Status to be interpreted as follows : 0065 //! = 0 OK 0066 //! < 0 file not found 0067 //! > 0 read error, no Model could be created 0068 Standard_EXPORT void SetFileStatus(const Standard_Integer status); 0069 0070 //! Returns the File Status 0071 Standard_EXPORT Standard_Integer FileStatus() const; 0072 0073 //! Returns True if FileStatus is for FileNotFound 0074 Standard_EXPORT Standard_Boolean FileNotFound() const; 0075 0076 //! Returns True if FileStatus is for Error during read 0077 //! (major error; for local error, see CheckModel) 0078 Standard_EXPORT Standard_Boolean SyntaxError() const; 0079 0080 //! Specifies a Model to work on 0081 //! Also clears the result and Done status 0082 Standard_EXPORT void SetModel(const Handle(Interface_InterfaceModel)& model); 0083 0084 //! Returns the Model to be worked on 0085 Standard_EXPORT Handle(Interface_InterfaceModel) Model() const; 0086 0087 //! clears the result and Done status. But not the Model. 0088 Standard_EXPORT void Clear(); 0089 0090 //! Checks the Model. Returns True if there is NO FAIL at all 0091 //! (regardless Warnings) 0092 //! If <withprint> is True, also sends Checks on standard output 0093 Standard_EXPORT Standard_Boolean CheckStatusModel(const Standard_Boolean withprint) const; 0094 0095 //! Checks the Model (complete : syntax + semantic) and returns 0096 //! the produced Check List 0097 Standard_EXPORT Interface_CheckIterator CheckListModel() const; 0098 0099 //! Returns (by Reference, hence can be changed) the Mode for new 0100 //! Transfer : True (D) means that each new Transfer produces a 0101 //! new TransferProcess. Else keeps the original one but each 0102 //! Transfer clears its (former results are not kept) 0103 Standard_EXPORT Standard_Boolean& ModeNewTransfer(); 0104 0105 //! Initializes the Reader for a Transfer (one,roots, or list) 0106 //! Also calls PrepareTransfer 0107 //! Returns True when done, False if could not be done 0108 Standard_EXPORT Standard_Boolean BeginTransfer(); 0109 0110 //! Ebds a Transfer (one, roots or list) by recording its result 0111 Standard_EXPORT void EndTransfer(); 0112 0113 //! Prepares the Transfer. Also can act on the Actor or change the 0114 //! TransientProcess if required. 0115 //! Should not set the Actor into the TransientProcess, it is done 0116 //! by caller. The provided default does nothing. 0117 Standard_EXPORT virtual void PrepareTransfer(); 0118 0119 //! Transfers all Root Entities which are recognized as Geom-Topol 0120 //! The result will be a list of Shapes. 0121 //! This method calls user redefinable PrepareTransfer 0122 //! Remark : former result is cleared 0123 Standard_EXPORT virtual void TransferRoots( 0124 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0125 0126 //! Transfers an Entity given its rank in the Model (Root or not) 0127 //! Returns True if it is recognized as Geom-Topol. 0128 //! (But it can have failed : see IsDone) 0129 Standard_EXPORT virtual Standard_Boolean Transfer( 0130 const Standard_Integer num, 0131 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0132 0133 //! Transfers a list of Entities (only the ones also in the Model) 0134 //! Remark : former result is cleared 0135 Standard_EXPORT virtual void TransferList( 0136 const Handle(TColStd_HSequenceOfTransient)& list, 0137 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0138 0139 //! Returns True if the LAST Transfer/TransferRoots was a success 0140 Standard_EXPORT Standard_Boolean IsDone() const; 0141 0142 //! Returns the count of produced Shapes (roots) 0143 Standard_EXPORT Standard_Integer NbShapes() const; 0144 0145 //! Returns the complete list of produced Shapes 0146 Standard_EXPORT Handle(TopTools_HSequenceOfShape) Shapes() const; 0147 0148 //! Returns a Shape given its rank, by default the first one 0149 Standard_EXPORT const TopoDS_Shape& Shape(const Standard_Integer num = 1) const; 0150 0151 //! Returns a Shape produced from a given entity (if it was 0152 //! individually transferred or if an intermediate result is 0153 //! known). If no Shape is bound with <ent>, returns a Null Shape 0154 //! Warning : Runs on the last call to Transfer,TransferRoots,TransferList 0155 Standard_EXPORT TopoDS_Shape ShapeResult(const Handle(Standard_Transient)& ent) const; 0156 0157 //! Returns a unique Shape for the result : 0158 //! - a void Shape (type = SHAPE) if result is empty 0159 //! - a simple Shape if result has only one : returns this one 0160 //! - a Compound if result has more than one Shape 0161 Standard_EXPORT TopoDS_Shape OneShape() const; 0162 0163 //! Returns the count of produced Transient Results (roots) 0164 Standard_EXPORT Standard_Integer NbTransients() const; 0165 0166 //! Returns the complete list of produced Transient Results 0167 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Transients() const; 0168 0169 //! Returns a Transient Root Result, given its rank (by default 0170 //! the first one) 0171 Standard_EXPORT Handle(Standard_Transient) Transient(const Standard_Integer num = 1) const; 0172 0173 //! Checks the Result of last Transfer (individual or roots, no 0174 //! cumulation on several transfers). Returns True if NO fail 0175 //! occurred during Transfer (queries the TransientProcess) 0176 Standard_EXPORT Standard_Boolean CheckStatusResult(const Standard_Boolean withprints) const; 0177 0178 //! Checks the Result of last Transfer (individual or roots, no 0179 //! cumulation on several transfers) and returns the produced list 0180 Standard_EXPORT Interface_CheckIterator CheckListResult() const; 0181 0182 //! Returns the TransientProcess. It records information about 0183 //! the very last transfer done. Null if no transfer yet done. 0184 //! Can be used for queries more accurate than the default ones. 0185 Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const; 0186 0187 Standard_EXPORT virtual ~TransferBRep_Reader(); 0188 0189 protected: 0190 Standard_Boolean theDone; 0191 Handle(Transfer_TransientProcess) theProc; 0192 0193 private: 0194 Handle(Interface_Protocol) theProto; 0195 Handle(Transfer_ActorOfTransientProcess) theActor; 0196 Handle(Interface_InterfaceModel) theModel; 0197 Standard_Integer theFilest; 0198 Standard_Boolean theNewpr; 0199 Handle(TopTools_HSequenceOfShape) theShapes; 0200 Handle(TColStd_HSequenceOfTransient) theTransi; 0201 }; 0202 0203 #endif // _TransferBRep_Reader_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|