Kstars

planetmoonscomponent.h
1 /*
2  SPDX-FileCopyrightText: Vipul Kumar Singh <[email protected]>
3  SPDX-FileCopyrightText: Médéric Boquien <[email protected]>
4 
5  SPDX-License-Identifier: GPL-2.0-or-later
6 */
7 
8 #pragma once
9 
10 #include "skycomponent.h"
11 #include "skyobjects/ksplanetbase.h"
12 
13 #include <memory>
14 
15 class KSNumbers;
16 class PlanetMoons;
17 class SkyComposite;
19 
20 /**
21  * @class PlanetMoonsComponent
22  * Represents the planetmoons on the sky map.
23  *
24  * @author Vipul Kumar Singh
25  * @author Médéric boquien
26  * @version 0.1
27  */
29 {
30  public:
31  /**
32  * @short Constructor
33  *
34  * @p parent pointer to the parent SkyComposite
35  */
36  PlanetMoonsComponent(SkyComposite *parent, SolarSystemSingleComponent *pla, KSPlanetBase::Planets &planet);
37 
38  virtual ~PlanetMoonsComponent() override = default;
39 
40  bool selected() override;
41  void draw(SkyPainter *skyp) override;
42 #ifndef KSTARS_LITE
43  void update(KSNumbers *num) override;
44 #endif
45  void updateMoons(KSNumbers *num) override;
46 
47  SkyObject *objectNearest(SkyPoint *p, double &maxrad) override;
48 
49  /**
50  * @return a pointer to a moon if its name matches the argument
51  *
52  * @p name the name to be matched
53  * @return a SkyObject pointer to the moon whose name matches
54  * the argument, or a nullptr pointer if no match was found.
55  */
56  SkyObject *findByName(const QString &name, bool exact = true) override;
57 
58  /** Return pointer to stored planet object. */
59  KSPlanetBase *getPlanet() const;
60 
61  /** Return pointer to stored moons object. */
62  inline PlanetMoons *getMoons() const
63  {
64  return pmoons.get();
65  }
66 
67  protected:
68  void drawTrails(SkyPainter *skyp) override;
69 
70  private:
71  KSPlanetBase::Planets planet;
72  std::unique_ptr<PlanetMoons> pmoons;
73  SolarSystemSingleComponent *m_Planet { nullptr };
74 };
PlanetMoonsComponent(SkyComposite *parent, SolarSystemSingleComponent *pla, KSPlanetBase::Planets &planet)
Constructor.
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
KSPlanetBase * getPlanet() const
Return pointer to stored planet object.
SkyObject * findByName(const QString &name, bool exact=true) override
SkyComposite * parent()
Definition: skycomponent.h:137
Store several time-dependent astronomical quantities.
Definition: ksnumbers.h:42
void update(KSNumbers *num) override
Update the sky position(s) of this component.
Draws things on the sky, without regard to backend.
Definition: skypainter.h:37
void drawTrails(SkyPainter *skyp) override
Draw trails for objects.
SkyObject * objectNearest(SkyPoint *p, double &maxrad) override
Find the SkyObject nearest the given SkyPoint.
PlanetMoons * getMoons() const
Return pointer to stored moons object.
void draw(SkyPainter *skyp) override
Draw the object on the SkyMap skyp a pointer to the SkyPainter to use.
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:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.