| 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_FOCUS_H |
| 7 |
#define AVOGADRO_QTPLUGINS_FOCUS_H |
| 8 |
|
| 9 |
#include <Eigen/Geometry> |
| 10 |
#include <avogadro/qtgui/extensionplugin.h> |
| 11 |
#include <avogadro/rendering/scene.h> |
| 12 |
|
| 13 |
namespace Avogadro { |
| 14 |
namespace QtPlugins { |
| 15 |
|
| 16 |
/** |
| 17 |
* @brief The Focus class is an extension to center the camera in the best |
| 18 |
* fit panel or the default camera position |
| 19 |
*/ |
| 20 |
class Focus : public Avogadro::QtGui::ExtensionPlugin |
| 21 |
{ |
| 22 |
Q_OBJECT |
| 23 |
public: |
| 24 |
explicit Focus(QObject* parent_ = nullptr); |
| 25 |
~Focus() override; |
| 26 |
|
| 27 |
QString name() const override { return tr("Focus"); } |
| 28 |
QString description() const override |
| 29 |
{ |
| 30 |
return tr("Focus the view on specific features."); |
| 31 |
} |
| 32 |
QList<QAction*> actions() const override; |
| 33 |
QStringList menuPath(QAction*) const override; |
| 34 |
|
| 35 |
public slots: |
| 36 |
void setMolecule(QtGui::Molecule* mol) override; |
| 37 |
void setCamera(Rendering::Camera* camera) override; |
| 38 |
void setScene(Rendering::Scene* scene) override; |
| 39 |
void setActiveWidget(QWidget* widget) override; |
| 40 |
|
| 41 |
signals: |
| 42 |
void updateRequested(); |
| 43 |
|
| 44 |
private slots: |
| 45 |
void focusSelection(); |
| 46 |
void unfocus(); |
| 47 |
|
| 48 |
private: |
| 49 |
QtGui::Molecule* m_molecule; |
| 50 |
Rendering::Camera* m_camera; |
| 51 |
Rendering::Scene* m_scene; |
| 52 |
QWidget* m_glWidget; |
| 53 |
QAction* m_focusSelectionAction; |
| 54 |
QAction* m_unfocusAction; |
| 55 |
|
| 56 |
void newFocus(Eigen::Vector3f point, float distance); |
| 57 |
}; |
| 58 |
|
| 59 |
} // namespace QtPlugins |
| 60 |
} // namespace Avogadro |
| 61 |
|
| 62 |
#endif |