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