summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-09-25 11:07:20 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-09-28 22:16:22 (GMT)
commit69caa284c81f86204ff4b37b4670c5bb927cb223 (patch)
treeb1c7f66e9f2bba5c08e9b859d5777c90fa8b35ab
parent284282fc64a0a5bf4f2b0e52a466a968c19ec113 (diff)
Avoid resetting "catalog" coordinates if no proper motion was applied
-rw-r--r--kstars/skyobjects/starobject.cpp25
-rw-r--r--kstars/skyobjects/starobject.h3
2 files changed, 19 insertions, 9 deletions
diff --git a/kstars/skyobjects/starobject.cpp b/kstars/skyobjects/starobject.cpp
index 8ec9cbf..71fa2b8 100644
--- a/kstars/skyobjects/starobject.cpp
+++ b/kstars/skyobjects/starobject.cpp
@@ -268,17 +268,25 @@ void StarObject::updateCoords( const KSNumbers *num, bool , const CachingDms*, c
double newRA, newDec;
- getIndexCoords( num, &newRA, &newDec );
- newRA /= 15.0; // getIndexCoords returns in Degrees, while we want the RA in Hours
- setRA0( newRA );
- setDec0( newDec );
+ bool properMotionCorrections = getIndexCoords( num, &newRA, &newDec );
+
+ // FIXME: Find a better way to do this without conditionals etc.
+ // Having the conditional is good so we can use CachingDms on RA0 and Dec0
+ if ( properMotionCorrections ) {
+ newRA /= 15.0; // getIndexCoords returns in Degrees, while we want the RA in Hours
+ setRA0( newRA );
+ setDec0( newDec );
+ }
SkyPoint::updateCoords( num );
- setRA0( saveRA );
- setDec0( saveDec );
+
+ if ( properMotionCorrections ) {
+ setRA0( saveRA );
+ setDec0( saveDec );
+ }
}
-void StarObject::getIndexCoords( const KSNumbers *num, double *ra, double *dec )
+bool StarObject::getIndexCoords( const KSNumbers *num, double *ra, double *dec )
{
static double pmms;
@@ -299,7 +307,7 @@ void StarObject::getIndexCoords( const KSNumbers *num, double *ra, double *dec )
// Ignore corrections
*ra = ra0().Degrees();
*dec = dec0().Degrees();
- return;
+ return false;
}
double pm = pmMagnitude() * num->julianMillenia(); // Proper Motion in arcseconds
@@ -337,6 +345,7 @@ void StarObject::getIndexCoords( const KSNumbers *num, double *ra, double *dec )
// *ra = ra0().Degrees() + dra;
// *dec = dec0().Degrees() + ddec;
+ return true;
}
void StarObject::JITupdate()
diff --git a/kstars/skyobjects/starobject.h b/kstars/skyobjects/starobject.h
index 08a94c1..f9c3721 100644
--- a/kstars/skyobjects/starobject.h
+++ b/kstars/skyobjects/starobject.h
@@ -168,9 +168,10 @@ public:
* motion correction but without precesion and its friends. It is used
* in StarComponent to re-index all the stars.
*
+ * @return true if we changed the coordinates, false otherwise
* NOTE: ra and dec both in degrees.
*/
- void getIndexCoords( const KSNumbers *num, double *ra, double *dec );
+ bool getIndexCoords( const KSNumbers *num, double *ra, double *dec );
/** @short added for JIT updates from both StarComponent and ConstellationLines */
void JITupdate();