Kstars

solarsystemlistcomponent.cpp
1 /*
2  SPDX-FileCopyrightText: 2005 Jason Harris <[email protected]>
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 
22 SolarSystemListComponent::SolarSystemListComponent(SolarSystemComposite *p) : ListComponent(p), m_Earth(p->earth())
23 {
24 }
25 
26 SolarSystemListComponent::~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  foreach (SkyObject *obj, m_ObjectList)
69  // Will segfault if not TrailObject
70  dynamic_cast<TrailObject *>(obj)->drawTrail(skyp);
71 }
void updateSolarSystemBodies(KSNumbers *num) override
Update the coordinates of the solar system bodies in this component.
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.
CachingDms * lst()
Definition: kstarsdata.h:223
void drawTrails(SkyPainter *skyp) override
Draw trails for objects.
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
virtual bool selected()
Definition: skycomponent.h:131
void updateTrail(dms *LST, const dms *lat)
update Horizontal coords of the trail
Definition: trailobject.cpp:45
Store several time-dependent astronomical quantities.
Definition: ksnumbers.h:42
const CachingDms * lat() const
Definition: geolocation.h:70
provides a SkyObject with an attachable Trail
Definition: trailobject.h:21
GeoLocation * geo()
Definition: kstarsdata.h:229
Draws things on the sky, without regard to backend.
Definition: skypainter.h:37
bool hasTrail() const
Definition: trailobject.h:36
void update(KSNumbers *num) override
Update the sky positions of this component.
Information about an object in the sky.
Definition: skyobject.h:41
Provides necessary information about objects in the solar system.
Definition: ksplanetbase.h:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:58 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.