summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-09-28 07:08:00 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-09-28 11:54:01 (GMT)
commitf1be36f39a00d3c86c5a192dba28136191ba2ddc (patch)
tree3d2e16f92ab292e47da7293d720c8af24413eaa8
parent3aedbf074e715bd233c584f5c0161dc824c8c1ae (diff)
Use KStarsDateTime::stringToEpoch etc. in FocusDialog
-rw-r--r--kstars/dialogs/focusdialog.cpp30
-rw-r--r--kstars/dialogs/focusdialog.h17
2 files changed, 3 insertions, 44 deletions
diff --git a/kstars/dialogs/focusdialog.cpp b/kstars/dialogs/focusdialog.cpp
index c9ceb89..78f1c79 100644
--- a/kstars/dialogs/focusdialog.cpp
+++ b/kstars/dialogs/focusdialog.cpp
@@ -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);
diff --git a/kstars/dialogs/focusdialog.h b/kstars/dialogs/focusdialog.h
index 8f86111..8256ef5 100644
--- a/kstars/dialogs/focusdialog.h
+++ b/kstars/dialogs/focusdialog.h
@@ -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();