File indexing completed on 2024-03-24 03:47:03
0001 /* 0002 SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #include "supernovaeitem.h" 0007 0008 #include "kscomet.h" 0009 #include "labelsitem.h" 0010 #include "Options.h" 0011 #include "rootnode.h" 0012 #include "satellitescomponent.h" 0013 #include "skylabeler.h" 0014 #include "supernovaecomponent.h" 0015 #include "projections/projector.h" 0016 #include "skynodes/supernovanode.h" 0017 0018 SupernovaeItem::SupernovaeItem(SupernovaeComponent *snovaComp, RootNode *rootNode) 0019 : SkyItem(LabelsItem::label_t::SATELLITE_LABEL, rootNode), m_snovaComp(snovaComp) 0020 { 0021 recreateList(); 0022 } 0023 0024 void SupernovaeItem::update() 0025 { 0026 if (!m_snovaComp->selected()) 0027 { 0028 hide(); 0029 return; 0030 } 0031 show(); 0032 0033 QSGNode *n = firstChild(); 0034 0035 while (n != 0) 0036 { 0037 SupernovaNode *sNode = static_cast<SupernovaNode *>(n); 0038 sNode->update(); 0039 0040 n = n->nextSibling(); 0041 } 0042 } 0043 0044 void SupernovaeItem::recreateList() 0045 { 0046 foreach (SkyObject *so, m_snovaComp->objectList()) 0047 { 0048 Supernova *sup = static_cast<Supernova*>(so); 0049 0050 if (sup) 0051 appendChildNode(new SupernovaNode(sup)); 0052 } 0053 }