| 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_DIPOLE_H |
| 7 |
#define AVOGADRO_QTPLUGINS_DIPOLE_H |
| 8 |
|
| 9 |
#include <avogadro/core/vector.h> |
| 10 |
#include <avogadro/qtgui/sceneplugin.h> |
| 11 |
|
| 12 |
namespace Avogadro { |
| 13 |
namespace QtPlugins { |
| 14 |
|
| 15 |
/** |
| 16 |
* @brief Render a molecule dipole moment arrow |
| 17 |
*/ |
| 18 |
class Dipole : public QtGui::ScenePlugin |
| 19 |
{ |
| 20 |
Q_OBJECT |
| 21 |
|
| 22 |
public: |
| 23 |
explicit Dipole(QObject* parent = nullptr); |
| 24 |
~Dipole() override; |
| 25 |
|
| 26 |
void process(const QtGui::Molecule& molecule, |
| 27 |
Rendering::GroupNode& node) override; |
| 28 |
|
| 29 |
QString name() const override { return tr("Dipole Moment"); } |
| 30 |
|
| 31 |
QString description() const override |
| 32 |
{ |
| 33 |
return tr("Render the dipole moment of the molecule."); |
| 34 |
} |
| 35 |
|
| 36 |
DefaultBehavior defaultBehavior() const override |
| 37 |
{ |
| 38 |
return DefaultBehavior::False; |
| 39 |
} |
| 40 |
|
| 41 |
QWidget* setupWidget() override; |
| 42 |
bool hasSetupWidget() const override { return false; } |
| 43 |
|
| 44 |
public slots: |
| 45 |
void updateDipole(); |
| 46 |
void updateFinished(); |
| 47 |
|
| 48 |
private: |
| 49 |
std::string m_name = "Dipole Moment"; |
| 50 |
std::string m_type = "MMFF94"; |
| 51 |
std::vector<std::string> m_types; |
| 52 |
Vector3 m_dipoleVector; |
| 53 |
Vector3 m_customDipoleVector; |
| 54 |
bool m_customDipole = false; // Custom dipole moment set |
| 55 |
bool m_updateNeeded = true; |
| 56 |
}; |
| 57 |
|
| 58 |
} // end namespace QtPlugins |
| 59 |
} // end namespace Avogadro |
| 60 |
|
| 61 |
#endif // AVOGADRO_QTPLUGINS_FORCE_H |