Kstars

solarsystemlistcomponent.cpp
1/*
2 SPDX-FileCopyrightText: 2005 Jason Harris <kstars@30doradus.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "solarsystemlistcomponent.h"
8
9#include "kstarsdata.h"
10#include "Options.h"
11#ifndef KSTARS_LITE
12#include "skymap.h"
13#endif
14#include "solarsystemcomposite.h"
15#include "skyobjects/ksplanet.h"
16#include "skyobjects/ksplanetbase.h"
17
18#include <KLocalizedString>
19
20#include <QPen>
21
22SolarSystemListComponent::SolarSystemListComponent(SolarSystemComposite *p) : ListComponent(p), m_Earth(p->earth())
23{
24}
25
26SolarSystemListComponent::~SolarSystemListComponent()
27{
28 //Object deletes handled by parent class (ListComponent)
29}
30
32{
33 if (selected())
34 {
35 KStarsData *data = KStarsData::Instance();
36
37 foreach (SkyObject *o, m_ObjectList)
38 {
39 KSPlanetBase *p = dynamic_cast<KSPlanetBase*>(o);
40
41 if (p)
42 p->EquatorialToHorizontal(data->lst(), data->geo()->lat());
43 }
44 }
45}
46
48{
49 if (selected())
50 {
51 KStarsData *data = KStarsData::Instance();
52 foreach (SkyObject *o, m_ObjectList)
53 {
54 KSPlanetBase *p = (KSPlanetBase *)o;
55 p->findPosition(num, data->geo()->lat(), data->lst(), m_Earth);
56 p->EquatorialToHorizontal(data->lst(), data->geo()->lat());
57
58 if (p->hasTrail())
59 p->updateTrail(data->lst(), data->geo()->lat());
60 }
61 }
62}
63
65{
66 //FIXME: here for all objects trails are drawn this could be source of inefficiency
67 if (selected())
68 {
69 foreach (SkyObject *obj, m_ObjectList)
70 // Will segfault if not TrailObject
71 dynamic_cast<TrailObject *>(obj)->drawTrail(skyp);
72 }
73}
const CachingDms * lat() const
Definition geolocation.h:70
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition ksnumbers.h:43
A subclass of TrailObject that provides additional information needed for most solar system objects.
void findPosition(const KSNumbers *num, const CachingDms *lat=nullptr, const CachingDms *LST=nullptr, const KSPlanetBase *Earth=nullptr)
Find position, including correction for Figure-of-the-Earth.
KStarsData is the backbone of KStars.
Definition kstarsdata.h:72
CachingDms * lst()
Definition kstarsdata.h:224
GeoLocation * geo()
Definition kstarsdata.h:230
An abstract parent class, to be inherited by SkyComponents that store a QList of SkyObjects.
virtual bool selected()
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
Draws things on the sky, without regard to backend.
Definition skypainter.h:40
void EquatorialToHorizontal(const CachingDms *LST, const CachingDms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates,...
Definition skypoint.cpp:77
The solar system composite manages all planets, asteroids and comets.
void drawTrails(SkyPainter *skyp) override
Draw trails for objects.
void update(KSNumbers *num) override
Update the sky positions of this component.
void updateSolarSystemBodies(KSNumbers *num) override
Update the coordinates of the solar system bodies in this component.
provides a SkyObject with an attachable Trail
Definition trailobject.h:22
bool hasTrail() const
Definition trailobject.h:36
void updateTrail(dms *LST, const dms *lat)
update Horizontal coords of the trail
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.