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 <DFBrowserPane_TDataStdRealArray.hxx>
18 #include <DFBrowserPane_AttributePaneModel.hxx>
19 #include <DFBrowserPane_HelperArray.hxx>
20 #include <DFBrowserPane_TableView.hxx>
22 #include <TDataStd_RealArray.hxx>
27 // =======================================================================
28 // function : CreateWidget
30 // =======================================================================
31 QWidget* DFBrowserPane_TDataStdRealArray::CreateWidget (QWidget* theParent)
33 QWidget* aMainWidget = new QWidget (theParent);
34 myTableView = new DFBrowserPane_TableView (aMainWidget);
35 myTableView->SetModel (getPaneModel());
37 myArrayTableHelper.CreateWidget (aMainWidget, myTableView);
42 // =======================================================================
45 // =======================================================================
46 void DFBrowserPane_TDataStdRealArray::Init (const Handle(TDF_Attribute)& theAttribute)
48 QList<QVariant> aValues;
49 GetValues (theAttribute, aValues);
50 myArrayTableHelper.Init (aValues);
53 // =======================================================================
54 // function : GetValues
56 // =======================================================================
57 void DFBrowserPane_TDataStdRealArray::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
59 Handle(TDataStd_RealArray) anAttribute = Handle(TDataStd_RealArray)::DownCast (theAttribute);
60 if (anAttribute.IsNull())
62 theValues.append (anAttribute->Lower());
63 theValues.append (anAttribute->Upper());
64 for (int aValueId = anAttribute->Lower(); aValueId <= anAttribute->Upper(); aValueId++)
65 theValues.append (anAttribute->Value(aValueId));
68 // =======================================================================
69 // function : GetShortAttributeInfo
71 // =======================================================================
72 void DFBrowserPane_TDataStdRealArray::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
73 QList<QVariant>& theValues)
75 QList<QVariant> aValues;
76 GetValues (theAttribute, aValues);
77 myArrayTableHelper.Init (aValues);
78 return myArrayTableHelper.GetShortAttributeInfo (theAttribute, theValues);