|
|
|||
File indexing completed on 2026-12-02 10:13:04
0001 // Created on: 1995-06-01 0002 // Created by: Christian CAILLET 0003 // Copyright (c) 1995-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 _XSControl_WorkSession_HeaderFile 0018 #define _XSControl_WorkSession_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_Type.hxx> 0022 0023 #include <IFSelect_WorkSession.hxx> 0024 #include <IFSelect_ReturnStatus.hxx> 0025 #include <XSControl_TransferWriter.hxx> 0026 class XSControl_Controller; 0027 class XSControl_TransferReader; 0028 class XSControl_Vars; 0029 class Transfer_TransientProcess; 0030 class Interface_InterfaceModel; 0031 class Transfer_FinderProcess; 0032 class TopoDS_Shape; 0033 class Interface_CheckIterator; 0034 0035 using XSControl_WorkSessionMap = 0036 NCollection_DataMap<TCollection_AsciiString, occ::handle<Standard_Transient>>; 0037 0038 //! This WorkSession completes the basic one, by adding : 0039 //! - use of Controller, with norm selection... 0040 //! - management of transfers (both ways) with auxiliary classes 0041 //! TransferReader and TransferWriter 0042 //! -> these transfers may work with a Context List : its items 0043 //! are given by the user, according to the transfer to be 0044 //! i.e. it is interpreted by the Actors 0045 //! Each item is accessed by a Name 0046 class XSControl_WorkSession : public IFSelect_WorkSession 0047 { 0048 public: 0049 Standard_EXPORT XSControl_WorkSession(); 0050 0051 ~XSControl_WorkSession() override { ClearBinders(); } 0052 0053 //! In addition to basic ClearData, clears Transfer and Management 0054 //! for interactive use, for mode = 0,1,2 and over 4 0055 //! Plus : mode = 5 to clear Transfers (both ways) only 0056 //! mode = 6 to clear enforced results 0057 //! mode = 7 to clear transfers, results 0058 Standard_EXPORT void ClearData(const int theMode) override; 0059 0060 //! Selects a Norm defined by its name. 0061 //! A Norm is described and handled by a Controller 0062 //! Returns True if done, False if <normname> is unknown 0063 //! 0064 //! The current Profile for this Norm is taken. 0065 Standard_EXPORT bool SelectNorm(const char* const theNormName); 0066 0067 //! Selects a Norm defined by its Controller itself 0068 Standard_EXPORT void SetController(const occ::handle<XSControl_Controller>& theCtl); 0069 0070 //! Returns the name of the last Selected Norm. If none is 0071 //! defined, returns an empty string 0072 //! By default, returns the complete name of the norm 0073 //! If <rsc> is True, returns the short name used for resource 0074 Standard_EXPORT const char* SelectedNorm(const bool theRsc = false) const; 0075 0076 //! Returns the norm controller itself 0077 const occ::handle<XSControl_Controller>& NormAdaptor() const { return myController; } 0078 0079 //! Returns the current Context List, Null if not defined 0080 //! The Context is given to the TransientProcess for TransferRead 0081 const XSControl_WorkSessionMap& Context() const { return myContext; } 0082 0083 //! Sets the current Context List, as a whole 0084 //! Sets it to the TransferReader 0085 Standard_EXPORT void SetAllContext(const XSControl_WorkSessionMap& theContext); 0086 0087 //! Clears the whole current Context (nullifies it) 0088 Standard_EXPORT void ClearContext(); 0089 0090 //! Prints the transfer status of a transferred item, as being 0091 //! the Mapped n0 <num>, from MapWriter if <wri> is True, or 0092 //! from MapReader if <wri> is False 0093 //! Returns True when done, False else (i.e. num out of range) 0094 Standard_EXPORT bool PrintTransferStatus(const int theNum, 0095 const bool theWri, 0096 Standard_OStream& theS) const; 0097 0098 //! Sets a Transfer Reader, by internal ways, according mode : 0099 //! 0 recreates it clear 0100 //! 1 clears it (does not recreate) 0101 //! 2 aligns Roots of TransientProcess from final Results 0102 //! 3 aligns final Results from Roots of TransientProcess 0103 //! 4 begins a new transfer (by BeginTransfer) 0104 //! 5 recreates TransferReader then begins a new transfer 0105 Standard_EXPORT void InitTransferReader(const int theMode); 0106 0107 //! Sets a Transfer Reader, which manages transfers on reading 0108 Standard_EXPORT void SetTransferReader(const occ::handle<XSControl_TransferReader>& theTR); 0109 0110 //! Returns the Transfer Reader, Null if not set 0111 const occ::handle<XSControl_TransferReader>& TransferReader() const { return myTransferReader; } 0112 0113 //! Returns the TransientProcess(internal data for TransferReader) 0114 Standard_EXPORT occ::handle<Transfer_TransientProcess> MapReader() const; 0115 0116 //! Changes the Map Reader, i.e. considers that the new one 0117 //! defines the relevant read results (forgets the former ones) 0118 //! Returns True when done, False in case of bad definition, i.e. 0119 //! if Model from TP differs from that of Session 0120 Standard_EXPORT bool SetMapReader(const occ::handle<Transfer_TransientProcess>& theTP); 0121 0122 //! Returns the result attached to a starting entity 0123 //! If <mode> = 0, returns Final Result 0124 //! If <mode> = 1, considers Last Result 0125 //! If <mode> = 2, considers Final, else if absent, Last 0126 //! returns it as Transient, if result is not transient returns 0127 //! the Binder 0128 //! <mode> = 10,11,12 idem but returns the Binder itself 0129 //! (if it is not, e.g. Shape, returns the Binder) 0130 //! <mode> = 20, returns the ResultFromModel 0131 Standard_EXPORT occ::handle<Standard_Transient> Result( 0132 const occ::handle<Standard_Transient>& theEnt, 0133 const int theMode) const; 0134 0135 //! Commands the transfer of, either one entity, or a list 0136 //! I.E. calls the TransferReader after having analysed <ents> 0137 //! It is cumulated from the last BeginTransfer 0138 //! <ents> is processed by GiveList, hence : 0139 //! - <ents> a Selection : its SelectionResult 0140 //! - <ents> a HSequenceOfTransient : this list 0141 //! - <ents> the Model : in this specific case, all the roots, 0142 //! with no cumulation of former transfers (TransferReadRoots) 0143 Standard_EXPORT int TransferReadOne( 0144 const occ::handle<Standard_Transient>& theEnts, 0145 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0146 0147 //! Commands the transfer of all the root entities of the model 0148 //! i.e. calls TransferRoot from the TransferReader with the Graph 0149 //! No cumulation with former calls to TransferReadOne 0150 Standard_EXPORT int TransferReadRoots( 0151 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0152 0153 //! produces and returns a new Model well conditioned 0154 //! It is produced by the Norm Controller 0155 //! It can be Null (if this function is not implemented) 0156 Standard_EXPORT occ::handle<Interface_InterfaceModel> NewModel(); 0157 0158 //! Returns the Transfer Reader, Null if not set 0159 const occ::handle<XSControl_TransferWriter>& TransferWriter() const { return myTransferWriter; } 0160 0161 //! Changes the Map Reader, i.e. considers that the new one 0162 //! defines the relevant read results (forgets the former ones) 0163 //! Returns True when done, False if <FP> is Null 0164 bool SetMapWriter(const occ::handle<Transfer_FinderProcess>& theFP) 0165 { 0166 if (theFP.IsNull()) 0167 return false; 0168 myTransferWriter->SetFinderProcess(theFP); 0169 return true; 0170 } 0171 0172 //! Transfers a Shape from CasCade to a model of current norm, 0173 //! according to the last call to SetModeWriteShape 0174 //! Returns status :Done if OK, Fail if error during transfer, 0175 //! Error if transfer badly initialised 0176 Standard_EXPORT IFSelect_ReturnStatus 0177 TransferWriteShape(const TopoDS_Shape& theShape, 0178 const bool theCompGraph = true, 0179 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0180 0181 //! Returns the check-list of last transfer (write) 0182 //! It is recorded in the FinderProcess, but it must be bound with 0183 //! resulting entities (in the resulting file model) rather than 0184 //! with original objects (in fact, their mappers) 0185 Standard_EXPORT Interface_CheckIterator TransferWriteCheckList() const; 0186 0187 const occ::handle<XSControl_Vars>& Vars() const { return myVars; } 0188 0189 void SetVars(const occ::handle<XSControl_Vars>& theVars) { myVars = theVars; } 0190 0191 DEFINE_STANDARD_RTTIEXT(XSControl_WorkSession, IFSelect_WorkSession) 0192 0193 private: 0194 //! Clears binders 0195 Standard_EXPORT void ClearBinders(); 0196 0197 private: 0198 occ::handle<XSControl_Controller> myController; 0199 occ::handle<XSControl_TransferReader> myTransferReader; 0200 occ::handle<XSControl_TransferWriter> myTransferWriter; 0201 XSControl_WorkSessionMap myContext; 0202 occ::handle<XSControl_Vars> myVars; 0203 }; 0204 0205 #endif // _XSControl_WorkSession_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|