Kstars

skyitem.cpp
1/*
2 SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
3 SPDX-License-Identifier: GPL-2.0-or-later
4*/
5
6#include "skyitem.h"
7
8#include "rootnode.h"
9
10SkyItem::SkyItem(LabelsItem::label_t labelType, RootNode *parent) : m_rootNode(parent), m_labelType(labelType)
11{
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
32void SkyItem::hideLabels()
33{
34 rootNode()->labelsItem()->getLabelNode(m_labelType)->hide();
35}
36
38{
40 rootNode()->labelsItem()->hideLabels(m_labelType);
41}
label_t
The label_t enum.
Definition labelsitem.h:62
void deleteLabels(label_t labelType)
deletes all labels of type labelType
void hideLabels(label_t labelType)
hides all labels of type labelType
LabelTypeNode * getLabelNode(label_t labelType)
Definition labelsitem.h:126
A QSGClipNode derived class used as a container for holding pointers to nodes and for clipping.
Definition rootnode.h:60
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
LabelsItem::label_t labelType()
Definition skyitem.h:60
virtual ~SkyItem()
Definition skyitem.cpp:15
virtual void show() override
makes this node visible
Definition skyitem.cpp:23
virtual void show()
makes this node visible
virtual void hide()
hides this node
void appendChildNode(QSGNode *node)
QSGNode * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.