Kstars

skyitem.h
1 /*
2  SPDX-FileCopyrightText: 2016 Artem Fedoskin <[email protected]>
3  SPDX-License-Identifier: GPL-2.0-or-later
4 */
5 
6 #pragma once
7 
8 #include "skyopacitynode.h"
9 #include "labelsitem.h"
10 
11 class SkyComponent;
12 class SkyMapLite;
13 class QQuickItem;
14 class RootNode;
15 class SkyNode;
16 
17 /**
18  * @class SkyItem
19  *
20  * This is an interface for implementing SkyItems that represent SkyComponent derived objects on
21  * the SkyMapLite. It is derived from QSGOpacityNode to make it possible to hide the whole node tree
22  * by simply setting opacity to 0.
23  *
24  * @short A base class that is used for displaying SkyComponents on SkyMapLite.
25  * @author Artem Fedoskin
26  * @version 1.0
27  */
28 
29 class SkyItem : public SkyOpacityNode
30 {
31  public:
32  /**
33  * Constructor, appends SkyItem to rootNode as a child in a node tree
34  *
35  * @param labelType type of label that corresponds to this item
36  * @note see LabelsItem::label_t
37  * @param parent a pointer to SkyItem's parent node
38  */
40  /** @see PointSourceNode::~PointSourceNode() */
41  virtual ~SkyItem();
42 
43  /**
44  * @short updates the coordinates and visibility of child node. Similar to draw routine in
45  * SkyComponent derived classes
46  */
47  virtual void update() = 0;
48 
49  virtual void show() override;
50 
51  /** @short hides this item and corresponding labels */
52  virtual void hide() override;
53 
54  void hideLabels();
55 
56  /** @return RootNode that is the parent of this SkyItem in a node tree */
57  inline RootNode *rootNode() { return m_rootNode; }
58 
59  /** @return label type of this SkyItem */
60  inline LabelsItem::label_t labelType() { return m_labelType; }
61 
62  private:
63  RootNode *m_rootNode { nullptr };
64  QVector<SkyNode *> m_skyNodes;
65  LabelsItem::label_t m_labelType;
66 };
A base class that is used for displaying SkyComponents on SkyMapLite.
Definition: skyitem.h:29
A container for nodes that holds collection of textures for stars and provides clipping.
Definition: rootnode.h:59
LabelsItem::label_t labelType()
Definition: skyitem.h:60
virtual void update()=0
updates the coordinates and visibility of child node.
virtual void show() override
makes this node visible
Definition: skyitem.cpp:23
label_t
The label_t enum.
Definition: labelsitem.h:61
A wrapper for QSGOpacityNode that provides hide() and show() functions. If node is invisible (opacity...
virtual void hide() override
hides this item and corresponding labels
Definition: skyitem.cpp:37
Item for displaying sky objects; also handles user interaction events.
Definition: skymaplite.h:58
virtual ~SkyItem()
Definition: skyitem.cpp:15
RootNode * rootNode()
Definition: skyitem.h:57
SkyItem(LabelsItem::label_t labelType, RootNode *rootNode=nullptr)
Constructor, appends SkyItem to rootNode as a child in a node tree.
Definition: skyitem.cpp:10
Provides virtual functions for update of coordinates and nodes hiding.
Definition: skynode.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Aug 13 2022 04:01:59 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.