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

Jasem Mutlaq mutlaqja at ikarustech.com
Wed Jul 27 23:36:53 CEST 2005


SVN commit 439356 by mutlaqja:

- Fixing a few memory issues.
- Adding the ability to center and track telescopes. But there is an odd
  behavior 
  that I cannot explain. I keep a copy of skyobject indi INDIStd class
(telescopeSkyObject) that contains the telescope coordinates and get
updated continuosly. When the user click on Center Telescope, I set the
current clicked point and clicked object in skymap to
telescopeSkyObject, and then I call slotCenter (this is done in
indiproperty.cpp). The sky map does indeed
slew to the telescope and tracking is locked. However, after 10 seconds
or so, the sky map arbitrary flips directions and faces northward.

What are the possible problems? You can try this out by uncommenting the
enableSimulation line in lx200basic.cpp and then using the device
manager to run lx200 basic, connect, then you'll the telescope marker on
the skymap, right click to get the telescope context menu and click
center telescope, and just observe. 

CCMAIL: kstars-devel at kde.org
CCMAIL: dougp at intermind.net


 M  +2 -0      ccdpreviewwg.cpp  
 M  +1 -1      detaildialog.cpp  
 M  +1 -1      indi/lx200basic.cpp  
 M  +1 -1      indi/lx200basic.h  
 M  +13 -0     indiproperty.cpp  
 M  +27 -5     indistd.cpp  
 M  +2 -0      indistd.h  
 M  +15 -1     kspopupmenu.cpp  
 M  +6 -1      skymapdraw.cpp  
 M  +1 -0      streamwg.cpp  
 M  +2 -2      tools/observinglist.cpp  


--- branches/KDE/3.5/kdeedu/kstars/kstars/ccdpreviewwg.cpp #439355:439356
@@ -298,6 +298,8 @@
   if (streamBuffer!=NULL) {
     free(streamBuffer);	  
   }
+
+  delete [] (grayTable);
 }
 
 void CCDVideoWG::newFrame(unsigned char *buffer, int buffSize, int w, int h)
--- branches/KDE/3.5/kdeedu/kstars/kstars/detaildialog.cpp #439355:439356
@@ -990,7 +990,7 @@
                 sp.set (ksw->map()->clickedPoint()->ra(), ksw->map()->clickedPoint()->dec());
 
       	 if (useJ2000)
-            sp.apparentCoord(ksw->data()->ut().djd(), (long double) J2000);
+	    sp.apparentCoord(ksw->data()->ut().djd(), (long double) J2000);
 
     	   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()));
--- branches/KDE/3.5/kdeedu/kstars/kstars/indi/lx200basic.cpp #439355:439356
@@ -1,5 +1,5 @@
 #if 0
-    Astro-Physics driver
+    LX200 Basic Driver
     Copyright (C) 2005 Jasem Mutlaq (mutlaqja at ikarustech.com)
 
     This library is free software; you can redistribute it and/or
--- branches/KDE/3.5/kdeedu/kstars/kstars/indi/lx200basic.h #439355:439356
@@ -1,5 +1,5 @@
 /*
-    Astro-Physics driver
+    LX200 Basic Driver
     Copyright (C) 2005 Jasem Mutlaq (mutlaqja at ikarustech.com)
 
     This library is free software; you can redistribute it and/or
--- branches/KDE/3.5/kdeedu/kstars/kstars/indiproperty.cpp #439355:439356
@@ -19,6 +19,7 @@
  #include "Options.h"
  #include "kstars.h"
  #include "timedialog.h"
+ #include "skymap.h"
 
  #include "indi/base64.h"
  #include "indi/indicom.h"
@@ -78,6 +79,8 @@
       delete (label_w);
       delete (set_w);
       delete (PHBox);
+      delete (indistd);
+      delete (groupB);
 }
 
 bool INDI_P::isOn(QString component)
@@ -212,6 +215,16 @@
    newText();
    return;
  }
+
+ /* Another special case, center telescope */
+ if (assosiatedPopup->text(id) == i18n("Center Telescope"))
+ {
+        if (!indistd->stdDev->dp->isOn()) return;
+	indistd->ksw->map()->setClickedObject(indistd->stdDev->telescopeSkyObject);
+	indistd->ksw->map()->setClickedPoint(indistd->stdDev->telescopeSkyObject);
+	indistd->ksw->map()->slotCenter();
+	return;
+ }
    
  lp = findElement(assosiatedPopup->text(id));
  
--- branches/KDE/3.5/kdeedu/kstars/kstars/indistd.cpp #439355:439356
@@ -72,6 +72,7 @@
 	 
    devTimer 		= new QTimer(this);
    seqLister		= new KDirLister();
+   telescopeSkyObject   = new SkyObject(0, 0, 0, 0, i18n("Telescope"));
    
    connect( devTimer, SIGNAL(timeout()), this, SLOT(timerDone()) );
    connect( seqLister, SIGNAL(newItems (const KFileItemList & )), this, SLOT(checkSeqBoundary(const KFileItemList &)));
@@ -89,6 +90,8 @@
    CCDPreviewWindow->enableStream(false);
    CCDPreviewWindow->close();
    streamDisabled();
+   delete (seqLister);
+   delete (telescopeSkyObject);
  }
  
 void INDIStdDevice::handleBLOB(unsigned char *buffer, int bufferSize, QString dataFormat)
@@ -99,10 +102,6 @@
   else if (dataFormat == ".ccdpreview") dataType = DATA_CCDPREVIEW;	  
   else dataType = DATA_OTHER;
 
-  // FIXME remove this!!
-  if (dataType == DATA_OTHER)
-       return;
-
   if (dataType == DATA_STREAM)
   {
     if (!streamWindow->processStream)
@@ -380,12 +379,32 @@
           CCDPreviewWindow->enableStream(false);
        break;
        
+       case EQUATORIAL_COORD:
+       case EQUATORIAL_EOD_COORD:
+	lp = pp->findElement("RA");
+	if (!lp) return;
+	telescopeSkyObject->setRA(lp->value);
+	lp = pp->findElement("DEC");
+	if (!lp) return;
+	telescopeSkyObject->setDec(lp->value);
+	//telescopeSkyObject->set(telescopeSkyObject->ra(), telescopeSkyObject->dec());
+	break;
+
+	case HORIZONTAL_COORD:
+	lp = pp->findElement("ALT");
+	if (!lp) return;
+	telescopeSkyObject->setAlt(lp->value);
+	lp = pp->findElement("AZ");
+	telescopeSkyObject->setAz(lp->value);
+        //telescopeSkyObject->set(telescopeSkyObject->ra(), telescopeSkyObject->dec());
+	break;
+
     default:
       break;
     }
  
  }
- 
+
  void INDIStdDevice::streamDisabled()
  {
     INDI_P *pp;
@@ -733,7 +752,10 @@
 	kdDebug() << "Az: " << currentObject->az()->toHMSString() << " - Alt " << currentObject->alt()->toDMSString() << endl;
 
 	if (useJ2000)
+	{
+		sp.set(currentObject->ra(), currentObject->dec());
         	sp.apparentCoord( ksw->data()->ut().djd() , (long double) J2000);
+        }
 
        // We need to get from JNow (Skypoint) to J2000
        // The ra0() of a skyPoint is the same as its JNow ra() without this process
--- branches/KDE/3.5/kdeedu/kstars/kstars/indistd.h #439355:439356
@@ -26,6 +26,7 @@
  class QSocketNotifier;
  class KProgressDialog;
  class KDirLister;
+ class SkyObject;
  
  
  /* This class implmements standard properties on the device level*/
@@ -77,6 +78,7 @@
    bool			batchMode;
    bool			ISOMode;
    KDirLister           *seqLister;
+   SkyObject		*telescopeSkyObject;
    
    public slots:
    void timerDone();
--- branches/KDE/3.5/kdeedu/kstars/kstars/kspopupmenu.cpp #439355:439356
@@ -140,7 +140,7 @@
   DeviceManager *mgr;
   INDI_D *dev;
   INDI_G *grp;
-  INDI_P *prop;
+  INDI_P *prop(NULL);
   INDI_E *element;
   int id=0;
 
@@ -205,7 +205,21 @@
 	    
 	    } // end property
 	  } // end group
+
+	// For telescopes, add option to center the telescope position
+	if ( dev->findElem("RA") || dev->findElem("ALT"))
+	{
+		menuDevice->insertSeparator();
+		menuDevice->insertItem(i18n("Center Telescope"), id++);
+                if (dev->findElem("RA"))
+			prop = dev->findElem("RA")->pp;
+ 		else   	
+			prop = dev->findElem("ALT")->pp;
+
+		QObject::connect(menuDevice, SIGNAL(activated(int)), prop, SLOT(convertSwitch(int)));	
+	}
        } // end device
+	
     } // end device manager
 
  return true;
--- branches/KDE/3.5/kdeedu/kstars/kstars/skymapdraw.cpp #439355:439356
@@ -202,6 +202,7 @@
 
 						indi_sp.setAz(azDMS);
 						indi_sp.setAlt(altDMS);
+
 						}
 						else
 						{
@@ -226,9 +227,13 @@
 
 						indi_sp.setRA(raDMS);
 						indi_sp.setDec(decDMS);
-						
+
 						if (useJ2000)
+						{
+							indi_sp.setRA0(raDMS);
+							indi_sp.setDec0(decDMS);
 							indi_sp.apparentCoord( (double) J2000, ksw->data()->ut().djd());
+						}
 							
 						indi_sp.EquatorialToHorizontal( ksw->LST(), ksw->geo()->lat() );
 
--- branches/KDE/3.5/kdeedu/kstars/kstars/streamwg.cpp #439355:439356
@@ -279,6 +279,7 @@
 VideoWG::~VideoWG() 
 {
  delete (streamImage);
+ delete [] (grayTable);
 }
 
 void VideoWG::newFrame(unsigned char *buffer, int buffSiz, int w, int h)
--- branches/KDE/3.5/kdeedu/kstars/kstars/tools/observinglist.cpp #439355:439356
@@ -414,8 +414,8 @@
             else
                 sp.set (ks->map()->clickedPoint()->ra(), ks->map()->clickedPoint()->dec());
 
-      	 if (useJ2000)
-            sp.apparentCoord(ks->data()->ut().djd(), (long double) J2000);
+      	if (useJ2000)
+	    sp.apparentCoord(ks->data()->ut().djd(), (long double) J2000);
 
     	   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()));


More information about the Kstars-devel mailing list