Skip to content

Commit

Permalink
Copy UB matrix from data WS to peaks WS when adding peaks. Re #6926.
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Apr 25, 2013
1 parent d8116ba commit 10daa82
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1276,16 +1276,14 @@ void InstrumentWindow::enableOpenGL( bool on )
/// Private slot to toggle between the GL and simple instrument display widgets
void InstrumentWindow::enableGL( bool on )
{
if ( m_surfaceType == FULL3D ) m_useOpenGL = true; // always OpenGL in 3D
else m_useOpenGL = on;

selectOpenGLDisplay(m_useOpenGL);
m_useOpenGL = on;
selectOpenGLDisplay(isGLEnabled());
}

/// True if the GL instrument display is currently on
bool InstrumentWindow::isGLEnabled() const
{
return m_useOpenGL;
return m_useOpenGL || ( m_surfaceType == FULL3D );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "MantidAPI/WorkspaceFactory.h"
#include "MantidAPI/TableRow.h"
#include "MantidAPI/FrameworkManager.h"
#include "MantidGeometry/Crystal/OrientedLattice.h"

#include "qwt_scale_widget.h"
#include "qwt_scale_div.h"
Expand Down Expand Up @@ -708,6 +709,16 @@ void InstrumentWindowPickTab::addPeak(double x,double y)
alg->setProperty( "BinCount", y );
alg->execute();

// if peaks workspace doesn't have UB but the data ws has one copy it to peaks
if ( !tw->sample().hasOrientedLattice() && ws->sample().hasOrientedLattice() )
{
auto UB = ws->sample().getOrientedLattice().getUB();
auto lattice = new Mantid::Geometry::OrientedLattice;
lattice->setUB(UB);
tw->mutableSample().setOrientedLattice(lattice);
}

// if there is a UB available calculate HKL for the new peak
if ( tw->sample().hasOrientedLattice() )
{
auto alg = Mantid::API::FrameworkManager::Instance().createAlgorithm("CalculatePeaksHKL");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <QAction>
#include <QSignalMapper>
#include <QMessageBox>
#include <QToolTip>

#include <qwt_scale_widget.h>
#include <qwt_scale_engine.h>
Expand Down Expand Up @@ -80,6 +81,7 @@ InstrumentWindowTab(instrWindow)

// Create "Use OpenGL" action
m_GLView = new QAction("Use OpenGL",this);
m_GLView->setToolTip("Toggle use of OpenGL for unwrapped view. Default value can be set in Preferences.");
m_GLView->setCheckable(true);
QString setting = QString::fromStdString(Mantid::Kernel::ConfigService::Instance().
getString("MantidOptions.InstrumentView.UseOpenGL")).toUpper();
Expand All @@ -97,6 +99,7 @@ InstrumentWindowTab(instrWindow)
displaySettingsMenu->addAction(m_lighting);
displaySettingsMenu->addAction(m_GLView);
displaySettings->setMenu(displaySettingsMenu);
connect(displaySettingsMenu,SIGNAL(hovered(QAction*)),this,SLOT(showMenuToolTip(QAction*)));

QFrame * axisViewFrame = setupAxisFrame();

Expand Down Expand Up @@ -548,3 +551,11 @@ void InstrumentWindowRenderTab::glOptionChanged(bool on)
m_GLView->setChecked(on);
m_GLView->blockSignals(false);
}

/**
* Show the tooltip of an action which is attached to a menu.
*/
void InstrumentWindowRenderTab::showMenuToolTip(QAction *action)
{
QToolTip::showText(QCursor::pos(),action->toolTip(),this);
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private slots:
void colorMapChanged();
void scaleTypeChanged(int);
void glOptionChanged(bool);
void showMenuToolTip(QAction*);

private:
void showEvent (QShowEvent *);
Expand Down

0 comments on commit 10daa82

Please sign in to comment.