fix(viz): Renaming a landmark creates a "ghost" landmark which is impossible to interact with
Description
When renaming a landmark in SightViewer, the landmark is duplicated: there is one version with the new name and another version with the old name. The version with the new name works correctly, but the version with the old name doesn't appear in the landmark list and can't be interacted with. A log appears when trying to move it: [libs/core/data/Landmarks.cpp:149] Exception: <sight::data::Exception>: Group 'Group_0' does not exist
.
Steps to reproduce
- Start SightViewer
- Load an ITK file
- Create a new landmark with Ctrl+Left Click
- Rename it in the Landmark list
- Two versions appear. The new version with the good name works correctly and can be moved (the old version might get in the way though, so you may have to enlarge it in order to be able to move it). The old version doesn't appear in the landmark list, and trying to move it gives the log
[libs/core/data/Landmarks.cpp:149] Exception: <sight::data::Exception>: Group 'Group_0' does not exist
.
I managed to reproduce the bug on Ubuntu 21.10, I didn't test it on Windows.
Proposal
It looks like there might be a missing signal-slot connexion between
data::Landmarks::s_GROUP_RENAMED_SIG
and the SLandmarks adaptor.
One solution could be to create a renameGroup
slot in the SLandmarks adaptor that removes the old group and only renders the new group name.
Functional specifications
Create a renameGroup
slot in the SLandmarks adaptor that removes the old group and only renders the new group name. It'll look like modifyGroup
with an additional parameter which would be the new group name.
Technical specifications
- New slot
renameGroup(std::string, std::string)
inscene3D::adaptor::SLandmarks.cpp
- the slot would be a close to
modifyGroup
Slot
Test plan
- Start SightViewer
- Load an ITK file
- Create a new landmark with Ctrl+Left Click
- Rename it in the Landmark list
- Only one landmark should appear with the right name.