File indexing completed on 2025-02-16 09:48:47
0001 /* 0002 SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #pragma once 0007 0008 #include "skyitem.h" 0009 0010 #include <QSGOpacityNode> 0011 0012 class ConstellationNamesComponent; 0013 0014 /** 0015 * @short The ConstellationName struct. It holds SkyObject (with coordinates of label) and 2 labels 0016 * (latin and secondary names) 0017 */ 0018 struct ConstellationName 0019 { 0020 explicit ConstellationName(SkyObject *skyObj); 0021 0022 SkyObject *obj { nullptr }; 0023 LabelNode *latin { nullptr }; 0024 LabelNode *secondary { nullptr }; 0025 0026 /** @short hides both latin and secondary labels */ 0027 void hide(); 0028 }; 0029 0030 /** 0031 * @class ConstellationNamesItem 0032 * 0033 * This class represents ConstellationNamesComponent in SkyMapLite. 0034 * 0035 * @author Artem Fedoskin 0036 * @version 1.0 0037 */ 0038 class ConstellationNamesItem : public SkyItem 0039 { 0040 public: 0041 /** 0042 * Constructor. 0043 * @param constComp a pointer to ConstellationNamesComponent that this object has to represent in 0044 * SkyMapLite 0045 * @param rootNode a pointer to SkyItem's parent node 0046 */ 0047 explicit ConstellationNamesItem(ConstellationNamesComponent *constComp, RootNode *rootNode = nullptr); 0048 0049 /** 0050 * Update positions ConstellationName labels based on user settings and labels visibility. 0051 * If the user chose latin names then label with secondary name won't be created until 0052 * settings are not changed. 0053 * 0054 * @short updates positions of labels based on their visibility and user settings. 0055 */ 0056 virtual void update(); 0057 0058 /** @short Delete all labels and recreate m_names according to object list of m_constelNamesComp */ 0059 void recreateList(); 0060 0061 private: 0062 ConstellationNamesComponent *m_constelNamesComp { nullptr }; 0063 QVector<ConstellationName *> m_names; 0064 };