Git commit 4eed79a103da272d8c9f76c944ba38bb89c986a0 by Khudyakov Alexey. Committed on 27/04/2011 at 16:52. Pushed by khudyakov into branch 'master'. Do not find use and then restore state of the Sun. Create new object and then throw it away M +5 -10 kstars/tools/altvstime.cpp http://commits.kde.org/kstars/4eed79a103da272d8c9f76c944ba38bb89c986a0 diff --git a/kstars/tools/altvstime.cpp b/kstars/tools/altvstime.cpp index bedaab1..fa7b798 100644 --- a/kstars/tools/altvstime.cpp +++ b/kstars/tools/altvstime.cpp @@ -37,7 +37,6 @@ #include "dialogs/locationdialog.h" #include "skyobjects/skypoint.h" #include "skyobjects/skyobject.h" -#include "skycomponents/skymapcomposite.h" #include "avtplotwidget.h" #include "ui_altvstime.h" @@ -468,22 +467,20 @@ double AltVsTime::getEpoch(const QString &eName) void AltVsTime::setDawnDusk() { - KStarsData* data = KStarsData::Instance(); KStarsDateTime today = getDate(); - KSNumbers oldNum( data->ut().djd() ); KSNumbers num( today.djd() ); dms LST = geo->GSTtoLST( today.gst() ); - - SkyObject* o = KStarsData::Instance()->skyComposite()->findByName( "Sun" ); - o->updateCoords( &num, true, geo->lat(), &LST ); + + KSSun sun; + sun.updateCoords( &num, true, geo->lat(), &LST ); double dawn, da, dusk, du, max_alt, min_alt; double last_h = -12.0; - double last_alt = findAltitude( o, last_h ); + double last_alt = findAltitude( &sun, last_h ); dawn = dusk = -13.0; max_alt = -100.0; min_alt = 100.0; for ( double h=-11.95; h<=12.0; h+=0.05 ) { - double alt = findAltitude( o, h ); + double alt = findAltitude( &sun, h ); bool asc = alt - last_alt > 0; if ( alt > max_alt ) max_alt = alt; @@ -499,8 +496,6 @@ void AltVsTime::setDawnDusk() last_alt = alt; } - o->updateCoords( &oldNum, true, data->geo()->lat(), data->lst() ); - if ( dawn < -12.0 || dusk < -12.0 ) { da = -1.0; du = -1.0;