From 936b0d89c64152ec17d9c8e2bd6c37ff6ed22832 Mon Sep 17 00:00:00 2001 From: Alexander Vieth Date: Mon, 30 Mar 2026 16:58:37 +0200 Subject: [PATCH 1/7] Update number of points to uint64 --- src/MappingUtils.cpp | 8 ++++---- src/MappingUtils.h | 8 ++++---- src/ScatterplotPlugin.cpp | 2 +- src/ScatterplotPlugin.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/MappingUtils.cpp b/src/MappingUtils.cpp index e238064..7f9324e 100644 --- a/src/MappingUtils.cpp +++ b/src/MappingUtils.cpp @@ -14,7 +14,7 @@ #include #include -std::pair getSelectionMapping(const mv::Dataset& source, const mv::Dataset& target, LinkedDataCondition checkMapping) { +std::pair getSelectionMapping(const mv::Dataset& source, const mv::Dataset& target, LinkedDataCondition checkMapping) { const std::vector& linkedDatas = source->getLinkedData(); if (linkedDatas.empty()) @@ -34,7 +34,7 @@ std::pair getSelectionMapping(const mv::Dat return { nullptr, 0 }; } -std::pair getSelectionMappingColorsToPositions(const mv::Dataset& colors, const mv::Dataset& positions) { +std::pair getSelectionMappingColorsToPositions(const mv::Dataset& colors, const mv::Dataset& positions) { auto testTargetAndParent = [](const mv::LinkedData& linkedData, const mv::Dataset& positions) -> bool { const mv::Dataset mapTargetData = linkedData.getTargetDataset(); return mapTargetData == positions || parentHasSameNumPoints(mapTargetData, positions); @@ -43,7 +43,7 @@ std::pair getSelectionMappingColorsToPositi return getSelectionMapping(colors, positions, testTargetAndParent); } -std::pair getSelectionMappingPositionsToColors(const mv::Dataset& positions, const mv::Dataset& colors) { +std::pair getSelectionMappingPositionsToColors(const mv::Dataset& positions, const mv::Dataset& colors) { auto testTarget = [](const mv::LinkedData& linkedData, const mv::Dataset& colors) -> bool { return linkedData.getTargetDataset() == colors; }; @@ -58,7 +58,7 @@ std::pair getSelectionMappingPositionsToCol return { mapping, numTargetPoints }; } -std::pair getSelectionMappingPositionSourceToColors(const mv::Dataset& positions, const mv::Dataset& colors) { +std::pair getSelectionMappingPositionSourceToColors(const mv::Dataset& positions, const mv::Dataset& colors) { if (!positions->isDerivedData()) return { nullptr, 0 }; diff --git a/src/MappingUtils.h b/src/MappingUtils.h index 62a4cba..6229dcb 100644 --- a/src/MappingUtils.h +++ b/src/MappingUtils.h @@ -39,17 +39,17 @@ using LinkedDataCondition = std::function getSelectionMapping(const mv::Dataset& source, const mv::Dataset& target, LinkedDataCondition checkMapping); +std::pair getSelectionMapping(const mv::Dataset& source, const mv::Dataset& target, LinkedDataCondition checkMapping); // Returns a mapping (linked data) from colors whose target is positions or whose target's parent has the same number of points as positions -std::pair getSelectionMappingColorsToPositions(const mv::Dataset& colors, const mv::Dataset& positions); +std::pair getSelectionMappingColorsToPositions(const mv::Dataset& colors, const mv::Dataset& positions); // Returns a mapping (linked data) from positions whose target is colors or // a mapping from positions' parent whose target is colors if the number of data points match -std::pair getSelectionMappingPositionsToColors(const mv::Dataset& positions, const mv::Dataset& colors); +std::pair getSelectionMappingPositionsToColors(const mv::Dataset& positions, const mv::Dataset& colors); // Returns a mapping (linked data) from positions' source data whose target is colors -std::pair getSelectionMappingPositionSourceToColors(const mv::Dataset& positions, const mv::Dataset& colors); +std::pair getSelectionMappingPositionSourceToColors(const mv::Dataset& positions, const mv::Dataset& colors); // Check if the mapping is surjective, i.e. hits all elements in the target bool checkSurjectiveMapping(const mv::LinkedData& linkedData, const std::uint32_t numPointsInTarget); diff --git a/src/ScatterplotPlugin.cpp b/src/ScatterplotPlugin.cpp index c071758..03c76bb 100644 --- a/src/ScatterplotPlugin.cpp +++ b/src/ScatterplotPlugin.cpp @@ -846,7 +846,7 @@ void ScatterplotPlugin::loadColors(const Dataset& clusters) return; // Get global indices from the position dataset - int totalNumPoints = 0; + std::uint64_t totalNumPoints = 0; if (_positionDataset->isDerivedData()) totalNumPoints = _positionSourceDataset->getFullDataset()->getNumPoints(); else diff --git a/src/ScatterplotPlugin.h b/src/ScatterplotPlugin.h index 8649f82..437876b 100644 --- a/src/ScatterplotPlugin.h +++ b/src/ScatterplotPlugin.h @@ -119,7 +119,7 @@ class ScatterplotPlugin : public ViewPlugin Dataset _positionDataset; /** Smart pointer to points dataset for point position */ Dataset _positionSourceDataset; /** Smart pointer to source of the points dataset for point position (if any) */ std::vector _positions; /** Point positions */ - unsigned int _numPoints; /** Number of point positions */ + std::uint64_t _numPoints; /** Number of point positions */ QPointer _settingsAction; /** Group action for all settings */ QPointer _primaryToolbarAction; /** Horizontal toolbar for primary content */ QRectF _selectionBoundaries; /** Boundaries of the selection */ From 0eb183700270cb9ee79df575e8cdc20d75375f9b Mon Sep 17 00:00:00 2001 From: Alexander Vieth Date: Mon, 30 Mar 2026 16:58:48 +0200 Subject: [PATCH 2/7] Use reference dataset --- src/ScatterplotPlugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ScatterplotPlugin.cpp b/src/ScatterplotPlugin.cpp index 03c76bb..2a851a5 100644 --- a/src/ScatterplotPlugin.cpp +++ b/src/ScatterplotPlugin.cpp @@ -138,10 +138,10 @@ ScatterplotPlugin::ScatterplotPlugin(const PluginFactory* factory) : if (datasetsMimeData == nullptr) return dropRegions; - if (datasetsMimeData->getDatasets().count() > 1) + if (datasetsMimeData->getDatasetsCount() > 1) return dropRegions; - const auto dataset = datasetsMimeData->getDatasets().first(); + const auto& dataset = datasetsMimeData->getDatasetsRef().first(); const auto datasetGuiName = dataset->text(); const auto datasetId = dataset->getId(); const auto dataType = dataset->getDataType(); From a22e30e6bc1a287483035d0b85398b472dc0e3e4 Mon Sep 17 00:00:00 2001 From: Alexander Vieth Date: Mon, 30 Mar 2026 16:58:56 +0200 Subject: [PATCH 3/7] Add some const --- src/MappingUtils.cpp | 2 +- src/ScatterplotPlugin.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MappingUtils.cpp b/src/MappingUtils.cpp index 7f9324e..2d80d11 100644 --- a/src/MappingUtils.cpp +++ b/src/MappingUtils.cpp @@ -77,7 +77,7 @@ bool checkSurjectiveMapping(const mv::LinkedData& linkedData, const std::uint32_ std::uint32_t count = 0; for (const auto& [key, vec] : linkedMap) { - for (std::uint32_t val : vec) { + for (const std::uint32_t val : vec) { if (val >= numPointsInTarget) continue; // Skip values that are too large if (!found[val]) { diff --git a/src/ScatterplotPlugin.cpp b/src/ScatterplotPlugin.cpp index 2a851a5..542d51b 100644 --- a/src/ScatterplotPlugin.cpp +++ b/src/ScatterplotPlugin.cpp @@ -755,7 +755,7 @@ void ScatterplotPlugin::loadColors(const Dataset& pointsColor, const std const mv::SelectionMap::Map& mapColorsToPositions = selectionMapping->getMapping().getMap(); for (const auto& [fromColorID, vecOfPositionIDs] : mapColorsToPositions) { - for (std::uint32_t toPositionID : vecOfPositionIDs) { + for (const std::uint32_t toPositionID : vecOfPositionIDs) { mappedColorScalars[toPositionID] = colorScalars[fromColorID]; } } @@ -775,7 +775,7 @@ void ScatterplotPlugin::loadColors(const Dataset& pointsColor, const std for (const auto& [fromPositionID, vecOfColorIDs] : mapPositionsToColors) { if (mappedColorScalars[fromPositionID] != std::numeric_limits::lowest()) continue; - for (std::uint32_t toColorID : vecOfColorIDs) { + for (const std::uint32_t toColorID : vecOfColorIDs) { mappedColorScalars[fromPositionID] = colorScalars[toColorID]; } } From 3ea07bbd30345deb3b1b2f627b50dcba58efdbe3 Mon Sep 17 00:00:00 2001 From: Alexander Vieth Date: Mon, 30 Mar 2026 16:59:24 +0200 Subject: [PATCH 4/7] Rename lambda capture variable to not shadow function paramters --- src/MappingUtils.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MappingUtils.cpp b/src/MappingUtils.cpp index 2d80d11..5483a24 100644 --- a/src/MappingUtils.cpp +++ b/src/MappingUtils.cpp @@ -35,17 +35,17 @@ std::pair getSelectionMapping(const mv::Da } std::pair getSelectionMappingColorsToPositions(const mv::Dataset& colors, const mv::Dataset& positions) { - auto testTargetAndParent = [](const mv::LinkedData& linkedData, const mv::Dataset& positions) -> bool { + auto testTargetAndParent = [](const mv::LinkedData& linkedData, const mv::Dataset& positions_) -> bool { const mv::Dataset mapTargetData = linkedData.getTargetDataset(); - return mapTargetData == positions || parentHasSameNumPoints(mapTargetData, positions); + return mapTargetData == positions_ || parentHasSameNumPoints(mapTargetData, positions_); }; return getSelectionMapping(colors, positions, testTargetAndParent); } std::pair getSelectionMappingPositionsToColors(const mv::Dataset& positions, const mv::Dataset& colors) { - auto testTarget = [](const mv::LinkedData& linkedData, const mv::Dataset& colors) -> bool { - return linkedData.getTargetDataset() == colors; + auto testTarget = [](const mv::LinkedData& linkedData, const mv::Dataset& colors_) -> bool { + return linkedData.getTargetDataset() == colors_; }; auto [mapping, numTargetPoints] = getSelectionMapping(positions, colors, testTarget); From 9d92d4dffe5c8150b988e7dde824fbbb8e7946e1 Mon Sep 17 00:00:00 2001 From: Alexander Vieth Date: Mon, 30 Mar 2026 17:08:20 +0200 Subject: [PATCH 5/7] More uint64 --- src/ScatterplotPlugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ScatterplotPlugin.cpp b/src/ScatterplotPlugin.cpp index 542d51b..ea804a7 100644 --- a/src/ScatterplotPlugin.cpp +++ b/src/ScatterplotPlugin.cpp @@ -244,13 +244,13 @@ ScatterplotPlugin::ScatterplotPlugin(const PluginFactory* factory) : { // Check to set whether the number of data points comprised throughout all clusters is the same number // as the number of data points in the dataset we are trying to color - int totalNumIndices = 0; + std::uint64_t totalNumIndices = 0; for (const Cluster& cluster : candidateDataset->getClusters()) { totalNumIndices += cluster.getIndices().size(); } - int totalNumPoints = 0; + std::uint64_t totalNumPoints = 0; if (_positionDataset->isDerivedData()) totalNumPoints = _positionSourceDataset->getFullDataset()->getNumPoints(); else From f717d346c0520b2cfe85b92bfa207e5346f8b047 Mon Sep 17 00:00:00 2001 From: Alexander Vieth Date: Mon, 30 Mar 2026 17:08:30 +0200 Subject: [PATCH 6/7] Set MSVC warning level to W3 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9674d0..59655d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ set(CMAKE_AUTORCC ON) set(CMAKE_AUTOMOC ON) if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DWIN32 /EHsc /MP /permissive- /Zc:__cplusplus") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DWIN32 /EHsc /W3 /MP /permissive- /Zc:__cplusplus") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD") From 7655d929aba9e3004db319641e899fb674553683 Mon Sep 17 00:00:00 2001 From: Alexander Vieth Date: Mon, 30 Mar 2026 17:12:59 +0200 Subject: [PATCH 7/7] We only want one dataset --- src/ScatterplotPlugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ScatterplotPlugin.cpp b/src/ScatterplotPlugin.cpp index ea804a7..42d2939 100644 --- a/src/ScatterplotPlugin.cpp +++ b/src/ScatterplotPlugin.cpp @@ -138,7 +138,7 @@ ScatterplotPlugin::ScatterplotPlugin(const PluginFactory* factory) : if (datasetsMimeData == nullptr) return dropRegions; - if (datasetsMimeData->getDatasetsCount() > 1) + if (datasetsMimeData->getDatasetsCount() != 1) return dropRegions; const auto& dataset = datasetsMimeData->getDatasetsRef().first();