0029902: Data Exchange, XCAF - provide extended Material definition for visualization...
[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_AreaDriver.hxx>
22 #include <BinMXCAFDoc_CentroidDriver.hxx>
23 #include <BinMXCAFDoc_ColorDriver.hxx>
24 #include <BinMXCAFDoc_ColorToolDriver.hxx>
25 #include <BinMXCAFDoc_DatumDriver.hxx>
26 #include <BinMXCAFDoc_GeomToleranceDriver.hxx>
27 #include <BinMXCAFDoc_DimensionDriver.hxx>
28 #include <BinMXCAFDoc_DimTolDriver.hxx>
29 #include <BinMXCAFDoc_DimTolToolDriver.hxx>
30 #include <BinMXCAFDoc_DocumentToolDriver.hxx>
31 #include <BinMXCAFDoc_GraphNodeDriver.hxx>
32 #include <BinMXCAFDoc_LayerToolDriver.hxx>
33 #include <BinMXCAFDoc_LocationDriver.hxx>
34 #include <BinMXCAFDoc_MaterialDriver.hxx>
35 #include <BinMXCAFDoc_MaterialToolDriver.hxx>
36 #include <BinMXCAFDoc_NoteDriver.hxx>
37 #include <BinMXCAFDoc_NoteBalloonDriver.hxx>
38 #include <BinMXCAFDoc_NoteBinDataDriver.hxx>
39 #include <BinMXCAFDoc_NoteCommentDriver.hxx>
40 #include <BinMXCAFDoc_NotesToolDriver.hxx>
41 #include <BinMXCAFDoc_ShapeToolDriver.hxx>
42 #include <BinMXCAFDoc_ViewDriver.hxx>
43 #include <BinMXCAFDoc_ViewToolDriver.hxx>
44 #include <BinMXCAFDoc_VisMaterialDriver.hxx>
45 #include <BinMXCAFDoc_VisMaterialToolDriver.hxx>
46 #include <BinMXCAFDoc_VolumeDriver.hxx>
47 #include <Message_Messenger.hxx>
48 #include <TNaming_NamedShape.hxx>
49
50 //=======================================================================
51 //function :
52 //purpose  : 
53 //=======================================================================
54 void BinMXCAFDoc::AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
55                              const Handle(Message_Messenger)&   theMsgDrv) 
56 {
57   theDriverTable->AddDriver( new BinMXCAFDoc_AreaDriver     (theMsgDrv));
58   theDriverTable->AddDriver( new BinMXCAFDoc_CentroidDriver (theMsgDrv));
59   theDriverTable->AddDriver( new BinMXCAFDoc_ColorDriver    (theMsgDrv));
60   theDriverTable->AddDriver( new BinMXCAFDoc_GraphNodeDriver(theMsgDrv));
61   
62   //oan: changes for sharing locations map
63   Handle(BinMDF_ADriver) aNSDriver;
64   theDriverTable->GetDriver(STANDARD_TYPE(TNaming_NamedShape), aNSDriver);
65   Handle(BinMNaming_NamedShapeDriver) aNamedShapeDriver =
66     Handle(BinMNaming_NamedShapeDriver)::DownCast (aNSDriver);
67   
68   Handle(BinMXCAFDoc_LocationDriver) aLocationDriver = new BinMXCAFDoc_LocationDriver (theMsgDrv);
69   if( !aNamedShapeDriver.IsNull() )
70   {
71     aLocationDriver->SetSharedLocations( &(aNamedShapeDriver->GetShapesLocations()) );
72   }
73   
74   theDriverTable->AddDriver( aLocationDriver);
75   theDriverTable->AddDriver( new BinMXCAFDoc_AssemblyItemRefDriver(theMsgDrv));
76   theDriverTable->AddDriver( new BinMXCAFDoc_VolumeDriver      (theMsgDrv));
77   theDriverTable->AddDriver( new BinMXCAFDoc_DatumDriver       (theMsgDrv));
78   theDriverTable->AddDriver( new BinMXCAFDoc_GeomToleranceDriver (theMsgDrv));
79   theDriverTable->AddDriver( new BinMXCAFDoc_DimensionDriver   (theMsgDrv));
80   theDriverTable->AddDriver( new BinMXCAFDoc_DimTolDriver      (theMsgDrv));
81   theDriverTable->AddDriver( new BinMXCAFDoc_MaterialDriver    (theMsgDrv));
82   theDriverTable->AddDriver( new BinMXCAFDoc_VisMaterialDriver (theMsgDrv));
83   theDriverTable->AddDriver( new BinMXCAFDoc_NoteBalloonDriver (theMsgDrv));
84   theDriverTable->AddDriver( new BinMXCAFDoc_NoteBinDataDriver (theMsgDrv));
85   theDriverTable->AddDriver( new BinMXCAFDoc_NoteCommentDriver (theMsgDrv));
86   theDriverTable->AddDriver( new BinMXCAFDoc_ViewDriver        (theMsgDrv));
87
88   theDriverTable->AddDriver( new BinMXCAFDoc_ColorToolDriver   (theMsgDrv));
89   theDriverTable->AddDriver( new BinMXCAFDoc_DocumentToolDriver(theMsgDrv));
90   theDriverTable->AddDriver( new BinMXCAFDoc_LayerToolDriver   (theMsgDrv));
91   theDriverTable->AddDriver( new BinMXCAFDoc_ShapeToolDriver   (theMsgDrv));
92   theDriverTable->AddDriver( new BinMXCAFDoc_DimTolToolDriver  (theMsgDrv));
93   theDriverTable->AddDriver( new BinMXCAFDoc_MaterialToolDriver(theMsgDrv));
94   theDriverTable->AddDriver( new BinMXCAFDoc_VisMaterialToolDriver(theMsgDrv));
95   theDriverTable->AddDriver( new BinMXCAFDoc_NotesToolDriver   (theMsgDrv));
96   theDriverTable->AddDriver( new BinMXCAFDoc_ViewToolDriver    (theMsgDrv));
97 }