summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-08-15 21:13:02 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-08-15 21:13:02 (GMT)
commit2e9a4d3293f9a27883d525abaaa5459a67b063af (patch)
tree8ce8e2720fd57d0e1160be0dff0d5800e2481ac6
parentaa7dc58f280cb4df951c8d767afaaff4ee1fecf3 (diff)
downloadblt-2e9a4d3293f9a27883d525abaaa5459a67b063af.zip
blt-2e9a4d3293f9a27883d525abaaa5459a67b063af.tar.gz
blt-2e9a4d3293f9a27883d525abaaa5459a67b063af.tar.bz2
simplify wcs code
-rw-r--r--tksao/frame/fitsimage.C19
-rw-r--r--tksao/frame/fitsimage.h7
-rw-r--r--tksao/frame/wcsast.C9
3 files changed, 11 insertions, 24 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C
index 615e07c..984b21a 100644
--- a/tksao/frame/fitsimage.C
+++ b/tksao/frame/fitsimage.C
@@ -32,10 +32,6 @@ WCSState::WCSState()
{
wcsSystem_ = Coord::WCS;
wcsSkyFrame_ = Coord::FK5;
-
- wcsFormatSystem_ = Coord::WCS;
- wcsFormatFrame_ = Coord::FK5;
- wcsFormat_ = Coord::DEGREES;
};
FitsImage::FitsImage(Context* cx, Tcl_Interp* pp)
@@ -1141,9 +1137,6 @@ void FitsImage::initWCS(FitsHead* hd)
wcsSystem(ast_,wcsState_->wcsSystem_);
wcsSkyFrame(ast_,wcsState_->wcsSkyFrame_);
- setWCSFormat(wcsState_->wcsFormatSystem_,
- wcsState_->wcsFormatFrame_,
- wcsState_->wcsFormat_,1);
// must wait until wcsState_ is realized
wcsSizeInit();
@@ -3176,18 +3169,8 @@ void FitsImage::setWCSSkyFrame(Coord::SkyFrame sky)
}
void FitsImage::setWCSFormat(Coord::CoordSystem sys, Coord::SkyFrame sky,
- Coord::SkyFormat format, int init)
+ Coord::SkyFormat format)
{
- if (!init &&
- wcsState_->wcsFormatSystem_ == sys &&
- wcsState_->wcsFormatFrame_ == sky &&
- wcsState_->wcsFormat_ == format)
- return;
-
- wcsState_->wcsFormatSystem_ = sys;
- wcsState_->wcsFormatFrame_ = sky;
- wcsState_->wcsFormat_ = format;
-
int id = sys-Coord::WCS;
// spacial axes
diff --git a/tksao/frame/fitsimage.h b/tksao/frame/fitsimage.h
index 27606e9..621773a 100644
--- a/tksao/frame/fitsimage.h
+++ b/tksao/frame/fitsimage.h
@@ -49,10 +49,6 @@ class WCSState {
Coord::CoordSystem wcsSystem_; // current state of ast_
Coord::SkyFrame wcsSkyFrame_; // current state of ast_
-
- Coord::CoordSystem wcsFormatSystem_; // current state of ast_
- Coord::SkyFrame wcsFormatFrame_; // current state of ast_
- Coord::SkyFormat wcsFormat_; // current state of ast_
};
class FitsImage {
@@ -169,8 +165,7 @@ class FitsImage {
void setWCSSystem(Coord::CoordSystem);
void setWCSSkyFrame(Coord::SkyFrame);
- void setWCSFormat(Coord::CoordSystem, Coord::SkyFrame, Coord::SkyFormat,
- int init=0);
+ void setWCSFormat(Coord::CoordSystem, Coord::SkyFrame, Coord::SkyFormat);
public:
char* fileName;
diff --git a/tksao/frame/wcsast.C b/tksao/frame/wcsast.C
index de5c3a6..18d930b 100644
--- a/tksao/frame/wcsast.C
+++ b/tksao/frame/wcsast.C
@@ -56,6 +56,15 @@ int wcsSkyFrame(AstFrameSet* ast, Coord::SkyFrame sky)
void wcsFormat(AstFrameSet* ast, int id, const char* format)
{
+ // is it already set?
+ // ast is very slow when changing params
+ {
+ ostringstream str;
+ str << "Format(" << id << ")" << ends;
+ const char* out = astGetC(ast, str.str().c_str());
+ if (!strcmp(out,format))
+ return;
+ }
ostringstream str;
str << "Format(" << id << ")=" << format << ends;
astSet(ast, str.str().c_str());