Commit 3fe172fa authored by Danny Hindson's avatar Danny Hindson
Browse files

Remove warning from instrument viewer

When viewing instruments that have banks that are width "one detector"
in x or y or z, the instrument viewer was giving a warning about "failed
to build unwrapped surface" when you viewed in one of the cylindrical
projections. Remove the warning and also the code to assign values to
u_min and u_max shortly after. The pre-existing values of 0 and 0 are
fine for these values which are in radians
Also include some line length changes that come from the latest clang
format version
parent fd3ed9b5
......@@ -26,11 +26,9 @@ Mantid::Kernel::Logger g_log("RotationSurface");
namespace MantidQt {
namespace MantidWidgets {
RotationSurface::RotationSurface(const InstrumentActor *rootActor,
const Mantid::Kernel::V3D &origin,
RotationSurface::RotationSurface(const InstrumentActor *rootActor, const Mantid::Kernel::V3D &origin,
const Mantid::Kernel::V3D &axis)
: UnwrappedSurface(rootActor), m_pos(origin), m_zaxis(axis),
m_manual_u_correction(false) {}
: UnwrappedSurface(rootActor), m_pos(origin), m_zaxis(axis), m_manual_u_correction(false) {}
void RotationSurface::findAxes() {
// First detector defines the surface's x axis
......@@ -79,8 +77,7 @@ std::vector<size_t> RotationSurface::retrieveSurfaceDetectors() const {
auto layer = layers[renderer.selectedLayer()];
auto dets = componentInfo.detectorsInSubtree(layer);
detectors.insert(detectors.end(), dets.begin(), dets.end());
} else if (component != root && parentType != ComponentType::Grid &&
grandparentType != ComponentType::Grid) {
} else if (component != root && parentType != ComponentType::Grid && grandparentType != ComponentType::Grid) {
// Add detectors not in any way related to a grid
auto dets = componentInfo.detectorsInSubtree(component);
detectors.insert(detectors.end(), dets.begin(), dets.end());
......@@ -236,8 +233,7 @@ void RotationSurface::findUVBounds() {
m_v_min = DBL_MAX;
m_v_max = -DBL_MAX;
for (const auto &udet : m_unwrappedDetectors) {
if (udet.empty() ||
!m_instrActor->componentInfo().hasValidShape(udet.detIndex))
if (udet.empty() || !m_instrActor->componentInfo().hasValidShape(udet.detIndex))
continue;
if (udet.u < m_u_min)
m_u_min = udet.u;
......@@ -257,20 +253,11 @@ void RotationSurface::findAndCorrectUGap() {
const int nbins = 1000;
std::vector<bool> ubins(nbins);
double bin_width = fabs(m_u_max - m_u_min) / (nbins - 1);
if (bin_width == 0.0) {
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
QMessageBox::warning(
nullptr, tr("Mantid - Instrument view warning"),
tr("Rotation surface: failed to build unwrapped surface"));
QApplication::restoreOverrideCursor();
m_u_min = 0.0;
m_u_max = 1.0;
if (bin_width == 0.0)
return;
}
for (const auto &udet : m_unwrappedDetectors) {
if (udet.empty() ||
!m_instrActor->componentInfo().hasValidShape(udet.detIndex))
if (udet.empty() || !m_instrActor->componentInfo().hasValidShape(udet.detIndex))
continue;
double u = udet.u;
int i = int((u - m_u_min) / bin_width);
......@@ -307,8 +294,7 @@ void RotationSurface::findAndCorrectUGap() {
}
for (auto &udet : m_unwrappedDetectors) {
if (udet.empty() ||
!m_instrActor->componentInfo().hasValidShape(udet.detIndex))
if (udet.empty() || !m_instrActor->componentInfo().hasValidShape(udet.detIndex))
continue;
double &u = udet.u;
u = applyUCorrection(u);
......
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