0025133: TKOpenGl - Crash on closing a view containing presentations with capping
[occt.git] / src / STEPConstruct / STEPConstruct_Tool.cxx
1 // Created on: 2000-09-29
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <STEPConstruct_Tool.ixx>
17 #include <XSControl_TransferReader.hxx>
18 #include <XSControl_TransferWriter.hxx>
19
20 //=======================================================================
21 //function : STEPConstruct_Tool
22 //purpose  : 
23 //=======================================================================
24
25 STEPConstruct_Tool::STEPConstruct_Tool () 
26 {
27 }
28
29 //=======================================================================
30 //function : STEPConstruct_Tool
31 //purpose  : 
32 //=======================================================================
33
34 STEPConstruct_Tool::STEPConstruct_Tool (const Handle(XSControl_WorkSession) &WS) 
35 {
36   SetWS ( WS );
37 }
38
39 //=======================================================================
40 //function : Init
41 //purpose  : 
42 //=======================================================================
43
44 Standard_Boolean STEPConstruct_Tool::SetWS (const Handle(XSControl_WorkSession) &WS)
45 {
46   myWS.Nullify();
47   myTransientProcess.Nullify();
48   myFinderProcess.Nullify();
49   
50   if ( WS.IsNull() ) return Standard_False;
51   myWS = WS;
52   myHGraph = myWS->HGraph();
53   
54   // collect data on reading process
55   Handle(XSControl_TransferReader) TR = WS->TransferReader();
56   if ( ! TR.IsNull() ) myTransientProcess = TR->TransientProcess();
57
58   // collect data on writing process
59   Handle(XSControl_TransferWriter) TW = myWS->TransferWriter();
60   if ( ! TW.IsNull() ) myFinderProcess = TW->FinderProcess();
61
62   return ! myTransientProcess.IsNull() && ! myFinderProcess.IsNull();
63 }
64