973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | //:i1 gka 03.04.99 BUC60301 |
15 | |
7fd59977 |
16 | #include <Interface_InterfaceModel.hxx> |
17 | #include <Interface_Macros.hxx> |
42cf5bc1 |
18 | #include <TopoDS_Shape.hxx> |
19 | #include <XSControl_Controller.hxx> |
20 | #include <XSControl_TransferWriter.hxx> |
21 | #include <XSControl_WorkSession.hxx> |
22 | #include <XSControl_Writer.hxx> |
7fd59977 |
23 | |
b311480e |
24 | XSControl_Writer::XSControl_Writer () |
7fd59977 |
25 | { |
26 | SetWS (new XSControl_WorkSession); |
27 | } |
28 | |
29 | XSControl_Writer::XSControl_Writer (const Standard_CString norm) |
30 | { |
31 | SetNorm (norm); |
32 | } |
33 | |
34 | XSControl_Writer::XSControl_Writer |
35 | (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch) |
36 | { |
37 | SetWS (WS,scratch); |
38 | } |
39 | |
40 | Standard_Boolean XSControl_Writer::SetNorm (const Standard_CString norm) |
41 | { |
42 | if (thesession.IsNull()) SetWS (new XSControl_WorkSession); |
43 | Standard_Boolean sess = thesession->SelectNorm (norm); |
44 | Handle(Interface_InterfaceModel) model = Model (); //:i1 gka 03.04.99 BUC60301 |
45 | return sess; |
46 | } |
47 | |
48 | void XSControl_Writer::SetWS |
49 | (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch) |
50 | { |
51 | thesession = WS; |
52 | // Un controller doit etre defini ... |
53 | thesession->InitTransferReader(0); |
54 | Handle(Interface_InterfaceModel) model = Model (scratch); |
55 | } |
56 | |
57 | Handle(XSControl_WorkSession) XSControl_Writer::WS () const |
58 | { return thesession; } |
59 | |
60 | Handle(Interface_InterfaceModel) XSControl_Writer::Model |
61 | (const Standard_Boolean newone) |
62 | { |
63 | Handle(Interface_InterfaceModel) model = thesession->Model(); |
64 | if (newone || model.IsNull()) model = thesession->NewModel(); |
65 | return model; |
66 | } |
67 | |
68 | IFSelect_ReturnStatus XSControl_Writer::TransferShape |
7e785937 |
69 | (const TopoDS_Shape& sh, const Standard_Integer mode, const Message_ProgressRange& theProgress) |
7fd59977 |
70 | { |
7f56eba8 |
71 | thesession->TransferWriter()->SetTransferMode (mode); |
7e785937 |
72 | return thesession->TransferWriteShape (sh, Standard_True, theProgress); |
7fd59977 |
73 | } |
74 | |
75 | IFSelect_ReturnStatus XSControl_Writer::WriteFile |
76 | (const Standard_CString filename) |
77 | { return thesession->SendAll(filename); } |
78 | |
79 | void XSControl_Writer::PrintStatsTransfer |
80 | (const Standard_Integer what, const Standard_Integer mode) const |
81 | { thesession->TransferWriter()->PrintStats (what,mode); } |