Skip to content

Commit d455061

Browse files
committed
Delay surjection check for faster UI response
1 parent 20750f2 commit d455061

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

src/MappingUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,5 @@ bool checkSelectionMapping(const mv::Dataset<Points>& colors, const mv::Dataset<
107107
if (!mapping)
108108
return false;
109109

110-
return checkSurjectiveMapping(*mapping, numTargetPoints);
110+
return true;
111111
}

src/ScatterplotPlugin.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,10 @@ void ScatterplotPlugin::loadColors(const Dataset<Points>& pointsColor, const std
691691
}
692692
else if ( // mapping from color data set to position data set
693693
const auto [selectionMapping, numPointsTarget] = getSelectionMappingColorsToPositions(pointsColor, _positionDataset);
694-
/* check if valid */ selectionMapping != nullptr && numPointsTarget == _numPoints
694+
/* check if valid */
695+
selectionMapping != nullptr &&
696+
numPointsTarget == _numPoints &&
697+
checkSurjectiveMapping(*selectionMapping, numPointsTarget)
695698
)
696699
{
697700
// Map values like selection
@@ -706,10 +709,12 @@ void ScatterplotPlugin::loadColors(const Dataset<Points>& pointsColor, const std
706709
}
707710
else if ( // mapping from position data set to color data set
708711
const auto [selectionMapping, numPointsTarget] = getSelectionMappingPositionsToColors(_positionDataset, pointsColor);
709-
/* check if valid */ selectionMapping != nullptr && numPointsTarget == numColorPoints
712+
/* check if valid */
713+
selectionMapping != nullptr &&
714+
numPointsTarget == numColorPoints &&
715+
checkSurjectiveMapping(*selectionMapping, numPointsTarget)
710716
)
711717
{
712-
713718
// Map values like selection (in reverse, use first value that occurs)
714719
const mv::SelectionMap::Map& mapPositionsToColors = selectionMapping->getMapping().getMap();
715720

@@ -724,7 +729,10 @@ void ScatterplotPlugin::loadColors(const Dataset<Points>& pointsColor, const std
724729
}
725730
else if ( // mapping from source of position data set to color data set
726731
const auto [selectionMapping, numPointsTarget] = getSelectionMappingPositionSourceToColors(_positionDataset, pointsColor);
727-
/* check if valid */ selectionMapping != nullptr && numPointsTarget == numColorPoints
732+
/* check if valid */
733+
selectionMapping != nullptr &&
734+
numPointsTarget == numColorPoints &&
735+
checkSurjectiveMapping(*selectionMapping, numPointsTarget)
728736
)
729737
{
730738
// the selection map is from full source data of positions data to pointsColor

0 commit comments

Comments
 (0)