From 5aa27c7fe70a53e500f896ee3c9d0fdd06d7b3ee Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Sun, 10 Apr 2022 20:55:46 -0500 Subject: [PATCH] Add scaling to 16-level thresholds --- .../scwx/qt/view/level3_product_view.cpp | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/scwx-qt/source/scwx/qt/view/level3_product_view.cpp b/scwx-qt/source/scwx/qt/view/level3_product_view.cpp index d8a7c5fa..54e68fd4 100644 --- a/scwx-qt/source/scwx/qt/view/level3_product_view.cpp +++ b/scwx-qt/source/scwx/qt/view/level3_product_view.cpp @@ -221,8 +221,28 @@ void Level3ProductView::UpdateColorTable() uint16_t th = descriptionBlock->data_level_threshold(i); if ((th & 0x8000u) == 0) { + float scale = 1.0f; + + if (th & 0x4000u) + { + scale *= 0.01f; + } + if (th & 0x2000u) + { + scale *= 0.05f; + } + if (th & 0x1000u) + { + scale *= 0.1f; + } + if (th & 0x0100u) + { + scale *= -1.0f; + } + // If bit 0 is zero, then the LSB is numeric - f = static_cast(th & 0x00ffu); + f = static_cast(th & 0x00ffu) * scale; + lut[lutIndex] = p->colorTable_->Color(f); } else