@@ -77,7 +77,6 @@ static std::optional<const mv::LinkedData*> getSelectionMapping(const mv::Datase
7777 }
7878
7979 return std::nullopt ; // nothing found
80-
8180}
8281
8382static std::optional<const mv::LinkedData*> getSelectionMappingColorsToPositions (const mv::Dataset<Points>& colors, const mv::Dataset<Points>& positions) {
@@ -90,22 +89,22 @@ static std::optional<const mv::LinkedData*> getSelectionMappingColorsToPositions
9089}
9190
9291static std::optional<const mv::LinkedData*> getSelectionMappingPositionsToColors (const mv::Dataset<Points>& positions, const mv::Dataset<Points>& colors) {
93-
9492 auto testTarget = [](const mv::LinkedData& linkedData, const mv::Dataset<Points>& colors) -> bool {
9593 return linkedData.getTargetDataset () == colors;
9694 };
9795
9896 auto mapping = getSelectionMapping (positions, colors, testTarget);
9997
100- if (!mapping.has_value () && parentHasSameNumPoints (positions, colors)) {
101- mapping = getSelectionMapping (positions->getParent <Points>(), colors, testTarget);
98+ if (!mapping.has_value () && parentHasSameNumPoints (positions, positions)) {
99+ const auto positionsParent = positions->getParent <Points>();
100+ mapping = getSelectionMapping (positionsParent, colors, testTarget);
102101 }
103102
104103 return mapping;
105104}
106105
106+ // Check if the mapping is surjective, i.e. hits all elements in the target
107107static bool checkSurjectiveMapping (const mv::LinkedData& linkedData, const std::uint32_t numPointsInTarget) {
108- // Check if the mapping is surjective, i.e. hits all elements in the target
109108 const std::map<std::uint32_t , std::vector<std::uint32_t >>& linkedMap = linkedData.getMapping ().getMap ();
110109
111110 std::vector<bool > found (numPointsInTarget, false );
@@ -126,7 +125,8 @@ static bool checkSurjectiveMapping(const mv::LinkedData& linkedData, const std::
126125 return false ; // The previous loop would have returned early if the entire taget set was covered
127126}
128127
129- // returns whether there is a selection map from source to target that covers all elements in the target
128+ // returns whether there is a selection map from colors to positions or positions to colors (or respective parents)
129+ // checks whether the mapping covers all elements in the target
130130static bool checkSelectionMapping (const mv::Dataset<Points>& colors, const mv::Dataset<Points>& positions) {
131131
132132 // Check if there is a mapping
@@ -294,9 +294,6 @@ ScatterplotPlugin::ScatterplotPlugin(const PluginFactory* factory) :
294294 /* then*/ _positionDataset->getSourceDataset <Points>()->getFullDataset <Points>()->getNumPoints () == numPointsCandidate :
295295 /* else*/ false ;
296296
297- const auto & l1 = candidateDataset->getLinkedData ();
298- const auto & l2 = _positionDataset->getLinkedData ();
299-
300297 // [3. Full selection mapping]
301298 const bool hasSelectionMapping = checkSelectionMapping (candidateDataset, _positionDataset);
302299
0 commit comments