From 3562edcb7a549877bf810d019f34f72c16498203 Mon Sep 17 00:00:00 2001 From: AdenKoperczak Date: Mon, 9 Dec 2024 18:11:59 -0500 Subject: [PATCH 1/4] Change negative threshold values to act as inverted threshold --- scwx-qt/gl/threshold.geom | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scwx-qt/gl/threshold.geom b/scwx-qt/gl/threshold.geom index 677a80cd..deead87d 100644 --- a/scwx-qt/gl/threshold.geom +++ b/scwx-qt/gl/threshold.geom @@ -21,7 +21,9 @@ smooth out vec4 color; void main() { if (gsIn[0].displayed != 0 && - (gsIn[0].threshold <= 0 || // If Threshold: 0 was specified, no threshold + (gsIn[0].threshold == 0 || // If Threshold: 0 was specified, no threshold + uMapDistance == 0 || // If uMapDistance is zero, threshold is disabled + (gsIn[0].threshold < 0 && -(gsIn[0].threshold) <= uMapDistance) || // If Threshold is negative and below current map distance gsIn[0].threshold >= uMapDistance || // If Threshold is above current map distance gsIn[0].threshold >= 999) && // If Threshold: 999 was specified (or greater), no threshold (gsIn[0].timeRange[0] == 0 || // If there is no start time specified From 7c884fec5548f004d5b3eef749e2d082616b29a8 Mon Sep 17 00:00:00 2001 From: AdenKoperczak Date: Mon, 9 Dec 2024 18:44:35 -0500 Subject: [PATCH 2/4] add inverted threshold to placefile text --- scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp index b8faa8f8..df4f650e 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp @@ -136,7 +136,10 @@ void PlacefileText::Impl::RenderTextDrawItem( std::chrono::system_clock::now() : selectedTime_; - if ((!thresholded_ || mapDistance_ <= di->threshold_) && + const bool thresholdMet = mapDistance_ <= di->threshold_ || + ((double)di->threshold_ < 0.0 && mapDistance_ >= -(di->threshold_)); + + if ((!thresholded_ || thresholdMet) && (di->startTime_ == std::chrono::system_clock::time_point {} || (di->startTime_ <= selectedTime && selectedTime < di->endTime_))) { From 1c4551522db61b34d867aaecc153301d92890c57 Mon Sep 17 00:00:00 2001 From: AdenKoperczak Date: Mon, 9 Dec 2024 18:49:23 -0500 Subject: [PATCH 3/4] fix formatting issues in inverted threshold code --- scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp index df4f650e..087f90d7 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp @@ -136,8 +136,9 @@ void PlacefileText::Impl::RenderTextDrawItem( std::chrono::system_clock::now() : selectedTime_; - const bool thresholdMet = mapDistance_ <= di->threshold_ || - ((double)di->threshold_ < 0.0 && mapDistance_ >= -(di->threshold_)); + const bool thresholdMet = + mapDistance_ <= di->threshold_ || + ((double) di->threshold_ < 0.0 && mapDistance_ >= -(di->threshold_)); if ((!thresholded_ || thresholdMet) && (di->startTime_ == std::chrono::system_clock::time_point {} || From 10aabce3a1fe16104241e83c480492bd0de3b148 Mon Sep 17 00:00:00 2001 From: AdenKoperczak Date: Tue, 10 Dec 2024 10:20:54 -0500 Subject: [PATCH 4/4] Fix some minor style issues with inverted threshold code --- scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp index 087f90d7..640d1c52 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_text.cpp @@ -137,10 +137,10 @@ void PlacefileText::Impl::RenderTextDrawItem( selectedTime_; const bool thresholdMet = - mapDistance_ <= di->threshold_ || - ((double) di->threshold_ < 0.0 && mapDistance_ >= -(di->threshold_)); + !thresholded_ || mapDistance_ <= di->threshold_ || + (di->threshold_.value() < 0.0 && mapDistance_ >= -(di->threshold_)); - if ((!thresholded_ || thresholdMet) && + if (thresholdMet && (di->startTime_ == std::chrono::system_clock::time_point {} || (di->startTime_ <= selectedTime && selectedTime < di->endTime_))) {