ATLAS Offline Software
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"
16 #include "VP1Base/VP1Serialise.h"
17 #include "VP1Base/VP1Deserialise.h"
18 //____________________________________________________________________
20 public:
21 
22 // Imp():theclass(0),editwindow(0),matButton(0), trackDrawStyle(0), trackLightModel(0){}
23  Imp():theclass(0), dim(0), fallBackMaterial(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 
VP1Serialise.h
VP1CollectionSettingsButtonBase::Imp::Imp
Imp()
Definition: VP1CollectionSettingsButtonBase.cxx:23
VP1Deserialise.h
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
VP1Serialise
Definition: VP1Serialise.h:45
RoiUtil::serialise
void serialise(const std::vector< const IRoiDescriptor * > &rois, roiserial_type &s)
serialise an entire vector of IRoiDescriptors
Definition: RoiSerialise.cxx:45
VP1CollectionSettingsButtonBase::Imp::theclass
VP1CollectionSettingsButtonBase * theclass
Definition: VP1CollectionSettingsButtonBase.cxx:26
VP1MaterialButton
Definition: VP1MaterialButton.h:46
VP1CollectionSettingsButtonBase::restoreFromState
void restoreFromState(const QByteArray &)
Definition: VP1CollectionSettingsButtonBase.cxx:84
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
VP1CollectionSettingsButtonBase::Imp
Definition: VP1CollectionSettingsButtonBase.cxx:19
VP1CollectionSettingsButtonBase.h
VP1CollectionSettingsButtonBase::~VP1CollectionSettingsButtonBase
virtual ~VP1CollectionSettingsButtonBase()
Definition: VP1CollectionSettingsButtonBase.cxx:44
VP1CollectionSettingsButtonBase::m_d
Imp * m_d
Definition: VP1CollectionSettingsButtonBase.h:38
VP1Deserialise::version
qint32 version() const
Definition: VP1Deserialise.cxx:143
VP1CollectionSettingsButtonBase::getMaterial
SoMaterial * getMaterial(VP1MaterialButton *) const
Definition: VP1CollectionSettingsButtonBase.cxx:62
VP1CollectionSettingsButtonBase
Definition: VP1CollectionSettingsButtonBase.h:17
test_pyathena.parent
parent
Definition: test_pyathena.py:15
VP1Deserialise::restore
void restore(QCheckBox *sb)
Definition: VP1Deserialise.cxx:245
VP1CollectionSettingsButtonBase::VP1CollectionSettingsButtonBase
VP1CollectionSettingsButtonBase(QWidget *parent=0, int dim=25)
Definition: VP1CollectionSettingsButtonBase.cxx:34
VP1CollectionSettingsButtonBase::fallBackMaterial
SoMaterial * fallBackMaterial() const
Definition: VP1CollectionSettingsButtonBase.cxx:52
VP1Deserialise
Definition: VP1Deserialise.h:44
VP1HelperClassBase::systemBase
IVP1System * systemBase() const
Definition: VP1HelperClassBase.h:50
VP1MaterialButtonBase
Definition: VP1MaterialButton.h:25
VP1CollectionSettingsButtonBase::Imp::dim
int dim
Definition: VP1CollectionSettingsButtonBase.cxx:28
TRT_PAI_physicsConstants::mb
const double mb
1mb to cm2
Definition: TRT_PAI_physicsConstants.h:15
VP1HelperClassBase::message
void message(const QString &) const
Definition: VP1HelperClassBase.cxx:49
VP1CollectionSettingsButtonBase::saveState
QByteArray saveState() const
fill out with the state of the object (used for drag and drop etc)
Definition: VP1CollectionSettingsButtonBase.cxx:78
VP1CollectionSettingsButtonBase::Imp::fallBackMaterial
SoMaterial * fallBackMaterial
Definition: VP1CollectionSettingsButtonBase.cxx:29