Kstars

deepskyitem.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 "skyitem.h"
9 #include "skyopacitynode.h"
10 #include "deepskycomponent.h"
11 #include "skynodes/trixelnode.h"
12 
13 class DeepSkyComponent;
14 class SkyMesh;
15 class StarBlockFactory;
16 class MeshIterator;
17 
18 /**
19  * @short This class represents DSOs from particular catalog. To create a node, first create a DSOTrixelNode,
20  * (if a node of this trixelID is not a child of m_trixels yet), append it to m_trixels and then append
21  * DeepSkyNode to DSOTrixelNode
22  */
24 {
25  public:
26  DSOIndexNode(DeepSkyIndex *index, LabelsItem::label_t labelType, QString colorString);
27 
28  /** @short hides the catalog nodes and their labels */
29  virtual void hide();
30 
31  /** @short shows the catalog nodes and their labels */
32  virtual void show();
33 
34  DeepSkyIndex *m_index { nullptr };
35  QSGNode *m_trixels { nullptr };
36  /** @short m_labelType holds label type of this catalog */
38  /** @short schemeColor holds the color, with which nodes of this catalog should be drawn */
40 };
41 
42 /**
43  * @short The DSOTrixelNode class represents trixel. Symbols should be appended to m_symbols, labels to
44  * m_labels and DeepSkyNodes directly to DSOTrixelNode
45  */
46 class DSOTrixelNode : public TrixelNode
47 {
48  public:
49  explicit DSOTrixelNode(Trixel trixelID);
50 
51  virtual void deleteAllChildNodes();
52 
53  TrixelNode *m_labels { nullptr };
54  QSGNode *m_symbols { nullptr };
55 };
56 
57 /**
58  * @class DeepSkyItem
59  *
60  * @short Class that handles representation of Deep Sky Objects.
61  *
62  * @author Artem Fedoskin
63  * @version 1.0
64  */
65 class DeepSkyItem : public SkyItem
66 {
67  public:
68  /**
69  * @short Constructor. Instantiates DSOIndexNodes for catalogs
70  * @param dsoComp pointer to DeepSkyComponent that handles data
71  * @param rootNode parent RootNode that instantiated this object
72  */
73  DeepSkyItem(DeepSkyComponent *dsoComp, RootNode *rootNode);
74 
75  /** @short Call update on all DSOIndexNodes (catalogs) */
76  virtual void update();
77 
78  /**
79  * @short update all nodes needed to represent DSO in the given DSOIndexNode
80  * In this function we perform some tricks to reduce memory consumption:
81  * 1. Each TrixelNode has hideCount() function that returns the number of updates, during which this TrixelNode
82  * was hidden. Whenever TrixelNode becomes visible this counter is set to 0 and is not being incremented.
83  * 2. Based on the zoom level we calculate the limit for hideCount. If hideCount() of particular TrixelNode is
84  * larger than the limit, we delete all nodes of this TrixelNode.
85  * 3. If DSOTrixelNode is visible, we iterate over its DeepSkyObjects and DeepSkyNodes. If hideCount of DeepSkyNode
86  * is larger than the limit we delete it. If DeepSkyObject is visible but no DeepSkyNode to represent this object
87  * is created, we instantiate a new one.
88  * @param node - DSOIndexNode(catalog) that should be updated
89  * @param drawObject - true if objects from this catalog should be drawn, false otherwise
90  * @param region - MeshIterator that should be used to iterate over visible trixels
91  * @param drawImage - true if images for objects should be drawn, false otherwise
92  */
93  void updateDeepSkyNode(DSOIndexNode *node, bool drawObject, MeshIterator *region, bool drawImage = false);
94 
95  private:
96  DeepSkyComponent *m_dsoComp { nullptr };
97  SkyMesh *m_skyMesh { nullptr };
98 
99  DSOIndexNode *m_Messier { nullptr };
100  DSOIndexNode *m_NGC { nullptr };
101  DSOIndexNode *m_IC { nullptr };
102  DSOIndexNode *m_other { nullptr };
103 };
virtual void show()
shows the catalog nodes and their labels
Definition: deepskyitem.cpp:33
void updateDeepSkyNode(DSOIndexNode *node, bool drawObject, MeshIterator *region, bool drawImage=false)
update all nodes needed to represent DSO in the given DSOIndexNode In this function we perform some t...
A base class that is used for displaying SkyComponents on SkyMapLite.
Definition: skyitem.h:29
A container for nodes that holds collection of textures for stars and provides clipping.
Definition: rootnode.h:59
DeepSkyItem(DeepSkyComponent *dsoComp, RootNode *rootNode)
Constructor.
Definition: deepskyitem.cpp:62
virtual void update()
Call update on all DSOIndexNodes (catalogs)
QString schemeColor
schemeColor holds the color, with which nodes of this catalog should be drawn
Definition: deepskyitem.h:39
label_t
The label_t enum.
Definition: labelsitem.h:61
Convenience class that represents trixel in SkyMapLite.
Definition: trixelnode.h:20
virtual void deleteAllChildNodes()
Delete all childNodes and remove nodes from pairs in m_nodes.
Definition: deepskyitem.cpp:43
A wrapper for QSGOpacityNode that provides hide() and show() functions. If node is invisible (opacity...
virtual void hide()
hides the catalog nodes and their labels
Definition: deepskyitem.cpp:27
The DSOTrixelNode class represents trixel.
Definition: deepskyitem.h:46
Class that handles representation of Deep Sky Objects.
Definition: deepskyitem.h:65
RootNode * rootNode()
Definition: skyitem.h:57
LabelsItem::label_t m_labelType
m_labelType holds label type of this catalog
Definition: deepskyitem.h:37
A factory that creates StarBlocks and recycles them in an LRU Cache.
This class represents DSOs from particular catalog.
Definition: deepskyitem.h:23
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Aug 11 2022 03:59:57 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.