Commit f1be36f3 authored by Akarsh Simha's avatar Akarsh Simha
Browse files

Use KStarsDateTime::stringToEpoch etc. in FocusDialog

parent 3aedbf07
......@@ -103,8 +103,9 @@ void FocusDialog::validatePoint() {
}
Point.set( ra, dec );
double epoch0 = getEpoch( fd->epochBox->text() );
long double jd0 = epochToJd ( epoch0 );
bool ok; // Ignored. FIXME: Make a version of KStarsDateTime::stringToEpoch that doesn't mandate the ok arg
double epoch0 = KStarsDateTime::stringToEpoch( fd->epochBox->text(), ok );
long double jd0 = KStarsDateTime::epochToJd ( epoch0 );
Point.apparentCoord(jd0, ks->data()->ut().djd() );
Point.EquatorialToHorizontal( ks->data()->lst(), ks->data()->geo()->lat() );
......@@ -137,31 +138,6 @@ void FocusDialog::validatePoint() {
}
}
double FocusDialog::getEpoch (const QString &eName) {
//If eName is empty (or not a number) assume 2000.0
bool ok(false);
double epoch = eName.toDouble( &ok );
if ( eName.isEmpty() || ! ok )
return 2000.0;
return epoch;
}
long double FocusDialog::epochToJd (double epoch) {
double yearsTo2000 = 2000.0 - epoch;
if (epoch == 1950.0) {
return 2433282.4235;
} else if ( epoch == 2000.0 ) {
return J2000;
} else {
return ( J2000 - yearsTo2000 * 365.2425 );
}
}
QSize FocusDialog::sizeHint() const
{
return QSize(240,210);
......
......@@ -60,23 +60,6 @@ public:
*/
void activateAzAltPage() const;
/**
*@short Convenience function to convert an epoch number (e.g., 2000.0)
*to the corresponding Julian Day number (e.g., 2451545.0).
*@param epoch the epoch value to be converted.
*FIXME: This should probably move to KStarsDateTime
*/
long double epochToJd (double epoch);
/**
*@short Convert a string to an epoch number; essentially just
*converts the string to a double.
*@param eName the tring representation of the epoch number.
*@return the epoch number described by the string argument.
*FIXME: This should probably move to KStarsDateTime
*/
double getEpoch (const QString &eName);
public slots:
/**If text has been entered in both KLineEdits, enable the Ok button. */
void checkLineEdits();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment