• 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
solarsystemlistcomponent.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  solarsystemlistcomponent.cpp - K Desktop Planetarium
3  -------------------
4  begin : 2005/22/09
5  copyright : (C) 2005 by Jason Harris
6  email : kstars@30doradus.org
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 "solarsystemlistcomponent.h"
19 #include "solarsystemcomposite.h"
20 
21 #include <QPen>
22 #include <klocale.h>
23 
24 #include "Options.h"
25 #include "skyobjects/ksplanet.h"
26 #include "skyobjects/ksplanetbase.h"
27 #include "kstarsdata.h"
28 #include "skymap.h"
29 
30 SolarSystemListComponent::SolarSystemListComponent( SolarSystemComposite *p ) :
31  ListComponent( p ),
32  m_Earth( p->earth() )
33 {}
34 
35 SolarSystemListComponent::~SolarSystemListComponent()
36 {
37  //Object deletes handled by parent class (ListComponent)
38 }
39 
40 void SolarSystemListComponent::update(KSNumbers * ) {
41  if ( selected() ) {
42  KStarsData *data = KStarsData::Instance();
43  foreach ( SkyObject *o, m_ObjectList ) {
44  // FIXME: get rid of cast.
45  KSPlanetBase *p = (KSPlanetBase*)o;
46  p->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
47  }
48  }
49 }
50 
51 void SolarSystemListComponent::updatePlanets(KSNumbers *num ) {
52  if ( selected() ) {
53  KStarsData *data = KStarsData::Instance();
54  foreach ( SkyObject *o, m_ObjectList ) {
55  KSPlanetBase *p = (KSPlanetBase*)o;
56  p->findPosition( num, data->geo()->lat(), data->lst(), m_Earth );
57  p->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
58 
59  if ( p->hasTrail() )
60  p->updateTrail( data->lst(), data->geo()->lat() );
61  }
62  }
63 }
64 
65 
66 void SolarSystemListComponent::drawTrails( SkyPainter *skyp ) {
67  //FIXME: here for all objects trails are drawn this could be source of inefficiency
68  if( selected() )
69  foreach( SkyObject *obj, m_ObjectList )
70  // Will segfault if not TrailObject
71  dynamic_cast<TrailObject*>(obj)->drawTrail(skyp);
72 }
TrailObject::hasTrail
bool hasTrail() const
Definition: trailobject.h:46
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
ksplanetbase.h
KStarsData
KStarsData is the backbone of KStars.
Definition: kstarsdata.h:66
ListComponent::m_ObjectList
QList< SkyObject * > m_ObjectList
Definition: listcomponent.h:64
KStarsData::lst
dms * lst()
Definition: kstarsdata.h:161
KStarsData::Instance
static KStarsData * Instance()
Definition: kstarsdata.h:92
SolarSystemListComponent::updatePlanets
virtual void updatePlanets(KSNumbers *num)
Update the coordinates of the solar system bodies in this component.
Definition: solarsystemlistcomponent.cpp:51
KStarsData::geo
GeoLocation * geo()
Definition: kstarsdata.h:164
TrailObject::updateTrail
void updateTrail(dms *LST, const dms *lat)
update Horizontal coords of the trail
Definition: trailobject.cpp:45
SolarSystemListComponent::SolarSystemListComponent
SolarSystemListComponent(SolarSystemComposite *parent)
Definition: solarsystemlistcomponent.cpp:30
ListComponent
An abstract parent class, to be inherited by SkyComponents that store a QList of SkyObjects.
Definition: listcomponent.h:36
solarsystemcomposite.h
ksplanet.h
SolarSystemListComponent::drawTrails
void drawTrails(SkyPainter *skyp)
Draw trails for objects.
Definition: solarsystemlistcomponent.cpp:66
skymap.h
SolarSystemListComponent::~SolarSystemListComponent
virtual ~SolarSystemListComponent()
Definition: solarsystemlistcomponent.cpp:35
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
Options.h
KSNumbers
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition: ksnumbers.h:43
GeoLocation::lat
const dms * lat() const
Definition: geolocation.h:79
TrailObject
provides a SkyObject with an attachable Trail
Definition: trailobject.h:33
KSPlanetBase
A subclass of TrailObject that provides additional information needed for most solar system objects...
Definition: ksplanetbase.h:63
kstarsdata.h
SkyObject
Provides all necessary information about an object in the sky: its coordinates, name(s), type, magnitude, and QStringLists of URLs for images and webpages regarding the object.
Definition: skyobject.h:46
SkyComponent::selected
virtual bool selected()
Definition: skycomponent.h:79
solarsystemlistcomponent.h
SolarSystemListComponent::update
virtual void update(KSNumbers *num)
Update the sky positions of this component.
Definition: solarsystemlistcomponent.cpp:40
SkyPainter
Draws things on the sky, without regard to backend.
Definition: skypainter.h:47
SolarSystemComposite
The solar system composite manages all planets, asteroids and comets.
Definition: solarsystemcomposite.h:41
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