b458ebe82dd4ebe5bd248e29fed381a696bbb7d3
[occt.git] / src / BinMXCAFDoc / BinMXCAFDoc.cxx
1 // Created on: 2005-04-18
2 // Created by: Eugeny NAPALKOV
3 // Copyright (c) 2005-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
17 #include <BinMDF_ADriverTable.hxx>
18 #include <BinMNaming_NamedShapeDriver.hxx>
19 #include <BinMXCAFDoc.hxx>
20 #include <BinMXCAFDoc_AssemblyItemRefDriver.hxx>
21 #include <BinMXCAFDoc_CentroidDriver.hxx>
22 #include <BinMXCAFDoc_ColorDriver.hxx>
23 #include <BinMXCAFDoc_DatumDriver.hxx>
24 #include <BinMXCAFDoc_DimTolDriver.hxx>
25 #include <BinMXCAFDoc_GraphNodeDriver.hxx>
26 #include <BinMXCAFDoc_LocationDriver.hxx>
27 #include <BinMXCAFDoc_MaterialDriver.hxx>
28 #include <BinMXCAFDoc_NoteDriver.hxx>
29 #include <BinMXCAFDoc_NoteBinDataDriver.hxx>
30 #include <BinMXCAFDoc_NoteCommentDriver.hxx>
31 #include <BinMXCAFDoc_VisMaterialDriver.hxx>
32 #include <BinMXCAFDoc_VisMaterialToolDriver.hxx>
33 #include <Message_Messenger.hxx>
34 #include <TNaming_NamedShape.hxx>
35
36 //=======================================================================
37 //function :
38 //purpose  : 
39 //=======================================================================
40 void BinMXCAFDoc::AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
41                              const Handle(Message_Messenger)&   theMsgDrv) 
42 {
43   theDriverTable->AddDriver( new BinMXCAFDoc_CentroidDriver (theMsgDrv));
44   theDriverTable->AddDriver( new BinMXCAFDoc_ColorDriver    (theMsgDrv));
45   theDriverTable->AddDriver( new BinMXCAFDoc_GraphNodeDriver(theMsgDrv));
46   
47   //oan: changes for sharing locations map
48   Handle(BinMDF_ADriver) aNSDriver;
49   theDriverTable->GetDriver(STANDARD_TYPE(TNaming_NamedShape), aNSDriver);
50   Handle(BinMNaming_NamedShapeDriver) aNamedShapeDriver =
51     Handle(BinMNaming_NamedShapeDriver)::DownCast (aNSDriver);
52   
53   Handle(BinMXCAFDoc_LocationDriver) aLocationDriver = new BinMXCAFDoc_LocationDriver (theMsgDrv);
54   if( !aNamedShapeDriver.IsNull() )
55   {
56     aLocationDriver->SetSharedLocations( &(aNamedShapeDriver->GetShapesLocations()) );
57   }
58   
59   theDriverTable->AddDriver( aLocationDriver);
60   theDriverTable->AddDriver( new BinMXCAFDoc_AssemblyItemRefDriver(theMsgDrv));
61   theDriverTable->AddDriver( new BinMXCAFDoc_DatumDriver       (theMsgDrv));
62   theDriverTable->AddDriver( new BinMXCAFDoc_DimTolDriver      (theMsgDrv));
63   theDriverTable->AddDriver( new BinMXCAFDoc_MaterialDriver    (theMsgDrv));
64   theDriverTable->AddDriver( new BinMXCAFDoc_VisMaterialDriver (theMsgDrv));
65   theDriverTable->AddDriver( new BinMXCAFDoc_NoteBinDataDriver (theMsgDrv));
66   theDriverTable->AddDriver( new BinMXCAFDoc_NoteCommentDriver (theMsgDrv));
67   theDriverTable->AddDriver( new BinMXCAFDoc_VisMaterialToolDriver(theMsgDrv));
68 }