1 // Created on: 2017-06-16
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2017 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <inspector/DFBrowserPaneXDE_XCAFDocDatum.hxx>
18 #include <inspector/DFBrowserPane_AttributePaneModel.hxx>
20 #include <Standard_Version.hxx>
21 #include <TCollection_HAsciiString.hxx>
23 #include <XCAFDoc_Datum.hxx>
24 #if OCC_VERSION_HEX > 0x060901
25 #include <XCAFDimTolObjects_DatumObject.hxx>
28 // =======================================================================
29 // function : Constructor
31 // =======================================================================
32 DFBrowserPaneXDE_XCAFDocDatum::DFBrowserPaneXDE_XCAFDocDatum()
33 : DFBrowserPane_AttributePane()
37 // =======================================================================
38 // function : GetValues
40 // =======================================================================
41 void DFBrowserPaneXDE_XCAFDocDatum::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
43 Handle(XCAFDoc_Datum) anAttr = Handle(XCAFDoc_Datum)::DownCast (theAttribute);
45 Handle(TCollection_HAsciiString) aName = anAttr->GetName();
46 Handle(TCollection_HAsciiString) aDescription = anAttr->GetDescription();
47 Handle(TCollection_HAsciiString) anIndentification = anAttr->GetIdentification();
49 theValues << "Name" << (!aName.IsNull() ? aName->ToCString() : QString (""))
50 << "Description" << (!aDescription.IsNull() ? aDescription->ToCString() : QString (""))
51 << "Indentification" << (!anIndentification.IsNull() ? anIndentification->ToCString() : QString (""));
53 #if OCC_VERSION_HEX > 0x060901
54 Handle(XCAFDimTolObjects_DatumObject) anObject = anAttr->GetObject();
55 Handle(TCollection_HAsciiString) anObjectName;
56 if (!anObject.IsNull())
57 anObjectName = anObject->GetName();
58 theValues << "Object" << (!anObjectName.IsNull() ? anObjectName->ToCString() : "Empty Name");
62 // =======================================================================
63 // function : GetShortAttributeInfo
65 // =======================================================================
66 void DFBrowserPaneXDE_XCAFDocDatum::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
68 Handle(XCAFDoc_Datum) anAttr = Handle(XCAFDoc_Datum)::DownCast (theAttribute);
70 Handle(TCollection_HAsciiString) aName = anAttr->GetName();
71 theValues << (!aName.IsNull() ? aName->ToCString() : QString (""));