diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-03-08 22:05:32 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-03-08 22:05:32 (GMT) |
commit | d7ff6fa1f451f9c32a6caf80e91c679a17d7e3af (patch) | |
tree | 254248b2e1806c13d43db943af2255c3a6fe4ecd | |
parent | aced47b647500f0dae9c982ea5fc6de905726505 (diff) | |
download | blt-d7ff6fa1f451f9c32a6caf80e91c679a17d7e3af.zip blt-d7ff6fa1f451f9c32a6caf80e91c679a17d7e3af.tar.gz blt-d7ff6fa1f451f9c32a6caf80e91c679a17d7e3af.tar.bz2 |
add contour scope
-rw-r--r-- | tksao/frame/fvcontour.C | 82 | ||||
-rw-r--r-- | tksao/frame/fvcontour.h | 20 |
2 files changed, 40 insertions, 62 deletions
diff --git a/tksao/frame/fvcontour.C b/tksao/frame/fvcontour.C index 8b049dc..48bacd0 100644 --- a/tksao/frame/fvcontour.C +++ b/tksao/frame/fvcontour.C @@ -40,11 +40,6 @@ FVContour::FVContour() smooth_ =4; numLevel_ =5; - colorScaleType_ = FrScale::LINEARSCALE; - clipMode_ = (float)FrScale::MINMAX; - expo_ =1000; - limits_ = Vector(0,100); - level_ =NULL; scale_ =NULL; } @@ -64,9 +59,7 @@ FVContour::~FVContour() void FVContour::create(Base* pp, FitsImage* fits, FrScale* fr, const char* cc, int ww, int dd, Method mm, int nn, int rr, - const char* ll, - FrScale::ColorScaleType sc, float exp, - float cm, Vector lim) + const char* ll) { lcontourlevel_.deleteAll(); @@ -80,10 +73,7 @@ void FVContour::create(Base* pp, FitsImage* fits, FrScale* fr, smooth_ = rr; numLevel_ = nn; - colorScaleType_ = sc; - clipMode_ = cm; - expo_ = exp; - limits_ = lim; + frScale_ = *fr; level_ = dupstr(ll); @@ -99,74 +89,66 @@ void FVContour::create(Base* pp, FitsImage* fits, FrScale* fr, scale_ = new InverseScale(cnt, levels); } else - buildScale(fits, fr); + buildScale(fits); append(fits); } -void FVContour::buildScale(FitsImage* fits, FrScale* fr) +void FVContour::buildScale(FitsImage* fits) { - switch (colorScaleType_) { + switch (frScale_.colorScaleType()) { case FrScale::LINEARSCALE: - scale_ = new LinearInverseScale(numLevel_, limits_[0], limits_[1]); + scale_ = new LinearInverseScale(numLevel_, frScale_.low(), frScale_.high()); break; case FrScale::LOGSCALE: - scale_ = new LogInverseScale(numLevel_, limits_[0], limits_[1], expo_); + scale_ = new LogInverseScale(numLevel_, frScale_.low(), frScale_.high(), frScale_.expo()); break; case FrScale::POWSCALE: - scale_ = new PowInverseScale(numLevel_, limits_[0], limits_[1], expo_); + scale_ = new PowInverseScale(numLevel_, frScale_.low(), frScale_.high(), frScale_.expo()); break; case FrScale::SQRTSCALE: - scale_ = new SqrtInverseScale(numLevel_, limits_[0], limits_[1]); + scale_ = new SqrtInverseScale(numLevel_, frScale_.low(), frScale_.high()); break; case FrScale::SQUAREDSCALE: - scale_ = new SquaredInverseScale(numLevel_, limits_[0], limits_[1]); + scale_ = new SquaredInverseScale(numLevel_, frScale_.low(), frScale_.high()); break; case FrScale::ASINHSCALE: - scale_ = new AsinhInverseScale(numLevel_, limits_[0], limits_[1]); + scale_ = new AsinhInverseScale(numLevel_, frScale_.low(), frScale_.high()); break; case FrScale::SINHSCALE: - scale_ = new SinhInverseScale(numLevel_, limits_[0], limits_[1]); + scale_ = new SinhInverseScale(numLevel_, frScale_.low(), frScale_.high()); break; case FrScale::HISTEQUSCALE: - scale_ = new HistEquInverseScale(numLevel_, limits_[0], limits_[1], - fr->histequ(fits), HISTEQUSIZE); + scale_ = new HistEquInverseScale(numLevel_, frScale_.low(), frScale_.high(), frScale_.histequ(fits), HISTEQUSIZE); break; case FrScale::IISSCALE: - scale_ = new IISInverseScale(numLevel_, limits_[0], limits_[1], - fits->iisz()); + scale_ = new IISInverseScale(numLevel_, frScale_.low(), frScale_.high(), fits->iisz()); break; } } void FVContour::update(FitsImage* fits) { - if (lcontourlevel_.isEmpty()) - return; - - lcontourlevel_.deleteAll(); - append(fits); -} - -void FVContour::update(FitsImage* fits, FrScale* fr) -{ - if (lcontourlevel_.isEmpty()) - return; - lcontourlevel_.deleteAll(); - if (scale_) - delete scale_; - limits_ = Vector(fr->low(),fr->high()); - expo_ = fr->expo(); - - buildScale(fits, fr); - - if (level_) - delete [] level_; - ostringstream str; - str << *scale_ << ends; - level_ = dupstr(str.str().c_str()); + switch (frScale_.clipScope()) { + case FrScale::GLOBAL: + break; + case FrScale::LOCAL: + if (scale_) + delete scale_; + + buildScale(fits); + + if (level_) + delete [] level_; + { + ostringstream str; + str << *scale_ << ends; + level_ = dupstr(str.str().c_str()); + } + break; + } append(fits); } diff --git a/tksao/frame/fvcontour.h b/tksao/frame/fvcontour.h index c6dda5a..38a2fd9 100644 --- a/tksao/frame/fvcontour.h +++ b/tksao/frame/fvcontour.h @@ -29,15 +29,12 @@ class FVContour { int smooth_; int numLevel_; - FrScale::ColorScaleType colorScaleType_; - float expo_; - float clipMode_; - Vector limits_; + FrScale frScale_; char* level_; InverseScale* scale_; - void buildScale(FitsImage* fits, FrScale* fr); + void buildScale(FitsImage* fits); void unity(FitsImage*); void bin(FitsImage*); void nobin(FitsImage*); @@ -56,12 +53,14 @@ public: List<ContourLevel>& lcontourlevel() {return lcontourlevel_;} void create(Base*, FitsImage*, FrScale*, - const char*, int, int, Method, int, int, const char*, - FrScale::ColorScaleType, float, float, Vector); - void append(FitsImage*); + const char*, int, int, + Method, int, int, + const char*); void update(FitsImage*); void update(FitsImage*, FrScale*); + void append(FitsImage*); + int isEmpty() {return lcontourlevel_.isEmpty();} const char* methodName(); @@ -69,10 +68,7 @@ public: int numLevel() {return numLevel_;} int smooth() {return smooth_;} - int colorScaleType() {return colorScaleType_;} - float expo() {return expo_;} - float clipMode() {return clipMode_;} - Vector limits() {return limits_;} + FrScale* frScale() {return &frScale_;} const char* getColorName() {return colorName_;} int getDash() {return dash_;} |