[Kstars-devel] KDE/kdeedu/kstars/kstars/tools
Akarsh Simha
akarshsimha at gmail.com
Tue May 19 06:19:53 CEST 2009
SVN commit 969843 by asimha:
Fixing bug 187922. The conjunction tool was using the location set in
KStars ( ksdata->geo() ) rather than using the location set in the
conjunction tool.
This commit implements a method, KSConjunct::setGeoLocation(), that
the conjunctions UI uses to set the geo location.
CCMAIL: kstars-devel at kde.org
BUG: 187922
M +1 -0 conjunctions.cpp
M +13 -7 ksconjunct.cpp
M +11 -0 ksconjunct.h
--- trunk/KDE/kdeedu/kstars/kstars/tools/conjunctions.cpp #969842:969843
@@ -196,6 +196,7 @@
}
QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
KSConjunct ksc;
+ ksc.setGeoLocation( geoPlace );
ComputeStack->setCurrentIndex( 1 );
connect( &ksc, SIGNAL(madeProgress(int)), this, SLOT(showProgress(int)) );
--- trunk/KDE/kdeedu/kstars/kstars/tools/ksconjunct.cpp #969842:969843
@@ -27,9 +27,15 @@
#include "kstarsdata.h"
KSConjunct::KSConjunct() {
+ ksdata = KStarsData::Instance();
+ geoPlace = ksdata->geo();
+}
- ksdata = NULL;
-
+void KSConjunct::setGeoLocation( GeoLocation *geo ) {
+ if( geo != NULL )
+ geoPlace = geo;
+ else
+ geoPlace = KStarsData::Instance()->geo();
}
QMap<long double, dms> KSConjunct::findClosestApproach(SkyObject& Object1, KSPlanetBase& Object2, long double startJD, long double stopJD, dms maxSeparation,bool _opposition) {
@@ -126,23 +132,23 @@
KSPlanet *m_Earth = new KSPlanet( ksdata, I18N_NOOP( "Earth" ), QString(), QColor( "white" ), 12756.28 /*diameter in km*/ );
m_Earth -> findPosition( &num );
- dms LST(ksdata->geo()->GSTtoLST(t.gst()));
+ dms LST(geoPlace->GSTtoLST(t.gst()));
if( Object1->isSolarSystem() ) {
switch( Object1->type() ) {
case 2: {
KSPlanet *Planet = (KSPlanet *)Object1;
- Planet->findPosition(&num, ksdata->geo()->lat(), &LST, (KSPlanetBase *)m_Earth);
+ Planet->findPosition(&num, geoPlace->lat(), &LST, (KSPlanetBase *)m_Earth);
break;
}
case 9: {
KSComet *Comet = (KSComet *)Object1;
- Comet->findPosition(&num, ksdata->geo()->lat(), &LST, (KSPlanetBase *)m_Earth);
+ Comet->findPosition(&num, geoPlace->lat(), &LST, (KSPlanetBase *)m_Earth);
break;
}
case 10: {
KSAsteroid *Asteroid = (KSAsteroid *)Object1;
- Asteroid->findPosition(&num, ksdata->geo()->lat(), &LST, (KSPlanetBase *)m_Earth);
+ Asteroid->findPosition(&num, geoPlace->lat(), &LST, (KSPlanetBase *)m_Earth);
break;
}
}
@@ -150,7 +156,7 @@
else
Object1->updateCoords( &num );
- Object2->findPosition(&num, ksdata->geo()->lat(), &LST, (KSPlanetBase *)m_Earth);
+ Object2->findPosition(&num, geoPlace->lat(), &LST, (KSPlanetBase *)m_Earth);
if(opposition) { Object2->setRA( Object2->ra()->Hours() + 12.0); Object2->setDec( -Object2->dec()->Degrees()); }
dist.setRadians(Object1 -> angularDistanceTo(Object2).radians());
if(opposition) { Object2->setRA( Object2->ra()->Hours() - 12.0); Object2->setDec( -Object2->dec()->Degrees()); }
--- trunk/KDE/kdeedu/kstars/kstars/tools/ksconjunct.h #969842:969843
@@ -61,6 +61,13 @@
~KSConjunct() { }
/**
+ *@short Sets the geographic location to compute conjunctions at
+ *
+ *@param geo Pointer to the GeoLocation object
+ */
+ void setGeoLocation( GeoLocation *geo );
+
+ /**
*@short Compute the closest approach of two planets in the given range
*
*@param Object1 A copy of the class corresponding to one of the two bodies
@@ -90,6 +97,9 @@
*@return The angular distance between the two bodies.
*/
+ // TODO: Make pointers to Object1 and Object2 private objects instead of passing them to the methods again and again.
+ // Should improve performance, at least marginally.
+
dms findDistance(long double jd, SkyObject *Object1, KSPlanetBase *Object2);
/**
@@ -119,6 +129,7 @@
bool opposition;
KStarsData *ksdata;
+ GeoLocation *geoPlace;
};
#endif
More information about the Kstars-devel
mailing list