Kstars

deepstarcomponent.h
1/*
2 SPDX-FileCopyrightText: 2008 Akarsh Simha Thomas Kabelmann <akarshsimha@gmail.com, thomas.kabelmann@gmx.de>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9/**
10 * @class DeepStarComponent
11 * Stores and manages unnamed stars, most of which are dynamically loaded into memory.
12 *
13 * @author Akarsh Simha
14 * @note Much of the code here is copied from class StarComponent authored by Thomas Kabelmann
15 * @version 0.1
16 */
17
18#include "binfilehelper.h"
19#include "ksnumbers.h"
20#include "listcomponent.h"
21#include "starblockfactory.h"
22#include "skyobjects/deepstardata.h"
23#include "skyobjects/stardata.h"
24
25class SkyLabeler;
26class SkyMesh;
28class StarBlockList;
29class StarObject;
30
32{
33#ifdef KSTARS_LITE
34 friend class DeepStarItem; //Needs access to staticStars and buch of other facilities
35#endif
36
37 public:
38 DeepStarComponent(SkyComposite *parent, QString fileName, float trigMag, bool staticstars = false);
39
40 ~DeepStarComponent() override;
41
42 //This function is empty; we need that so that the JiT update
43 //is the only one being used.
44 void update(KSNumbers *num) override;
45
46 bool selected() override;
47
48 void draw(SkyPainter *skyp) override;
49
50 bool loadStaticStars();
51
52 bool openDataFile();
53
54 /**
55 * @return true if this DeepStarComponent has static stars (that are not dynamically loaded)
56 */
57 inline bool hasStaticStars() const { return staticStars; }
58
59 /**
60 * @return return the estimated faint magnitude limit of this DeepStarComponent
61 */
62 float faintMagnitude() const { return m_FaintMagnitude; }
63
64 /**
65 * @param HDnum Henry-Draper catalog number of the desired star
66 * @return A star matching the given Henry-Draper catalog number
67 */
68 StarObject *findByHDIndex(int HDnum);
69
70 /**
71 * @return Nearest star within maxrad of SkyPoint p, or nullptr if not found
72 */
73 SkyObject *objectNearest(SkyPoint *p, double &maxrad) override;
74
75 inline bool fileOpen() const { return fileOpened; }
76
77 inline BinFileHelper *getStarReader() { return &starReader; }
78
79 bool verifySBLIntegrity();
80
81 /**
82 * @short Add to the given list, the stars from this component,
83 * that lie within the specified circular aperture, and that are
84 * brighter than the limiting magnitude specified.
85 * @p center The center point of the aperture
86 * @p radius The radius around the center point that defines the
87 * aperture
88 * @p maglim Optional parameter indicating the limiting magnitude.
89 * If magnitude limit is numerically < -28, the limiting magnitude
90 * is assumed to be the limiting magnitude of the catalog (i.e. no
91 * magnitude limit)
92 * @p list The list to operate on
93 * @return false if the limiting magnitude is brighter than the
94 * trigger magnitude of the DeepStarComponent
95 */
96 bool starsInAperture(QList<StarObject *> &list, const SkyPoint &center, float radius, float maglim = -29);
97
98 // TODO: Find the right place for this method
99 static void byteSwap(DeepStarData *stardata);
100 static void byteSwap(StarData *stardata);
101
102 static StarBlockFactory m_StarBlockFactory;
103
104 private:
105 SkyMesh *m_skyMesh { nullptr };
106 KSNumbers m_reindexNum;
107
108 float m_zoomMagLimit { 0 };
109 /// Magnitude at which this catalog triggers
110 float triggerMag { 0 };
111 /// Limiting magnitude of the catalog currently loaded
112 float m_FaintMagnitude { 0 };
113 /// Indicates whether the file is opened or not
114 bool fileOpened { false };
115 unsigned long visibleStarCount { 0 };
116 /// Maximum number of stars in any given trixel
117 quint16 MSpT { 0 };
118
119 // Time keeping variables
120 long unsigned t_dynamicLoad { 0 };
121 long unsigned t_drawUnnamed { 0 };
122 long unsigned t_updateCache { 0 };
123
125 QHash<int, StarObject *> m_CatalogNumber;
126
127 bool staticStars { false };
128
129 // Stuff required for reading data
130 DeepStarData deepstardata;
131 StarData stardata;
132 BinFileHelper starReader;
133 QString dataFileName;
134};
This class provides utility functions to handle binary data files in the format prescribed by KStars.
Stores and manages unnamed stars, most of which are dynamically loaded into memory.
bool starsInAperture(QList< StarObject * > &list, const SkyPoint &center, float radius, float maglim=-29)
Add to the given list, the stars from this component, that lie within the specified circular aperture...
float faintMagnitude() const
void draw(SkyPainter *skyp) override
Draw the object on the SkyMap skyp a pointer to the SkyPainter to use.
bool hasStaticStars() const
void update(KSNumbers *num) override
Update the sky position(s) of this component.
StarObject * findByHDIndex(int HDnum)
SkyObject * objectNearest(SkyPoint *p, double &maxrad) override
bool selected() override
This class handles representation of unnamed stars in SkyMapLite.
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition ksnumbers.h:43
An abstract parent class, to be inherited by SkyComponents that store a QList of SkyObjects.
SkyComposite * parent()
SkyComposite is a kind of container class for SkyComponent objects.
The purpose of this class is to prevent labels from overlapping.
Definition skylabeler.h:99
Provides an interface to the Hierarchical Triangular Mesh (HTM) library written by A.
Definition skymesh.h:74
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
Draws things on the sky, without regard to backend.
Definition skypainter.h:40
The sky coordinates of a point in the sky.
Definition skypoint.h:45
A factory that creates StarBlocks and recycles them in an LRU Cache.
Maintains a list of StarBlocks that contain the stars lying in a single trixel.
This is a subclass of SkyObject.
Definition starobject.h:33
A 16-byte structure that holds star data for really faint stars.
A 32-byte Structure that holds star data.
Definition stardata.h:18
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.