File indexing completed on 2024-04-28 15:10:48
0001 /* 0002 SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 #ifndef PLANETNODE_H_ 0006 #define PLANETNODE_H_ 0007 #include "skynode.h" 0008 #include "../skyopacitynode.h" 0009 0010 class QSGSimpleTextureNode; 0011 class QImage; 0012 class KSPlanetBase; 0013 class RootNode; 0014 class PointNode; 0015 class LabelNode; 0016 #include "../labelsitem.h" 0017 0018 /** @class PlanetNode 0019 * 0020 * A SkyNode derived class used as a container for holding two other nodes: PointNode 0021 * and QSGSimpleTextureNode(displays object as image) that are displayed depending according to the 0022 * conditions (zoom level, user options) 0023 * 0024 *@short A container for PointNode and QSGSimpleTextureNode used for displaying some solar system objects 0025 *@author Artem Fedoskin 0026 *@version 1.0 0027 */ 0028 0029 class PlanetNode : public SkyNode 0030 { 0031 public: 0032 /** 0033 * @brief Constructor 0034 * @param pb used in PlanetItem to update position of PlanetNode 0035 * @param parentNode used by PointNode to get textures from cache 0036 * @param labelType type of label. Pluto has different from planets label type 0037 */ 0038 PlanetNode(KSPlanetBase *pb, RootNode *parentNode, 0039 LabelsItem::label_t labelType = LabelsItem::label_t::PLANET_LABEL); 0040 0041 /** 0042 * @short updates the size of m_point 0043 * @param size new size of m_point 0044 */ 0045 void setPointSize(float size); 0046 /** 0047 * @short updates the size of m_planetPic 0048 * @param size new size of m_planetPic 0049 */ 0050 void setPlanetPicSize(float size); 0051 /** 0052 * @short hides m_planetPic and shows m_point 0053 */ 0054 void showPoint(); 0055 /** 0056 * @short hides m_point and shows m_planetPic 0057 */ 0058 void showPlanetPic(); 0059 /** 0060 * @short changePos changes the position m_point and m_planetPic 0061 * @param pos new position 0062 */ 0063 virtual void changePos(QPointF pos) override; 0064 0065 /** 0066 * @note similar to SolarSystemSingleComponent::draw() 0067 */ 0068 virtual void update() override; 0069 virtual void hide() override; 0070 0071 private: 0072 PointNode *m_point; 0073 0074 // This opacity node is used to hide m_planetPic. m_point is subclass of QSGOpacityNode so it needs 0075 // no explicit opacity node here. 0076 QSGSimpleTextureNode *m_planetPic; 0077 SkyOpacityNode *m_planetOpacity; 0078 LabelNode *m_label; 0079 }; 0080 0081 #endif