summaryrefslogtreecommitdiffstats
path: root/tksao/frame
diff options
context:
space:
mode:
Diffstat (limited to 'tksao/frame')
-rw-r--r--tksao/frame/fitsimage.C8
-rw-r--r--tksao/frame/wcsast.C47
-rw-r--r--tksao/frame/wcsast.h2
3 files changed, 53 insertions, 4 deletions
diff --git a/tksao/frame/fitsimage.C b/tksao/frame/fitsimage.C
index 474326d..2668ef0 100644
--- a/tksao/frame/fitsimage.C
+++ b/tksao/frame/fitsimage.C
@@ -1201,19 +1201,19 @@ void FitsImage::resetWCS()
else
initWCS(image_->head());
-
// apply block factor
if (ast_) {
Vector block = context_->blockFactor();
- if (block[0] != 1 && block[1] != 1) {
+ if (block[0] != 1 || block[1] != 1) {
astClearStatus; // just to make sure
astBegin; // start memory management
Vector ll(.5,.5);
Vector ur(1.5,1.5);
Vector rr = ur*Translate(-.5,-.5)*Scale(block)*Translate(.5,.5);
- AstWinMap* winmap = astWinMap(2, ll.vv(), rr.vv(), ll.vv(), ur.vv(), "");
- astRemapFrame(ast_, AST__BASE, winmap);
+ AstWinMap* winmap = wcsWinMap(ast_, ll, ur, rr);
+ if (winmap)
+ astRemapFrame(ast_, AST__BASE, winmap);
astEnd;
}
diff --git a/tksao/frame/wcsast.C b/tksao/frame/wcsast.C
index d3801f1..5ae4ac7 100644
--- a/tksao/frame/wcsast.C
+++ b/tksao/frame/wcsast.C
@@ -392,3 +392,50 @@ double wcsAxAngle(AstFrameSet* ast, const Vector& vv1, const Vector& vv2)
return 0;
}
+AstWinMap* wcsWinMap(AstFrameSet* ast, Vector& ll, Vector& ur, Vector& rr)
+{
+ int naxes = astGetI(ast,"Naxes");
+ switch (naxes) {
+ case 1:
+ // error
+ return NULL;
+ case 2:
+ return astWinMap(2, ll.vv(), rr.vv(), ll.vv(), ur.vv(), "");
+ case 3:
+ {
+ double vll[3];
+ vll[0] = ll[0];
+ vll[1] = ll[0];
+ vll[2] = .5;
+ double vur[3];
+ vur[0] = ur[0];
+ vur[1] = ur[0];
+ vur[2] = .5;
+ double vrr[3];
+ vrr[0] = rr[0];
+ vrr[1] = rr[1];
+ vrr[2] = 1.5;
+ return astWinMap(3, vll, vrr, vll, vur, "");
+ }
+ case 4:
+ {
+ double vll[4];
+ vll[0] = ll[0];
+ vll[1] = ll[0];
+ vll[2] = .5;
+ vll[3] = .5;
+ double vur[4];
+ vur[0] = ur[0];
+ vur[1] = ur[0];
+ vur[2] = .5;
+ vur[3] = .5;
+ double vrr[4];
+ vrr[0] = rr[0];
+ vrr[1] = rr[1];
+ vrr[2] = 1.5;
+ vrr[3] = 1.5;
+ return astWinMap(4, vll, vrr, vll, vur, "");
+ }
+ break;
+ }
+}
diff --git a/tksao/frame/wcsast.h b/tksao/frame/wcsast.h
index 6aa42c0..e1c85fe 100644
--- a/tksao/frame/wcsast.h
+++ b/tksao/frame/wcsast.h
@@ -21,3 +21,5 @@ Vector3d wcsTran(AstFrameSet*, const Vector3d&, int);
double wcsDistance(AstFrameSet*, const Vector&, const Vector&);
double wcsAngle(AstFrameSet*, const Vector&, const Vector&, const Vector&);
double wcsAxAngle(AstFrameSet*, const Vector&, const Vector&);
+
+AstWinMap* wcsWinMap(AstFrameSet*, Vector&, Vector&, Vector&);