File indexing completed on 2024-07-14 07:17:24

0001 /*
0002     SPDX-FileCopyrightText: 2005 Thomas Kabelmann <thomas.kabelmann@gmx.de>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "planetmoonscomponent.h"
0010 #include "skycomposite.h"
0011 
0012 class AsteroidsComponent;
0013 class CometsComponent;
0014 class KSMoon;
0015 class KSPlanet;
0016 class KSSun;
0017 //class JupiterMoonsComponent;
0018 class SkyLabeler;
0019 class KSEarthShadow;
0020 /**
0021  * @class SolarSystemComposite
0022  * The solar system composite manages all planets, asteroids and comets.
0023  * As every sub component of solar system needs the earth , the composite
0024  * is managing this object by itself.
0025  *
0026  * @author Thomas Kabelmann
0027  * @version 0.1
0028  */
0029 
0030 class SolarSystemComposite : public SkyComposite
0031 {
0032   public:
0033     explicit SolarSystemComposite(SkyComposite *parent);
0034     ~SolarSystemComposite() override;
0035 
0036     // Use this instead of `findByName`
0037     KSPlanet *earth() { return m_Earth; }
0038     KSSun *sun() { return m_Sun; }
0039     KSMoon *moon() { return m_Moon; }
0040     KSEarthShadow *earthShadow() { return m_EarthShadow; }
0041 
0042     const QList<SkyObject *> &asteroids() const;
0043     const QList<SkyObject *> &comets() const;
0044     const QList<SkyObject *> &planetObjects() const;
0045     const QList<SkyObject *> &moons() const;
0046 
0047     bool selected() override;
0048 
0049     void update(KSNumbers *num) override;
0050 
0051     void updateSolarSystemBodies(KSNumbers *num) override;
0052 
0053     void updateMoons(KSNumbers *num) override;
0054 
0055     void drawTrails(SkyPainter *skyp) override;
0056 
0057     CometsComponent *cometsComponent();
0058 
0059     AsteroidsComponent *asteroidsComponent();
0060 
0061     QList<PlanetMoonsComponent *> planetMoonsComponent() const;
0062 
0063     const QList<SolarSystemSingleComponent *> &planets() const;
0064 
0065   private:
0066     KSPlanet *m_Earth { nullptr };
0067     KSSun *m_Sun { nullptr };
0068     KSMoon *m_Moon { nullptr };
0069     KSEarthShadow *m_EarthShadow { nullptr };
0070 
0071     //    PlanetMoonsComponent *m_JupiterMoons;
0072     AsteroidsComponent *m_AsteroidsComponent;
0073     CometsComponent *m_CometsComponent;
0074     QList<SolarSystemSingleComponent *> m_planets;
0075     QList<SkyObject *> m_planetObjects;
0076     QList<SkyObject *> m_moons;
0077 };