[Kstars-devel] KDE/kdeedu/kstars/kstars
Jason Harris
kstars at 30doradus.org
Sat Dec 9 16:20:11 CET 2006
SVN commit 611823 by harris:
Fixing some issues with updating of solar system objects.
The biggest problem was that the Jupiter Moons were never
having EquatorialToHorizontal() called.
CCMAIL: kstars-devel at kde.org
M +8 -8 kstarsdata.cpp
M +8 -2 skycomponents/jupitermoonscomponent.cpp
M +1 -0 skycomponents/jupitermoonscomponent.h
M +3 -1 skycomponents/skymapcomposite.cpp
M +11 -0 skycomponents/solarsystemcomposite.cpp
M +2 -0 skycomponents/solarsystemcomposite.h
M +9 -0 skycomponents/solarsystemlistcomponent.cpp
M +2 -0 skycomponents/solarsystemlistcomponent.h
M +5 -0 skycomponents/solarsystemsinglecomponent.cpp
M +2 -0 skycomponents/solarsystemsinglecomponent.h
--- trunk/KDE/kdeedu/kstars/kstars/kstarsdata.cpp #611822:611823
@@ -276,35 +276,35 @@
if ( fabs( ut().djd() - LastNumUpdate.djd() ) > 1.0 ) {
LastNumUpdate = ut().djd();
//TIMING
- t.start();
+ // t.start();
skyComposite()->update( this, &num );
//TIMING
- kDebug() << QString("SkyMapComposite::update() took %1 ms").arg(t.elapsed()) << endl;
+ // kDebug() << QString("SkyMapComposite::update() took %1 ms").arg(t.elapsed()) << endl;
}
if ( fabs( ut().djd() - LastPlanetUpdate.djd() ) > 0.01 ) {
LastPlanetUpdate = ut().djd();
//TIMING
- t.start();
+ // t.start();
skyComposite()->updatePlanets( this, &num );
//TIMING
- kDebug() << QString("SkyMapComposite::updatePlanets() took %1 ms").arg(t.elapsed()) << endl;
+ // kDebug() << QString("SkyMapComposite::updatePlanets() took %1 ms").arg(t.elapsed()) << endl;
}
// Moon moves ~30 arcmin/hr, so update its position every minute.
if ( fabs( ut().djd() - LastMoonUpdate.djd() ) > 0.00069444 ) {
LastMoonUpdate = ut();
//TIMING
- t.start();
+ // t.start();
skyComposite()->updateMoons( this, &num );
//TIMING
- kDebug() << QString("SkyMapComposite::updateMoons() took %1 ms").arg(t.elapsed()) << endl;
+ // kDebug() << QString("SkyMapComposite::updateMoons() took %1 ms").arg(t.elapsed()) << endl;
}
//Update Alt/Az coordinates. Timescale varies with zoom level
@@ -312,7 +312,7 @@
if ( fabs( ut().djd() - LastSkyUpdate.djd() ) > 0.25/Options::zoomFactor() || clock()->isManualMode() ) {
LastSkyUpdate = ut();
//TIMING
- t.start();
+ // t.start();
skyComposite()->update( this ); //omit KSNumbers arg == just update Alt/Az coords
@@ -320,7 +320,7 @@
skymap->updateFocus();
//TIMING
- kDebug() << QString("SkyMapComposite::update() for Alt/Az took %1 ms").arg(t.elapsed()) << endl;
+ // kDebug() << QString("SkyMapComposite::update() for Alt/Az took %1 ms").arg(t.elapsed()) << endl;
if ( clock()->isManualMode() )
QTimer::singleShot( 0, skymap, SLOT( forceUpdateNow() ) );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/jupitermoonscomponent.cpp #611822:611823
@@ -44,12 +44,17 @@
jmoons = new JupiterMoons();
}
+void JupiterMoonsComponent::update( KStarsData *data, KSNumbers * )
+{
+ if ( visible() )
+ jmoons->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
+}
+
void JupiterMoonsComponent::updateMoons( KStarsData *, KSNumbers *num )
{
//TODO findPosition should named updatePosition
- if ( visible() )
+ if ( visible() )
jmoons->findPosition( num, (KSPlanet*)(parent()->findByName("Jupiter")), (KSSun*)(parent()->findByName( "Sun" )) );
-
}
void JupiterMoonsComponent::draw(KStars *ks, QPainter& psky, double scale)
@@ -72,6 +77,7 @@
for ( unsigned int i=0; i<4; ++i )
{
QPointF o = map->toScreen( jmoons->pos(i), scale );
+
if ( ( o.x() >= 0. && o.x() <= Width && o.y() >= 0. && o.y() <= Height ) )
{
if ( jmoons->z(i) < 0.0 ) //Moon is nearer than Jupiter
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/jupitermoonscomponent.h #611822:611823
@@ -62,6 +62,7 @@
*/
virtual void init(KStarsData *data);
+ virtual void update( KStarsData *data, KSNumbers *num );
virtual void updateMoons( KStarsData *data, KSNumbers *num );
private:
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.cpp #611822:611823
@@ -104,7 +104,9 @@
m_CustomCatalogs->update( data, num );
//10. Stars
m_Stars->update( data, num );
- //11. Horizn
+ //12. Solar system
+ m_SolarSystem->update( data, num );
+ //12. Horizon
m_Horizon->update( data, num );
}
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemcomposite.cpp #611822:611823
@@ -76,6 +76,17 @@
SkyComposite::init(data);
}
+void SolarSystemComposite::update( KStarsData *data, KSNumbers *num )
+{
+ m_Sun->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
+ m_Moon->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
+ m_JupiterMoons->update( data, num );
+
+ foreach ( SkyComponent *comp, components() ) {
+ comp->update( data, num );
+ }
+}
+
void SolarSystemComposite::updatePlanets( KStarsData *data, KSNumbers *num )
{
m_Earth->findPosition( num );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemcomposite.h #611822:611823
@@ -49,6 +49,8 @@
virtual void init(KStarsData *data);
+ virtual void update( KStarsData *data, KSNumbers *num );
+
virtual void updatePlanets( KStarsData *data, KSNumbers *num );
virtual void updateMoons( KStarsData *data, KSNumbers *num );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemlistcomponent.cpp #611822:611823
@@ -41,6 +41,15 @@
//Object deletes handled by parent class (ListComponent)
}
+void SolarSystemListComponent::update(KStarsData *data, KSNumbers *num ) {
+ if ( visible() ) {
+ foreach ( SkyObject *o, objectList() ) {
+ KSPlanetBase *p = (KSPlanetBase*)o;
+ p->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
+ }
+ }
+}
+
void SolarSystemListComponent::updatePlanets(KStarsData *data, KSNumbers *num ) {
if ( visible() ) {
foreach ( SkyObject *o, objectList() ) {
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemlistcomponent.h #611822:611823
@@ -35,6 +35,8 @@
SolarSystemListComponent( SolarSystemComposite *parent, bool (*visibleMethod)(), int msize);
~SolarSystemListComponent();
+ virtual void update( KStarsData *data, KSNumbers *num );
+
/**
*@short Update the coordinates of the solar system bodies in this component.
*
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemsinglecomponent.cpp #611822:611823
@@ -51,6 +51,11 @@
objectNames().append( ksp()->longname() );
}
+void SolarSystemSingleComponent::update(KStarsData *data, KSNumbers *num) {
+ if ( visible() )
+ ksp()->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
+}
+
void SolarSystemSingleComponent::updatePlanets(KStarsData *data, KSNumbers *num) {
if ( visible() ) {
ksp()->findPosition( num, data->geo()->lat(), data->lst(), earth() );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/solarsystemsinglecomponent.h #611822:611823
@@ -53,6 +53,8 @@
*/
virtual void init(KStarsData *data);
+ virtual void update( KStarsData *data, KSNumbers *num );
+
/**
*@short Update the coordinates of the planet.
*
More information about the Kstars-devel
mailing list