0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / BinDrivers / BinDrivers_DocumentRetrievalDriver.cxx
CommitLineData
b311480e 1// Created on: 2002-10-31
2// Created by: Michael SAZONOV
973c2be1 3// Copyright (c) 2002-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
42cf5bc1 16
7fd59977 17#include <BinDrivers.hxx>
42cf5bc1 18#include <BinDrivers_DocumentRetrievalDriver.hxx>
7fd59977 19#include <BinLDrivers_DocumentSection.hxx>
42cf5bc1 20#include <BinMDataStd.hxx>
21#include <BinMDF_ADriverTable.hxx>
7fd59977 22#include <BinMNaming_NamedShapeDriver.hxx>
83ae3591 23#include <Message_Messenger.hxx>
42cf5bc1 24#include <Standard_ErrorHandler.hxx>
7fd59977 25#include <Standard_Failure.hxx>
26#include <Standard_IStream.hxx>
42cf5bc1 27#include <Standard_Type.hxx>
d5c71e20 28#include <Standard_NotImplemented.hxx>
42cf5bc1 29#include <TCollection_ExtendedString.hxx>
30#include <TNaming_NamedShape.hxx>
31
92efcf78 32IMPLEMENT_STANDARD_RTTIEXT(BinDrivers_DocumentRetrievalDriver,BinLDrivers_DocumentRetrievalDriver)
33
7fd59977 34//=======================================================================
35//function : BinDrivers_DocumentRetrievalDriver
36//purpose : Constructor
37//=======================================================================
7fd59977 38BinDrivers_DocumentRetrievalDriver::BinDrivers_DocumentRetrievalDriver ()
39{
40}
41
42//=======================================================================
43//function : AttributeDrivers
44//purpose :
45//=======================================================================
46
47Handle(BinMDF_ADriverTable) BinDrivers_DocumentRetrievalDriver::AttributeDrivers
83ae3591 48 (const Handle(Message_Messenger)& theMessageDriver)
7fd59977 49{
50 return BinDrivers::AttributeDrivers (theMessageDriver);
51}
52
53//=======================================================================
54//function : ReadShapeSection
55//purpose :
56//=======================================================================
57
58void BinDrivers_DocumentRetrievalDriver::ReadShapeSection
59 (BinLDrivers_DocumentSection& /*theSection*/,
60 Standard_IStream& theIS,
6d8f9f4a 61 const Standard_Boolean /*isMess*/,
7e785937 62 const Message_ProgressRange& theRange)
7fd59977 63
64{
65 // Read Shapes
aa00364d 66 Handle(BinMDF_ADriver) aDriver;
d5c71e20 67 if (myDrivers->GetDriver (STANDARD_TYPE(TNaming_NamedShape),aDriver))
aa00364d 68 {
69 try {
70 OCC_CATCH_SIGNALS
71 Handle(BinMNaming_NamedShapeDriver) aNamedShapeDriver =
72 Handle(BinMNaming_NamedShapeDriver)::DownCast (aDriver);
7e785937 73 aNamedShapeDriver->ReadShapeSection (theIS, theRange);
7fd59977 74 }
9775fa61 75 catch(Standard_Failure const& anException) {
aa00364d 76 const TCollection_ExtendedString aMethStr
77 ("BinDrivers_DocumentRetrievalDriver: ");
d5c71e20 78 myMsgDriver->Send(aMethStr + "error of Shape Section " +
83ae3591 79 anException.GetMessageString(), Message_Fail);
aa00364d 80 }
81 }
7fd59977 82}
83
84//=======================================================================
85//function : CheckShapeSection
86//purpose :
87//=======================================================================
d5c71e20 88void BinDrivers_DocumentRetrievalDriver::CheckShapeSection (
83ae3591 89 const Storage_Position& /*ShapeSectionPos*/,
90 Standard_IStream& /*IS*/)
7fd59977 91{}
92
bf954475 93//=======================================================================
94//function : Clear
95//purpose :
96//=======================================================================
97void BinDrivers_DocumentRetrievalDriver::Clear()
98{
99 // Clear NamedShape driver
100 Handle(BinMDF_ADriver) aDriver;
d5c71e20 101 if (myDrivers->GetDriver (STANDARD_TYPE(TNaming_NamedShape), aDriver))
bf954475 102 {
103 Handle(BinMNaming_NamedShapeDriver) aNamedShapeDriver =
d5c71e20 104 Handle(BinMNaming_NamedShapeDriver)::DownCast (aDriver);
bf954475 105 aNamedShapeDriver->Clear();
106 }
107 BinLDrivers_DocumentRetrievalDriver::Clear();
108}
109
d5c71e20 110//=======================================================================
111//function : EnableQuickPartReading
112//purpose :
113//=======================================================================
114void BinDrivers_DocumentRetrievalDriver::EnableQuickPartReading (
115 const Handle(Message_Messenger)& theMessageDriver, Standard_Boolean theValue)
116{
117 if (myDrivers.IsNull())
118 myDrivers = AttributeDrivers (theMessageDriver);
119 if (myDrivers.IsNull())
120 return;
7fd59977 121
d5c71e20 122 Handle(BinMDF_ADriver) aDriver;
123 myDrivers->GetDriver (STANDARD_TYPE(TNaming_NamedShape), aDriver);
124 Handle(BinMNaming_NamedShapeDriver) aShapesDriver = Handle(BinMNaming_NamedShapeDriver)::DownCast (aDriver);
125 if (aShapesDriver.IsNull())
126 throw Standard_NotImplemented ("Internal Error - TNaming_NamedShape is not found!");
127
128 aShapesDriver->EnableQuickPart (theValue);
129}