Kstars

deepskynode.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 "skynode.h"
9#include "../labelsitem.h"
10
11class PlanetItemNode;
12class SkyMapLite;
13class PointNode;
14class LabelNode;
16class DSOSymbolNode;
17
18/**
19 * @class DeepSkyNode
20 *
21 * @short A SkyNode derived class used for displaying DeepSkyObjects.
22 *
23 * Keep in mind that DSO symbol is handled by DSOSymbolNode that has different parent from this node
24 * but DeepSkyNode calls update routines of DSOSymbolNode.
25 * @author Artem Fedoskin
26 * @version 1.0
27 */
28
29class RootNode;
30class DeepSkyObject;
31
32class DeepSkyNode : public SkyNode
33{
34 public:
35 /**
36 * @short Constructor.
37 * @param skyObject - DSOs that is represented by this node
38 * @param symbol - DSOSymbolNode of this DSO
39 * @param labelType - type of label
40 * @param trixel - trixelID, with which this node is indexed
41 */
42 DeepSkyNode(DeepSkyObject *skyObject, DSOSymbolNode *symbol, LabelsItem::label_t labelType, short trixel = -1);
43
44 /** @short Destructor. Call delete routines of label */
45 virtual ~DeepSkyNode();
46
47 /**
48 * @short changePos changes the position of this node and rotate it according to m_angle
49 * @param pos new position
50 */
51 virtual void changePos(QPointF pos) override;
52
53 /**
54 * @short Update position and visibility of this node
55 * @param drawImage - true if image (if exists) should be drawn
56 * @param drawLabel - true if label should be drawn
57 * @param pos - new position of the object. If default parameter is passed, the visibility and
58 * position of node is calculated.
59 * There is one case when we pass this parameter - in DeepSkyItem::updateDeepSkyNode() when
60 * we check whether DeepSkyObject is visible or no and instantiate it accordingly. There is no
61 * need to calculate the position again and we pass it as a parameter.
62 */
63 void update(bool drawImage, bool drawLabel, QPointF pos = QPointF(-1, -1));
64
65 virtual void hide() override;
66
67 /**
68 * @short sets color of DSO symbol and label
69 * To not increase the code for symbols we just recreate the symbol painted with desired color
70 * @param color the color to be set
71 * @param symbolTrixel the TrixelNode to which symbol node should be appended
72 */
73 void setColor(QColor color, TrixelNode *symbolTrixel);
74
75 DeepSkyObject *dsObject() { return m_dso; }
76 DSOSymbolNode *symbol() { return m_symbol; }
77
78 private:
79 QSGSimpleTextureNode *m_objImg { nullptr };
80 /// Trixel to which this object belongs. Used only in stars. By default -1 for all
81 Trixel m_trixel { 0 };
82
83 LabelNode *m_label { nullptr };
84 LabelsItem::label_t m_labelType { LabelsItem::NO_LABEL };
85
86 DeepSkyObject *m_dso { nullptr };
87 DSOSymbolNode *m_symbol { nullptr };
88 float m_angle { 0 };
89 QPointF pos;
90};
A SkyNode derived class used for Deep Sky symbols in SkyMapLite.
A SkyNode derived class used for displaying DeepSkyObjects.
Definition deepskynode.h:33
virtual void hide() override
hides all child nodes (sets opacity of m_opacity to 0)
virtual ~DeepSkyNode()
Destructor.
void setColor(QColor color, TrixelNode *symbolTrixel)
sets color of DSO symbol and label To not increase the code for symbols we just recreate the symbol p...
virtual void changePos(QPointF pos) override
changePos changes the position of this node and rotate it according to m_angle
DeepSkyNode(DeepSkyObject *skyObject, DSOSymbolNode *symbol, LabelsItem::label_t labelType, short trixel=-1)
Constructor.
A SkyNode derived class used for displaying labels.
Definition labelnode.h:27
label_t
The label_t enum.
Definition labelsitem.h:62
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
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
SkyObject * skyObject() const
returns SkyObject associated with this SkyNode
Definition skynode.h:86
virtual void update()
Updates coordinate of the object on SkyMapLite.
Definition skynode.h:48
Convenience class that represents trixel in SkyMapLite.
Definition trixelnode.h:21
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.