diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-08-03 21:37:06 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-08-03 21:37:06 (GMT) |
commit | 7d93a22fae9936e55db4eab06c51267173e66eac (patch) | |
tree | 4cf0539e8ae2d79173cc3197d575624c09527b8b | |
parent | b8525c3dd6b1e98d1b8754cfeb25a2f8a5a56479 (diff) | |
download | blt-7d93a22fae9936e55db4eab06c51267173e66eac.zip blt-7d93a22fae9936e55db4eab06c51267173e66eac.tar.gz blt-7d93a22fae9936e55db4eab06c51267173e66eac.tar.bz2 |
clean up code
-rw-r--r-- | tksao/frame/base.C | 11 | ||||
-rw-r--r-- | tksao/frame/base.h | 4 | ||||
-rw-r--r-- | tksao/frame/basecommand.C | 8 | ||||
-rw-r--r-- | tksao/frame/contourparser.C | 2 | ||||
-rw-r--r-- | tksao/frame/contourparser.Y | 2 | ||||
-rw-r--r-- | tksao/frame/ds9parser.C | 2 | ||||
-rw-r--r-- | tksao/frame/ds9parser.Y | 2 | ||||
-rw-r--r-- | tksao/frame/frame3dbase.C | 35 | ||||
-rw-r--r-- | tksao/frame/framebase.C | 32 | ||||
-rw-r--r-- | tksao/frame/framergb.C | 7 |
10 files changed, 67 insertions, 38 deletions
diff --git a/tksao/frame/base.C b/tksao/frame/base.C index af3995b..43e2c8d 100644 --- a/tksao/frame/base.C +++ b/tksao/frame/base.C @@ -105,7 +105,7 @@ Base::Base(Tcl_Interp* i, Tk_Canvas c, Tk_Item* item) magnifierColorName = dupstr("white"); wcsSystem_ = Coord::WCS; - wcsSky_ = Coord::FK5; + wcsSkyFrame_ = Coord::FK5; wcsSkyFormat_ = Coord::DEGREES; wcsAlign_ = 0; @@ -296,7 +296,7 @@ void Base::alignWCS() return; } - calcAlignWCS(context->cfits, wcsSystem_, wcsSky_, + calcAlignWCS(context->cfits, wcsSystem_, wcsSkyFrame_, &wcsOrientation, &wcsOrientationMatrix, &wcsRotation); } @@ -323,11 +323,11 @@ void Base::alignWCS(FitsImage* ptr, Coord::CoordSystem sys) } // This calcs the wcs - calcAlignWCS(context->cfits, sys, wcsSky_, + calcAlignWCS(context->cfits, sys, wcsSkyFrame_, &wcsOrientation, &wcsOrientationMatrix, &wcsRotation); // and this the zoom - Matrix mm = calcAlignWCS(ptr, context->cfits, sys, wcsSystem_, wcsSky_); + Matrix mm = calcAlignWCS(ptr, context->cfits, sys, wcsSystem_, wcsSkyFrame_); if (mm[0][0] != 0 && mm[1][1] !=0) zoom_ *= (Vector(mm[0][0],mm[1][0]).length() + Vector(mm[0][1],mm[1][1]).length())/2.; @@ -618,6 +618,9 @@ void Base::getInfoClearWCS(char* var) Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x"),"",0); Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),"",0); Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z"),"",0); + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"",0); + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"",0); + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z,sys"),"",0); Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),"",0); } } diff --git a/tksao/frame/base.h b/tksao/frame/base.h index d3aa888..931681b 100644 --- a/tksao/frame/base.h +++ b/tksao/frame/base.h @@ -212,7 +212,7 @@ public: Vector cropEnd; Coord::CoordSystem wcsSystem_; - Coord::SkyFrame wcsSky_; + Coord::SkyFrame wcsSkyFrame_; Coord::SkyFormat wcsSkyFormat_; int wcsAlign_; // flag to indicate wcs alignment @@ -551,7 +551,7 @@ public: void resetCompositeMarker() {compositeMarker = NULL;} Coord::CoordSystem wcsSystem() {return wcsSystem_;} - Coord::SkyFrame wcsSky() {return wcsSky_;} + Coord::SkyFrame wcsSkyFrame() {return wcsSkyFrame_;} Coord::SkyFormat wcsSkyFormat() {return wcsSkyFormat_;} Coord::CoordSystem xySystem() {return xySystem_;} diff --git a/tksao/frame/basecommand.C b/tksao/frame/basecommand.C index 243a562..12fdf17 100644 --- a/tksao/frame/basecommand.C +++ b/tksao/frame/basecommand.C @@ -2100,7 +2100,7 @@ void Base::getVertCutCmd(char* xx, char* yy, const Vector& vv, void Base::getWCSCmd() { Tcl_AppendResult(interp, coord.coordSystemStr(wcsSystem_), " ", - coord.skyFrameStr(wcsSky_), " ", + coord.skyFrameStr(wcsSkyFrame_), " ", coord.skyFormatStr(wcsSkyFormat_), NULL); } @@ -2120,7 +2120,7 @@ void Base::getWCSAlignPointerCmd() Tcl_AppendResult(interp, (wcsAlign_ ? "1" : "0"), " ", str.str().c_str(), " ", coord.coordSystemStr(wcsSystem_), " ", - coord.skyFrameStr(wcsSky_), NULL); + coord.skyFrameStr(wcsSkyFrame_), NULL); } void Base::getWCSNameCmd(Coord::CoordSystem sys) @@ -2941,7 +2941,7 @@ void Base::wcsCmd(Coord::CoordSystem sys, Coord::SkyFrame sky, Coord::SkyFormat format) { wcsSystem_ = sys; - wcsSky_ = sky; + wcsSkyFrame_ = sky; wcsSkyFormat_ = format; } @@ -2966,7 +2966,7 @@ void Base::wcsAlignCmd(int which, FitsImage* ptr, Coord::CoordSystem sys, Coord::SkyFrame sky) { wcsAlign_ = which; - wcsSky_ = sky; + wcsSkyFrame_ = sky; alignWCS(ptr, sys); update(MATRIX); diff --git a/tksao/frame/contourparser.C b/tksao/frame/contourparser.C index 45003e2..f98f807 100644 --- a/tksao/frame/contourparser.C +++ b/tksao/frame/contourparser.C @@ -1880,7 +1880,7 @@ yyreduce: cc = NULL; globalSystem = Coord::WCS; globalWCS = fr->wcsSystem(); - globalSky = fr->wcsSky(); + globalSky = fr->wcsSkyFrame(); strcpy(globalColor,"green"); globalDash = 0; globalDashList[0] = 8; diff --git a/tksao/frame/contourparser.Y b/tksao/frame/contourparser.Y index dd08936..07d4d09 100644 --- a/tksao/frame/contourparser.Y +++ b/tksao/frame/contourparser.Y @@ -260,7 +260,7 @@ initGlobal: { cc = NULL; globalSystem = Coord::WCS; globalWCS = fr->wcsSystem(); - globalSky = fr->wcsSky(); + globalSky = fr->wcsSkyFrame(); strcpy(globalColor,"green"); globalDash = 0; globalDashList[0] = 8; diff --git a/tksao/frame/ds9parser.C b/tksao/frame/ds9parser.C index 767790a..9433062 100644 --- a/tksao/frame/ds9parser.C +++ b/tksao/frame/ds9parser.C @@ -3789,7 +3789,7 @@ yyreduce: // global properties globalSystem = Coord::PHYSICAL; globalWCS = fr->wcsSystem(); - globalSky = fr->wcsSky(); + globalSky = fr->wcsSkyFrame(); globalTile = 1; globalProps = Marker::SELECT | Marker::EDIT | Marker::MOVE | diff --git a/tksao/frame/ds9parser.Y b/tksao/frame/ds9parser.Y index a4d4cdd..07055a0 100644 --- a/tksao/frame/ds9parser.Y +++ b/tksao/frame/ds9parser.Y @@ -776,7 +776,7 @@ initGlobal:{ // global properties globalSystem = Coord::PHYSICAL; globalWCS = fr->wcsSystem(); - globalSky = fr->wcsSky(); + globalSky = fr->wcsSkyFrame(); globalTile = 1; globalProps = Marker::SELECT | Marker::EDIT | Marker::MOVE | diff --git a/tksao/frame/frame3dbase.C b/tksao/frame/frame3dbase.C index 74818ed..5349651 100644 --- a/tksao/frame/frame3dbase.C +++ b/tksao/frame/frame3dbase.C @@ -158,32 +158,44 @@ void Frame3dBase::getInfoWCS(char* var, Vector3d& rr, FitsImage* ptr, Vector3d img = rr * sptr->refToImage3d; for (int ii=0; ii<MULTWCS; ii++) { - char buf[64]; + char buf[128]; char ww = !ii ? '\0' : '`'+ii; Coord::CoordSystem www = (Coord::CoordSystem)(Coord::WCS+ii); if (hasWCS(www)) { char buff[128]; - sptr->pix2wcs(img, www, wcsSky_, wcsSkyFormat_, buff); + sptr->pix2wcs(img, www, wcsSkyFrame_, wcsSkyFormat_, buff); int argc; const char** argv; Tcl_SplitList(interp, buff, &argc, &argv); - if (argc > 0 && argv && argv[0]) + if (argc > 0 && argv && argv[0]) { Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x"),argv[0],0); - else + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"",0); + } + else { Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x"),"",0); - - if (argc > 1 && argv && argv[1]) + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"",0); + } + + if (argc > 1 && argv && argv[1]) { Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),argv[1],0); - else + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"",0); + } + else { Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),"",0); + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"",0); + } - if (argc > 2 && argv && argv[2]) + if (argc > 2 && argv && argv[2]) { Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z"),argv[2],0); - else + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z,sys"),"",0); + } + else { Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z"),"",0); + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z,sys"),"",0); + } char* wcsname = (char*)sptr->getWCSName(www); if (wcsname) @@ -199,6 +211,9 @@ void Frame3dBase::getInfoWCS(char* var, Vector3d& rr, FitsImage* ptr, Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x"),"",0); Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),"",0); Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z"),"",0); + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"",0); + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"",0); + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z,sys"),"",0); Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),"",0); } } @@ -988,7 +1003,7 @@ void Frame3dBase::updatePanner() if (keyContext->fits && keyContext->fits->hasWCS(wcsSystem_)) { Matrix3d mx; Coord::Orientation oo = - keyContext->fits->getWCSOrientation(wcsSystem_, wcsSky_); + keyContext->fits->getWCSOrientation(wcsSystem_, wcsSkyFrame_); if (hasWCSCel(wcsSystem_)) { if (oo==Coord::XX) mx *= FlipX3d(); diff --git a/tksao/frame/framebase.C b/tksao/frame/framebase.C index 075de88..a2e4e53 100644 --- a/tksao/frame/framebase.C +++ b/tksao/frame/framebase.C @@ -140,27 +140,36 @@ void FrameBase::getInfoWCS(char* var, Vector& rr, FitsImage* ptr, Vector img = rr * sptr->refToImage; for (int ii=0; ii<MULTWCS; ii++) { - char buf[64]; + char buf[128]; char ww = !ii ? '\0' : '`'+ii; Coord::CoordSystem www = (Coord::CoordSystem)(Coord::WCS+ii); if (hasWCS(www)) { char buff[128]; - sptr->pix2wcs(img, www, wcsSky_, wcsSkyFormat_, buff); + sptr->pix2wcs(img, www, wcsSkyFrame_, wcsSkyFormat_, buff); int argc; const char** argv; Tcl_SplitList(interp, buff, &argc, &argv); - if (argc > 0 && argv && argv[0]) + if (argc > 0 && argv && argv[0]) { Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x"),argv[0],0); - else + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"",0); + } + else { Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x"),"",0); - if (argc > 1 && argv && argv[1]) + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"",0); + } + + if (argc > 1 && argv && argv[1]) { Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),argv[1],0); - else + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"",0); + } + else { Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),"",0); - + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"",0); + } + char* wcsname = (char*)sptr->getWCSName(www); if (wcsname) Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),wcsname,0); @@ -168,13 +177,14 @@ void FrameBase::getInfoWCS(char* var, Vector& rr, FitsImage* ptr, Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),argv[2],0); else Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),"",0); - + Tcl_Free((char*)argv); } else { Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x"),"",0); Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y"),"",0); - Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",z"),"",0); + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",x,sys"),"",0); + Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",y,sys"),"",0); Tcl_SetVar2(interp,var,varcat(buf,(char*)"wcs",ww,(char*)",sys"),"",0); } } @@ -320,7 +330,7 @@ void FrameBase::updatePanner() if (keyContext->fits && keyContext->fits->hasWCS(wcsSystem_)) { Matrix mx; Coord::Orientation oo = - keyContext->fits->getWCSOrientation(wcsSystem_, wcsSky_); + keyContext->fits->getWCSOrientation(wcsSystem_, wcsSkyFrame_); if (hasWCSCel(wcsSystem_)) { if (oo==Coord::XX) mx *= FlipX(); @@ -330,7 +340,7 @@ void FrameBase::updatePanner() mx *= FlipX(); } - double rr = keyContext->fits->getWCSRotation(wcsSystem_, wcsSky_); + double rr = keyContext->fits->getWCSRotation(wcsSystem_, wcsSkyFrame_); mx *= Rotate(rr)*mm; Vector north = (Vector(0,1)*mx).normalize(); Vector east = (Vector(-1,0)*mx).normalize(); diff --git a/tksao/frame/framergb.C b/tksao/frame/framergb.C index cee716f..bdb1a10 100644 --- a/tksao/frame/framergb.C +++ b/tksao/frame/framergb.C @@ -70,7 +70,7 @@ void FrameRGB::alignWCS() wcsRotation = 0; } else - calcAlignWCS(keyContext->fits, wcsSystem_, wcsSky_, + calcAlignWCS(keyContext->fits, wcsSystem_, wcsSkyFrame_, &wcsOrientation, &wcsOrientationMatrix, &wcsRotation); updateRGBMatrices(); @@ -100,11 +100,12 @@ void FrameRGB::alignWCS(FitsImage* ptr, Coord::CoordSystem sys) } else { // This calcs the wcs - calcAlignWCS(keyContext->fits, sys, wcsSky_, + calcAlignWCS(keyContext->fits, sys, wcsSkyFrame_, &wcsOrientation, &wcsOrientationMatrix, &wcsRotation); // and this the zoom - Matrix mm = calcAlignWCS(ptr, keyContext->fits, sys, wcsSystem_, wcsSky_); + Matrix mm = calcAlignWCS(ptr, keyContext->fits, sys, + wcsSystem_, wcsSkyFrame_); if (mm[0][0] != 0 && mm[1][1] !=0) zoom_ *= (Vector(mm[0][0],mm[1][0]).length() + Vector(mm[0][1],mm[1][1]).length())/2.; |