Kstars

deepstarcomponent.h
1 /*
2  SPDX-FileCopyrightText: 2008 Akarsh Simha Thomas Kabelmann <[email protected], [email protected]>
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 
25 class SkyLabeler;
26 class SkyMesh;
27 class StarBlockFactory;
28 class StarBlockList;
29 class 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 };
bool selected() override
bool hasStaticStars() const
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...
A 32-byte Structure that holds star data.
Definition: stardata.h:17
Stores dms coordinates for a point in the sky. for converting between coordinate systems.
Definition: skypoint.h:44
StarObject * findByHDIndex(int HDnum)
SkyComposite * parent()
Definition: skycomponent.h:137
This class handles representation of unnamed stars in SkyMapLite.
Definition: deepstaritem.h:25
Store several time-dependent astronomical quantities.
Definition: ksnumbers.h:42
subclass of SkyObject specialized for stars.
Definition: starobject.h:32
Implements an interface to handle binary data files used by KStars.
Definition: binfilehelper.h:38
Draws things on the sky, without regard to backend.
Definition: skypainter.h:38
void update(KSNumbers *num) override
Update the sky position(s) of this component.
A 16-byte structure that holds star data for really faint stars.
float faintMagnitude() const
void draw(SkyPainter *skyp) override
Draw the object on the SkyMap skyp a pointer to the SkyPainter to use.
A factory that creates StarBlocks and recycles them in an LRU Cache.
Information about an object in the sky.
Definition: skyobject.h:41
SkyObject * objectNearest(SkyPoint *p, double &maxrad) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Jun 4 2023 03:57:11 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.