Kstars

fovsymbolnode.h
1 /*
2  SPDX-FileCopyrightText: 2016 Artem Fedoskin <[email protected]>
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 
14 class EllipseNode;
15 class 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 
44 class 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 };
55 class 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 
65 class 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 
77 class 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 
89 class 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  */
109 class 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 };
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
FOVSymbolBase(FOVItem::Shape shape)
virtual void updateSymbol(QColor color, float pixelSizeX, float pixelSizeY)=0
updates geometry (position, size) of elements of this FOV symbol
QSGGeometryNode derived class that draws filled and non-filled rectangles.
Definition: rectnode.h:21
virtual void update()
Updates coordinate of the object on SkyMapLite.
Definition: skynode.h:48
FOVSymbolNode(const QString &name, float a, float b, float xoffset, float yoffset, float rot, FOVItem::Shape shape=FOVItem::SQUARE, const QString &color="#FFFFFF")
Constructor.
FOVItem::Shape type()
return type of this FOV symbol
Definition: fovsymbolnode.h:34
A QSGTransformNode derived base class of every type of FOV symbol.
Definition: fovsymbolnode.h:27
A SkyNode derived class that is used for displaying FOV symbol.
QSGTransformNode derived node used to draw ellipses.
Definition: ellipsenode.h:22
Provides virtual functions for update of coordinates and nodes hiding.
Definition: skynode.h:27
Shape
FOV symbol types.
Definition: fovitem.h:21
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Aug 13 2022 04:01:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.