[Kstars-devel] KDE/kdeedu/kstars/kstars/skyobjects

Alexey Khudyakov alexey.skladnoy at gmail.com
Wed Jun 24 14:58:54 CEST 2009


SVN commit 986275 by khudyakov:

Make KSPlanetBase::findPhase virtual function.

It much more robust that mechnism based on checking whether
type() == SkyObject::MOON

CCMAIL: kstars-devel at kde.org



 M  +1 -1      ksmoon.h  
 M  +1 -6      ksplanetbase.cpp  
 M  +1 -1      ksplanetbase.h  


--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/ksmoon.h #986274:986275
@@ -50,7 +50,7 @@
      *moon image
      *@note Overrides KSPlanetBase::findPhase()
      */
-    void findPhase();
+    virtual void findPhase();
 
     /**@return the illuminated fraction of the Moon as seen from Earth
     	*/
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/ksplanetbase.cpp #986274:986275
@@ -127,12 +127,7 @@
 void KSPlanetBase::findPosition( const KSNumbers *num, const dms *lat, const dms *LST, const KSPlanetBase *Earth ) {
     // DEBUG edit
     findGeocentricPosition( num, Earth );  //private function, reimplemented in each subclass
-    if( type() == SkyObject::MOON ) { // Required till we make KSSun singleton and re-implement KSPlanetBase::findPhase()
-        KSMoon *me = (KSMoon *)this;
-        me->findPhase(); // Find the phase.
-    }
-    else
-        findPhase();
+    findPhase();
     setAngularSize( asin(physicalSize()/Rearth/AU_KM)*60.*180./dms::PI ); //angular size in arcmin
 
     if ( lat && LST )
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/ksplanetbase.h #986274:986275
@@ -305,7 +305,7 @@
     /**
      * Determine the phase of the planet.
      */
-    void findPhase();
+    virtual void findPhase();
 
     // Geocentric ecliptic position, but distance to the Sun
     EclipticPosition ep;


More information about the Kstars-devel mailing list