Kstars

trailobject.h
1/*
2 SPDX-FileCopyrightText: 2007 Jason Harris <kstars@30doradus.org>
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
13class SkyPainter;
14
15/**
16 *@class TrailObject
17 *@short provides a SkyObject with an attachable Trail
18 *@author Jason Harris
19 *@version 1.0
20 */
21class 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
The KStars Popup Menu.
Definition kspopupmenu.h:35
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
Draws things on the sky, without regard to backend.
Definition skypainter.h:40
provides a SkyObject with an attachable Trail
Definition trailobject.h:22
TrailObject(int t=TYPE_UNKNOWN, dms r=dms(0.0), dms d=dms(0.0), float m=0.0, const QString &n=QString())
Constructor.
bool hasTrail() const
Definition trailobject.h:36
void clearTrail()
clear the Trail
void addToTrail(const QString &label=QString())
adds a point to the planet's trail
static void clearTrailsExcept(SkyObject *o)
Remove trail for all objects but one which is passed as parameter.
void initPopupMenu(KSPopupMenu *pmenu) override
Initialize the popup menut.
static const int MaxTrail
Maximum trail size.
Definition trailobject.h:66
static QSet< TrailObject * > trailObjects
Store list of objects with trails.
Definition trailobject.h:74
void updateTrail(dms *LST, const dms *lat)
update Horizontal coords of the trail
void clipTrail()
removes the oldest point from the trail
TrailObject * clone() const override
Create copy of object.
const QList< SkyPoint > & trail() const
Definition trailobject.h:42
An angle, stored as degrees, but expressible in many ways.
Definition dms.h:38
qsizetype count() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:09:53 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.