Commit 61879f76 authored by Antti Soininen's avatar Antti Soininen
Browse files

Code beautification.

Re #16957
parent 32632f07
......@@ -115,7 +115,9 @@ public:
void setScaleType(GraphOptions::ScaleType type);
void setExponent(double nth_power);
void setViewType(const QString &type);
const InstrumentActor &getInstrumentActor() const { return *m_instrumentActor; }
const InstrumentActor &getInstrumentActor() const {
return *m_instrumentActor;
}
InstrumentActor &getInstrumentActor() { return *m_instrumentActor; }
void resetInstrument(bool resetGeometry);
void selectTab(int tab);
......
......@@ -188,7 +188,8 @@ class ComponentInfoController : public QObject {
public:
/// Constructor.
ComponentInfoController(InstrumentWidgetPickTab *tab,
const InstrumentWidget *instrWidget, QTextEdit *infoDisplay);
const InstrumentWidget *instrWidget,
QTextEdit *infoDisplay);
public slots:
void displayInfo(size_t pickID);
void displayComparePeaksInfo(
......
......@@ -66,7 +66,8 @@ void InstrumentTreeWidget::getSelectedBoundingBox(const QModelIndex &index,
// int(instrument->getSample()->getComponentID()) << '\n';
if (tmpObj->getComponentID() ==
instrument->getSample()->getComponentID()) {
boundBox = m_instrWidget->getInstrumentActor().getWorkspace()
boundBox = m_instrWidget->getInstrumentActor()
.getWorkspace()
->sample()
.getShape()
.getBoundingBox();
......
......@@ -411,13 +411,15 @@ void InstrumentWidget::setSurfaceType(int type) {
// create the surface
if (surfaceType == FULL3D) {
surface =
new Projection3D(m_instrumentActor.get(), getInstrumentDisplayWidth(),
getInstrumentDisplayHeight());
surface = new Projection3D(m_instrumentActor.get(),
getInstrumentDisplayWidth(),
getInstrumentDisplayHeight());
} else if (surfaceType <= CYLINDRICAL_Z) {
surface = new UnwrappedCylinder(m_instrumentActor.get(), sample_pos, axis);
surface =
new UnwrappedCylinder(m_instrumentActor.get(), sample_pos, axis);
} else if (surfaceType <= SPHERICAL_Z) {
surface = new UnwrappedSphere(m_instrumentActor.get(), sample_pos, axis);
surface =
new UnwrappedSphere(m_instrumentActor.get(), sample_pos, axis);
} else // SIDE_BY_SIDE
{
surface = new PanelsSurface(m_instrumentActor.get(), sample_pos, axis);
......
......@@ -785,8 +785,8 @@ void InstrumentWidgetMaskTab::saveExcludeGroupToFile() {
if (!fname.isEmpty()) {
QList<int> dets;
m_instrWidget->getSurface()->getMaskedDetectors(dets);
DetXMLFile mapFile(m_instrWidget->getInstrumentActor().getAllDetIDs(),
dets, fname);
DetXMLFile mapFile(m_instrWidget->getInstrumentActor().getAllDetIDs(), dets,
fname);
}
}
......
......@@ -575,10 +575,9 @@ void InstrumentWidgetPickTab::initSurface() {
connect(p3d, SIGNAL(finishedMove()), this,
SLOT(updatePlotMultipleDetectors()));
}
m_infoController = new ComponentInfoController(
this, m_instrWidget, m_selectionInfoDisplay);
m_plotController = new DetectorPlotController(
this, m_instrWidget, m_plot);
m_infoController =
new ComponentInfoController(this, m_instrWidget, m_selectionInfoDisplay);
m_plotController = new DetectorPlotController(this, m_instrWidget, m_plot);
m_plotController->setTubeXUnits(
static_cast<DetectorPlotController::TubeXUnits>(m_tubeXUnitsCache));
m_plotController->setPlotType(
......@@ -800,9 +799,9 @@ std::string InstrumentWidgetPickTab::saveToProject() const {
* @param instrActor :: A pointer to the InstrumentActor instance.
* @param infoDisplay :: Widget on which to display the information.
*/
ComponentInfoController::ComponentInfoController(InstrumentWidgetPickTab *tab,
const InstrumentWidget *instrWidget,
QTextEdit *infoDisplay)
ComponentInfoController::ComponentInfoController(
InstrumentWidgetPickTab *tab, const InstrumentWidget *instrWidget,
QTextEdit *infoDisplay)
: QObject(tab), m_tab(tab), m_instrWidget(instrWidget),
m_selectionInfoDisplay(infoDisplay), m_freezePlot(false),
m_instrWidgetBlocked(false), m_currentPickID(-1) {}
......@@ -901,7 +900,9 @@ QString ComponentInfoController::displayDetectorInfo(Mantid::detid_t detid) {
*/
QString ComponentInfoController::displayNonDetectorInfo(
Mantid::Geometry::ComponentID compID) {
auto component = m_instrWidget->getInstrumentActor().getInstrument()->getComponentByID(compID);
auto component =
m_instrWidget->getInstrumentActor().getInstrument()->getComponentByID(
compID);
QString text = "Selected component: ";
text += QString::fromStdString(component->getName()) + '\n';
Mantid::Kernel::V3D pos = component->getPos();
......@@ -1170,8 +1171,7 @@ void DetectorPlotController::setPlotData(QList<int> detIDs) {
std::vector<double> x, y;
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
const auto &actor = m_instrWidget->getInstrumentActor();
actor.sumDetectors(detIDs, x, y,
static_cast<size_t>(m_plot->width()));
actor.sumDetectors(detIDs, x, y, static_cast<size_t>(m_plot->width()));
QApplication::restoreOverrideCursor();
if (!x.empty()) {
m_plot->setData(&x[0], &y[0], static_cast<int>(y.size()),
......@@ -1210,7 +1210,11 @@ void DetectorPlotController::plotSingle(int detid) {
// set the data
m_plot->setData(&x[0], &y[0], static_cast<int>(y.size()),
m_instrWidget->getInstrumentActor().getWorkspace()->getAxis(0)->unit()->unitID());
m_instrWidget->getInstrumentActor()
.getWorkspace()
->getAxis(0)
->unit()
->unitID());
m_plot->setLabel("Detector " + QString::number(detid));
// find any markers
......@@ -1467,8 +1471,7 @@ void DetectorPlotController::prepareDataForIntegralsPlot(
size_t imin, imax;
actor.getBinMinMaxIndex(wi, imin, imax);
Mantid::Kernel::V3D samplePos =
actor.getInstrument()->getSample()->getPos();
Mantid::Kernel::V3D samplePos = actor.getInstrument()->getSample()->getPos();
const int n = ass->nelements();
if (n == 0) {
......@@ -1799,8 +1802,7 @@ void DetectorPlotController::addPeak(double x, double y) {
alg->setPropertyValue("PeaksWorkspace", peakTableName);
alg->setProperty("DetectorID", m_currentDetID);
alg->setProperty("TOF", x);
alg->setProperty("Height",
actor.getIntegratedCounts(m_currentDetID));
alg->setProperty("Height", actor.getIntegratedCounts(m_currentDetID));
alg->setProperty("BinCount", y);
alg->execute();
......
......@@ -644,8 +644,7 @@ void InstrumentWidgetRenderTab::surfaceTypeChanged(int index) {
void InstrumentWidgetRenderTab::colorMapChanged() {
const auto &instrumentActor = m_instrWidget->getInstrumentActor();
setupColorBar(instrumentActor.getColorMap(), instrumentActor.minValue(),
instrumentActor.maxValue(),
instrumentActor.minPositiveValue(),
instrumentActor.maxValue(), instrumentActor.minPositiveValue(),
instrumentActor.autoscaling());
}
......
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