42cf5bc1 |
1 | // Created on: 1996-03-13 |
2 | // Created by: Christian CAILLET |
3 | // Copyright (c) 1996-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _XSControl_TransferWriter_HeaderFile |
18 | #define _XSControl_TransferWriter_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
25e59720 |
23 | #include <Standard_Transient.hxx> |
42cf5bc1 |
24 | #include <IFSelect_ReturnStatus.hxx> |
7f56eba8 |
25 | #include <Transfer_FinderProcess.hxx> |
42cf5bc1 |
26 | class XSControl_Controller; |
42cf5bc1 |
27 | class Interface_InterfaceModel; |
28 | class TopoDS_Shape; |
29 | class Interface_CheckIterator; |
30 | |
31 | |
32 | class XSControl_TransferWriter; |
25e59720 |
33 | DEFINE_STANDARD_HANDLE(XSControl_TransferWriter, Standard_Transient) |
42cf5bc1 |
34 | |
35 | //! TransferWriter gives help to control transfer to write a file |
36 | //! after having converted data from Cascade/Imagine |
37 | //! |
38 | //! It works with a Controller (which itself can work with an |
39 | //! Actor to Write) and a FinderProcess. It records results and |
40 | //! checks |
25e59720 |
41 | class XSControl_TransferWriter : public Standard_Transient |
42cf5bc1 |
42 | { |
7f56eba8 |
43 | public: |
42cf5bc1 |
44 | |
45 | //! Creates a TransferWriter, empty, ready to run |
46 | //! with an empty FinderProcess (but no controller, etc) |
7f56eba8 |
47 | XSControl_TransferWriter() |
48 | : myTransferWriter(new Transfer_FinderProcess), |
49 | myTransferMode(0) |
50 | {} |
42cf5bc1 |
51 | |
52 | //! Returns the FinderProcess itself |
7f56eba8 |
53 | const Handle(Transfer_FinderProcess) & FinderProcess() const |
54 | { return myTransferWriter; } |
42cf5bc1 |
55 | |
56 | //! Sets a new FinderProcess and forgets the former one |
7f56eba8 |
57 | void SetFinderProcess (const Handle(Transfer_FinderProcess)& theFP) |
58 | { myTransferWriter = theFP; } |
59 | |
42cf5bc1 |
60 | //! Returns the currently used Controller |
7f56eba8 |
61 | const Handle(XSControl_Controller) & Controller() const |
62 | { return myController; } |
42cf5bc1 |
63 | |
64 | //! Sets a new Controller, also sets a new FinderProcess |
0f57ab75 |
65 | void SetController (const Handle(XSControl_Controller)& theCtl) |
7f56eba8 |
66 | { |
67 | myController = theCtl; |
68 | Clear(-1); |
69 | } |
42cf5bc1 |
70 | |
71 | //! Clears recorded data according a mode |
72 | //! 0 clears FinderProcess (results, checks) |
73 | //! -1 create a new FinderProcess |
7f56eba8 |
74 | Standard_EXPORT void Clear (const Standard_Integer theMode); |
42cf5bc1 |
75 | |
76 | //! Returns the current Transfer Mode (an Integer) |
77 | //! It will be interpreted by the Controller to run Transfers |
78 | //! This call form could be later replaced by more specific ones |
79 | //! (parameters suited for each norm / transfer case) |
7f56eba8 |
80 | Standard_Integer TransferMode() const |
81 | { return myTransferMode; } |
82 | |
42cf5bc1 |
83 | //! Changes the Transfer Mode |
7f56eba8 |
84 | void SetTransferMode (const Standard_Integer theMode) |
85 | { myTransferMode = theMode; } |
86 | |
42cf5bc1 |
87 | //! Prints statistics on current Trace File, according what,mode |
88 | //! See PrintStatsProcess for details |
7f56eba8 |
89 | Standard_EXPORT void PrintStats (const Standard_Integer theWhat, const Standard_Integer theMode = 0) const; |
42cf5bc1 |
90 | |
91 | //! Tells if a transient object (from an application) is a valid |
92 | //! candidate for a transfer to a model |
93 | //! Asks the Controller (RecognizeWriteTransient) |
94 | //! If <obj> is a HShape, calls RecognizeShape |
7f56eba8 |
95 | Standard_EXPORT Standard_Boolean RecognizeTransient (const Handle(Standard_Transient)& theObj); |
42cf5bc1 |
96 | |
97 | //! Transfers a Transient object (from an application) to a model |
98 | //! of current norm, according to the last call to SetTransferMode |
99 | //! Works by calling the Controller |
100 | //! Returns status : =0 if OK, >0 if error during transfer, <0 if |
101 | //! transfer badly initialised |
7e785937 |
102 | Standard_EXPORT IFSelect_ReturnStatus TransferWriteTransient |
103 | (const Handle(Interface_InterfaceModel)& theModel, |
104 | const Handle(Standard_Transient)& theObj, |
105 | const Message_ProgressRange& theProgress = Message_ProgressRange()); |
42cf5bc1 |
106 | |
107 | //! Tells if a Shape is valid for a transfer to a model |
108 | //! Asks the Controller (RecognizeWriteShape) |
7f56eba8 |
109 | Standard_EXPORT Standard_Boolean RecognizeShape (const TopoDS_Shape& theShape); |
42cf5bc1 |
110 | |
111 | //! Transfers a Shape from CasCade to a model of current norm, |
112 | //! according to the last call to SetTransferMode |
113 | //! Works by calling the Controller |
114 | //! Returns status : =0 if OK, >0 if error during transfer, <0 if |
115 | //! transfer badly initialised |
7e785937 |
116 | Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape |
117 | (const Handle(Interface_InterfaceModel)& theModel, |
118 | const TopoDS_Shape& theShape, |
119 | const Message_ProgressRange& theProgress = Message_ProgressRange()); |
42cf5bc1 |
120 | |
121 | //! Returns the check-list of last transfer (write), i.e. the |
122 | //! check-list currently recorded in the FinderProcess |
123 | Standard_EXPORT Interface_CheckIterator CheckList() const; |
124 | |
125 | //! Returns the check-list of last transfer (write), but tries |
126 | //! to bind to each check, the resulting entity in the model |
127 | //! instead of keeping the original Mapper, whenever known |
7f56eba8 |
128 | Standard_EXPORT Interface_CheckIterator ResultCheckList (const Handle(Interface_InterfaceModel)& theModel) const; |
42cf5bc1 |
129 | |
25e59720 |
130 | DEFINE_STANDARD_RTTIEXT(XSControl_TransferWriter,Standard_Transient) |
42cf5bc1 |
131 | |
7f56eba8 |
132 | private: |
42cf5bc1 |
133 | |
7f56eba8 |
134 | Handle(XSControl_Controller) myController; |
135 | Handle(Transfer_FinderProcess) myTransferWriter; |
136 | Standard_Integer myTransferMode; |
42cf5bc1 |
137 | }; |
138 | |
42cf5bc1 |
139 | #endif // _XSControl_TransferWriter_HeaderFile |