Skip to content
Snippets Groups Projects
Commit 2fd28b36 authored by Lamar Moore's avatar Lamar Moore
Browse files

small cleanup #22349

parent 33c1e1a1
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@
#include "MantidQtWidgets/InstrumentView/InstrumentWidgetRenderTab.h"
#include "MantidQtWidgets/InstrumentView/InstrumentWidgetTreeTab.h"
#include "MantidGeometry/Instrument/ComponentInfo.h"
#include "MantidGeometry/Instrument/DetectorInfo.h"
#include "MantidAPI/Axis.h"
#include "MantidAPI/IMaskWorkspace.h"
......@@ -1234,24 +1235,17 @@ void InstrumentWidget::handleWorkspaceReplacement(
close();
return;
}
bool sameWS = false;
try {
sameWS = (matrixWS == m_instrumentActor->getWorkspace());
} catch (std::runtime_error &) {
// Carry on, sameWS should stay false
}
// try to detect if the instrument changes (unlikely if the workspace
// hasn't, but theoretically possible)
bool resetGeometry = matrixWS->getInstrument()->getNumberDetectors() !=
m_instrumentActor->ndetectors();
// if workspace and instrument don't change keep the scaling
if (sameWS && !resetGeometry) {
m_instrumentActor->updateColors();
setupColorMap();
updateInstrumentView();
} else {
bool resetGeometry =
matrixWS->detectorInfo().size() != m_instrumentActor->ndetectors();
try {
if (matrixWS == m_instrumentActor->getWorkspace() && !resetGeometry) {
m_instrumentActor->updateColors();
setupColorMap();
updateInstrumentView();
}
} catch (std::runtime_error &) {
resetInstrument(resetGeometry);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment