[Kstars-devel] kdeedu/kstars/kstars

Jasem Mutlaq mutlaqja at ikarustech.com
Sat Jan 15 13:27:45 CET 2005


CVS commit by mutlaqja: 

The Scope button in the observing list tool is now functional.

Btw, the observing list tool crashes KStars. The crash occurs in slotClose() function apparently. To get the crash, add objects to the observing list tool, open the tool, remove all objects, then close the dialog.

CCMAIL: kstars-devel at kde.org


  M +1 -1      indi/lx200generic.cpp   1.45
  M +77 -3     tools/observinglist.cpp   1.7


--- kdeedu/kstars/kstars/indi/lx200generic.cpp  #1.44:1.45
@@ -138,5 +138,5 @@ static ISwitchVectorProperty SlewModeSw 
 static ISwitchVectorProperty TrackModeSw  = { mydev, "Tracking Mode", "", MOVE_GROUP, IP_RW, ISR_1OFMANY, 0, IPS_IDLE, TrackModeS, NARRAY(TrackModeS), 0, 0};
 
-static INumber TrackFreq[]  = {{ "trackFreq", "Freq", "%g", 50.0, 80.0, 0.1, 60.1, 0, 0, 0}};
+static INumber TrackFreq[]  = {{ "trackFreq", "Freq", "%g", 56.4, 60.1, 0.1, 60.1, 0, 0, 0}};
 
 static INumberVectorProperty TrackingFreq= { mydev, "Tracking Frequency", "", MOVE_GROUP, IP_RW, 0, IPS_IDLE, TrackFreq, NARRAY(TrackFreq), 0, 0};

--- kdeedu/kstars/kstars/tools/observinglist.cpp  #1.6:1.7
@@ -24,4 +24,6 @@
 #include <kstatusbar.h>
 #include <ktextedit.h>
+#include <kmessagebox.h>
+#include <klineedit.h>
 
 #include "observinglist.h"
@@ -34,4 +36,10 @@
 #include "tools/altvstime.h"
 
+#include "indimenu.h"
+#include "indielement.h"
+#include "indiproperty.h"
+#include "indidevice.h"
+#include "devicemanager.h"
+
 ObservingList::ObservingList( KStars *_ks, QWidget* parent )
                 : KDialogBase( KDialogBase::Plain, i18n( "Observing List" ), 
@@ -258,6 +266,72 @@ void ObservingList::slotCenterObject() {
 }
 
-void ObservingList::slotSlewToObject() {
-        //Needs Jasem  :)
+void ObservingList::slotSlewToObject()
+{
+
+  INDI_D *indidev;
+  INDI_P *eqCoord, *onSet;
+  INDI_E *RAEle, *DecEle, *ConnectEle;
+  bool useJ2000( false);
+  SkyPoint sp;
+  
+  if (obsList.current() == NULL)
+    return;
+  
+  // Find the first device with EQUATORIAL_EOD_COORD or EQUATORIAL_COORD and with SLEW element
+  // i.e. the first telescope we find!
+  
+  INDIMenu *imenu = ks->getINDIMenu();
+  
+  for (unsigned int i=0; i < imenu->mgr.count() ; i++)
+  {
+    for (unsigned int j=0; j < imenu->mgr.at(i)->indi_dev.count(); j++)
+    {
+       indidev = imenu->mgr.at(i)->indi_dev.at(j);
+       eqCoord = indidev->findProp("EQUATORIAL_EOD_COORD");
+       if (eqCoord == NULL)
+       {
+         eqCoord = indidev->findProp("EQUATORIAL_COORD");
+         useJ2000 = true;
+       }
+       
+       if (eqCoord == NULL) continue;
+       
+       ConnectEle = indidev->findElem("CONNECT");
+       if (!ConnectEle) continue;
+       
+       if (ConnectEle->state == PS_OFF)
+       {
+         KMessageBox::error(0, i18n("Telescope %1 is offline. Please connect and retry again.").arg(indidev->label));
+         return;
+       }
+
+       RAEle = eqCoord->findElement("RA");
+       if (!RAEle) continue;
+       DecEle = eqCoord->findElement("DEC");
+       if (!DecEle) continue;
+       
+       onSet = indidev->findProp("ON_COORD_SET");
+       if (!onSet) continue;
+       
+       onSet->activateSwitch("SLEW");
+       
+       sp.set (obsList.current()->ra(), obsList.current()->dec());
+       
+       if (useJ2000)
+         sp.apparentCoord(ks->data()->ut().djd(), (long double) J2000);
+
+           // Use J2000 coordinate as required by INDI
+       RAEle->write_w->setText(QString("%1:%2:%3").arg(sp.ra()->hour()).arg(sp.ra()->minute()).arg(sp.ra()->second()));
+       DecEle->write_w->setText(QString("%1:%2:%3").arg(sp.dec()->degree()).arg(sp.dec()->arcmin()).arg(sp.dec()->arcsec()));
+       
+       eqCoord->newText();
+       
+       return;
+    }
+  }
+       
+  // We didn't find any telescopes
+  KMessageBox::sorry(0, i18n("KStars did not find any active telescopes."));
+  
 }
 
@@ -300,5 +374,5 @@ void ObservingList::saveCurrentUserLog()
                 
                 ui->NotesEdit->clear();
-                ui->NotesLabel->setText( i18n( "observing notes for object:" ) );
+                ui->NotesLabel->setText( i18n( "Observing notes for object:" ) );
                 LogObject = NULL;
         }




More information about the Kstars-devel mailing list