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

Akarsh Simha akarshsimha at gmail.com
Sun Nov 1 23:59:21 CET 2009


SVN commit 1043604 by asimha:

Backporting fix for missing stars (r1043599) to 4.3 branch

Original commit log:
--------------------
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  


--- branches/KDE/4.3/kdeedu/kstars/kstars/skyobjects/starobject.cpp #1043603:1043604
@@ -576,6 +576,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*/ ) {
 
@@ -583,7 +590,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] );
 
--- branches/KDE/4.3/kdeedu/kstars/kstars/skyobjects/starobject.h #1043603:1043604
@@ -248,6 +248,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