Kstars

supernova.cpp
1/*
2 SPDX-FileCopyrightText: 2016 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 Based on Samikshan Bairagya GSoC work.
5
6 SPDX-License-Identifier: GPL-2.0-or-later
7*/
8
9#include "supernova.h"
10
11#include <typeinfo>
12#ifndef KSTARS_LITE
13#include "kspopupmenu.h"
14#endif
15
16Supernova::Supernova(const QString &sName, dms ra, dms dec, const QString &type, const QString &hostGalaxy,
17 const QString &date, float sRedShift, float sMag, const QDateTime& _discoveryDate)
18 : SkyObject(SkyObject::SUPERNOVA, ra, dec, sMag, sName), type(type), hostGalaxy(hostGalaxy), date(date),
19 redShift(sRedShift)
20{
21 this->discoveryDate = _discoveryDate;
22}
23
25{
26 Q_ASSERT(typeid(this) == typeid(static_cast<const Supernova *>(this))); // Ensure we are not slicing a derived class
27 return new Supernova(*this);
28}
29
31{
32#ifdef KSTARS_LITE
33 Q_UNUSED(pmenu)
34#else
35 pmenu->createSupernovaMenu(this);
36#endif
37}
38
39QString Supernova::url() {
40 // usually names are like "SN 2023xyz" or "AT 2023xyz"
42 if (!(name().startsWith("19") || name().startsWith("20")))
43 basename = name().mid(3);
44 else
45 basename = name();
46
47 return "https://www.wis-tns.org/object/" + basename;
48}
The KStars Popup Menu.
Definition kspopupmenu.h:35
void createSupernovaMenu(Supernova *supernova)
Create a popup menu for a supernova.
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
virtual QString name(void) const
Definition skyobject.h:145
Represents the supernova object.
Definition supernova.h:34
Supernova * clone() const override
Definition supernova.cpp:24
void initPopupMenu(KSPopupMenu *) override
Initialize the popup menut.
Definition supernova.cpp:30
An angle, stored as degrees, but expressible in many ways.
Definition dms.h:38
Type type(const QSqlDatabase &db)
QTextStream & dec(QTextStream &stream)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:49:23 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.