• 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
solarsystemcomposite.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  solarsystemcomposite.h - K Desktop Planetarium
3  -------------------
4  begin : 2005/01/09
5  copyright : (C) 2005 by Thomas Kabelmann
6  email : thomas.kabelmann@gmx.de
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 "solarsystemcomposite.h"
19 
20 #include <klocale.h>
21 
22 #include "solarsystemsinglecomponent.h"
23 #include "asteroidscomponent.h"
24 #include "cometscomponent.h"
25 #include "skycomponent.h"
26 
27 #include "Options.h"
28 #include "skymap.h"
29 #include "kstarsdata.h"
30 #include "ksnumbers.h"
31 #include "skyobjects/ksplanet.h"
32 #include "skyobjects/kssun.h"
33 #include "skyobjects/ksmoon.h"
34 #include "skyobjects/kspluto.h"
35 #include "planetmoonscomponent.h"
36 
37 SolarSystemComposite::SolarSystemComposite(SkyComposite *parent ) :
38  SkyComposite(parent)
39 {
40  emitProgressText( i18n("Loading solar system" ) );
41  m_Earth = new KSPlanet( I18N_NOOP( "Earth" ), QString(), QColor( "white" ), 12756.28 /*diameter in km*/ );
42 
43  m_Sun = new KSSun();
44  addComponent( new SolarSystemSingleComponent( this, m_Sun, Options::showSun ) );
45  m_Moon = new KSMoon();
46  addComponent( new SolarSystemSingleComponent( this, m_Moon, Options::showMoon ) );
47  addComponent( new SolarSystemSingleComponent( this, new KSPlanet( KSPlanetBase::MERCURY ), Options::showMercury ) );
48  addComponent( new SolarSystemSingleComponent( this, new KSPlanet( KSPlanetBase::VENUS ), Options::showVenus ) );
49  addComponent( new SolarSystemSingleComponent( this, new KSPlanet( KSPlanetBase::MARS ), Options::showMars ) );
50  SolarSystemSingleComponent *jup = new SolarSystemSingleComponent( this, new KSPlanet( KSPlanetBase::JUPITER ), Options::showJupiter );
51  addComponent( jup );
52  m_JupiterMoons = new PlanetMoonsComponent( this, jup, KSPlanetBase::JUPITER);
53  addComponent( m_JupiterMoons );
54  SolarSystemSingleComponent *sat = new SolarSystemSingleComponent( this, new KSPlanet( KSPlanetBase::SATURN ), Options::showSaturn );
55  addComponent( sat );
56  addComponent( new SolarSystemSingleComponent( this, new KSPlanet( KSPlanetBase::URANUS ), Options::showUranus ) );
57  addComponent( new SolarSystemSingleComponent( this, new KSPlanet( KSPlanetBase::NEPTUNE ), Options::showNeptune ) );
58  addComponent( new SolarSystemSingleComponent( this, new KSPluto(), Options::showPluto ) );
59 
60  addComponent( m_AsteroidsComponent = new AsteroidsComponent( this ));
61  addComponent( m_CometsComponent = new CometsComponent( this ));
62 }
63 
64 SolarSystemComposite::~SolarSystemComposite()
65 {
66  delete m_Earth;
67 }
68 
69 bool SolarSystemComposite::selected()
70 {
71  return Options::showSolarSystem() &&
72  !( Options::hideOnSlew() && Options::hidePlanets() && SkyMap::IsSlewing() );
73 }
74 
75 void SolarSystemComposite::update( KSNumbers *num )
76 {
77  // if ( ! selected() ) return;
78 
79  KStarsData *data = KStarsData::Instance();
80  m_Sun->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
81  m_Moon->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
82  m_JupiterMoons->update( num );
83 
84  foreach ( SkyComponent *comp, components() ) {
85  comp->update( num );
86  }
87 }
88 
89 void SolarSystemComposite::updatePlanets( KSNumbers *num )
90 {
91  m_Earth->findPosition( num );
92  foreach ( SkyComponent *comp, components() ) {
93  comp->updatePlanets( num );
94  }
95 }
96 
97 void SolarSystemComposite::updateMoons( KSNumbers *num )
98 {
99  // if ( ! selected() ) return;
100  KStarsData *data = KStarsData::Instance();
101  m_Sun->findPosition( num );
102  m_Moon->findPosition( num, data->geo()->lat(), data->lst() );
103  m_Moon->findPhase();
104  m_JupiterMoons->updateMoons( num );
105 }
106 
107 void SolarSystemComposite::drawTrails( SkyPainter* skyp )
108 {
109  if( selected() )
110  foreach( SkyComponent *comp, components() )
111  comp->drawTrails( skyp );
112 }
113 
114 const QList<SkyObject*>& SolarSystemComposite::asteroids() const {
115  return m_AsteroidsComponent->objectList();
116 }
117 
118 const QList<SkyObject*>& SolarSystemComposite::comets() const {
119  return m_CometsComponent->objectList();
120 }
121 
122 CometsComponent* SolarSystemComposite::cometsComponent()
123 {
124  return m_CometsComponent;
125 }
126 
127 AsteroidsComponent* SolarSystemComposite::asteroidsComponent()
128 {
129  return m_AsteroidsComponent;
130 }
Options::showMercury
static bool showMercury()
Get Draw Mercury in the sky map?
Definition: Options.h:2025
KSPlanetBase::findPosition
void findPosition(const KSNumbers *num, const dms *lat=0, const dms *LST=0, const KSPlanetBase *Earth=0)
Find position, including correction for Figure-of-the-Earth.
Definition: ksplanetbase.cpp:122
SkyComponent::updatePlanets
virtual void updatePlanets(KSNumbers *)
Definition: skycomponent.h:75
SolarSystemComposite::~SolarSystemComposite
~SolarSystemComposite()
Definition: solarsystemcomposite.cpp:64
Options::showNeptune
static bool showNeptune()
Get Draw Neptune in the sky map?
Definition: Options.h:2139
SolarSystemComposite::drawTrails
void drawTrails(SkyPainter *skyp)
Draw trails for objects.
Definition: solarsystemcomposite.cpp:107
KStarsData
KStarsData is the backbone of KStars.
Definition: kstarsdata.h:66
KSPlanetBase::NEPTUNE
Definition: ksplanetbase.h:82
KSPlanet
A subclass of KSPlanetBase for seven of the major planets in the solar system (Earth and Pluto have t...
Definition: ksplanet.h:40
solarsystemsinglecomponent.h
KSSun
Child class of KSPlanetBase; encapsulates information about the Sun.
Definition: kssun.h:31
SolarSystemComposite::comets
const QList< SkyObject * > & comets() const
Definition: solarsystemcomposite.cpp:118
KSPlanetBase::JUPITER
Definition: ksplanetbase.h:82
KStarsData::lst
dms * lst()
Definition: kstarsdata.h:161
KStarsData::Instance
static KStarsData * Instance()
Definition: kstarsdata.h:92
SolarSystemComposite::updateMoons
virtual void updateMoons(KSNumbers *num)
Definition: solarsystemcomposite.cpp:97
SkyComponent
SkyComponent represents an object on the sky map.
Definition: skycomponent.h:44
KStarsData::geo
GeoLocation * geo()
Definition: kstarsdata.h:164
CometsComponent
This class encapsulates the Comets.
Definition: cometscomponent.h:33
PlanetMoonsComponent::updateMoons
virtual void updateMoons(KSNumbers *num)
Definition: planetmoonscomponent.cpp:76
SolarSystemComposite::asteroidsComponent
AsteroidsComponent * asteroidsComponent()
Definition: solarsystemcomposite.cpp:127
KSPlanetBase::MERCURY
Definition: ksplanetbase.h:82
Options::hideOnSlew
static bool hideOnSlew()
Get Hide objects while moving?
Definition: Options.h:1094
KSMoon::findPhase
virtual void findPhase(const KSSun *Sun=0)
Determine the phase angle of the moon, and assign the appropriate moon image.
Definition: ksmoon.cpp:243
solarsystemcomposite.h
ksplanet.h
SkyComposite::addComponent
void addComponent(SkyComponent *comp)
Add a new sub component to the composite comp Pointer to the SkyComponent to be added.
Definition: skycomposite.cpp:31
SolarSystemComposite::update
virtual void update(KSNumbers *num)
Delegate update-position requests to all sub components.
Definition: solarsystemcomposite.cpp:75
kspluto.h
SolarSystemComposite::selected
bool selected()
Definition: solarsystemcomposite.cpp:69
SolarSystemComposite::updatePlanets
virtual void updatePlanets(KSNumbers *num)
Definition: solarsystemcomposite.cpp:89
PlanetMoonsComponent::update
virtual void update(KSNumbers *num)
Update the sky position(s) of this component.
Definition: planetmoonscomponent.cpp:69
Options::showSolarSystem
static bool showSolarSystem()
Get Meta-option for all planets in the sky map.
Definition: Options.h:1930
Options::showSaturn
static bool showSaturn()
Get Draw Saturn in the sky map?
Definition: Options.h:2101
KSPlanetBase::MARS
Definition: ksplanetbase.h:82
skymap.h
Options::showJupiter
static bool showJupiter()
Get Draw Jupiter in the sky map?
Definition: Options.h:2082
Options::showMoon
static bool showMoon()
Get Draw Moon in the sky map?
Definition: Options.h:2006
ListComponent::objectList
const QList< SkyObject * > & objectList() const
Definition: listcomponent.h:61
Options::showMars
static bool showMars()
Get Draw Mars in the sky map?
Definition: Options.h:2063
ksnumbers.h
Options::showUranus
static bool showUranus()
Get Draw Uranus in the sky map?
Definition: Options.h:2120
SolarSystemComposite::asteroids
const QList< SkyObject * > & asteroids() const
Definition: solarsystemcomposite.cpp:114
skycomponent.h
SkyComposite
SkyComposite is a kind of container class for SkyComponent objects.
Definition: skycomposite.h:43
planetmoonscomponent.h
SkyPoint::EquatorialToHorizontal
void EquatorialToHorizontal(const dms *LST, const dms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates, given the local sidereal time and the observer's latitude.
Definition: skypoint.cpp:55
SkyComposite::components
QList< SkyComponent * > & components()
Definition: skycomposite.h:103
KSPlanetBase::SATURN
Definition: ksplanetbase.h:82
Options.h
KSNumbers
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition: ksnumbers.h:43
SkyComponent::update
virtual void update(KSNumbers *)
Update the sky position(s) of this component.
Definition: skycomponent.h:74
kssun.h
GeoLocation::lat
const dms * lat() const
Definition: geolocation.h:79
KSMoon
A subclass of SkyObject that provides information needed for the Moon.
Definition: ksmoon.h:36
asteroidscomponent.h
SolarSystemComposite::SolarSystemComposite
SolarSystemComposite(SkyComposite *parent)
Definition: solarsystemcomposite.cpp:37
PlanetMoonsComponent
Represents the planetmoons on the sky map.
Definition: planetmoonscomponent.h:41
cometscomponent.h
SkyMap::IsSlewing
static bool IsSlewing()
Definition: skymap.h:91
SolarSystemSingleComponent
This class encapsulates some methods which are shared between all single-object solar system componen...
Definition: solarsystemsinglecomponent.h:40
ksmoon.h
Options::showVenus
static bool showVenus()
Get Draw Venus in the sky map?
Definition: Options.h:2044
AsteroidsComponent
Represents the asteroids on the sky map.
Definition: asteroidscomponent.h:32
SkyComponent::emitProgressText
virtual void emitProgressText(const QString &message)
Emit signal about progress.
Definition: skycomponent.cpp:35
kstarsdata.h
SolarSystemComposite::cometsComponent
CometsComponent * cometsComponent()
Definition: solarsystemcomposite.cpp:122
KSPlanetBase::VENUS
Definition: ksplanetbase.h:82
Options::hidePlanets
static bool hidePlanets()
Get Hide solar system objects while moving?
Definition: Options.h:1303
Options::showPluto
static bool showPluto()
Get Draw Pluto in the sky map?
Definition: Options.h:2158
KSPlanetBase::URANUS
Definition: ksplanetbase.h:82
Options::showSun
static bool showSun()
Get Draw Sun in the sky map?
Definition: Options.h:1987
SkyPainter
Draws things on the sky, without regard to backend.
Definition: skypainter.h:47
QList
KSPluto
A subclass of KSAsteroid that represents the planet Pluto.
Definition: kspluto.h:43
SkyComponent::drawTrails
virtual void drawTrails(SkyPainter *skyp)
Draw trails for objects.
Definition: skycomponent.cpp:47
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