From fea9083f7d6c26a15996b2713d2e1eb0d76d5797 Mon Sep 17 00:00:00 2001 From: AdenKoperczak Date: Mon, 17 Mar 2025 09:39:01 -0400 Subject: [PATCH] Remove unnecessary copy, and make callback argument const in geolines --- scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp | 5 ++--- scwx-qt/source/scwx/qt/gl/draw/geo_lines.hpp | 2 +- scwx-qt/source/scwx/qt/map/alert_layer.cpp | 9 +++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp b/scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp index c3999c36..aa4d2ccb 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/geo_lines.cpp @@ -494,7 +494,7 @@ void GeoLines::Impl::UpdateModifiedLineBuffers() for (auto& di : dirtyLines_) { // Check if modified line is in the current list - if (currentLineList_.size() < di->lineIndex_ || + if (di->lineIndex_ >= currentLineList_.size() || currentLineList_[di->lineIndex_] != di) { continue; @@ -799,8 +799,7 @@ bool GeoLines::RunMousePicking( } else if (it->second.di_->hoverCallback_ != nullptr) { - std::shared_ptr di = it->second.di_; - it->second.di_->hoverCallback_(di, mouseGlobalPos); + it->second.di_->hoverCallback_(it->second.di_, mouseGlobalPos); } if (it->second.di_->event_ != nullptr) diff --git a/scwx-qt/source/scwx/qt/gl/draw/geo_lines.hpp b/scwx-qt/source/scwx/qt/gl/draw/geo_lines.hpp index b7b792d0..4bc29b26 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/geo_lines.hpp +++ b/scwx-qt/source/scwx/qt/gl/draw/geo_lines.hpp @@ -19,7 +19,7 @@ struct GeoLineDrawItem; class GeoLines : public DrawItem { public: - typedef std::function&, + typedef std::function&, const QPointF&)> HoverCallback; diff --git a/scwx-qt/source/scwx/qt/map/alert_layer.cpp b/scwx-qt/source/scwx/qt/map/alert_layer.cpp index b05084c9..c88f6220 100644 --- a/scwx-qt/source/scwx/qt/map/alert_layer.cpp +++ b/scwx-qt/source/scwx/qt/map/alert_layer.cpp @@ -159,8 +159,9 @@ public: void ConnectSignals(); void HandleGeoLinesEvent(std::weak_ptr& di, QEvent* ev); - void HandleGeoLinesHover(std::shared_ptr& di, - const QPointF& mouseGlobalPos); + void + HandleGeoLinesHover(const std::shared_ptr& di, + const QPointF& mouseGlobalPos); void ScheduleRefresh(); LineData& GetLineData(const std::shared_ptr& segment, @@ -720,8 +721,8 @@ void AlertLayer::Impl::HandleGeoLinesEvent( } void AlertLayer::Impl::HandleGeoLinesHover( - std::shared_ptr& di, - const QPointF& mouseGlobalPos) + const std::shared_ptr& di, + const QPointF& mouseGlobalPos) { if (di != lastHoverDi_) {