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

Jason Harris kstars at 30doradus.org
Fri Jan 18 07:49:28 CET 2008


SVN commit 762901 by harris:

Fixing bug #147742: You can now save objects named "star" 
to the observing list.  I have not yet implemented SAO numbers, 
or the ability to add names to objects (it would be better if 
these were filed separately as wishes).

Thanks for the report.

BUG: 147742
CCMAIL: kstars-devel at kde.org



 M  +14 -0     skycomponents/skymapcomposite.cpp  
 M  +16 -2     skycomponents/skymapcomposite.h  
 M  +20 -2     tools/observinglist.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.cpp #762900:762901
@@ -307,6 +307,20 @@
 
 }
 
+SkyObject* SkyMapComposite::starNearest( SkyPoint *p, double &maxrad ) {
+    double rtry = maxrad;
+    SkyObject *star = 0;
+
+    m_skyMesh->aperture( p, maxrad + 1.0, OBJ_NEAREST_BUF);
+
+    star = m_Stars->objectNearest( p, rtry );
+    //reduce rBest by 0.75 for stars brighter than 4th mag
+    if ( star && star->mag() < 4.0 ) rtry *= 0.75;
+
+    maxrad = rtry;
+    return star;
+}
+
 bool SkyMapComposite::addNameLabel( SkyObject *o ) {
     if ( !o ) return false;
     labelObjects().append( o );
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.h #762900:762901
@@ -111,11 +111,25 @@
     	*/
     virtual void draw( QPainter& psky );
 
-    //virtual void draw( );
-
+    /**
+      *@return the object nearest a given point in the sky.
+      *@param p The point to find an object near
+      *@param maxrad The maximum search radius, in Degrees
+			*@note the angular separation to the matched object is returned 
+			*through the maxrad variable.
+      */
     virtual SkyObject* objectNearest( SkyPoint *p, double &maxrad );
 
     /**
+     *@return the star nearest a given point in the sky.
+      *@param p The point to find a star near
+      *@param maxrad The maximum search radius, in Degrees
+			*@note the angular separation to the matched star is returned 
+			*through the maxrad variable.
+      */
+    SkyObject* starNearest( SkyPoint *p, double &maxrad );
+
+    /**
     	*@short Search the children of this SkyMapComposite for 
     	*a SkyObject whose name matches the argument.
     	*
--- trunk/KDE/kdeedu/kstars/kstars/tools/observinglist.cpp #762900:762901
@@ -45,6 +45,7 @@
 #include "skymap.h"
 #include "detaildialog.h"
 #include "tools/altvstime.h"
+#include "Options.h"
 
 #include "indimenu.h"
 #include "indielement.h"
@@ -568,7 +569,20 @@
 
         while ( ! istream.atEnd() ) {
             line = istream.readLine();
-            SkyObject *o = ks->data()->objectNamed( line );
+
+            //If the object is named "star", add it by coordinates
+            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 );
+                double maxrad = 1000.0/Options::zoomFactor();
+								o = ks->data()->skyComposite()->starNearest( &p, maxrad );
+						} else {
+                o = ks->data()->objectNamed( line );
+            }
+
             if ( o ) slotAddObject( o );
         }
 
@@ -640,7 +654,11 @@
     QTextStream ostream(&f);
     ostream << ListName << endl;
     foreach ( SkyObject* o, obsList() ) {
-        ostream << o->name() << endl;
+        if ( o->name() == "star" ) {
+            ostream << o->name() << "  " << o->ra()->Hours() << "  " << o->dec()->Degrees() << endl;
+        } else {
+            ostream << o->name() << endl;
+        }
     }
 
     f.close();


More information about the Kstars-devel mailing list