Kstars

skyitem.cpp
1 /*
2  SPDX-FileCopyrightText: 2016 Artem Fedoskin <[email protected]>
3  SPDX-License-Identifier: GPL-2.0-or-later
4 */
5 
6 #include "skyitem.h"
7 
8 #include "rootnode.h"
9 
10 SkyItem::SkyItem(LabelsItem::label_t labelType, RootNode *parent) : m_rootNode(parent), m_labelType(labelType)
11 {
12  parent->appendChildNode(this);
13 }
14 
16 {
17  /*PointSourceNode in StarItem deletes the label on its own because nodes of this type are created and
18  * deleted during the lifetime of program to decrease memory consumption*/
19  if (m_labelType != LabelsItem::label_t::STAR_LABEL)
20  rootNode()->labelsItem()->deleteLabels(m_labelType);
21 }
22 
24 {
26  if (labelType() != LabelsItem::label_t::NO_LABEL)
27  {
28  rootNode()->labelsItem()->getLabelNode(m_labelType)->show();
29  }
30 }
31 
32 void SkyItem::hideLabels()
33 {
34  rootNode()->labelsItem()->getLabelNode(m_labelType)->hide();
35 }
36 
38 {
40  rootNode()->labelsItem()->hideLabels(m_labelType);
41 }
A container for nodes that holds collection of textures for stars and provides clipping.
Definition: rootnode.h:59
virtual void show()
makes this node visible
LabelsItem::label_t labelType()
Definition: skyitem.h:60
void deleteLabels(label_t labelType)
deletes all labels of type labelType
Definition: labelsitem.cpp:214
void appendChildNode(QSGNode *node)
LabelTypeNode * getLabelNode(label_t labelType)
Definition: labelsitem.h:126
virtual void show() override
makes this node visible
Definition: skyitem.cpp:23
label_t
The label_t enum.
Definition: labelsitem.h:61
void hideLabels(label_t labelType)
hides all labels of type labelType
Definition: labelsitem.cpp:190
virtual void hide() override
hides this item and corresponding labels
Definition: skyitem.cpp:37
QSGNode * parent() const const
virtual ~SkyItem()
Definition: skyitem.cpp:15
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
virtual void hide()
hides this node
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:58 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.