| 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_SELECT_H |
| 7 |
#define AVOGADRO_QTPLUGINS_SELECT_H |
| 8 |
|
| 9 |
#include <avogadro/core/vector.h> |
| 10 |
#include <avogadro/qtgui/extensionplugin.h> |
| 11 |
#include <avogadro/qtgui/pluginlayermanager.h> |
| 12 |
|
| 13 |
namespace Avogadro { |
| 14 |
|
| 15 |
namespace QtGui { |
| 16 |
class PeriodicTableView; |
| 17 |
} |
| 18 |
namespace QtPlugins { |
| 19 |
|
| 20 |
/** |
| 21 |
* @brief The Select class is an extension to modify selections |
| 22 |
*/ |
| 23 |
class Select : public Avogadro::QtGui::ExtensionPlugin |
| 24 |
{ |
| 25 |
Q_OBJECT |
| 26 |
public: |
| 27 |
explicit Select(QObject* parent_ = nullptr); |
| 28 |
~Select() override; |
| 29 |
|
| 30 |
QString name() const override { return tr("Select"); } |
| 31 |
QString description() const override; |
| 32 |
QList<QAction*> actions() const override; |
| 33 |
QStringList menuPath(QAction*) const override; |
| 34 |
|
| 35 |
public slots: |
| 36 |
void setMolecule(QtGui::Molecule* mol) override; |
| 37 |
|
| 38 |
private slots: |
| 39 |
void selectAll(); |
| 40 |
void selectNone(); |
| 41 |
void invertSelection(); |
| 42 |
void selectElement(); |
| 43 |
void selectAtomIndex(); |
| 44 |
void selectElement(int element); |
| 45 |
void selectResidue(); |
| 46 |
|
| 47 |
void selectBackboneAtoms(); |
| 48 |
void selectSidechainAtoms(); |
| 49 |
|
| 50 |
void selectWater(); |
| 51 |
bool isWaterOxygen(Index i); |
| 52 |
|
| 53 |
void enlargeSelection(); |
| 54 |
void shrinkSelection(); |
| 55 |
Vector3 getSelectionCenter(); |
| 56 |
|
| 57 |
void createLayerFromSelection(); |
| 58 |
|
| 59 |
private: |
| 60 |
QList<QAction*> m_actions; |
| 61 |
QtGui::Molecule* m_molecule; |
| 62 |
QtGui::PeriodicTableView* m_elements; |
| 63 |
QtGui::PluginLayerManager m_layerManager; |
| 64 |
|
| 65 |
bool evalSelect(bool input, Index index) const; |
| 66 |
}; |
| 67 |
|
| 68 |
} // namespace QtPlugins |
| 69 |
} // namespace Avogadro |
| 70 |
|
| 71 |
#endif // AVOGADRO_QTPLUGINS_SELECT_H |