Kstars

constellationartitem.cpp
1/*
2 SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
3 SPDX-License-Identifier: GPL-2.0-or-later
4*/
5
6#include "constellationartitem.h"
7
8#include "Options.h"
9#include "projections/projector.h"
10#include "constellationartcomponent.h"
11#include "skynodes/constellationartnode.h"
12
14 : SkyItem(LabelsItem::label_t::NO_LABEL, rootNode), m_artComp(artComp)
15{
16 loadNodes();
17}
18
20{
21 m_artComp->deleteData();
22 QSGNode *n = firstChild();
23 while (n != 0)
24 {
25 QSGNode *d = n;
26 n = n->nextSibling();
28 delete d;
29 }
30}
31
33{
34 m_artComp->loadData();
35 if (!childCount())
36 {
37 QList<ConstellationsArt *> list = m_artComp->m_ConstList;
38 foreach (ConstellationsArt *art, list)
39 {
40 ConstellationArtNode *constArt = new ConstellationArtNode(art);
41 appendChildNode(constArt);
42 }
43 }
44}
45
47{
48 if (Options::showConstellationArt())
49 {
50 loadNodes();
51 if (SkyMapLite::IsSlewing() == false)
52 {
53 show();
54 //Traverse all children nodes of RootNode
55 QSGNode *n = firstChild();
56 while (n != 0)
57 {
58 ConstellationArtNode *artNode = static_cast<ConstellationArtNode *>(n);
59 artNode->update();
60 n = n->nextSibling();
61 }
62 }
63 else
64 {
65 hide();
66 }
67 }
68 else
69 {
70 //Delete all images if we don't need to draw constellation art and save ~50 MB.
72 }
73}
Represents the ConstellationsArt objects.
void loadData()
Read the skycultures.sqlite database file.
void deleteData()
deletes all created ConstellationsArt objects.
void loadNodes()
loadNodes loads constellation art data and creates ConstellationArtNodes
void deleteNodes()
deleteNodes deletes constellation art data and ConstellationArtNodes
ConstellationArtItem(ConstellationArtComponent *artComp, RootNode *rootNode=nullptr)
void update() override
calls update() of all child ConstellationArtNodes if constellation art is on.
A SkyNode derived class that represents ConstellationsArt object.
virtual void update() override
Updates coordinate of the object on SkyMapLite.
Information about a ConstellationsArt object.
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
This is an interface for implementing SkyItems that represent SkyComponent derived objects on the Sky...
Definition skyitem.h:30
virtual void hide() override
hides this item and corresponding labels
Definition skyitem.cpp:37
virtual void show() override
makes this node visible
Definition skyitem.cpp:23
void appendChildNode(QSGNode *node)
int childCount() const const
QSGNode * firstChild() const const
QSGNode * nextSibling() const const
void removeChildNode(QSGNode *node)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.