summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-08-31 18:49:19 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-08-31 18:49:19 (GMT)
commit8c46826b77c1705a5702a6901a96baf3e837aace (patch)
tree60774020ed7bc97e7f0098ba0e99c2cb5fc8a451
parentcc9f1d2497abee56e8d3bc76cf74068489ebc67f (diff)
downloadblt-8c46826b77c1705a5702a6901a96baf3e837aace.zip
blt-8c46826b77c1705a5702a6901a96baf3e837aace.tar.gz
blt-8c46826b77c1705a5702a6901a96baf3e837aace.tar.bz2
clean up wcs code
-rw-r--r--ds9/library/markerbasepanda.tcl7
-rw-r--r--tksao/frame/frmarker.C66
2 files changed, 38 insertions, 35 deletions
diff --git a/ds9/library/markerbasepanda.tcl b/ds9/library/markerbasepanda.tcl
index 4b260a4..363dd7c 100644
--- a/ds9/library/markerbasepanda.tcl
+++ b/ds9/library/markerbasepanda.tcl
@@ -141,6 +141,9 @@ proc MarkerBasePandaGenerateAngles {varname} {
upvar #0 $varname var
global $varname
+ global pds9
+ set prec [expr $pds9(prec,angle)-3]
+
$var(angtxt) delete 1.0 end
set ang1 $var(ang1)
@@ -175,8 +178,8 @@ proc MarkerBasePandaGenerateAngles {varname} {
}
for {set i 0} {$i<=$angnum} {incr i} {
- set v [expr ((($ang2-$ang1)/double($angnum))*$i)+$ang1]
- $var(angtxt) insert end "$v\n"
+ set vv [expr ((($ang2-$ang1)/double($angnum))*$i)+$ang1]
+ $var(angtxt) insert end "[format %.${prec}f $vv]\n"
}
}
}
diff --git a/tksao/frame/frmarker.C b/tksao/frame/frmarker.C
index 3f9695d..3b750ca 100644
--- a/tksao/frame/frmarker.C
+++ b/tksao/frame/frmarker.C
@@ -1126,25 +1126,25 @@ void Base::getMarkerBpandaAnglesCmd(int id)
}
}
-void Base::getMarkerBpandaAnglesCmd(int id, Coord::CoordSystem sys, Coord::SkyFrame sky)
+void Base::getMarkerBpandaAnglesCmd(int id, Coord::CoordSystem sys,
+ Coord::SkyFrame sky)
{
+ ostringstream str;
Marker* mm=markers->head();
while (mm) {
if (mm->getId() == id) {
int cnt = ((Bpanda*)mm)->numAngles();
- double first=0;
+ double first = ((Bpanda*)mm)->angles(0);
for (int ii=0; ii<cnt; ii++) {
- double ang =
- radToDeg(mapAngleFromRef(((Bpanda*)mm)->angles(ii),sys,sky));
+ double ang = ((Bpanda*)mm)->angles(ii);
if (!ii)
- first = ang;
- else
- if (ang<=first+FLT_EPSILON)
- ang += 360;
-
- printDouble(ang);
- Tcl_AppendResult(interp, "\n", NULL);
+ listAngleFromRef(str,ang,sys,sky);
+ else
+ listAngleFromRef(str,ang,first,sys,sky);
+ str << endl;
}
+ str << ends;
+ Tcl_AppendResult(interp, str.str().c_str(), NULL);
return;
}
mm=mm->next();
@@ -1248,25 +1248,25 @@ void Base::getMarkerCpandaAnglesCmd(int id)
Tcl_AppendResult(interp, "", NULL);
}
-void Base::getMarkerCpandaAnglesCmd(int id, Coord::CoordSystem sys, Coord::SkyFrame sky)
+void Base::getMarkerCpandaAnglesCmd(int id, Coord::CoordSystem sys,
+ Coord::SkyFrame sky)
{
+ ostringstream str;
Marker* mm=markers->head();
while (mm) {
if (mm->getId() == id) {
int cnt = ((Cpanda*)mm)->numAngles();
- double first=0;
+ double first = ((Cpanda*)mm)->angles(0);
for (int ii=0; ii<cnt; ii++) {
- double ang =
- radToDeg(mapAngleFromRef(((Cpanda*)mm)->angles(ii),sys,sky));
- if (!ii)
- first = ang;
+ double ang = ((Cpanda*)mm)->angles(ii);
+ if (!ii)
+ listAngleFromRef(str,ang,sys,sky);
else
- if (ang<=first+FLT_EPSILON)
- ang += 360;
-
- printDouble(ang);
- Tcl_AppendResult(interp, "\n", NULL);
+ listAngleFromRef(str,ang,first,sys,sky);
+ str << endl;
}
+ str << ends;
+ Tcl_AppendResult(interp, str.str().c_str(), NULL);
return;
}
mm=mm->next();
@@ -1511,25 +1511,25 @@ void Base::getMarkerEpandaAnglesCmd(int id)
}
}
-void Base::getMarkerEpandaAnglesCmd(int id, Coord::CoordSystem sys, Coord::SkyFrame sky)
+void Base::getMarkerEpandaAnglesCmd(int id, Coord::CoordSystem sys,
+ Coord::SkyFrame sky)
{
+ ostringstream str;
Marker* mm=markers->head();
while (mm) {
if (mm->getId() == id) {
- int cnt = ((Epanda*)mm)->numAngles();
- double first=0;
+ int cnt = ((Cpanda*)mm)->numAngles();
+ double first = ((Cpanda*)mm)->angles(0);
for (int ii=0; ii<cnt; ii++) {
- double ang =
- radToDeg(mapAngleFromRef(((Epanda*)mm)->angles(ii),sys,sky));
+ double ang = ((Cpanda*)mm)->angles(ii);
if (!ii)
- first = ang;
+ listAngleFromRef(str,ang,sys,sky);
else
- if (ang<=first+FLT_EPSILON)
- ang += 360;
-
- printDouble(ang);
- Tcl_AppendResult(interp, "\n", NULL);
+ listAngleFromRef(str,ang,first,sys,sky);
+ str << endl;
}
+ str << ends;
+ Tcl_AppendResult(interp, str.str().c_str(), NULL);
return;
}
mm=mm->next();