Kstars

dsosymbolnode.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
10#include <QSGNode>
11
12class DeepSkyObject;
13class EllipseNode;
14
15/**
16 * @short A base class for all symbol nodes.
17 */
18class SymbolNode : public QSGNode
19{
20 public:
21 /**
22 * @short Update size and the symbol itself. Each SymbolNode should override this function,
23 * and call SymbolNode::updateSymbol() in the beginning of overridden updateSymbol to
24 * initialize values that are used across all symbols.
25 */
26 virtual void updateSymbol(float x, float y, float e, float size);
27
28 protected:
29 SymbolNode() {}
30 float zoom { 0 };
31 int isize { 0 };
32
33 float dx1 { 0 };
34 float dx2 { 0 };
35 float dy1 { 0 };
36 float dy2 { 0 };
37 float x1 { 0 };
38 float x2 { 0 };
39 float y1 { 0 };
40 float y2 { 0 };
41
42 float dxa { 0 };
43 float dxb { 0 };
44 float dya { 0 };
45 float dyb { 0 };
46 float xa { 0 };
47 float xb { 0 };
48 float ya { 0 };
49 float yb { 0 };
50 float psize { 0 };
51};
52
53class StarSymbol : public SymbolNode
54{
55 public:
56 explicit StarSymbol(const QColor &color = QColor());
57
58 virtual void updateSymbol(float x, float y, float e, float size) override;
59
60 EllipseNode *m_ellipse { nullptr };
61};
62
63class AsterismSymbol : public SymbolNode
64{
65 public:
66 explicit AsterismSymbol(const QColor &color);
67
68 virtual void updateSymbol(float x, float y, float e, float size) override;
69
70 EllipseNode *e1 { nullptr };
71 EllipseNode *e2 { nullptr };
72 EllipseNode *e3 { nullptr };
73 EllipseNode *e4 { nullptr };
74 EllipseNode *e5 { nullptr };
75 EllipseNode *e6 { nullptr };
76 EllipseNode *e7 { nullptr };
77 EllipseNode *e8 { nullptr };
78};
79
80class GlobularClusterSymbol : public SymbolNode
81{
82 public:
83 explicit GlobularClusterSymbol(const QColor &color);
84
85 virtual void updateSymbol(float x, float y, float e, float size) override;
86
87 EllipseNode *e1 { nullptr };
88 QSGGeometryNode *lines { nullptr };
89};
90
91class DarkNebulaSymbol : public SymbolNode
92{
93 public:
94 explicit DarkNebulaSymbol(const QColor &color);
95
96 virtual void updateSymbol(float x, float y, float e, float size) override;
97
98 QSGGeometryNode *lines { nullptr };
99};
100
101class PlanetaryNebulaSymbol : public SymbolNode
102{
103 public:
104 explicit PlanetaryNebulaSymbol(const QColor &color);
105
106 virtual void updateSymbol(float x, float y, float e, float size) override;
107
108 EllipseNode *e1 { nullptr };
109 QSGGeometryNode *lines { nullptr };
110};
111
112class SupernovaRemnantSymbol : public SymbolNode
113{
114 public:
115 explicit SupernovaRemnantSymbol(const QColor &color);
116
117 virtual void updateSymbol(float x, float y, float e, float size) override;
118
119 QSGGeometryNode *lines { nullptr };
120};
121
122class GalaxySymbol : public SymbolNode
123{
124 public:
125 explicit GalaxySymbol(const QColor &color);
126
127 virtual void updateSymbol(float x, float y, float e, float size) override;
128
129 EllipseNode *e1 { nullptr };
130};
131
132class GalaxyClusterSymbol : public SymbolNode
133{
134 public:
135 explicit GalaxyClusterSymbol(const QColor &color);
136
137 virtual void updateSymbol(float x, float y, float e, float size) override;
138
139 QSGGeometryNode *lines { nullptr };
140};
141
142/**
143 * @class DSOSymbolNode
144 * @short A SkyNode derived class used for Deep Sky symbols in SkyMapLite
145 *
146 * @author Artem Fedoskin
147 * @version 1.0
148 */
149class DSOSymbolNode : public SkyNode
150{
151 public:
152 /**
153 * @short Constructor.
154 * @param skyObject - DeepSkyObject, for which this symbol should be created
155 * @param color of the symbol
156 */
157 explicit DSOSymbolNode(DeepSkyObject *skyObject, const QColor &color = QColor());
158
159 /**
160 * @short Changes position and rotation angle of the symbol
161 * @param pos - new position
162 * @param positionangle - rotation angle
163 */
164 void changePos(const QPointF &pos, float positionangle);
165
166 /**
167 * @short Update size and position of the symbol
168 * @param size - new size of symbol
169 * @param pos - new position
170 * @param positionangle - new rotation angle
171 */
172 void update(float size, const QPointF &pos, float positionangle);
173
174 /** Create SymbolNode based on the type of m_dso */
175 void initSymbol();
176 QColor getColor() { return m_color; }
177
178 private:
179 QColor m_color;
180 //TODO deal setter for this when stars will be introduced
181 DeepSkyObject *m_dso { nullptr };
182 SymbolNode *m_symbol { nullptr };
183 /// If the symbol needs rotation this should be set to true
184 bool m_rotate { false };
185};
A SkyNode derived class used for Deep Sky symbols in SkyMapLite.
DSOSymbolNode(DeepSkyObject *skyObject, const QColor &color=QColor())
Constructor.
void changePos(const QPointF &pos, float positionangle)
Changes position and rotation angle of the symbol.
void initSymbol()
Create SymbolNode based on the type of m_dso.
QSGTransformNode derived node used to draw ellipses.
Definition ellipsenode.h:23
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
A base class for all symbol nodes.
virtual void updateSymbol(float x, float y, float e, float size)
Update size and the symbol itself.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 4 2024 12:01:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.