ATLAS Offline Software
Loading...
Searching...
No Matches
VP1CollectionSettingsButtonBase.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*
6 * VP1CollectionSettingsButtonBase.cxx
7 *
8 * Created on: Sep 2, 2014
9 * Author: Riccardo-Maria BIANCHI - rbianchi
10 */
11
12
14#include "Inventor/C/errors/debugerror.h"
15#include "Inventor/nodes/SoMaterial.h"
18//____________________________________________________________________
20public:
21
22// Imp():theclass(0),editwindow(0),matButton(0), trackDrawStyle(0), trackLightModel(0){}
24
25 // the main class
27
28 int dim;
29 SoMaterial * fallBackMaterial;
30};
31
32
33//____________________________________________________________________
35: VP1MaterialButtonBase(parent,0,"VP1MaterialButton"), m_d(new Imp)
36{
37 m_d->dim = dim;
38 m_d->fallBackMaterial = 0;
39 m_d->theclass = this;
40}
41
42
43//____________________________________________________________________
45{
46 if (m_d->fallBackMaterial)
47 m_d->fallBackMaterial->unref();
48 delete m_d;
49}
50
51//____________________________________________________________________
53{
54 if (!m_d->fallBackMaterial) {
55 m_d->fallBackMaterial = new SoMaterial;
56 m_d->fallBackMaterial->ref();
57 }
58 return m_d->fallBackMaterial;
59}
60
61//____________________________________________________________________
63{
64 if (!mb) {
65 message("ERROR: Null material button pointer");
66 return fallBackMaterial();
67 }
68 QList<SoMaterial*> mats = mb->handledMaterials();
69 if (mats.count()!=1) {
70 message("ERROR: No material in button "+mb->objectName());
71 return fallBackMaterial();
72 }
73 return mats.at(0);
74
75
76}
77
79 VP1Serialise serialise(1/*version*/);
80 serialise.save(this);
81 return serialise.result();
82}
83
85 VP1Deserialise state(ba,systemBase());
86 if (state.version()<0||state.version()>1)
87 return;//Ignore silently
88 state.restore(this);
89}
90
91
92
93
QByteArray saveState() const
fill out with the state of the object (used for drag and drop etc)
VP1CollectionSettingsButtonBase(QWidget *parent=0, int dim=25)
SoMaterial * getMaterial(VP1MaterialButton *) const
void restore(QCheckBox *sb)
qint32 version() const
void message(const QString &) const
IVP1System * systemBase() const
VP1MaterialButtonBase(QWidget *parent, IVP1System *sys=0, const QString &helpername="")