Kstars

deepskyitem.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 "skyitem.h"
9#include "skyopacitynode.h"
10#include "deepskycomponent.h"
11#include "skynodes/trixelnode.h"
12
13class DeepSkyComponent;
14class SkyMesh;
16class 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 */
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 */
65class 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};
This class represents DSOs from particular catalog.
Definition deepskyitem.h:24
virtual void show()
shows the catalog nodes and their labels
QString schemeColor
schemeColor holds the color, with which nodes of this catalog should be drawn
Definition deepskyitem.h:39
LabelsItem::label_t m_labelType
m_labelType holds label type of this catalog
Definition deepskyitem.h:37
virtual void hide()
hides the catalog nodes and their labels
The DSOTrixelNode class represents trixel.
Definition deepskyitem.h:47
virtual void deleteAllChildNodes()
Delete all childNodes and remove nodes from pairs in m_nodes.
Class that handles representation of Deep Sky Objects.
Definition deepskyitem.h:66
virtual void update()
Call update on all DSOIndexNodes (catalogs)
DeepSkyItem(DeepSkyComponent *dsoComp, RootNode *rootNode)
Constructor.
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...
label_t
The label_t enum.
Definition labelsitem.h:62
MeshIterator is a very lightweight class used to iterate over the result set of an HTMesh intersectio...
A QSGClipNode derived class used as a container for holding pointers to nodes and for clipping.
Definition rootnode.h:60
This is an interface for implementing SkyItems that represent SkyComponent derived objects on the Sky...
Definition skyitem.h:30
RootNode * rootNode()
Definition skyitem.h:57
Provides an interface to the Hierarchical Triangular Mesh (HTM) library written by A.
Definition skymesh.h:74
A wrapper for QSGOpacityNode that provides hide() and show() functions.
A factory that creates StarBlocks and recycles them in an LRU Cache.
Convenience class that represents trixel in SkyMapLite.
Definition trixelnode.h:21
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:59:52 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.