Changeset View
Changeset View
Standalone View
Standalone View
kstars/skycomponents/starblocklist.h
Context not available. | |||||
15 | * * | 15 | * * | ||
---|---|---|---|---|---|
16 | ***************************************************************************/ | 16 | ***************************************************************************/ | ||
17 | 17 | | |||
18 | #ifndef STARBLOCKLIST_H | 18 | #pragma once | ||
19 | #define STARBLOCKLIST_H | | |||
20 | 19 | | |||
21 | #include "starblock.h" | | |||
22 | #include "deepstarcomponent.h" | | |||
23 | #include "typedef.h" | 20 | #include "typedef.h" | ||
24 | 21 | | |||
25 | class StarBlock; | 22 | class StarBlock; | ||
26 | class DeepStarComponent; | 23 | class DeepStarComponent; | ||
27 | 24 | | |||
28 | /** | 25 | /** | ||
29 | *@class StarBlockList | 26 | * @class StarBlockList | ||
30 | *Maintains a list of StarBlocks that contain the stars lying in a single trixel. | 27 | * Maintains a list of StarBlocks that contain the stars lying in a single trixel. | ||
31 | *Takes care of the dynamic loading of stars | 28 | * Takes care of the dynamic loading of stars | ||
32 | *@author Akarsh Simha | 29 | * @author Akarsh Simha | ||
33 | *@version 0.1 | 30 | * @version 0.1 | ||
34 | */ | 31 | */ | ||
35 | 32 | | |||
36 | class StarBlockList | 33 | class StarBlockList | ||
37 | { | 34 | { | ||
38 | public: | 35 | public: | ||
39 | /** | 36 | /** | ||
40 | *Constructor. | 37 | * Constructor. | ||
41 | */ | 38 | */ | ||
42 | explicit StarBlockList(Trixel trixel); | 39 | explicit StarBlockList(Trixel trixel); | ||
43 | 40 | | |||
44 | /** | 41 | /** | ||
45 | *Constructor for deep star catalogs. | 42 | * Constructor for deep star catalogs. | ||
46 | *@param trixel The trixel ID | 43 | * @param trixel The trixel ID | ||
47 | *@param parent Pointer to the parent DeepStarComponent | 44 | * @param parent Pointer to the parent DeepStarComponent | ||
48 | */ | 45 | */ | ||
49 | StarBlockList(Trixel trixel, DeepStarComponent *parent); | 46 | StarBlockList(Trixel trixel, DeepStarComponent *parent = nullptr); | ||
50 | 47 | | |||
51 | /** | 48 | /** | ||
52 | *Destructor | 49 | * Destructor | ||
53 | */ | 50 | */ | ||
54 | ~StarBlockList(); | 51 | ~StarBlockList(); | ||
55 | 52 | | |||
56 | /** | 53 | /** | ||
57 | *@short Ensures that the list is loaded with stars to given magnitude limit | 54 | * @short Ensures that the list is loaded with stars to given magnitude limit | ||
58 | * | 55 | * | ||
59 | *@param Magnitude limit to load stars upto | 56 | * @param Magnitude limit to load stars upto | ||
60 | *@return true on success, false on failure (data file not found, bad seek etc) | 57 | * @return true on success, false on failure (data file not found, bad seek etc) | ||
61 | */ | 58 | */ | ||
62 | bool fillToMag(float maglim); | 59 | bool fillToMag(float maglim); | ||
63 | 60 | | |||
64 | /** | 61 | /** | ||
65 | *@short Sets the first StarBlock in the list to point to the given StarBlock | 62 | * @short Sets the first StarBlock in the list to point to the given StarBlock | ||
66 | * | 63 | * | ||
67 | *This function must ideally be used only once. Also, it does not make a copy | 64 | * This function must ideally be used only once. Also, it does not make a copy | ||
68 | *of the StarBlock supplied, but uses the pointer directly. StarBlockList will | 65 | * of the StarBlock supplied, but uses the pointer directly. StarBlockList will | ||
69 | *take care of deleting the StarBlock when it is destroyed | 66 | * take care of deleting the StarBlock when it is destroyed | ||
70 | * | 67 | * | ||
71 | *@param Pointer to the StarBlock | 68 | * @param Pointer to the StarBlock | ||
72 | */ | 69 | */ | ||
73 | void setStaticBlock(StarBlock *block); | 70 | void setStaticBlock(StarBlock *block); | ||
74 | 71 | | |||
75 | /** | 72 | /** | ||
76 | *@short Drops the StarBlock with the given pointer from the list | 73 | * @short Drops the StarBlock with the given pointer from the list | ||
77 | *@param Pointer to the StarBlock to remove | 74 | * @param Pointer to the StarBlock to remove | ||
78 | *@return Number of entries removed from the QList | 75 | * @return Number of entries removed from the QList | ||
79 | */ | 76 | */ | ||
80 | int releaseBlock(StarBlock *block); | 77 | int releaseBlock(StarBlock *block); | ||
81 | 78 | | |||
82 | /** | 79 | /** | ||
83 | *@short Returns the i-th block in this StarBlockList | 80 | * @short Returns the i-th block in this StarBlockList | ||
84 | * | 81 | * | ||
85 | *@param Index of the required block | 82 | * @param Index of the required block | ||
86 | *@return The StarBlock requested for, nullptr if index out of bounds | 83 | * @return The StarBlock requested for, nullptr if index out of bounds | ||
87 | */ | 84 | */ | ||
88 | inline StarBlock *block(unsigned int i) { return ((i < nBlocks) ? blocks[i] : nullptr); } | 85 | inline StarBlock *block(unsigned int i) { return ((i < nBlocks) ? blocks[i] : nullptr); } | ||
89 | 86 | | |||
90 | /** | 87 | /** | ||
91 | *@return a const reference to the contents of this StarBlockList | 88 | * @return a const reference to the contents of this StarBlockList | ||
92 | */ | 89 | */ | ||
93 | inline const QList<StarBlock *> &contents() const { return blocks; } | 90 | inline const QList<StarBlock *> &contents() const { return blocks; } | ||
94 | 91 | | |||
95 | /** | 92 | /** | ||
96 | *@short Returns the total number of stars in this StarBlockList | 93 | * @short Returns the total number of stars in this StarBlockList | ||
97 | *@return Total number of stars in this StarBlockList | 94 | * @return Total number of stars in this StarBlockList | ||
98 | */ | 95 | */ | ||
99 | inline long getStarCount() const { return nStars; } | 96 | inline long getStarCount() const { return nStars; } | ||
100 | 97 | | |||
101 | /** | 98 | /** | ||
102 | *@short Returns the total number of blocks in theis StarBlockList | 99 | * @short Returns the total number of blocks in theis StarBlockList | ||
103 | *@return Number of blocks in this StarBlockList | 100 | * @return Number of blocks in this StarBlockList | ||
104 | */ | 101 | */ | ||
105 | inline int getBlockCount() const { return nBlocks; } | 102 | inline int getBlockCount() const { return nBlocks; } | ||
106 | 103 | | |||
107 | /** | 104 | /** | ||
108 | *@short Returns the magnitude of the faintest star currently stored | 105 | * @short Returns the magnitude of the faintest star currently stored | ||
109 | *@return Magnitude of faintest star stored in this StarBlockList | 106 | * @return Magnitude of faintest star stored in this StarBlockList | ||
110 | */ | 107 | */ | ||
111 | inline float getFaintMag() const { return faintMag; } | 108 | inline float getFaintMag() const { return faintMag; } | ||
112 | 109 | | |||
113 | /** | 110 | /** | ||
114 | *@short Returns the trixel that this SBL is meant for | 111 | * @short Returns the trixel that this SBL is meant for | ||
115 | *@return The value of trixel | 112 | * @return The value of trixel | ||
116 | */ | 113 | */ | ||
117 | inline Trixel getTrixel() const { return trixel; } | 114 | inline Trixel getTrixel() const { return trixel; } | ||
118 | 115 | | |||
119 | private: | 116 | private: | ||
Context not available. | |||||
126 | bool staticStars; | 123 | bool staticStars; | ||
127 | DeepStarComponent *parent; | 124 | DeepStarComponent *parent; | ||
128 | }; | 125 | }; | ||
129 | | ||||
130 | #endif | | |||
Context not available. |