1 /* 2 SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com> 3 SPDX-License-Identifier: GPL-2.0-or-later 4 */ 5 #ifndef PLANETNODE_H_ 6 #define PLANETNODE_H_ 7 #include "skynode.h" 8 #include "../skyopacitynode.h" 9 10 class QSGSimpleTextureNode; 11 class QImage; 12 class KSPlanetBase; 13 class RootNode; 14 class PointNode; 15 class LabelNode; 16 #include "../labelsitem.h" 17 18 /** @class PlanetNode 19 * 20 * A SkyNode derived class used as a container for holding two other nodes: PointNode 21 * and QSGSimpleTextureNode(displays object as image) that are displayed depending according to the 22 * conditions (zoom level, user options) 23 * 24 *@short A container for PointNode and QSGSimpleTextureNode used for displaying some solar system objects 25 *@author Artem Fedoskin 26 *@version 1.0 27 */ 28 29 class PlanetNode : public SkyNode 30 { 31 public: 32 /** 33 * @brief Constructor 34 * @param pb used in PlanetItem to update position of PlanetNode 35 * @param parentNode used by PointNode to get textures from cache 36 * @param labelType type of label. Pluto has different from planets label type 37 */ 38 PlanetNode(KSPlanetBase *pb, RootNode *parentNode, 39 LabelsItem::label_t labelType = LabelsItem::label_t::PLANET_LABEL); 40 41 /** 42 * @short updates the size of m_point 43 * @param size new size of m_point 44 */ 45 void setPointSize(float size); 46 /** 47 * @short updates the size of m_planetPic 48 * @param size new size of m_planetPic 49 */ 50 void setPlanetPicSize(float size); 51 /** 52 * @short hides m_planetPic and shows m_point 53 */ 54 void showPoint(); 55 /** 56 * @short hides m_point and shows m_planetPic 57 */ 58 void showPlanetPic(); 59 /** 60 * @short changePos changes the position m_point and m_planetPic 61 * @param pos new position 62 */ 63 virtual void changePos(QPointF pos) override; 64 65 /** 66 * @note similar to SolarSystemSingleComponent::draw() 67 */ 68 virtual void update() override; 69 virtual void hide() override; 70 71 private: 72 PointNode *m_point; 73 74 // This opacity node is used to hide m_planetPic. m_point is subclass of QSGOpacityNode so it needs 75 // no explicit opacity node here. 76 QSGSimpleTextureNode *m_planetPic; 77 SkyOpacityNode *m_planetOpacity; 78 LabelNode *m_label; 79 }; 80 81 #endif 82