File indexing completed on 2024-03-24 15:18:02
0001 /* 0002 SPDX-FileCopyrightText: 2008 Akarsh Simha <akarshsimha@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 0006 0007 Much of the code here is taken from Pablo de Vicente's 0008 modcalcplanets.h 0009 0010 */ 0011 0012 #pragma once 0013 0014 #include "dms.h" 0015 #include "ui_conjunctions.h" 0016 0017 #include <QFrame> 0018 #include <QMap> 0019 #include <QString> 0020 #include "skycomponents/typedef.h" 0021 #include <memory> 0022 0023 class QSortFilterProxyModel; 0024 class QStandardItemModel; 0025 0026 class GeoLocation; 0027 class KSPlanetBase; 0028 class SkyObject; 0029 0030 //FIXME: URGENT! There's a bug when setting max sep to 0! 0031 0032 /** 0033 * @short Predicts conjunctions using KSConjunct in the background 0034 */ 0035 class ConjunctionsTool : public QFrame, public Ui::ConjunctionsDlg 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 explicit ConjunctionsTool(QWidget *p); 0041 virtual ~ConjunctionsTool() override = default; 0042 0043 public slots: 0044 0045 void slotLocation(); 0046 void slotCompute(); 0047 void showProgress(int); 0048 void slotFindObject(); 0049 void setMode(int); 0050 void slotGoto(); 0051 void slotFilterType(int); 0052 void slotClear(); 0053 void slotExport(); 0054 void slotFilterReg(const QString &); 0055 0056 private: 0057 void showConjunctions(const QMap<long double, dms> &conjunctionlist, const QString &object1, 0058 const QString &object2); 0059 0060 /** 0061 * @brief setUpConjunctionOpposition 0062 * @short set up ui for conj./opp. 0063 */ 0064 void setUpConjunctionOpposition(); 0065 0066 /** 0067 * @brief mode 0068 * @short Represents whether the tool looks for conj/opp. 0069 */ 0070 enum MODE { 0071 CONJUNCTION, 0072 OPPOSITION 0073 } mode; 0074 0075 SkyObject_s Object1; 0076 KSPlanetBase_s Object2; // Second object is always a planet. 0077 /// To store the names of Planets vs. values expected by KSPlanetBase::createPlanet() 0078 QHash<int, QString> pNames; 0079 0080 /// To store Julian Days corresponding to the row index in the output list widget 0081 QMap<int, long double> outputJDList; 0082 GeoLocation *geoPlace { nullptr }; 0083 QStandardItemModel *m_Model { nullptr }; 0084 QSortFilterProxyModel *m_SortModel { nullptr }; 0085 int m_index { 0 }; 0086 };