[Kst] extragear/graphics/kst/kst/datasources/healpix

Ted Kisner tskisner.public at gmail.com
Sat Nov 5 06:16:19 CET 2005


SVN commit 477785 by tskisner:

Make sure to use RA/DEC as external default when loading/saving config.  When saving config, remember to swap theta min/max when exporting the internal values, which are in radians.

 M  +16 -12    healpix.cpp  


--- trunk/extragear/graphics/kst/kst/datasources/healpix/healpix.cpp #477784:477785
@@ -1070,11 +1070,11 @@
   _nX = (int)cfg->readNumEntry("Matrix X Dimension", DEFAULT_XDIM);
   _nY = (int)cfg->readNumEntry("Matrix Y Dimension", DEFAULT_YDIM);
   _autoTheta = cfg->readBoolEntry("Theta Autoscale", true);
-  _thetaUnits = cfg->readNumEntry("Theta Units", 0);
+  _thetaUnits = cfg->readNumEntry("Theta Units", HPUNIT_RADEC);
   confThetaMin = (cfg->readEntry("Theta Min", QString::null)).toDouble();
   confThetaMax = (cfg->readEntry("Theta Max", QString::null)).toDouble();
   _autoPhi = cfg->readBoolEntry("Phi Autoscale", true);
-  _phiUnits = cfg->readNumEntry("Phi Units", 0);
+  _phiUnits = cfg->readNumEntry("Phi Units", HPUNIT_RADEC);
   confPhiMin = (cfg->readEntry("Phi Min", QString::null)).toDouble();
   confPhiMax = (cfg->readEntry("Phi Max", QString::null)).toDouble();
   _vecTheta = cfg->readNumEntry("Vector Theta", 0);
@@ -1086,13 +1086,12 @@
   
   // convert the entered range values into radians and 
   // force them to the correct range.
-  
   theta2Internal(_thetaUnits, confThetaMin);
   theta2Internal(_thetaUnits, confThetaMax);
   phi2Internal(_phiUnits, confPhiMin);
   phi2Internal(_phiUnits, confPhiMax);
   
-  //perhaps the user mixed up theta min/max...
+  // swap theta min/max if coordinate system requires it
   if (confThetaMax < confThetaMin) {
     double temp = confThetaMax;
     confThetaMax = confThetaMin;
@@ -1115,12 +1114,18 @@
   
   // export the internal range (in radians) to the
   // selected coordinate system
-  
   theta2External(_thetaUnits, confThetaMin);
   theta2External(_thetaUnits, confThetaMax);
   phi2External(_phiUnits, confPhiMin);
   phi2External(_phiUnits, confPhiMax);
   
+  // swap theta min/max if coordinate system requires it
+  if (confThetaMax < confThetaMin) {
+    double temp = confThetaMax;
+    confThetaMax = confThetaMin;
+    confThetaMin = temp;
+  }
+  
   cfg->setGroup("Healpix General");
   cfg->setGroup(fileName());
   cfg->writeEntry("Matrix X Dimension", _nX);
@@ -1173,20 +1178,19 @@
       _hc->vecPhi->clear();
       _hc->matThetaUnits->insertStringList(unitList);
       _hc->matPhiUnits->insertStringList(unitList);
-      //FIXME change to zero eventually
-      _hc->matThetaUnits->setCurrentItem(2);
-      _hc->matPhiUnits->setCurrentItem(2);
+      _hc->matThetaUnits->setCurrentItem(0);
+      _hc->matPhiUnits->setCurrentItem(0);
       _hc->matDimX->setValue(_cfg->readNumEntry("Matrix X Dimension", DEFAULT_XDIM));
       _hc->matDimY->setValue(_cfg->readNumEntry("Matrix Y Dimension", DEFAULT_YDIM));
       _hc->matThetaAuto->setChecked(_cfg->readBoolEntry("Theta Autoscale", true));
       //FIXME default to RA/DEC for now
       //_hc->matThetaUnits->setCurrentItem(_cfg->readNumEntry("Theta Units", 0));
-      _hc->matThetaUnits->setCurrentItem(_cfg->readNumEntry("Theta Units", 2));
+      _hc->matThetaUnits->setCurrentItem(_cfg->readNumEntry("Theta Units", HPUNIT_RADEC));
       _hc->matThetaMin->setText(_cfg->readEntry("Theta Min", QString::null));
       _hc->matThetaMax->setText(_cfg->readEntry("Theta Max", QString::null));
       _hc->matPhiAuto->setChecked(_cfg->readBoolEntry("Phi Autoscale", true));
       //_hc->matPhiUnits->setCurrentItem(_cfg->readNumEntry("Phi Units", 0));
-      _hc->matPhiUnits->setCurrentItem(_cfg->readNumEntry("Phi Units", 2));
+      _hc->matPhiUnits->setCurrentItem(_cfg->readNumEntry("Phi Units", HPUNIT_RADEC));
       _hc->matPhiMin->setText(_cfg->readEntry("Phi Min", QString::null));
       _hc->matPhiMax->setText(_cfg->readEntry("Phi Max", QString::null));
       _hc->vecTheta->setCurrentItem(_cfg->readNumEntry("Vector Theta", 0));
@@ -1207,11 +1211,11 @@
         _hc->matDimX->setValue(_cfg->readNumEntry("Matrix X Dimension", DEFAULT_XDIM));
         _hc->matDimY->setValue(_cfg->readNumEntry("Matrix Y Dimension", DEFAULT_YDIM));
         _hc->matThetaAuto->setChecked(_cfg->readBoolEntry("Theta Autoscale", true));
-        _hc->matThetaUnits->setCurrentItem(_cfg->readNumEntry("Theta Units", 0));
+        _hc->matThetaUnits->setCurrentItem(_cfg->readNumEntry("Theta Units", HPUNIT_RADEC));
         _hc->matThetaMin->setText(_cfg->readEntry("Theta Min", QString::null));
         _hc->matThetaMax->setText(_cfg->readEntry("Theta Max", QString::null));
         _hc->matPhiAuto->setChecked(_cfg->readBoolEntry("Phi Autoscale", true));
-        _hc->matPhiUnits->setCurrentItem(_cfg->readNumEntry("Phi Units", 0));
+        _hc->matPhiUnits->setCurrentItem(_cfg->readNumEntry("Phi Units", HPUNIT_RADEC));
         _hc->matPhiMin->setText(_cfg->readEntry("Phi Min", QString::null));
         _hc->matPhiMax->setText(_cfg->readEntry("Phi Max", QString::null));
         _hc->vecTheta->setCurrentItem(_cfg->readNumEntry("Vector Theta", 0));


More information about the Kst mailing list