ATLAS Offline Software
Loading...
Searching...
No Matches
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
25#include <QObject>
26class SoSwitch;
27class SoSeparator;
28class SoMaterial;
30
31class VP1StdCollection : public QObject, public VP1Collection {
32
33 Q_OBJECT
34
35public:
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
70public Q_SLOTS:
71 void setVisible(bool);//will also update checkbox, etc.
73protected:
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()
94public:
95 qint32 collTypeID() const;
96
97signals:
99private:
102 class Imp;
104};
105
106#endif
VP1Collection(IVP1System *sys=0, const QString &helperClassName="VP1Collection")
const QString & helperClassName() const
virtual bool load()=0
virtual QString matButtonToolTip() const
virtual void setExtraWidgetsState(const QByteArray &)
QList< QWidget * > provideWidgetsForGuiRow() const
double collMaterialTransparency() const
virtual qint32 provideCollTypeID() const
virtual void collMaterialTransparencyAndBrightnessChanged()
bool problemsLoading() const
virtual void assignDefaultMaterial(SoMaterial *) const =0
SoMaterial * material() const
virtual void largeChangesEnd()
virtual void init(VP1MaterialButtonBase *button=0)
SoSeparator * collSep() const
All 3D objects from this coll.
SoSwitch * collSwitch() const
Add this somewhere in your scenegraph (do not add any children here!)
virtual void largeChangesBegin()
virtual QString checkBoxToolTip() const
qint32 collTypeID() const
virtual QByteArray providePersistifiableID() const
double collMaterialBrightness() const
void possibleChangeMatTranspOrBrightness()
VP1StdCollection & operator=(const VP1StdCollection &)
virtual QByteArray persistifiableState() const
Provide default implementation based on widget list + version.
VP1StdCollection(const VP1StdCollection &)
void visibilityChanged(bool)
QString text() const
virtual QByteArray extraWidgetsState() const
virtual void setState(const QByteArray &)
Provide default implementation based on widget list + version.
virtual QList< QWidget * > provideExtraWidgetsForGuiRow() const
virtual QString provideText() const =0
VP1StdCollection(IVP1System *, const QString &helperClassName)