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

Akarsh Simha akarshsimha at gmail.com
Sun Nov 1 23:41:46 CET 2009


SVN commit 1043599 by asimha:

Ensure that stars with unspecified spectral types / partially
specified spectral types are drawn as well. For the time being, all
stars with undefined spectral classes are drawn with the colors
corresponding to spectral class 'A'.

This fixes the bug that Lukas Middendorf brought up on the mailing
list, regarding stars in M 29.

Many thanks to Lukas, who not only pointed out this hard-to-catch bug,
but also gave me enough information to swat it dead real easy!

CCMAIL: kstars-devel at kde.org



 M  +8 -1      starobject.cpp  
 M  +4 -0      starobject.h  


--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/starobject.cpp #1043598:1043599
@@ -575,6 +575,13 @@
     }
 }
 
+bool StarObject::isSpecType( char c ) {
+    if( c == 'W' || c == 'O' || c == 'B' || c == 'A' || c == 'F' || c == 'G' || c == 'K' || c == 'M' || c == 'R' || c == 'N' || c == 'S' )
+        return true;
+    else
+        return false;
+}
+
 void StarObject::draw( QPainter &psky, float x, float y, float size,
                        bool /*useRealColors*/, int /*scIntensity*/, bool /*showMultiple*/ ) {
 
@@ -582,7 +589,7 @@
     if ( isize >= 14 ) {
         isize = 14;
     }
-    QString imKey = SpType[0] + QString("%1").arg(isize);
+    QString imKey = ( isSpecType( SpType[0] )  ? SpType[0] : ( isSpecType( SpType[1] ) ? SpType[1] : 'A' ) ) + QString("%1").arg(isize);
     float offset = 0.5*StarImage[imKey].width();
     psky.drawPixmap( QPointF(x-offset, y-offset), StarImage[imKey] );
 
--- trunk/KDE/kdeedu/kstars/kstars/skyobjects/starobject.h #1043598:1043599
@@ -246,6 +246,10 @@
         */
     inline bool isVariable() const { return Variability; }
 
+    /**@return true if the passed character is a valid spectral class
+     */
+    bool isSpecType( char c );
+
     //Not using VRange, VPeriod currently (to save memory)
     ///**@short set the range in brightness covered by the star's variability
     //  *@param r the range of brightness, in magnitudes


More information about the Kstars-devel mailing list