0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / Transfer / Transfer_TransferDispatch.cxx
CommitLineData
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
42cf5bc1 14
15#include <Interface_GeneralLib.hxx>
16#include <Interface_InterfaceError.hxx>
17#include <Interface_InterfaceModel.hxx>
18#include <Interface_Macros.hxx>
19#include <Interface_Protocol.hxx>
20#include <Standard_Transient.hxx>
7fd59977 21#include <Transfer_DispatchControl.hxx>
22#include <Transfer_SimpleBinderOfTransient.hxx>
42cf5bc1 23#include <Transfer_TransferDispatch.hxx>
24#include <Transfer_TransientProcess.hxx>
7fd59977 25
b311480e 26Transfer_TransferDispatch::Transfer_TransferDispatch
7fd59977 27 (const Handle(Interface_InterfaceModel)& amodel,
28 const Interface_GeneralLib& lib)
29 : Interface_CopyTool (amodel,lib)
30{ SetControl (new Transfer_DispatchControl
31 (amodel, new Transfer_TransientProcess(amodel->NbEntities()))); }
32
33
34 Transfer_TransferDispatch::Transfer_TransferDispatch
35 (const Handle(Interface_InterfaceModel)& amodel,
36 const Handle(Interface_Protocol)& protocol)
37 : Interface_CopyTool (amodel,protocol)
38{ SetControl (new Transfer_DispatchControl
39 (amodel,new Transfer_TransientProcess(amodel->NbEntities()))); }
40
41
42 Transfer_TransferDispatch::Transfer_TransferDispatch
43 (const Handle(Interface_InterfaceModel)& amodel)
44 : Interface_CopyTool (amodel)
45{ SetControl (new Transfer_DispatchControl
46 (amodel,new Transfer_TransientProcess(amodel->NbEntities()))); }
47
48
49
50 Handle(Transfer_TransientProcess) Transfer_TransferDispatch::TransientProcess
51 () const
52{ return Handle(Transfer_DispatchControl)::DownCast(Control())->TransientProcess(); }
53
54 Standard_Boolean Transfer_TransferDispatch::Copy
55 (const Handle(Standard_Transient)& entfrom,
56 Handle(Standard_Transient)& entto,
57 const Standard_Boolean mapped, const Standard_Boolean errstat)
58{
59 Handle(Transfer_Binder) result = TransientProcess()->Transferring(entfrom);
60 if (result.IsNull())
61 return Interface_CopyTool::Copy(entfrom,entto,mapped,errstat);
62
63 if (!result->IsKind(STANDARD_TYPE(Transfer_SimpleBinderOfTransient)))
64 return Standard_False; // Produit qq chose, mais quoi ?
65 entto = GetCasted(Transfer_SimpleBinderOfTransient,result)->Result();
66 return Standard_True;
67}