Kstars

skyitem.h
1/*
2 SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
3 SPDX-License-Identifier: GPL-2.0-or-later
4*/
5
6#pragma once
7
8#include "skyopacitynode.h"
9#include "labelsitem.h"
10
11class SkyComponent;
12class SkyMapLite;
13class QQuickItem;
14class RootNode;
15class 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
29class 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};
label_t
The label_t enum.
Definition labelsitem.h:62
A QSGClipNode derived class used as a container for holding pointers to nodes and for clipping.
Definition rootnode.h:60
SkyComponent represents an object on the sky map.
This is an interface for implementing SkyItems that represent SkyComponent derived objects on the Sky...
Definition skyitem.h:30
virtual void hide() override
hides this item and corresponding labels
Definition skyitem.cpp:37
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
LabelsItem::label_t labelType()
Definition skyitem.h:60
virtual void update()=0
updates the coordinates and visibility of child node.
virtual ~SkyItem()
Definition skyitem.cpp:15
virtual void show() override
makes this node visible
Definition skyitem.cpp:23
This is the main item that displays all SkyItems.
Definition skymaplite.h:59
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 Sat Dec 21 2024 17:04:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.