Prevent "shadow" control spot from appearing

This situation was happening when switching between pictures or using
history with specific control spot id configuration (for instance, when
ID1 was not used by a control spot)
This commit is contained in:
Pandagrapher
2019-01-06 10:56:33 +01:00
parent 7a33c69b57
commit 9b845a628e

View File

@@ -888,7 +888,14 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited)
set_inconsistent(multiImage && !pedited->locallab.enabled); set_inconsistent(multiImage && !pedited->locallab.enabled);
} }
// Add non existent spots and update existent ones // Delete all existent spots
std::vector<int>* const list = expsettings->getSpotIdList();
for (size_t i = 0; i < list->size(); i++) {
expsettings->deleteControlSpot(list->at(i));
}
// Add existent spots based on pp
ControlSpotPanel::SpotRow* const r = new ControlSpotPanel::SpotRow(); ControlSpotPanel::SpotRow* const r = new ControlSpotPanel::SpotRow();
for (int i = 0; i < pp->locallab.nbspot && i < (int)pp->locallab.spots.size(); i++) { for (int i = 0; i < pp->locallab.nbspot && i < (int)pp->locallab.spots.size(); i++) {
@@ -941,28 +948,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited)
r->thresh = pp->locallab.spots.at(i).thresh; r->thresh = pp->locallab.spots.at(i).thresh;
r->iter = pp->locallab.spots.at(i).iter; r->iter = pp->locallab.spots.at(i).iter;
if (!expsettings->updateControlSpot(r)) { expsettings->addControlSpot(r);
expsettings->addControlSpot(r);
}
}
// Delete not anymore existent spots
std::vector<int>* const list = expsettings->getSpotIdList();
bool ispresent;
for (int i = 0; i < (int)list->size() - 1; i++) {
ispresent = false;
for (int j = 0; j < pp->locallab.nbspot && j < (int)pp->locallab.spots.size(); j++) {
if (list->at(i) == pp->locallab.spots.at(j).id) {
ispresent = true;
break;
}
}
if (!ispresent) {
expsettings->deleteControlSpot(list->at(i));
}
} }
// Select active spot // Select active spot