Kstars

highpmstarlist.h
1 /*
2  SPDX-FileCopyrightText: 2007 James B. Bowlin <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "ksnumbers.h"
10 #include "typedef.h"
11 
12 struct HighPMStar;
13 class SkyMesh;
14 
15 /** @class HighPMStarList
16  * Holds a list of stars with high proper motion along with the trixel each star
17  * is currently located in. The purpose of this class is to save some time by
18  * only re-indexing the stars with high proper motion instead of the entire
19  * collection of stars (which takes about 4 seconds on a AMD64 3600).
20  *
21  * Multiple HighPMStarList's can be used so we re-index a smaller number of
22  * stars more frequently and a larger number of stars less frequently.
23  *
24  *
25  * @author James B. Bowlin @version 0.1
26 */
27 
29 {
30  public:
31  /** @short Constructor */
32  explicit HighPMStarList(double threshold);
33  ~HighPMStarList();
34 
35  /**
36  * @short adds the star located at trixel to the list if the pm is
37  * greater than the threshold. We also use the pm to determine the
38  * update interval. Returns true if the star was appended and false
39  * otherwise.
40  */
41  bool append(Trixel trixel, StarObject *star, double pm);
42 
43  /** @short returns the threshold. */
44  double threshold() const { return m_threshold; }
45 
46  /** @short returns the number of stars in the list. */
47  int size() const { return m_stars.size(); }
48 
49  /**
50  * @short sets the time this list was last indexed to. Normally this
51  * is done automatically in the reindex() routine but this is useful
52  * if the entire starIndex gets re-indexed.
53  */
54  void setIndexTime(KSNumbers *num);
55 
56  /**
57  * @short if the date in num differs from the last time we indexed by
58  * more than our update interval then we re-index all the stars in our
59  * list that have actually changed trixels.
60  */
61  bool reindex(KSNumbers *num, StarIndex *starIndex);
62 
63  /** @short prints out some brief statistics. */
64  void stats();
65 
66  private:
67  QVector<HighPMStar *> m_stars;
68 
69  KSNumbers m_reindexNum;
70  double m_reindexInterval { 0 };
71  double m_threshold { 0 };
72  double m_maxPM { 0 };
73 
74  SkyMesh *m_skyMesh { nullptr };
75 };
double threshold() const
returns the threshold.
Store several time-dependent astronomical quantities.
Definition: ksnumbers.h:42
subclass of SkyObject specialized for stars.
Definition: starobject.h:32
void setIndexTime(KSNumbers *num)
sets the time this list was last indexed to.
bool append(Trixel trixel, StarObject *star, double pm)
adds the star located at trixel to the list if the pm is greater than the threshold.
int size() const const
HighPMStarList(double threshold)
Constructor.
void stats()
prints out some brief statistics.
bool reindex(KSNumbers *num, StarIndex *starIndex)
if the date in num differs from the last time we indexed by more than our update interval then we re-...
int size() const
returns the number of stars in the list.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Aug 15 2022 04:04:01 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.