Kstars

listcomponent.h
1 /*
2  SPDX-FileCopyrightText: 2005 Jason Harris <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "skycomponent.h"
10 
11 #include <QList>
12 
13 class SkyComposite;
14 class SkyMap;
15 
16 /**
17  * @class ListComponent
18  * An abstract parent class, to be inherited by SkyComponents that store a QList of SkyObjects.
19  *
20  * @author Jason Harris
21  * @version 0.1
22  */
24 {
25  public:
27 
28  ~ListComponent() override;
29 
30  /**
31  * @short Update the sky positions of this component.
32  *
33  * This function usually just updates the Horizontal (Azimuth/Altitude)
34  * coordinates of the objects in this component. If the KSNumbers*
35  * argument is not nullptr, this function also recomputes precession and
36  * nutation for the date in KSNumbers.
37  * @p num Pointer to the KSNumbers object
38  * @note By default, the num parameter is nullptr, indicating that
39  * Precession/Nutation computation should be skipped; this computation
40  * is only occasionally required.
41  */
42  void update(KSNumbers *num = nullptr) override;
43 
44  SkyObject *findByName(const QString &name, bool exact = true) override;
45  SkyObject *objectNearest(SkyPoint *p, double &maxrad) override;
46 
47  void clear();
48 
49  const QList<SkyObject *> &objectList() const
50  {
51  return m_ObjectList;
52  }
53 
54  /**
55  * @short Add an object to the Object list.
56  *
57  * This method is a handy wrapper, which automatically appends the given
58  * SkyObject to m_ObjectList and inserts references with all common names (name,
59  * name2, longname) into the m_ObjectHash QHash to enable a faster findbyname.
60  */
61  void appendListObject(SkyObject * object);
62 
63  protected:
64  QList<SkyObject *> m_ObjectList;
65  QHash<QString, SkyObject *> m_ObjectHash;
66 };
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
SkyObject * objectNearest(SkyPoint *p, double &maxrad) override
Find the SkyObject nearest the given SkyPoint.
SkyComposite * parent()
Definition: skycomponent.h:137
Store several time-dependent astronomical quantities.
Definition: ksnumbers.h:42
void appendListObject(SkyObject *object)
Add an object to the Object list.
Canvas widget for displaying the sky bitmap; also handles user interaction events.
Definition: skymap.h:53
SkyObject * findByName(const QString &name, bool exact=true) override
Search the children of this SkyComponent for a SkyObject whose name matches the argument name the nam...
void update(KSNumbers *num=nullptr) override
Update the sky positions of this component.
Information about an object in the sky.
Definition: skyobject.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Oct 1 2023 04:02:41 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.