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 <QColor>
0010 
0011 /**
0012     *@class SolarSystemSingleComponent
0013     *This class encapsulates some methods which are shared between
0014     *all single-object solar system components (Sun, Moon, Planet, Pluto)
0015     *
0016     *@author Thomas Kabelmann
0017     *@version 0.1
0018     */
0019 
0020 #include "skycomponent.h"
0021 
0022 class SolarSystemComposite;
0023 class KSNumbers;
0024 class KSPlanet;
0025 class KSPlanetBase;
0026 class SkyLabeler;
0027 
0028 class SolarSystemSingleComponent : public SkyComponent
0029 {
0030     public:
0031         /** Initialize visible method, minimum size and sizeScale. */
0032         SolarSystemSingleComponent(SolarSystemComposite *, KSPlanetBase *kspb, bool (*visibleMethod)(), bool isMoon = false);
0033 
0034         ~SolarSystemSingleComponent() override;
0035 
0036         /** Return pointer to stored planet object. */
0037         KSPlanetBase *planet()
0038         {
0039             return m_Planet;
0040         }
0041 
0042         bool selected() override;
0043 
0044         /**
0045              * @brief update Only convert Equatorial to Horizontal coordinates given current time.
0046              * @param num pointer to KSNumbers instance for target time
0047              */
0048         void update(KSNumbers *num) override;
0049 
0050         /**
0051              * @brief updateSolarSystemBodies Update Equatorial & Horizontal coordinates.
0052              * @param num pointer to KSNumbers instance for target time
0053              */
0054         void updateSolarSystemBodies(KSNumbers *num) override;
0055 
0056         /**
0057          * @brief update Update Equatorial & Horizontal coordinates. (Called more frequently.)
0058          */
0059         void updateMoons(KSNumbers *num) override;
0060 
0061 
0062         SkyObject *findByName(const QString &name, bool exact = true) override;
0063         SkyObject *objectNearest(SkyPoint *p, double &maxrad) override;
0064         void draw(SkyPainter *skyp) override;
0065 
0066     protected:
0067         void drawTrails(SkyPainter *skyp) override;
0068 
0069     private:
0070         bool (*visible)();
0071         bool m_isMoon { false };
0072         QColor m_Color;
0073         KSPlanet *m_Earth;
0074         KSPlanetBase *m_Planet;
0075 };