• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • edu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • extragear
  • edu
  • kstars
  • kstars
  • skycomponents
starblock.h
Go to the documentation of this file.
1 /***************************************************************************
2  starblock.h - K Desktop Planetarium
3  -------------------
4  begin : 8 Jun 2008
5  copyright : (C) 2008 by Akarsh Simha
6  email : [email protected]
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #pragma once
19 
20 #include "typedef.h"
21 #include "starblocklist.h"
22 
23 #include <QVector>
24 
25 class StarObject;
26 class StarBlockList;
27 class PointSourceNode;
28 struct StarData;
29 struct DeepStarData;
30 
31 #ifdef KSTARS_LITE
32 #include "starobject.h"
33 
34 struct StarNode
35 {
36  StarNode();
37  ~StarNode();
38 
39  StarObject star;
40  PointSourceNode *starNode;
41 };
42 #endif
43 
53 class StarBlock
54 {
55  public:
56 // StarBlockEntry is the data type held by the StarBlock's QVector
57 #ifdef KSTARS_LITE
58  typedef StarNode StarBlockEntry;
59 #else
60  typedef StarObject StarBlockEntry;
61 #endif
62 
70  explicit StarBlock(int nstars = 100);
71 
72  ~StarBlock() = default;
73 
84  StarBlockEntry *addStar(const StarData &data);
85  StarBlockEntry *addStar(const DeepStarData &data);
86 
92  inline bool isFull() const { return nStars == size(); }
93 
103  inline int size() const { return stars.size(); }
104 
111  inline StarBlockEntry *star(int i) { return &stars[i]; }
112 
119  inline QVector<StarBlockEntry> &contents() { return stars; }
120 
121  // These methods are there because we might want to make faintMag and brightMag private at some point
127  inline float getBrightMag() const { return brightMag; }
128 
134  inline float getFaintMag() const { return faintMag; }
135 
141  inline int getStarCount() const { return nStars; }
142 
144  void reset();
145 
146  float faintMag { 0 };
147  float brightMag { 0 };
148  StarBlockList *parent;
149  std::shared_ptr<StarBlock> prev;
150  std::shared_ptr<StarBlock> next;
151  quint32 drawID { 0 };
152 
153  private:
154  // Disallow copying and assignment. Just in case.
155  StarBlock(const StarBlock &);
156  StarBlock &operator=(const StarBlock &);
157 
159  int nStars { 0 };
161  QVector<StarBlockEntry> stars;
162 };
StarData
A 32-byte Structure that holds star data.
Definition: stardata.h:28
StarBlock::parent
StarBlockList * parent
Definition: starblock.h:148
StarBlock
Holds a block of stars and various peripheral variables to mark its place in data structures...
Definition: starblock.h:53
typedef.h
StarBlock::drawID
quint32 drawID
Definition: starblock.h:151
StarBlock::isFull
bool isFull() const
Returns true if the StarBlock is full.
Definition: starblock.h:92
StarBlock::brightMag
float brightMag
Definition: starblock.h:147
StarBlock::getBrightMag
float getBrightMag() const
Return the magnitude of the brightest star in this StarBlock.
Definition: starblock.h:127
StarBlock::size
int size() const
Return the capacity of this StarBlock.
Definition: starblock.h:103
DeepStarData
A 16-byte structure that holds star data for really faint stars.
Definition: nomadbinfile2mysql.h:37
StarBlock::reset
void reset()
Reset this StarBlock's data, for reuse of the StarBlock.
Definition: starblock.cpp:54
StarBlock::StarBlockEntry
StarObject StarBlockEntry
Definition: starblock.h:60
PointSourceNode
A SkyNode derived class used for displaying PointNode with coordinates provided by SkyObject...
Definition: pointsourcenode.h:37
QVector
StarBlock::faintMag
float faintMag
Definition: starblock.h:146
StarBlock::star
StarBlockEntry * star(int i)
Return the i-th star in this StarBlock.
Definition: starblock.h:111
StarBlock::prev
std::shared_ptr< StarBlock > prev
Definition: starblock.h:149
starobject.h
StarBlockList
Maintains a list of StarBlocks that contain the stars lying in a single trixel.
Definition: starblocklist.h:33
StarBlock::contents
QVector< StarBlockEntry > & contents()
Definition: starblock.h:119
StarBlock::addStar
StarBlockEntry * addStar(const StarData &data)
Initialize another star with data.
Definition: starblock.cpp:96
starblocklist.h
StarBlock::~StarBlock
~StarBlock()=default
StarBlock::StarBlock
StarBlock(int nstars=100)
Constructor.
Definition: starblock.cpp:44
StarObject
This is a subclass of SkyObject.
Definition: starobject.h:43
StarBlock::getFaintMag
float getFaintMag() const
Return the magnitude of the faintest star in this StarBlock.
Definition: starblock.h:134
StarBlock::next
std::shared_ptr< StarBlock > next
Definition: starblock.h:150
StarBlock::getStarCount
int getStarCount() const
Return the number of stars currently filled in this StarBlock.
Definition: starblock.h:141
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Wed Dec 11 2019 07:20:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

edu API Reference

Skip menu "edu API Reference"
  •     core
  • kstars

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal