Kstars

deepskynode.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 "skynode.h"
9 #include "../labelsitem.h"
10 
11 class PlanetItemNode;
12 class SkyMapLite;
13 class PointNode;
14 class LabelNode;
16 class 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 
29 class RootNode;
30 class DeepSkyObject;
31 
32 class 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 };
SkyOpacityNode derived class that represents stars and planets using cached QSGTexture.
Definition: pointnode.h:24
virtual void changePos(QPointF pos) override
changePos changes the position of this node and rotate it according to m_angle
Definition: deepskynode.cpp:34
A container for nodes that holds collection of textures for stars and provides clipping.
Definition: rootnode.h:59
A SkyNode derived class used for displaying labels.
Definition: labelnode.h:26
virtual void update()
Updates coordinate of the object on SkyMapLite.
Definition: skynode.h:48
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...
Definition: deepskynode.cpp:46
virtual void hide() override
hides all child nodes (sets opacity of m_opacity to 0)
label_t
The label_t enum.
Definition: labelsitem.h:61
Convenience class that represents trixel in SkyMapLite.
Definition: trixelnode.h:20
virtual ~DeepSkyNode()
Destructor.
Definition: deepskynode.cpp:28
DeepSkyNode(DeepSkyObject *skyObject, DSOSymbolNode *symbol, LabelsItem::label_t labelType, short trixel=-1)
Constructor.
Definition: deepskynode.cpp:22
Item for displaying sky objects; also handles user interaction events.
Definition: skymaplite.h:58
SkyObject * skyObject() const
returns SkyObject associated with this SkyNode
Definition: skynode.h:86
Provides virtual functions for update of coordinates and nodes hiding.
Definition: skynode.h:27
A SkyNode derived class used for Deep Sky symbols in SkyMapLite.
A SkyNode derived class used for displaying DeepSkyObjects.
Definition: deepskynode.h:32
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Aug 8 2022 04:13:19 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.