diff options
Diffstat (limited to 'tksao/frame/frame.C')
-rw-r--r-- | tksao/frame/frame.C | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/tksao/frame/frame.C b/tksao/frame/frame.C index 38f5175..119e63d 100644 --- a/tksao/frame/frame.C +++ b/tksao/frame/frame.C @@ -291,7 +291,7 @@ void Frame::pushMatrices() // now any masks FitsMask* msk = mask.tail(); while (msk) { - Base::pushMatrices(msk->context()->fits, rgbToRef); + Base::pushMatrices(msk->context()->fits, msk->mm()); msk = msk->previous(); } } @@ -356,6 +356,51 @@ void Frame::updateColorCells(unsigned char* cells, int cnt) memcpy(colorCells, cells, cnt*3); } +void Frame::updateMaskMatrices() +{ + // image,pysical,amplifier,detector are ok, check for wcs + if (maskSystem >= Coord::WCS) { + FitsMask* mptr = mask.head(); + while (mptr) { + if (mptr->context()->fits && !mptr->context()->fits->hasWCS(maskSystem)) { + maskSystem = Coord::IMAGE; + break; + } + mptr = mptr->next(); + } + } + + // mask align + FitsMask* mptr = mask.head(); + while (mptr) { + mptr->mm().identity(); + if (mptr->context()->fits) { + switch (maskSystem) { + case Coord::IMAGE: + // nothing to do here + break; + case Coord::PHYSICAL: + mptr->mm() = mptr->context()->fits->imageToPhysical * + keyContext->fits->physicalToImage; + break; + case Coord::AMPLIFIER: + mptr->mm() = mptr->context()->fits->imageToAmplifier * + keyContext->fits->amplifierToImage; + break; + case Coord::DETECTOR: + mptr->mm() = mptr->context()->fits->imageToDetector * + keyContext->fits->detectorToImage; + break; + default: + mptr->mm() = + calcAlignWCS(keyContext->fits, mptr->context()->fits, maskSystem, maskSystem, Coord::FK5); + break; + } + } + mptr = mptr->next(); + } +} + void Frame::unloadFits() { if (DebugPerf) @@ -681,12 +726,10 @@ void Frame::getTypeCmd() void Frame::iisCmd(int width, int height) { unloadAllFits(); - context->setIIS(); FitsImage* img = new FitsImageIIS(currentContext, interp, width, height); - - loadDone(currentContext->load(ALLOC, "", img), IMG); + loadDone(currentContext->load(ALLOC, "", img)); } void Frame::iisEraseCmd() @@ -992,3 +1035,10 @@ void Frame::loadFitsVarCmd(const char* ch, const char* fn, LayerType ll) break; } } + +void Frame::loadDone(int rr) +{ + if (rr) + updateMaskMatrices(); + Base::loadDone(rr); +} |