File indexing completed on 2024-09-08 06:32:03
0001 /* 0002 SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #include "skyitem.h" 0007 0008 #include "rootnode.h" 0009 0010 SkyItem::SkyItem(LabelsItem::label_t labelType, RootNode *parent) : m_rootNode(parent), m_labelType(labelType) 0011 { 0012 parent->appendChildNode(this); 0013 } 0014 0015 SkyItem::~SkyItem() 0016 { 0017 /*PointSourceNode in StarItem deletes the label on its own because nodes of this type are created and 0018 * deleted during the lifetime of program to decrease memory consumption*/ 0019 if (m_labelType != LabelsItem::label_t::STAR_LABEL) 0020 rootNode()->labelsItem()->deleteLabels(m_labelType); 0021 } 0022 0023 void SkyItem::show() 0024 { 0025 SkyOpacityNode::show(); 0026 if (labelType() != LabelsItem::label_t::NO_LABEL) 0027 { 0028 rootNode()->labelsItem()->getLabelNode(m_labelType)->show(); 0029 } 0030 } 0031 0032 void SkyItem::hideLabels() 0033 { 0034 rootNode()->labelsItem()->getLabelNode(m_labelType)->hide(); 0035 } 0036 0037 void SkyItem::hide() 0038 { 0039 SkyOpacityNode::hide(); 0040 rootNode()->labelsItem()->hideLabels(m_labelType); 0041 }