SkyComposite
#include <skycomposite.h>
Public Member Functions | |
SkyComposite (SkyComposite *parent=nullptr) | |
~SkyComposite () override | |
void | addComponent (SkyComponent *comp, int priority=1024) |
QList< SkyComponent * > | components () |
QMultiMap< int, SkyComponent * > & | componentsWithPriorities () |
void | draw (SkyPainter *skyp) override |
SkyObject * | findByName (const QString &name, bool exact=true) override |
SkyObject * | objectNearest (SkyPoint *p, double &maxrad) override |
void | removeComponent (SkyComponent *const comp) |
void | update (KSNumbers *num=nullptr) override |
Public Member Functions inherited from SkyComponent | |
SkyComponent (SkyComposite *parent=nullptr) | |
virtual void | drawTrails (SkyPainter *skyp) |
virtual void | emitProgressText (const QString &message) |
QHash< int, QVector< QPair< QString, const SkyObject * > > > & | objectLists () |
QVector< QPair< QString, const SkyObject * > > & | objectLists (int type) |
QHash< int, QStringList > & | objectNames () |
QStringList & | objectNames (int type) |
virtual void | objectsInArea (QList< SkyObject * > &list, const SkyRegion ®ion) |
SkyComposite * | parent () |
void | removeFromLists (const SkyObject *obj) |
void | removeFromNames (const SkyObject *obj) |
virtual bool | selected () |
virtual void | updateMoons (KSNumbers *) |
virtual void | updateSolarSystemBodies (KSNumbers *) |
Detailed Description
SkyComposite is a kind of container class for SkyComponent objects.
The SkyComposite is responsible for distributing calls to functions like draw() and update() to its children, which can be SkyComponents or other SkyComposites with their own children. This is based on the "composite/component" design pattern.
Performance tuning: Sometimes it will be better to override a virtual function and do the work in the composite instead of delegating the request to all sub components.
- Version
- 0.1
Definition at line 29 of file skycomposite.h.
Constructor & Destructor Documentation
◆ SkyComposite()
|
explicit |
Constructor parent
pointer to the parent SkyComponent.
Definition at line 12 of file skycomposite.cpp.
◆ ~SkyComposite()
|
override |
Member Function Documentation
◆ addComponent()
void SkyComposite::addComponent | ( | SkyComponent * | comp, |
int | priority = 1024 ) |
Add a new sub component to the composite comp
Pointer to the SkyComponent to be added priority
A priority ordering for various operations on the list of all sky components (notably objectNearest())
Definition at line 22 of file skycomposite.cpp.
◆ components()
|
inline |
Definition at line 97 of file skycomposite.h.
◆ componentsWithPriorities()
|
inline |
Definition at line 102 of file skycomposite.h.
◆ draw()
|
overridevirtual |
Delegate draw requests to all sub components psky
Reference to the QPainter on which to paint.
Implements SkyComponent.
Reimplemented in SkyMapComposite.
Definition at line 50 of file skycomposite.cpp.
◆ findByName()
Search the children of this SkyComposite for a SkyObject whose name matches the argument.
The objects' primary, secondary and long-form names will all be checked for a match. name
the name to be matched exact
If true, it will return an exact match, otherwise it can return a partial match.
- Returns
- a pointer to the SkyObject whose name matches the argument, or a nullptr pointer if no match was found.
Reimplemented from SkyComponent.
Reimplemented in SkyMapComposite.
Definition at line 65 of file skycomposite.cpp.
◆ objectNearest()
Identify the nearest SkyObject to the given SkyPoint, among the children of this SkyComposite p
pointer to the SkyPoint around which to search.
maxrad
reference to current search radius
- Returns
- a pointer to the nearest SkyObject
Reimplemented from SkyComponent.
Reimplemented in SkyMapComposite.
Definition at line 76 of file skycomposite.cpp.
◆ removeComponent()
void SkyComposite::removeComponent | ( | SkyComponent *const | comp | ) |
Remove a sub component from the composite comp
Pointer to the SkyComponent to be removed.
Definition at line 33 of file skycomposite.cpp.
◆ update()
|
overridevirtual |
Delegate update-position requests to all sub components.
This function usually just updates the Horizontal (Azimuth/Altitude) coordinates. However, the precession and nutation must also be recomputed periodically. Requests to do so are sent through the doPrecess parameter. num
Pointer to the KSNumbers object
- See also
- updatePlanets()
- updateMoons()
- Note
- By default, the num parameter is nullptr, indicating that Precession/Nutation computation should be skipped; this computation is only occasionally required.
Reimplemented from SkyComponent.
Reimplemented in SkyMapComposite, and SolarSystemComposite.
Definition at line 59 of file skycomposite.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.