Debian Codegraph @

avogadro/qtplugins/plotpdf/plotpdf.h

raw
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_PLOTPDF_H
7 #define AVOGADRO_QTPLUGINS_PLOTPDF_H
8
9 #include <avogadro/qtgui/extensionplugin.h>
10
11 namespace Avogadro {
12
13 namespace QtGui {
14 class ChartDialog;
15 }
16
17 namespace QtPlugins {
18
19 class PdfOptionsDialog;
20
21 // First item in the pair is radius. Second is the pdf value.
22 typedef std::vector<std::pair<double, double>> PdfData;
23
24 /**
25 * @brief Generate and plot a PDF curve
26 */
27 class PlotPdf : public Avogadro::QtGui::ExtensionPlugin
28 {
29 Q_OBJECT
30 public:
31 explicit PlotPdf(QObject* parent_ = nullptr);
32 ~PlotPdf() override;
33
34 QString name() const override { return tr("PlotPdf"); }
35 QString description() const override;
36 QList<QAction*> actions() const override;
37 QStringList menuPath(QAction*) const override;
38
39 public slots:
40 void setMolecule(QtGui::Molecule* mol) override;
41
42 void moleculeChanged(unsigned int changes);
43
44 private slots:
45 void updateActions();
46
47 void displayDialog();
48
49 private:
50 // Generate Pdf curve from a crystal
51 // Writes the results to @p results, which is a vector of pairs of doubles
52 // (see definition above).
53 // err will be set to an error string if the function fails.
54 // radius is in Angstroms.
55 static bool generatePdfPattern(QtGui::Molecule& mol, PdfData& results,
56 QString& err, double maxRadius = 10.0,
57 double step = 0.1);
58
59 QList<QAction*> m_actions;
60 QtGui::Molecule* m_molecule;
61
62 QScopedPointer<PdfOptionsDialog> m_pdfOptionsDialog;
63 QScopedPointer<QAction> m_displayDialogAction;
64 QScopedPointer<QtGui::ChartDialog> m_chartDialog;
65 };
66
67 inline QString PlotPdf::description() const
68 {
69 return tr("Generate and plot a Pair Distribution Function curve.");
70 }
71
72 } // namespace QtPlugins
73 } // namespace Avogadro
74
75 #endif // AVOGADRO_QTPLUGINS_PLOTPDF_H