| 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_CARTOONS_H |
| 7 |
#define AVOGADRO_QTPLUGINS_CARTOONS_H |
| 8 |
|
| 9 |
#include <avogadro/qtgui/sceneplugin.h> |
| 10 |
#include <list> |
| 11 |
#include <map> |
| 12 |
|
| 13 |
namespace Avogadro::QtPlugins { |
| 14 |
|
| 15 |
struct BackboneResidue; |
| 16 |
using AtomsPairList = std::list<BackboneResidue>; |
| 17 |
|
| 18 |
class Cartoons : public QtGui::ScenePlugin |
| 19 |
{ |
| 20 |
Q_OBJECT |
| 21 |
|
| 22 |
public: |
| 23 |
explicit Cartoons(QObject* parent = nullptr); |
| 24 |
~Cartoons() 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("Cartoons", "protein ribbon / cartoon rendering"); |
| 32 |
} |
| 33 |
|
| 34 |
QString description() const override |
| 35 |
{ |
| 36 |
return tr("Display of biomolecule ribbons / cartoons."); |
| 37 |
} |
| 38 |
|
| 39 |
QWidget* setupWidget() override; |
| 40 |
bool hasSetupWidget() const override { return true; } |
| 41 |
|
| 42 |
DefaultBehavior defaultBehavior() const override |
| 43 |
{ |
| 44 |
return DefaultBehavior::True; |
| 45 |
} |
| 46 |
|
| 47 |
public slots: |
| 48 |
// straights line between alpha carbons |
| 49 |
void showBackbone(bool show); |
| 50 |
// A flat line is displayed along the main backbone trace. |
| 51 |
void showTrace(bool show); |
| 52 |
// same as trace but with a circle volume (like a pipeline) |
| 53 |
void showTube(bool show); |
| 54 |
// same as trace but a flat plane |
| 55 |
void showRibbon(bool show); |
| 56 |
// the classic |
| 57 |
void showSimpleCartoon(bool show); |
| 58 |
// the classic + sheets and helix |
| 59 |
void showCartoon(bool show); |
| 60 |
// same as tube but instead of creating a b-spline (cuadratic bezier, segments |
| 61 |
// of 3) we crea a big N-bezier line |
| 62 |
void showRope(bool show); |
| 63 |
|
| 64 |
private: |
| 65 |
Rendering::GroupNode* m_group; |
| 66 |
std::string m_name = "Cartoons"; |
| 67 |
|
| 68 |
std::map<size_t, AtomsPairList> getBackboneByResidues( |
| 69 |
const QtGui::Molecule& molecule, size_t layer); |
| 70 |
std::map<size_t, AtomsPairList> getBackboneManually( |
| 71 |
const QtGui::Molecule& molecule, size_t layer); |
| 72 |
}; |
| 73 |
} // namespace Avogadro::QtPlugins |
| 74 |
|
| 75 |
#endif // AVOGADRO_QTPLUGINS_CARTOONS_H |