File indexing completed on 2024-04-14 14:11:31

0001 /*
0002     SPDX-FileCopyrightText: 2016 Jasem Mutlaq <mutlaqja@ikarustech.com>
0003 
0004     Based on Samikshan Bairagya GSoC work.
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include "skyobject.h"
0012 
0013 /**
0014  * @class Supernova
0015  * Represents the supernova object. It is a subclass of the SkyObject class.
0016  * This class has the information for different supernovae.
0017  *
0018  * N.B. This was modified to use the Open Supernova Project
0019  *
0020  * @note The Data File Contains the following parameters
0021  * @li sName        Designation
0022  * @li RA           Right Ascension
0023  * @li Dec          Declination
0024  * @li type         Supernova Type
0025  * @li hostGalaxy   Host Galaxy for the supernova
0026  * @li date         Discovery date yyyy/mm/dd
0027  * @li sRedShift    Redshift
0028  * @li sMag         Maximum Apparent magnitude
0029  *
0030  * @author Samikshan Bairagya
0031  * @author Jasem Mutlaq
0032  */
0033 class Supernova : public SkyObject
0034 {
0035   public:
0036     explicit Supernova(const QString &sName, dms ra, dms dec, const QString &type = QString(),
0037                        const QString &hostGalaxy = QString(), const QString &date = QString(), float sRedShift = 0.0,
0038                        float sMag = 99.9, const QDateTime& discoveryDate=QDateTime::currentDateTime());
0039     /**
0040      * @return a clone of this object
0041      * @note See SkyObject::clone()
0042      */
0043     Supernova *clone() const override;
0044 
0045     ~Supernova() override = default;
0046 
0047     /** @return the type of the supernova */
0048     inline QString getType() const { return type; }
0049 
0050     /** @return the host galaxy of the supernova */
0051     inline QString getHostGalaxy() const { return hostGalaxy; }
0052 
0053     /** @return the date the supernova was observed */
0054     inline QString getDate() const { return date; }
0055 
0056     /** @return the date the supernova was observed */
0057     inline float getRedShift() const { return redShift; }
0058 
0059     inline float getAgeDays() { return discoveryDate.daysTo(QDateTime::currentDateTime());}
0060 
0061     QString url();
0062 
0063     void initPopupMenu(KSPopupMenu *) override;
0064 
0065   private:
0066     QString type, hostGalaxy, date;
0067     QDateTime discoveryDate;
0068     float redShift { 0 };
0069 };