| 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_CLOSECONTACTS_H |
| 7 |
#define AVOGADRO_QTPLUGINS_CLOSECONTACTS_H |
| 8 |
|
| 9 |
#include <avogadro/core/vector.h> |
| 10 |
#include <avogadro/qtgui/sceneplugin.h> |
| 11 |
|
| 12 |
namespace Avogadro::QtPlugins { |
| 13 |
|
| 14 |
/** |
| 15 |
* @brief Detect and render close contacts between atoms. |
| 16 |
* @author Aritz Erkiaga |
| 17 |
*/ |
| 18 |
class CloseContacts : public QtGui::ScenePlugin |
| 19 |
{ |
| 20 |
Q_OBJECT |
| 21 |
|
| 22 |
public: |
| 23 |
explicit CloseContacts(QObject* parent = nullptr); |
| 24 |
~CloseContacts() override = default; |
| 25 |
|
| 26 |
void process(const QtGui::Molecule& molecule, |
| 27 |
Rendering::GroupNode& node) override; |
| 28 |
|
| 29 |
QString name() const override |
| 30 |
{ |
| 31 |
return tr("Close Contacts", "rendering of non-covalent close contacts"); |
| 32 |
} |
| 33 |
|
| 34 |
QString description() const override |
| 35 |
{ |
| 36 |
return tr("Render close contacts between atoms."); |
| 37 |
} |
| 38 |
|
| 39 |
QWidget* setupWidget() override; |
| 40 |
bool hasSetupWidget() const override { return true; } |
| 41 |
|
| 42 |
DefaultBehavior defaultBehavior() const override |
| 43 |
{ |
| 44 |
return DefaultBehavior::False; |
| 45 |
} |
| 46 |
|
| 47 |
public slots: |
| 48 |
void setMaximumDistance(float maximumDistance, Index index); |
| 49 |
void setLineWidth(float width, Index index); |
| 50 |
|
| 51 |
private: |
| 52 |
std::string m_name = "Close Contacts"; |
| 53 |
|
| 54 |
std::array<double, 3> m_maximumDistances; |
| 55 |
std::array<Vector3ub, 3> m_lineColors; |
| 56 |
std::array<float, 3> m_lineWidths; |
| 57 |
}; |
| 58 |
|
| 59 |
} // end namespace Avogadro::QtPlugins |
| 60 |
|
| 61 |
#endif // AVOGADRO_QTPLUGINS_CLOSECONTACTS_H |