From 3a98acb6407b3570be0ebb6a730b98d24ea3afc1 Mon Sep 17 00:00:00 2001 From: William Joye Date: Mon, 22 Oct 2018 14:18:24 -0400 Subject: new mask --- tksao/frame/base.C | 61 ---------------------------- tksao/frame/base.h | 13 ++---- tksao/frame/basecommand.C | 7 ---- tksao/frame/context.h | 4 -- tksao/frame/frame.C | 101 +++++++++------------------------------------- tksao/frame/frame.h | 4 ++ tksao/frame/frame3d.C | 8 ---- tksao/frame/framergb.C | 64 +---------------------------- tksao/frame/frload.C | 11 +++-- 9 files changed, 35 insertions(+), 238 deletions(-) diff --git a/tksao/frame/base.C b/tksao/frame/base.C index e0e97e4..1494385 100644 --- a/tksao/frame/base.C +++ b/tksao/frame/base.C @@ -1135,8 +1135,6 @@ Matrix Base::psMatrix(float scale, int width, int height) return refToUser * userToPS; } -// waj - void Base::pushMatrices(FitsImage* fits, Matrix& rgbToRef) { FitsImage* ptr = fits; @@ -1192,65 +1190,6 @@ void Base::pushPSMatrices(FitsImage* fits, float scale, int width, int height) } } -/* -void Base::pushMatrices() -{ - Matrix rgbToRef; - - FitsImage* ptr = context->fits; - while (ptr) { - FitsImage* sptr = ptr; - while (sptr) { - sptr->updateMatrices(rgbToRef, refToUser, userToWidget, - widgetToCanvas, canvasToWindow); - sptr = sptr->nextSlice(); - } - ptr = ptr->nextMosaic(); - } -} - -void Base::pushMagnifierMatrices() -{ - FitsImage* ptr = context->fits; - while (ptr) { - FitsImage* sptr = ptr; - while (sptr) { - sptr->updateMagnifierMatrices(refToMagnifier); - sptr = sptr->nextSlice(); - } - ptr = ptr->nextMosaic(); - } -} - -void Base::pushPannerMatrices() -{ - FitsImage* ptr = context->fits; - while (ptr) { - FitsImage* sptr = ptr; - while (sptr) { - sptr->updatePannerMatrices(refToPanner); - sptr = sptr->nextSlice(); - } - ptr = ptr->nextMosaic(); - } -} - -void Base::pushPSMatrices(float scale, int width, int height) -{ - Matrix mx = psMatrix(scale, width, height); - - FitsImage* ptr = context->fits; - while (ptr) { - FitsImage* sptr = ptr; - while (sptr) { - sptr->updatePS(mx); - sptr = sptr->nextSlice(); - } - ptr = ptr->nextMosaic(); - } -} -*/ - void Base::reset() { if (!preservePan) diff --git a/tksao/frame/base.h b/tksao/frame/base.h index a90ba0a..4e57b78 100644 --- a/tksao/frame/base.h +++ b/tksao/frame/base.h @@ -383,6 +383,7 @@ public: virtual int isFrameRGB() {return 0;} virtual void loadDone(int, LayerType); + void loadDone(int); void markerAnalysisHistogram(Marker*, double**, double**, const BBox&, int); int markerAnalysisPlot2d(Marker*, double**, double**, double**, double**, @@ -443,17 +444,11 @@ public: void pushMagnifierMatrices(FitsImage*); void pushPannerMatrices(FitsImage*); void pushPSMatrices(FitsImage*, float, int, int); - // waj + virtual void pushMatrices() =0; virtual void pushMagnifierMatrices() =0; virtual void pushPannerMatrices() =0; virtual void pushPSMatrices(float, int, int) =0; - /* - virtual void pushMatrices(); - virtual void pushMagnifierMatrices(); - virtual void pushPannerMatrices(); - virtual void pushPSMatrices(float, int, int); - */ virtual void reset(); void resetSecMode(); @@ -796,7 +791,7 @@ public: void loadFitsChannelCmd(const char*, const char*, LayerType); void loadFitsMMapCmd(const char*, LayerType); void loadFitsSMMapCmd(const char*, const char*, LayerType); - void loadFitsMMapIncrCmd(const char*, LayerType); + virtual void loadFitsMMapIncrCmd(const char*, LayerType); void loadFitsShareCmd(ShmType, int, const char*, LayerType); void loadFitsSShareCmd(ShmType, int, int, const char*, LayerType); void loadFitsSocketCmd(int, const char*, LayerType); @@ -1565,7 +1560,7 @@ public: void getMaskTransparencyCmd(); void maskColorCmd(const char*); - void maskClearCmd(); + virtual void maskClearCmd() {}; void maskMarkCmd(int m) {maskMark=m;} void maskTransparencyCmd(float); diff --git a/tksao/frame/basecommand.C b/tksao/frame/basecommand.C index c082b72..6bcc2d3 100644 --- a/tksao/frame/basecommand.C +++ b/tksao/frame/basecommand.C @@ -2523,13 +2523,6 @@ void Base::matchCmd(const char* xxname1, const char* yyname1, rrname); } -void Base::maskClearCmd() -{ - // waj - // currentContext->mask.deleteAll(); - update(BASE); -} - void Base::maskColorCmd(const char* color) { if (maskColorName) diff --git a/tksao/frame/context.h b/tksao/frame/context.h index 9a717c8..cbf1c19 100644 --- a/tksao/frame/context.h +++ b/tksao/frame/context.h @@ -80,10 +80,6 @@ class Context { protected: void binFinish(); - // waj - // int blockMask(); - // void loadFinishMask(); - // int loadFinishMosaicMask(); int nhdu(); void loadFinishMosaic(FitsImage*); int processMosaicKeywords(FitsImage*); diff --git a/tksao/frame/frame.C b/tksao/frame/frame.C index f8cb555..f41c426 100644 --- a/tksao/frame/frame.C +++ b/tksao/frame/frame.C @@ -274,7 +274,6 @@ int Frame::isIIS() return context->cfits && context->cfits->isIIS(); } -// waj void Frame::pushMatrices() { // alway identity @@ -325,87 +324,6 @@ void Frame::pushPSMatrices(float scale, int width, int height) } } -/* -void Frame::pushMatrices() -{ - Base::pushMatrices(); - - // alway identity - Matrix rgbToRef; - - // now any masks - FitsMask* msk = currentContext->mask.tail(); - while (msk) { - FitsImage* mskimg = msk->mask(); - while (mskimg) { - FitsImage* sptr = mskimg; - while (sptr) { - sptr->updateMatrices(rgbToRef, refToUser, userToWidget, - widgetToCanvas, canvasToWindow); - sptr = sptr->nextSlice(); - } - mskimg = mskimg->nextMosaic(); - } - - msk = msk->previous(); - } -} - -void Frame::pushMagnifierMatrices() -{ - Base::pushMagnifierMatrices(); - - FitsMask* msk = context->mask.tail(); - while (msk) { - FitsImage* mskimg = msk->mask(); - while (mskimg) { - FitsImage* sptr = mskimg; - while (sptr) { - sptr->updateMagnifierMatrices(refToMagnifier); - sptr = sptr->nextSlice(); - } - mskimg = mskimg->nextMosaic(); - } - msk = msk->previous(); - } -} - -void Frame::pushPannerMatrices() -{ - Base::pushPannerMatrices(); - - FitsMask* msk = context->mask.tail(); - while (msk) { - FitsImage* mskimg = msk->mask(); - while (mskimg) { - FitsImage* sptr = mskimg; - while (sptr) { - sptr->updatePannerMatrices(refToPanner); - sptr = sptr->nextSlice(); - } - mskimg = mskimg->nextMosaic(); - } - msk = msk->previous(); - } -} - -void Frame::pushPSMatrices(float scale, int width, int height) -{ - Base::pushPSMatrices(scale, width, height); - - Matrix mx = psMatrix(scale, width, height); - FitsMask* msk = context->mask.tail(); - while (msk) { - FitsImage* ptr = msk->current(); - while (ptr) { - ptr->updatePS(mx); - ptr = ptr->nextMosaic(); - } - msk = msk->previous(); - } -} -*/ - void Frame::reset() { cmapID = 1; @@ -446,6 +364,12 @@ void Frame::unloadFits() // Commands +void Frame::maskClearCmd() +{ + mask.deleteAll(); + update(BASE); +} + void Frame::colormapCmd(int id, float b, float c, int i, unsigned char* cells, int cnt) { @@ -829,5 +753,16 @@ void Frame::savePhotoCmd(const char* ph) } } +// load - +void Frame::loadFitsMMapIncrCmd(const char* fn, LayerType ll) +{ + switch (ll) { + case IMG: + Base::loadFitsMMapIncrCmd(fn,ll); + break; + case MASK: + + break; + } +} diff --git a/tksao/frame/frame.h b/tksao/frame/frame.h index f89a9d3..b15ac63 100644 --- a/tksao/frame/frame.h +++ b/tksao/frame/frame.h @@ -49,6 +49,8 @@ class Frame : public FrameBase { Frame(Tcl_Interp*, Tk_Canvas, Tk_Item*); virtual ~Frame(); + void maskClearCmd(); + void colormapCmd(int, float, float, int, unsigned char*, int); void colormapBeginCmd(); void colormapMotionCmd(int, float, float, int, unsigned char*, int); @@ -67,6 +69,8 @@ class Frame : public FrameBase { void iisWCSCmd(const Matrix&, const Vector&, int); void savePhotoCmd(const char*); + + void loadFitsMMapIncrCmd(const char*, LayerType); }; #endif diff --git a/tksao/frame/frame3d.C b/tksao/frame/frame3d.C index 01e07a7..eafbbd0 100644 --- a/tksao/frame/frame3d.C +++ b/tksao/frame/frame3d.C @@ -986,11 +986,9 @@ void Frame3d::updateColorCells(unsigned char* cells, int cnt) void Frame3d::pushMatrices() { - // waj // alway identity Matrix rgbToRef; Base::pushMatrices(keyContext->fits, rgbToRef); - // Base::pushMatrices(); FitsImage* ptr = keyContext->fits; while (ptr) { @@ -1006,9 +1004,7 @@ void Frame3d::pushMatrices() void Frame3d::pushPannerMatrices() { - // waj Base::pushPannerMatrices(keyContext->fits); - // Base::pushPannerMatrices(); FitsImage* ptr = keyContext->fits; while (ptr) { @@ -1023,9 +1019,7 @@ void Frame3d::pushPannerMatrices() void Frame3d::pushMagnifierMatrices() { - // waj Base::pushMagnifierMatrices(keyContext->fits); - // Base::pushMagnifierMatrices(); FitsImage* ptr = keyContext->fits; while (ptr) { @@ -1040,9 +1034,7 @@ void Frame3d::pushMagnifierMatrices() void Frame3d::pushPSMatrices(float scale, int width, int height) { - // waj Base::pushPSMatrices(keyContext->fits, scale, width, height); - // Base::pushPSMatrices(scale, width, height); Matrix3d mx = psMatrix(scale, width, height); FitsImage* ptr = keyContext->fits; diff --git a/tksao/frame/framergb.C b/tksao/frame/framergb.C index a71dd23..2d2c5a8 100644 --- a/tksao/frame/framergb.C +++ b/tksao/frame/framergb.C @@ -673,7 +673,6 @@ void FrameRGB::loadDone(int rr, LayerType ll) } } -// waj void FrameRGB::pushMatrices() { for (int ii=0; ii<3; ii++) @@ -697,66 +696,6 @@ void FrameRGB::pushPSMatrices(float scale, int width, int height) for (int ii=0; ii<3; ii++) Base::pushPSMatrices(context[ii].fits, scale, width, height); } -/* -void FrameRGB::pushMatrices() -{ - for (int ii=0; ii<3; ii++) { - FitsImage* ptr = context[ii].fits; - while (ptr) { - FitsImage* sptr = ptr; - while (sptr) { - sptr->updateMatrices(rgb[ii], refToUser, userToWidget, - widgetToCanvas, canvasToWindow); - sptr = sptr->nextSlice(); - } - ptr = ptr->nextMosaic(); - } - } -} - -void FrameRGB::pushMagnifierMatrices() -{ - for (int ii=0; ii<3; ii++) { - FitsImage* ptr = context[ii].fits; - while (ptr) { - FitsImage* sptr = ptr; - while (sptr) { - sptr->updateMagnifierMatrices(refToMagnifier); - sptr = sptr->nextSlice(); - } - ptr = ptr->nextMosaic(); - } - } -} - -void FrameRGB::pushPannerMatrices() -{ - for (int ii=0; ii<3; ii++) { - FitsImage* ptr = context[ii].fits; - while (ptr) { - FitsImage* sptr = ptr; - while (sptr) { - sptr->updatePannerMatrices(refToPanner); - sptr = sptr->nextSlice(); - } - ptr = ptr->nextMosaic(); - } - } -} - -void FrameRGB::pushPSMatrices(float scale, int width, int height) -{ - Matrix mx = psMatrix(scale, width, height); - for (int kk=0; kk<3; kk++) - if (context[kk].fits) { - FitsImage* ptr = context[kk].cfits; - while (ptr) { - ptr->updatePS(mx); - ptr = ptr->nextMosaic(); - } - } -} -*/ void FrameRGB::reset() { @@ -773,7 +712,8 @@ void FrameRGB::reset() void FrameRGB::rgbAlignWCS(int ii) { if (keyContext->fits && keyContext->fits->hasWCS(rgbSystem)) - rgb[ii] = calcAlignWCS(keyContext->fits, context[ii].fits, rgbSystem, rgbSystem, Coord::FK5); + rgb[ii] = calcAlignWCS(keyContext->fits, context[ii].fits, rgbSystem, + rgbSystem, Coord::FK5); if (DebugRGB) cerr << "rgbAlignWCS " << rgb[ii] << endl; diff --git a/tksao/frame/frload.C b/tksao/frame/frload.C index a0c2184..8645a9d 100644 --- a/tksao/frame/frload.C +++ b/tksao/frame/frload.C @@ -66,10 +66,8 @@ void Base::loadFitsSMMapCmd(const char* hdr, const char* fn, LayerType ll) void Base::loadFitsMMapIncrCmd(const char* fn, LayerType ll) { - if (ll == IMG) - unloadFits(); - FitsImage* img = new FitsImageFitsMMapIncr(currentContext, interp, - fn, 1); + unloadFits(); + FitsImage* img = new FitsImageFitsMMapIncr(currentContext, interp, fn, 1); loadDone(currentContext->load(MMAPINCR, fn, img), ll); } @@ -713,6 +711,11 @@ void Base::loadMosaicImageWFPC2VarCmd(const char* ch, const char* fn) void Base::loadDone(int rr, LayerType ll) { + loadDone(rr); +} + +void Base::loadDone(int rr) +{ if (rr) { alignWCS(); if (!preservePan) { -- cgit v0.12