Kstars

fovsymbolnode.h
1/*
2 SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "../fovitem.h"
10
11#include <QSGSimpleRectNode>
12#include <QSGTransformNode>
13
14class EllipseNode;
15class RectNode;
16
17/**
18 * @class FOVSymbolBase
19 *
20 * FOVSymbolBase is a virtual class that should be subclassed by every type of FOV symbol. It is derived
21 * from QSGTransformNode to provide transform matrix for updating coordinates of FOV symbol.
22 *
23 * @short A QSGTransformNode derived base class of every type of FOV symbol
24 * @author Artem Fedoskin
25 * @version 1.0
26 */
28{
29 public:
30 /** @short updates geometry (position, size) of elements of this FOV symbol */
31 virtual void updateSymbol(QColor color, float pixelSizeX, float pixelSizeY) = 0;
32
33 /** @short return type of this FOV symbol **/
34 FOVItem::Shape type() { return m_shape; }
35
36 protected:
37 /** @param shape of the symbol. Each subclass sets its own type. Returned in type() */
39 /* QImage m_image; //Not supported yet
40 bool m_imageDisplay;*/
41 FOVItem::Shape m_shape;
42};
43
44class SquareFOV : public FOVSymbolBase
45{
46 public:
47 SquareFOV();
48 virtual void updateSymbol(QColor color, float pixelSizeX, float pixelSizeY);
49
50 private:
51 RectNode *rect1 { nullptr };
52 RectNode *rect2 { nullptr };
53 QSGGeometryNode *lines { nullptr };
54};
55class CircleFOV : public FOVSymbolBase
56{
57 public:
58 CircleFOV();
59 virtual void updateSymbol(QColor color, float pixelSizeX, float pixelSizeY);
60
61 private:
62 EllipseNode *el { nullptr };
63};
64
65class CrosshairFOV : public FOVSymbolBase
66{
67 public:
68 CrosshairFOV();
69 virtual void updateSymbol(QColor color, float pixelSizeX, float pixelSizeY);
70
71 private:
72 QSGGeometryNode *lines { nullptr };
73 EllipseNode *el1 { nullptr };
74 EllipseNode *el2 { nullptr };
75};
76
77class BullsEyeFOV : public FOVSymbolBase
78{
79 public:
80 BullsEyeFOV();
81 virtual void updateSymbol(QColor color, float pixelSizeX, float pixelSizeY);
82
83 private:
84 EllipseNode *el1 { nullptr };
85 EllipseNode *el2 { nullptr };
86 EllipseNode *el3 { nullptr };
87};
88
89class SolidCircleFOV : public FOVSymbolBase
90{
91 public:
92 SolidCircleFOV();
93 virtual void updateSymbol(QColor color, float pixelSizeX, float pixelSizeY);
94
95 private:
96 EllipseNode *el { nullptr };
97};
98
99/**
100 * @class FOVSymbolNode
101 *
102 * A SkyNode derived class used for displaying FOV symbol. FOVSymbolNade handles creation of FOVSymbolBase
103 * and its update.
104 *
105 * @short A SkyNode derived class that is used for displaying FOV symbol
106 * @author Artem Fedoskin
107 * @version 1.0
108 */
109class FOVSymbolNode : public SkyNode
110{
111 public:
112 /**
113 * @short Constructor. Initialize m_symbol according to shape
114 * @param name - name of the FOV symbol (used to switch it on/off through SkyMapLite from QML)
115 * @param a - width
116 * @param b - height
117 * @param xoffset - x offset
118 * @param yoffset - y offset
119 * @param rot - rotation
120 * @param shape - shape
121 * @param color - RGB color
122 */
123 FOVSymbolNode(const QString &name, float a, float b, float xoffset, float yoffset, float rot,
124 FOVItem::Shape shape = FOVItem::SQUARE, const QString &color = "#FFFFFF");
125 /** @short Update this FOV symbol according to the zoomFactor */
126 void update(float zoomFactor);
127
128 QString getName() { return m_name; }
129
130 private:
131 QString m_name;
132 QString m_color;
133 float m_sizeX { 0 };
134 float m_sizeY { 0 };
135 float m_offsetX { 0 };
136 float m_offsetY { 0 };
137 float m_rotation { 0 };
138 float m_northPA { 0 };
139 SkyPoint m_center;
140 FOVSymbolBase *m_symbol { nullptr };
141};
QSGTransformNode derived node used to draw ellipses.
Definition ellipsenode.h:23
Shape
FOV symbol types.
Definition fovitem.h:22
FOVSymbolBase is a virtual class that should be subclassed by every type of FOV symbol.
FOVItem::Shape type()
return type of this FOV symbol
virtual void updateSymbol(QColor color, float pixelSizeX, float pixelSizeY)=0
updates geometry (position, size) of elements of this FOV symbol
FOVSymbolBase(FOVItem::Shape shape)
A SkyNode derived class used for displaying FOV symbol.
FOVSymbolNode(const QString &name, float a, float b, float xoffset, float yoffset, float rot, FOVItem::Shape shape=FOVItem::SQUARE, const QString &color="#FFFFFF")
Constructor.
QSGGeometryNode derived class that draws filled and non-filled rectangles.
Definition rectnode.h:22
Provides virtual functions for update of coordinates and nodes hiding.
Definition skynode.h:28
virtual void update()
Updates coordinate of the object on SkyMapLite.
Definition skynode.h:48
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.