Kstars

rootnode.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 "kstarslite.h"
9 
10 #include <QPolygonF>
11 #include <QSGClipNode>
12 
13 class QSGTexture;
14 class SkyMapLite;
15 
16 class StarItem;
17 class DeepSkyItem;
18 
19 class PlanetsItem;
20 class AsteroidsItem;
21 class CometsItem;
22 
24 class LabelsItem;
26 class SatellitesItem;
27 class SupernovaeItem;
28 
29 class LinesItem;
30 class HorizonItem;
31 class EquatorItem;
32 class EclipticItem;
33 class MilkyWayItem;
34 
35 class SkyMapComposite;
37 
38 class 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 
59 class 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 };
QSGTexture * getCachedTexture(int size, char spType)
returns cached texture from textureCache
Definition: rootnode.cpp:185
void updateClipPoly()
triangulates and sets new clipping polygon provided by Projection system
Definition: rootnode.cpp:190
A container for nodes that holds collection of textures for stars and provides clipping.
Definition: rootnode.h:59
void genCachedTextures()
initializes textureCache with cached images of stars from SkyMapLite
Definition: rootnode.cpp:165
Handles labels in SkyMapLite.
Definition: labelsitem.h:52
Represents Equator in SkyMapLite.
Definition: equatoritem.h:22
Class that handles Stars.
Definition: staritem.h:22
Class that handles representation of Deep Sky Objects.
Definition: deepskyitem.h:65
Item for displaying sky objects; also handles user interaction events.
Definition: skymaplite.h:58
void testLeakDelete()
Debug functions.
Definition: rootnode.cpp:127
Represents Ecliptic in SkyMapLite.
Definition: eclipticitem.h:19
Class that handles most of the lines in SkyMapLite.
Definition: linesitem.h:37
void update(bool clearTextures=false)
update positions of all child SkyItems
Definition: rootnode.cpp:216
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Aug 11 2022 04:00:04 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.