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

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
  • skycomponents
starblock.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  starblock.cpp - K Desktop Planetarium
3  -------------------
4  begin : 9 Jun 2008
5  copyright : (C) 2008 by Akarsh Simha
6  email : akarshsimha@gmail.com
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 #include "starblock.h"
19 #include "skyobjects/starobject.h"
20 #include "starcomponent.h"
21 #include "skyobjects/stardata.h"
22 #include "skyobjects/deepstardata.h"
23 
24 #include <kdebug.h>
25 
26 
27 StarBlock::StarBlock( int nstars ) :
28  faintMag(-5),
29  brightMag(35),
30  parent(0),
31  prev(0),
32  next(0),
33  drawID(0),
34  nStars(0),
35  stars(nstars, StarObject())
36 { }
37 
38 
39 void StarBlock::reset()
40 {
41  if( parent )
42  parent->releaseBlock( this );
43  parent = NULL;
44  faintMag = -5.0;
45  brightMag = 35.0;
46  nStars = 0;
47 }
48 
49 StarBlock::~StarBlock()
50 {
51  if( parent )
52  parent -> releaseBlock( this );
53 }
54 
55 StarObject* StarBlock::addStar(const starData& data)
56 {
57  if(isFull())
58  return 0;
59  StarObject& star = stars[nStars++];
60 
61  star.init(&data);
62  if( star.mag() > faintMag )
63  faintMag = star.mag();
64  if( star.mag() < brightMag )
65  brightMag = star.mag();
66  return &star;
67 }
68 
69 StarObject* StarBlock::addStar(const deepStarData& data)
70 {
71  if(isFull())
72  return 0;
73  StarObject& star = stars[nStars++];
74 
75  star.init(&data);
76  if( star.mag() > faintMag )
77  faintMag = star.mag();
78  if( star.mag() < brightMag )
79  brightMag = star.mag();
80  return &star;
81 }
deepStarData
Structure that holds star data for really faint stars.
Definition: deepstardata.h:28
starData
Structure that holds star data.
Definition: stardata.h:28
StarBlock::parent
StarBlockList * parent
Definition: starblock.h:119
starcomponent.h
deepstardata.h
starblock.h
StarBlock::~StarBlock
~StarBlock()
Destructor Deletes all stored stars.
Definition: starblock.cpp:49
StarBlock::star
StarObject * star(int i)
Return the i-th star in this StarBlock.
Definition: starblock.h:89
stardata.h
StarBlock::isFull
bool isFull()
Returns true if the StarBlock is full.
Definition: starblock.h:70
StarBlock::brightMag
float brightMag
Definition: starblock.h:118
StarBlock::reset
void reset()
Reset this StarBlock's data, for reuse of the StarBl.
Definition: starblock.cpp:39
SkyObject::mag
float mag(void) const
Definition: skyobject.h:182
StarBlock::faintMag
float faintMag
Definition: starblock.h:117
StarObject::init
void init(const starData *stardata)
Initializes a StarObject to given data.
Definition: starobject.cpp:133
StarBlockList::releaseBlock
int releaseBlock(StarBlock *block)
Drops the StarBlock with the given pointer from the list.
Definition: starblocklist.cpp:43
starobject.h
StarBlock::StarBlock
StarBlock(int nstars=100)
Constructor Initializes values of various parameters and creates nstars number of stars...
Definition: starblock.cpp:27
StarObject
This is a subclass of SkyObject.
Definition: starobject.h:41
StarBlock::addStar
StarObject * addStar(const starData &data)
Initialize another star with data.
Definition: starblock.cpp:55
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:21 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
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

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