ATLAS Offline Software
VP1StdCollection.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // //
8 // Header file for class VP1StdCollection //
9 // //
10 // Description: Implements most of the VP1Collection code //
11 // for the most typical use-case of a checkbox //
12 // controlling a switch + load on the first //
13 // time, as well as a material button with the //
14 // material. //
15 // //
16 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
17 // Initial version: June 2008 //
18 // //
20 
21 #ifndef VP1STDCOLLECTION_H
22 #define VP1STDCOLLECTION_H
23 
24 #include "VP1Base/VP1Collection.h"
25 #include <QObject>
26 class SoSwitch;
27 class SoSeparator;
28 class SoMaterial;
30 
31 class VP1StdCollection : public QObject, public VP1Collection {
32 
33  Q_OBJECT
34 
35 public:
36 
38 
39  virtual void init(VP1MaterialButtonBase* button=0);//Must always be called directly after construction! (since it needs virtual methods!).
40  //Reimplementations must start with a call to this base implementation.
41  virtual ~VP1StdCollection();
42 
43  bool visible() const;
44  bool isLoaded() const;
45  bool problemsLoading() const;
46 
47  QString text() const;//Will be used on checkBox (possibly elided if too long - thus important that tooltip includes the full text()).
48 
49  //Attach this somewhere in your scenegraph:
50  //Put your objects somewhere below this:
51  SoSwitch * collSwitch() const;
52  SoSeparator * collSep() const;
53  SoMaterial * material() const;
54 
55  //So e.g. random materials can inherit transparency and brightness
56  double collMaterialTransparency() const;
57  double collMaterialBrightness() const;
58 
59  //sterilises collSep+collSwitch (if coll. has objects not under
60  //collSep - reimplement and call this base implementation in
61  //addition to custom sterilisations):
62  virtual void largeChangesBegin();
63  virtual void largeChangesEnd();
64 
65  virtual QByteArray persistifiableState() const;
66  virtual void setState(const QByteArray&);
67 
68  //Node clicked stuff?
69 
70 public Q_SLOTS:
71  void setVisible(bool);//will also update checkbox, etc.
73 protected:
74  QList<QWidget*> provideWidgetsForGuiRow() const;
75  virtual QString provideText() const = 0;//Will only be called once.
76  virtual QString checkBoxToolTip() const { return "Collection "+text(); }
77  virtual QString matButtonToolTip() const { return "Edit the material of "+text(); }
78  virtual void assignDefaultMaterial(SoMaterial*) const = 0;
80  virtual bool load() = 0;
81  //Is called the first time the collection is made visible: Add 3D
82  //objects under the collSep(). Return false in case of problems.
83  //You probably want to use systemBase() to construct an
84  //VP1SGAccessHelper, etc. And do not forget calls to
85  //systemBase()->updateGUI().
86 
87  //In case the collection needs more widgets, override these three:
88  virtual QList<QWidget*> provideExtraWidgetsForGuiRow() const { return QList<QWidget*>(); }
89  virtual QByteArray extraWidgetsState() const { return QByteArray(); }
90  virtual void setExtraWidgetsState(const QByteArray&) {}
91 
92  virtual qint32 provideCollTypeID() const { return -1; }
93  virtual QByteArray providePersistifiableID() const;//Implementation concatenating collTypeID() and text()
94 public:
95  qint32 collTypeID() const;
96 
97 signals:
98  void visibilityChanged(bool);
99 private:
102  class Imp;
103  Imp * m_d;
104 };
105 
106 #endif
VP1StdCollection::collMaterialTransparency
double collMaterialTransparency() const
Definition: VP1StdCollection.cxx:336
VP1StdCollection::checkBoxToolTip
virtual QString checkBoxToolTip() const
Definition: VP1StdCollection.h:76
VP1StdCollection::VP1StdCollection
VP1StdCollection(IVP1System *, const QString &helperClassName)
Definition: VP1StdCollection.cxx:67
VP1StdCollection::material
SoMaterial * material() const
Definition: VP1StdCollection.cxx:220
VP1StdCollection::~VP1StdCollection
virtual ~VP1StdCollection()
Definition: VP1StdCollection.cxx:119
VP1StdCollection::collTypeID
qint32 collTypeID() const
Definition: VP1StdCollection.cxx:315
VP1StdCollection::possibleChangeMatTranspOrBrightness
void possibleChangeMatTranspOrBrightness()
Definition: VP1StdCollection.cxx:348
VP1StdCollection::collSwitch
SoSwitch * collSwitch() const
Add this somewhere in your scenegraph (do not add any children here!)
Definition: VP1StdCollection.cxx:204
VP1StdCollection::init
virtual void init(VP1MaterialButtonBase *button=0)
Definition: VP1StdCollection.cxx:73
VP1StdCollection::largeChangesBegin
virtual void largeChangesBegin()
Definition: VP1StdCollection.cxx:228
VP1Collection.h
VP1StdCollection::extraWidgetsState
virtual QByteArray extraWidgetsState() const
Definition: VP1StdCollection.h:89
VP1StdCollection::providePersistifiableID
virtual QByteArray providePersistifiableID() const
Definition: VP1StdCollection.cxx:325
IVP1System
Definition: IVP1System.h:36
VP1StdCollection::setVisible
void setVisible(bool)
Definition: VP1StdCollection.cxx:160
VP1StdCollection::load
virtual bool load()=0
VP1StdCollection::operator=
VP1StdCollection & operator=(const VP1StdCollection &)
VP1StdCollection::visibilityChanged
void visibilityChanged(bool)
VP1StdCollection::provideExtraWidgetsForGuiRow
virtual QList< QWidget * > provideExtraWidgetsForGuiRow() const
Definition: VP1StdCollection.h:88
VP1StdCollection::text
QString text() const
Definition: VP1StdCollection.cxx:132
VP1StdCollection::collMaterialBrightness
double collMaterialBrightness() const
Definition: VP1StdCollection.cxx:342
python.L1.Config.LegacyTopoMergerMap.signals
signals
Definition: LegacyTopoMergerMap.py:13
VP1Collection
Definition: VP1Collection.h:31
VP1StdCollection::problemsLoading
bool problemsLoading() const
Definition: VP1StdCollection.cxx:154
VP1StdCollection::collMaterialTransparencyAndBrightnessChanged
virtual void collMaterialTransparencyAndBrightnessChanged()
Definition: VP1StdCollection.h:79
VP1StdCollection::Imp
Definition: VP1StdCollection.cxx:30
VP1StdCollection::isLoaded
bool isLoaded() const
Definition: VP1StdCollection.cxx:148
VP1MaterialButtonBase
Definition: VP1MaterialButton.h:25
VP1StdCollection::largeChangesEnd
virtual void largeChangesEnd()
Definition: VP1StdCollection.cxx:239
VP1StdCollection::assignDefaultMaterial
virtual void assignDefaultMaterial(SoMaterial *) const =0
VP1StdCollection::collSep
SoSeparator * collSep() const
All 3D objects from this coll.
Definition: VP1StdCollection.cxx:212
VP1StdCollection::matButtonToolTip
virtual QString matButtonToolTip() const
Definition: VP1StdCollection.h:77
VP1StdCollection::visible
bool visible() const
Definition: VP1StdCollection.cxx:142
VP1StdCollection
Definition: VP1StdCollection.h:31
VP1HelperClassBase::helperClassName
QString helperClassName() const
Definition: VP1HelperClassBase.h:51
VP1StdCollection::m_d
Imp * m_d
Definition: VP1StdCollection.h:102
VP1StdCollection::persistifiableState
virtual QByteArray persistifiableState() const
Provide default implementation based on widget list + version.
Definition: VP1StdCollection.cxx:270
VP1StdCollection::provideText
virtual QString provideText() const =0
VP1StdCollection::setState
virtual void setState(const QByteArray &)
Provide default implementation based on widget list + version.
Definition: VP1StdCollection.cxx:288
VP1StdCollection::provideCollTypeID
virtual qint32 provideCollTypeID() const
Definition: VP1StdCollection.h:92
VP1StdCollection::setExtraWidgetsState
virtual void setExtraWidgetsState(const QByteArray &)
Definition: VP1StdCollection.h:90
VP1StdCollection::provideWidgetsForGuiRow
QList< QWidget * > provideWidgetsForGuiRow() const
Definition: VP1StdCollection.cxx:258
VP1StdCollection::VP1StdCollection
VP1StdCollection(const VP1StdCollection &)