Debian Codegraph @

avogadro/qtplugins/label/label.h

raw
1 /******************************************************************************
2 This source file is part of the Avogadro project.
3 This source code is released under the 3-Clause BSD License, (see "LICENSE").
4 ******************************************************************************/
5
6 #ifndef AVOGADRO_QTPLUGINS_LABEL_H
7 #define AVOGADRO_QTPLUGINS_LABEL_H
8
9 #include <avogadro/core/vector.h>
10 #include <avogadro/qtgui/sceneplugin.h>
11 namespace Avogadro {
12 namespace QtPlugins {
13
14 /**
15 * @brief Render labels to each atom.
16 */
17 class Label : public QtGui::ScenePlugin
18 {
19 Q_OBJECT
20
21 public:
22 explicit Label(QObject* parent = nullptr);
23 ~Label() override;
24
25 QString name() const override { return tr("Labels"); }
26
27 QString description() const override
28 {
29 return tr("Display labels on ball and stick style.");
30 }
31
32 QWidget* setupWidget() override;
33 bool hasSetupWidget() const override { return true; }
34
35 void process(const QtGui::Molecule& molecule,
36 Rendering::GroupNode& node) override;
37
38 DefaultBehavior defaultBehavior() const override
39 {
40 return DefaultBehavior::False;
41 }
42 public slots:
43 void atomLabelType(int index);
44 void bondLabelType(int index);
45 void residueLabelType(int index);
46 void setRadiusScalar(double radius);
47 void setLabelScale(double scale);
48 void setColor(const QColor& color);
49
50 private:
51 void processAtom(const Core::Molecule& molecule, Rendering::GroupNode& node,
52 size_t layer);
53 void processBond(const Core::Molecule& molecule, Rendering::GroupNode& node,
54 size_t layer);
55 void processResidue(const Core::Molecule& molecule,
56 Rendering::GroupNode& node, size_t layer);
57
58 Rendering::GroupNode* m_group;
59 std::string m_name = "Labels";
60 Vector3ub m_color;
61 };
62
63 } // end namespace QtPlugins
64 } // end namespace Avogadro
65
66 #endif // AVOGADRO_QTPLUGINS_LABEL_H