Kstars

rootnode.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 "kstarslite.h"
9
10#include <QPolygonF>
11#include <QSGClipNode>
12
13class QSGTexture;
14class SkyMapLite;
15
16class StarItem;
17class DeepSkyItem;
18
19class PlanetsItem;
20class AsteroidsItem;
21class CometsItem;
22
24class LabelsItem;
26class SatellitesItem;
27class SupernovaeItem;
28
29class LinesItem;
30class HorizonItem;
31class EquatorItem;
32class EclipticItem;
33class MilkyWayItem;
34
35class SkyMapComposite;
37
38class FOVItem;
39
41
42/**
43 * @class RootNode
44 *
45 * A QSGClipNode derived class used as a container for holding pointers to nodes and for clipping.
46 * Upon construction RootNode generates all textures that are used by PointNode.
47 *
48 * KStars Lite has the following hierarchy:
49 * 1. RootNode - the parent of all nodes that also acts as a clipping node
50 * 2. SkyItem derived nodes that acts like SkyComponent in regular KStars
51 * 3. SkyNode derived nodes that represent SkyObjects (similar to SkyComponent::draw())
52 * 4. Simple nodes like EllipseNode or PointNode that draw basic geometry and stars
53 *
54 * @short A container for nodes that holds collection of textures for stars and provides clipping
55 * @author Artem Fedoskin
56 * @version 1.0
57 */
58
59class RootNode : public QSGClipNode
60{
61 public:
62 RootNode();
63 virtual ~RootNode();
64
65 /**
66 * @short returns cached texture from textureCache
67 * @param size size of the star
68 * @param spType spectral class
69 * @return cached QSGTexture from textureCache
70 */
71 QSGTexture *getCachedTexture(int size, char spType);
72
73 /** @short triangulates and sets new clipping polygon provided by Projection system */
74 void updateClipPoly();
75
76 /**
77 * @short update positions of all child SkyItems
78 * @param clearTextures true if textures for PointNodes should recreated (required when color scheme
79 * is changed)
80 */
81 void update(bool clearTextures = false);
82
83 /** Debug functions **/
84 void testLeakDelete();
85 void testLeakAdd();
86
87 inline CometsItem *cometsItem() { return m_cometsItem; }
88
89 inline LabelsItem *labelsItem() { return m_labelsItem; }
90
91 inline StarItem *starItem() { return m_starItem; }
92 /** @short initializes textureCache with cached images of stars from SkyMapLite */
93 void genCachedTextures();
94
95 inline TelescopeSymbolsItem *telescopeSymbolsItem() { return m_telescopeSymbols; }
96
97 private:
98 QVector<QVector<QSGTexture *>> m_textureCache;
99 QVector<QVector<QSGTexture *>> m_oldTextureCache;
100 SkyMapLite *m_skyMapLite { nullptr };
101
102 QPolygonF m_clipPoly;
103 QSGGeometry *m_clipGeometry { nullptr };
104
105 StarItem *m_starItem { nullptr };
106 DeepSkyItem *m_dsoItem { nullptr };
107
108 PlanetsItem *m_planetsItem { nullptr };
109 AsteroidsItem *m_asteroidsItem { nullptr };
110 CometsItem *m_cometsItem { nullptr };
111
112 ConstellationNamesItem *m_constelNamesItem { nullptr };
113 LabelsItem *m_labelsItem { nullptr };
114 ConstellationArtItem *m_artItem { nullptr };
115 SatellitesItem *m_satItem { nullptr };
116 SupernovaeItem *m_snovaItem { nullptr };
117
118 HorizonItem *m_horizonItem { nullptr };
119 LinesItem *m_linesItem { nullptr };
120 EquatorItem *m_equator { nullptr };
121 EclipticItem *m_ecliptic { nullptr };
122 MilkyWayItem *m_MWItem { nullptr };
123
124 SkyMapComposite *m_skyComposite { nullptr };
125 SolarSystemComposite *m_solarSystem { nullptr };
126
127 FOVItem *m_FOVItem { nullptr };
128 TelescopeSymbolsItem *m_telescopeSymbols { nullptr };
129};
This class handles asteroids in SkyMapLite.
This class handles comets in SkyMapLite.
Definition cometsitem.h:20
This class handles constellation art in SkyMapLite.
This class represents ConstellationNamesComponent in SkyMapLite.
Class that handles representation of Deep Sky Objects.
Definition deepskyitem.h:66
Represents Ecliptic in SkyMapLite.
Represents Equator in SkyMapLite.
Definition equatoritem.h:23
This class handles representation of FOV symbols in SkyMapLite.
Definition fovitem.h:18
Handles representation of HorizonComponent in SkyMapLite (lines, filled polygon and compass labels).
Definition horizonitem.h:23
This class is in charge of labels in SkyMapLite.
Definition labelsitem.h:53
Class that handles lines (Constellation lines and boundaries and both coordinate grids) in SkyMapLite...
Definition linesitem.h:38
This class handles planets and their moons in SkyMapLite.
Definition planetsitem.h:22
A QSGClipNode derived class used as a container for holding pointers to nodes and for clipping.
Definition rootnode.h:60
void update(bool clearTextures=false)
update positions of all child SkyItems
Definition rootnode.cpp:216
void genCachedTextures()
initializes textureCache with cached images of stars from SkyMapLite
Definition rootnode.cpp:165
void updateClipPoly()
triangulates and sets new clipping polygon provided by Projection system
Definition rootnode.cpp:190
QSGTexture * getCachedTexture(int size, char spType)
returns cached texture from textureCache
Definition rootnode.cpp:185
void testLeakDelete()
Debug functions.
Definition rootnode.cpp:127
This class handles representation of satellites in SkyMapLite.
SkyMapComposite is the root object in the object hierarchy of the sky map.
This is the main item that displays all SkyItems.
Definition skymaplite.h:59
The solar system composite manages all planets, asteroids and comets.
Class that handles Stars.
Definition staritem.h:23
This class handles supernovae in SkyMapLite.
This class handles representation of telescope symbols in SkyMapLite.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.