Commit 95fc42aa authored by Mathieu Tillet's avatar Mathieu Tillet
Browse files

Allow to replace the workspace linked to a viewer

This adds the C++ function allowing to replace a workspace currently being
shown in the instrument viewer by a new one, and update the view and the
color bar accordingly.
parent 65f851eb
......@@ -149,6 +149,8 @@ public:
void handleWorkspaceReplacement(
const std::string &wsName,
const std::shared_ptr<Mantid::API::Workspace> &workspace);
void replaceWs(const std::string &newWs,
const std::shared_ptr<Mantid::API::Workspace> &workspace);
/// Get the currently selected tab index
int getCurrentTab() const;
......@@ -635,7 +635,6 @@ void InstrumentActor::resetColors() {
void InstrumentActor::updateColors() {
setIntegrationRange(m_BinMinValue, m_BinMaxValue);
......@@ -575,6 +575,23 @@ void InstrumentWidget::setSurfaceType(const QString &typeStr) {
* @brief InstrumentWidget::replaceWs
* Replace the workspace currently linked to the instrument viewer by a new one.
* @param newWs the name of the new workspace
* @param workspace the new workspace to show
void InstrumentWidget::replaceWs(const std::string &newWs,
const std::shared_ptr<Workspace> &workspace) {
handleWorkspaceReplacement(m_workspaceName.toStdString(), workspace);
m_instrumentActor.reset(new InstrumentActor(QString::fromStdString(newWs)));
auto surface = getSurface();
* Update the colormap on the render tab.
......@@ -600,6 +617,7 @@ void InstrumentWidget::changeColormap(const QString &cmapNameOrPath) {
if (!m_instrumentActor)
const auto currentCMap = m_instrumentActor->getCurrentColorMap();
QString selection;
if (cmapNameOrPath.isEmpty()) {
// ask user
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment