Kstars

trailobject.h
1 /*
2  SPDX-FileCopyrightText: 2007 Jason Harris <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <QSet>
10 
11 #include "skyobject.h"
12 
13 class SkyPainter;
14 
15 /**
16  *@class TrailObject
17  *@short provides a SkyObject with an attachable Trail
18  *@author Jason Harris
19  *@version 1.0
20  */
21 class TrailObject : public SkyObject
22 {
23  public:
24  /** Constructor */
25  explicit TrailObject(int t = TYPE_UNKNOWN, dms r = dms(0.0), dms d = dms(0.0), float m = 0.0,
26  const QString &n = QString());
27 
28  /** Constructor */
29  TrailObject(int t, double r, double d, float m = 0.0, const QString &n = QString());
30 
31  ~TrailObject() override;
32 
33  TrailObject *clone() const override;
34 
35  /** @return whether the planet has a trail */
36  inline bool hasTrail() const
37  {
38  return (Trail.count() > 0);
39  }
40 
41  /** @return a reference to the planet's trail */
42  inline const QList<SkyPoint> &trail() const
43  {
44  return Trail;
45  }
46 
47  /** @short adds a point to the planet's trail */
48  void addToTrail(const QString &label = QString());
49 
50  /** @short removes the oldest point from the trail */
51  void clipTrail();
52 
53  /** @short clear the Trail */
54  void clearTrail();
55 
56  /** @short update Horizontal coords of the trail */
57  void updateTrail(dms *LST, const dms *lat);
58 
59  /**Remove trail for all objects but one which is passed as
60  * parameter. It has SkyObject type for generality. */
61  static void clearTrailsExcept(SkyObject *o);
62 
63  void drawTrail(SkyPainter *skyp) const;
64 
65  /** Maximum trail size */
66  static const int MaxTrail = 400;
67 
68  void initPopupMenu(KSPopupMenu *pmenu) override;
69 
70  protected:
71  QList<SkyPoint> Trail;
72  QList<QString> m_TrailLabels;
73  /// Store list of objects with trails.
75 
76  private:
77 };
78 
TrailObject * clone() const override
Create copy of object.
Definition: trailobject.cpp:38
static void clearTrailsExcept(SkyObject *o)
Remove trail for all objects but one which is passed as parameter.
Definition: trailobject.cpp:86
void clipTrail()
removes the oldest point from the trail
Definition: trailobject.cpp:67
int count(const T &value) const const
const QList< SkyPoint > & trail() const
Definition: trailobject.h:42
static QSet< TrailObject * > trailObjects
Store list of objects with trails.
Definition: trailobject.h:74
void addToTrail(const QString &label=QString())
adds a point to the planet's trail
Definition: trailobject.cpp:60
void clearTrail()
clear the Trail
Definition: trailobject.cpp:79
void updateTrail(dms *LST, const dms *lat)
update Horizontal coords of the trail
Definition: trailobject.cpp:45
TrailObject(int t=TYPE_UNKNOWN, dms r=dms(0.0), dms d=dms(0.0), float m=0.0, const QString &n=QString())
Constructor.
Definition: trailobject.cpp:25
provides a SkyObject with an attachable Trail
Definition: trailobject.h:21
Draws things on the sky, without regard to backend.
Definition: skypainter.h:37
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:37
bool hasTrail() const
Definition: trailobject.h:36
void initPopupMenu(KSPopupMenu *pmenu) override
Initialize the popup menut.
Definition: trailobject.cpp:51
Information about an object in the sky.
Definition: skyobject.h:41
static const int MaxTrail
Maximum trail size.
Definition: trailobject.h:66
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Wed Aug 17 2022 04:14:19 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.