Skip to content

Commit 08f3fe6

Browse files
committed
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.
1 parent 009b91c commit 08f3fe6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/ScalarAction.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ ScalarAction::ScalarAction(QObject* parent, const QString& title, const float& m
2424
if (auto scatterplotPlugin = dynamic_cast<ScatterplotPlugin*>(findPluginAncestor())) {
2525
auto positionDataset = scatterplotPlugin->getPositionDataset();
2626
auto scalarSourcePointsDataset = Dataset<Points>(getCurrentDataset());
27+
const auto numScalars = scalarSourcePointsDataset->getNumPoints();
28+
const auto numPositions = positionDataset->getNumPoints();
2729

28-
if (scalarSourcePointsDataset->getNumPoints() != positionDataset->getNumPoints()) {
30+
if (numScalars != numPositions) {
2931
emitSourceSelectionChanged = false;
3032

31-
scatterplotPlugin->addNotification("The number of points in the scalar source dataset does not match the number of points in the position dataset.");
33+
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)));
3234
}
3335
}
3436
}

0 commit comments

Comments
 (0)