Kstars

planetnode.h
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
11class QImage;
12class KSPlanetBase;
13class RootNode;
14class PointNode;
15class 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
29class 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
A subclass of TrailObject that provides additional information needed for most solar system objects.
A SkyNode derived class used for displaying labels.
Definition labelnode.h:27
label_t
The label_t enum.
Definition labelsitem.h:62
A SkyNode derived class used as a container for holding two other nodes: PointNode and QSGSimpleTextu...
Definition planetnode.h:30
void showPlanetPic()
hides m_point and shows m_planetPic
void setPlanetPicSize(float size)
updates the size of m_planetPic
virtual void changePos(QPointF pos) override
changePos changes the position m_point and m_planetPic
void setPointSize(float size)
updates the size of m_point
void showPoint()
hides m_planetPic and shows m_point
virtual void update() override
PlanetNode(KSPlanetBase *pb, RootNode *parentNode, LabelsItem::label_t labelType=LabelsItem::label_t::PLANET_LABEL)
Constructor.
virtual void hide() override
hides all child nodes (sets opacity of m_opacity to 0)
SkyOpacityNode derived class that represents stars and planets using cached QSGTexture.
Definition pointnode.h:25
A QSGClipNode derived class used as a container for holding pointers to nodes and for clipping.
Definition rootnode.h:60
Provides virtual functions for update of coordinates and nodes hiding.
Definition skynode.h:28
A wrapper for QSGOpacityNode that provides hide() and show() functions.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:15:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.