Kstars

satellitesitem.cpp
1/*
2 SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
3 SPDX-License-Identifier: GPL-2.0-or-later
4*/
5
6#include "satellitesitem.h"
7#include "satellitescomponent.h"
8
9#include "Options.h"
10#include "projections/projector.h"
11#include "kscomet.h"
12
13#include "rootnode.h"
14#include "labelsitem.h"
15#include "satellite.h"
16#include "skylabeler.h"
17
18#include "skynodes/satellitenode.h"
19
21 : SkyItem(LabelsItem::label_t::SATELLITE_LABEL, rootNode), m_satComp(satComp)
22{
24 Options::setDrawSatellitesLikeStars(false);
25}
26
28{
29 if (!m_satComp->selected())
30 {
31 hide();
32 return;
33 }
34
35 QSGNode *n = firstChild();
36
37 while (n != 0)
38 {
39 SatelliteNode *satNode = static_cast<SatelliteNode *>(n);
40 Satellite *sat = satNode->sat();
41 if (sat->selected())
42 {
43 if (Options::showVisibleSatellites())
44 {
45 if (sat->isVisible())
46 {
47 satNode->update();
48 }
49 else
50 {
51 satNode->hide();
52 }
53 }
54 else
55 {
56 satNode->update();
57 }
58 }
59 else
60 {
61 satNode->hide();
62 }
63 n = n->nextSibling();
64 }
65}
66
68{
69 QList<SatelliteGroup *> list = m_satComp->groups();
70 for (int i = 0; i < list.size(); ++i)
71 {
72 SatelliteGroup *group = list.at(i);
73 for (int c = 0; c < group->size(); ++c)
74 {
75 appendChildNode(new SatelliteNode(group->at(c), rootNode()));
76 }
77 }
78}
This class is in charge of labels in SkyMapLite.
Definition labelsitem.h:53
A QSGClipNode derived class used as a container for holding pointers to nodes and for clipping.
Definition rootnode.h:60
Represents a group of artificial satellites.
A SkyNode derived class that represents satellite.
virtual void hide() override
hides all child nodes (sets opacity of m_opacity to 0)
virtual void update() override
Update position and visibility of satellite.
Represents an artificial satellites.
Definition satellite.h:23
bool isVisible()
bool selected()
Represents artificial satellites on the sky map.
virtual void update() override
Update positions and visibility of satellites.
SatellitesItem(SatellitesComponent *satComp, RootNode *rootNode=nullptr)
Constructor.
void recreateList()
recreates the node tree (deletes old nodes and appends new ones according to SatelliteGroups from Sat...
virtual void hide() override
hides this item and corresponding labels
Definition skyitem.cpp:37
RootNode * rootNode()
Definition skyitem.h:57
SkyItem(LabelsItem::label_t labelType, RootNode *rootNode=nullptr)
Constructor, appends SkyItem to rootNode as a child in a node tree.
Definition skyitem.cpp:10
const_reference at(qsizetype i) const const
qsizetype size() const const
void appendChildNode(QSGNode *node)
QSGNode * firstChild() const const
QSGNode * nextSibling() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:53:02 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.