From 33c5b6b4e6628a659c2f7a46c91ca4cfe97cb072 Mon Sep 17 00:00:00 2001 From: Thomas Kroes Date: Wed, 25 Feb 2026 09:00:45 +0100 Subject: [PATCH 1/3] Remove point size restriction --- src/DatasetsAction.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/DatasetsAction.cpp b/src/DatasetsAction.cpp index e31ce00..cbec33a 100644 --- a/src/DatasetsAction.cpp +++ b/src/DatasetsAction.cpp @@ -172,17 +172,10 @@ void DatasetsAction::setupPointSizeDatasetPickerAction(ScatterplotPlugin* scatte auto& pointSizeAction = pointPlotAction.getSizeAction(); _pointSizeDatasetPickerAction.setFilterFunction([this, scatterplotPlugin](mv::Dataset dataset) -> bool { - if (dataset->getDataType() != PointType) + if (!scatterplotPlugin->getPositionDataset().isValid()) return false; - const auto positionDataset = scatterplotPlugin->getPositionDataset(); - - if (!positionDataset.isValid()) - return false; - - const mv::Dataset candidatePoints(dataset); - - if (candidatePoints->getNumPoints() != positionDataset->getNumPoints()) + if (dataset->getDataType() != PointType) return false; return true; @@ -219,19 +212,12 @@ void DatasetsAction::setupPointOpacityDatasetPickerAction(ScatterplotPlugin* sca auto& pointOpacityAction = pointPlotAction.getOpacityAction(); _pointOpacityDatasetPickerAction.setFilterFunction([this, scatterplotPlugin](mv::Dataset dataset) -> bool { - if (dataset->getDataType() != PointType) - return false; - - const auto positionDataset = scatterplotPlugin->getPositionDataset(); - - if (!positionDataset.isValid()) + if (!scatterplotPlugin->getPositionDataset().isValid()) return false; - const mv::Dataset candidatePoints(dataset); - - if (candidatePoints->getNumPoints() != positionDataset->getNumPoints()) + if (dataset->getDataType() != PointType) return false; - + return true; }); From 009b91c5b16c3a2b457dda035576a4662fdb910f Mon Sep 17 00:00:00 2001 From: Thomas Kroes Date: Wed, 25 Feb 2026 09:29:01 +0100 Subject: [PATCH 2/3] Check scalar source dataset point count When the source picker index points to a dataset, verify that the selected scalar source dataset has the same number of points as the ScatterplotPlugin's position dataset. If the counts differ, suppress emitting sourceSelectionChanged and add a user notification explaining the mismatch to prevent invalid selection. Also fix a parameter name in ScalarSourceAction.h's doc comment (variantMap). --- src/ScalarAction.cpp | 18 +++++++++++++++++- src/ScalarSourceAction.h | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/ScalarAction.cpp b/src/ScalarAction.cpp index f151703..9c026b1 100644 --- a/src/ScalarAction.cpp +++ b/src/ScalarAction.cpp @@ -18,7 +18,23 @@ ScalarAction::ScalarAction(QObject* parent, const QString& title, const float& m addAction(&_sourceAction); connect(&_sourceAction.getPickerAction(), &OptionAction::currentIndexChanged, this, [this](const std::uint32_t& currentIndex) { - emit sourceSelectionChanged(currentIndex); + bool emitSourceSelectionChanged = true; + + if (currentIndex >= ScalarSourceModel::DefaultRow::DatasetStart) { + if (auto scatterplotPlugin = dynamic_cast(findPluginAncestor())) { + auto positionDataset = scatterplotPlugin->getPositionDataset(); + auto scalarSourcePointsDataset = Dataset(getCurrentDataset()); + + if (scalarSourcePointsDataset->getNumPoints() != positionDataset->getNumPoints()) { + emitSourceSelectionChanged = false; + + scatterplotPlugin->addNotification("The number of points in the scalar source dataset does not match the number of points in the position dataset."); + } + } + } + + if (emitSourceSelectionChanged) + emit sourceSelectionChanged(currentIndex); }); connect(&_magnitudeAction, &DecimalAction::valueChanged, this, [this](const float& value) { diff --git a/src/ScalarSourceAction.h b/src/ScalarSourceAction.h index 5387c31..c4e808a 100644 --- a/src/ScalarSourceAction.h +++ b/src/ScalarSourceAction.h @@ -54,7 +54,7 @@ class ScalarSourceAction : public GroupAction /** * Load widget action from variant map - * @param Variant map representation of the widget action + * @param variantMap Variant map representation of the widget action */ void fromVariantMap(const QVariantMap& variantMap) override; From 08f3fe6891589e6d7b8c0121a7676b043ada3b37 Mon Sep 17 00:00:00 2001 From: Thomas Kroes Date: Wed, 25 Feb 2026 10:06:41 +0100 Subject: [PATCH 3/3] Show point counts in dataset mismatch warning Cache the number of points for the scalar source and position datasets and use those values in the mismatch notification. This avoids repeated getNumPoints() calls and provides a clearer notification message (includes numPositions and numScalars) when the two datasets have different sizes. --- src/ScalarAction.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ScalarAction.cpp b/src/ScalarAction.cpp index 9c026b1..1c8d2da 100644 --- a/src/ScalarAction.cpp +++ b/src/ScalarAction.cpp @@ -24,11 +24,13 @@ ScalarAction::ScalarAction(QObject* parent, const QString& title, const float& m if (auto scatterplotPlugin = dynamic_cast(findPluginAncestor())) { auto positionDataset = scatterplotPlugin->getPositionDataset(); auto scalarSourcePointsDataset = Dataset(getCurrentDataset()); + const auto numScalars = scalarSourcePointsDataset->getNumPoints(); + const auto numPositions = positionDataset->getNumPoints(); - if (scalarSourcePointsDataset->getNumPoints() != positionDataset->getNumPoints()) { + if (numScalars != numPositions) { emitSourceSelectionChanged = false; - scatterplotPlugin->addNotification("The number of points in the scalar source dataset does not match the number of points in the position dataset."); + scatterplotPlugin->addNotification(QString("The number of points in the scalar source dataset does not match the number of points in the position dataset. (numPositions=%1, numScalars:%2)").arg(QString::number(numPositions), QString::number(numScalars))); } } }