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

Jason Harris kstars at 30doradus.org
Sun Jan 27 22:11:17 CET 2008


SVN commit 767354 by harris:

Make it possible to save stars with only a genetive name (i.e., 
"sigma orionis") to be saved to an observing list.  The problem was 
that greek letters were saved as "?" to the file.  Now saving the 
short-form genetive name as represented in stars.dat.  This allows us 
to use the StarComponent::findStarByGenetiveName() function to 
retrieve the correct star without looping.

I just commited a similar fix to 3.5 branch, and will now backport it 
to 4.0.

CCMAIL: kstars-devel at kde.org



 M  +18 -5     observinglist.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/tools/observinglist.cpp #767353:767354
@@ -42,6 +42,7 @@
 #include "kstars.h"
 #include "kstarsdata.h"
 #include "skyobject.h"
+#include "starobject.h"
 #include "skymap.h"
 #include "detaildialog.h"
 #include "tools/altvstime.h"
@@ -574,15 +575,19 @@
             SkyObject *o;
             if ( line.startsWith( "star" ) ) {
                 QStringList fields = line.split( " ", QString::SkipEmptyParts );
-								dms ra = dms::fromString( fields[1], false ); //false = hours
-								dms dc = dms::fromString( fields[2], true );  //true  = degrees
-								SkyPoint p( ra, dc );
+                dms ra = dms::fromString( fields[1], false ); //false = hours
+                dms dc = dms::fromString( fields[2], true );  //true  = degrees
+                SkyPoint p( ra, dc );
                 double maxrad = 1000.0/Options::zoomFactor();
-								o = ks->data()->skyComposite()->starNearest( &p, maxrad );
-						} else {
+                o = ks->data()->skyComposite()->starNearest( &p, maxrad );
+            } else {
                 o = ks->data()->objectNamed( line );
             }
 
+            //If we haven't identified the object, try interpreting the 
+            //name as a star's genetive name (with ascii letters)
+            if ( !o ) o = ks->data()->skyComposite()->findStarByGenetiveName( line );
+
             if ( o ) slotAddObject( o );
         }
 
@@ -656,6 +661,14 @@
     foreach ( SkyObject* o, obsList() ) {
         if ( o->name() == "star" ) {
             ostream << o->name() << "  " << o->ra()->Hours() << "  " << o->dec()->Degrees() << endl;
+        } else if ( o->type() == SkyObject::STAR ) {
+            StarObject *s = (StarObject*)o;
+
+            if ( s->name() == s->gname() ) {
+                ostream << s->name2() << endl;
+            } else { 
+                ostream << s->name() << endl;
+            }
         } else {
             ostream << o->name() << endl;
         }


More information about the Kstars-devel mailing list