Commit 318e44b9 authored by Tom Perkins's avatar Tom Perkins
Browse files

Refactoring some in-and-out functions in MantidWidgets

re #15286
parent 5e8c6cdb
...@@ -609,7 +609,7 @@ MDHistoWorkspace::getLineData(const Mantid::Kernel::VMD &start, ...@@ -609,7 +609,7 @@ MDHistoWorkspace::getLineData(const Mantid::Kernel::VMD &start,
line.x.push_back(length); line.x.push_back(length);
line.y.push_back(std::numeric_limits<signal_t>::quiet_NaN()); line.y.push_back(std::numeric_limits<signal_t>::quiet_NaN());
line.e.push_back(std::numeric_limits<signal_t>::quiet_NaN()); line.e.push_back(std::numeric_limits<signal_t>::quiet_NaN());
return; return line;
} else { } else {
// Get the first point // Get the first point
std::set<coord_t>::iterator it; std::set<coord_t>::iterator it;
......
...@@ -73,7 +73,7 @@ namespace MantidQt ...@@ -73,7 +73,7 @@ namespace MantidQt
// is a point in real space masked by any of the shapes // is a point in real space masked by any of the shapes
bool isMasked(double x, double y)const; bool isMasked(double x, double y)const;
// collect all screen pixels that are masked by the shapes // collect all screen pixels that are masked by the shapes
void getMaskedPixels(QList<QPoint>& pixels)const; QList<QPoint> getMaskedPixels()const;
// set the bounding rect of the current shape such that its real rect is given by the argument // set the bounding rect of the current shape such that its real rect is given by the argument
void setCurrentBoundingRectReal(const QRectF& rect); void setCurrentBoundingRectReal(const QRectF& rect);
......
...@@ -23,7 +23,7 @@ namespace MantidQt ...@@ -23,7 +23,7 @@ namespace MantidQt
RenameParDialog(const std::vector<std::string>& old_params, RenameParDialog(const std::vector<std::string>& old_params,
const std::vector<std::string>& new_params, const std::vector<std::string>& new_params,
QWidget *parent=NULL); QWidget *parent=NULL);
void setOutput(std::vector<std::string>& out)const; std::vector<std::string> setOutput() const;
protected slots: protected slots:
void uniqueIndexedNames(bool); void uniqueIndexedNames(bool);
void doNotRename(bool); void doNotRename(bool);
......
...@@ -273,8 +273,7 @@ namespace MantidQt ...@@ -273,8 +273,7 @@ namespace MantidQt
m_instrActor->cacheDetPos(); m_instrActor->cacheDetPos();
// find the layer of visible detectors // find the layer of visible detectors
QList<QPoint> pixels; QList<QPoint> pixels = m_maskShapes.getMaskedPixels();
m_maskShapes.getMaskedPixels(pixels);
double zmin = 1.0; double zmin = 1.0;
double zmax = 0.0; double zmax = 0.0;
QSet<int> ids; QSet<int> ids;
......
...@@ -702,9 +702,8 @@ namespace MantidQt ...@@ -702,9 +702,8 @@ namespace MantidQt
return false; return false;
} }
void Shape2DCollection::getMaskedPixels(QList<QPoint>& pixels)const QList<QPoint> Shape2DCollection::getMaskedPixels() const {
{ QList<QPoint> pixels;
pixels.clear();
QTransform inv = m_transform.inverted(); QTransform inv = m_transform.inverted();
for (int i = m_viewport.left(); i <= m_viewport.right(); ++i) for (int i = m_viewport.left(); i <= m_viewport.right(); ++i)
{ {
...@@ -721,6 +720,7 @@ namespace MantidQt ...@@ -721,6 +720,7 @@ namespace MantidQt
} }
} }
} }
return pixels;
} }
/** /**
......
...@@ -96,16 +96,17 @@ QString RenameParDialog::makeUniqueIndexedName(const QString& name) ...@@ -96,16 +96,17 @@ QString RenameParDialog::makeUniqueIndexedName(const QString& name)
/** /**
* Output the new names to a vector * Output the new names to a vector
* @param out :: Reference to a vector for output * @returns :: new names in a vector
*/ */
void RenameParDialog::setOutput(std::vector<std::string>& out)const std::vector<std::string> RenameParDialog::setOutput() const
{ {
out.clear(); std::vector<std::string> out;
QAbstractItemModel* model = m_uiForm.tableWidget->model(); QAbstractItemModel* model = m_uiForm.tableWidget->model();
for(int row=0;row< m_uiForm.tableWidget->rowCount(); ++row) for(int row=0;row< m_uiForm.tableWidget->rowCount(); ++row)
{ {
out.push_back(model->data(model->index(row,1)).toString().toStdString()); out.push_back(model->data(model->index(row,1)).toString().toStdString());
} }
return out;
} }
void RenameParDialog::uniqueIndexedNames(bool ok) void RenameParDialog::uniqueIndexedNames(bool ok)
......
...@@ -244,8 +244,7 @@ void UserFunctionDialog::checkParameters(QString& expr) ...@@ -244,8 +244,7 @@ void UserFunctionDialog::checkParameters(QString& expr)
RenameParDialog dlg(all,common); RenameParDialog dlg(all,common);
if (dlg.exec() == QDialog::Accepted) if (dlg.exec() == QDialog::Accepted)
{ {
std::vector<std::string> vars_new; auto vars_new = dlg.setOutput();
dlg.setOutput(vars_new);
std::vector<std::string>::const_iterator v_old = common.begin(); std::vector<std::string>::const_iterator v_old = common.begin();
std::vector<std::string>::const_iterator v_new = vars_new.begin(); std::vector<std::string>::const_iterator v_new = vars_new.begin();
for(; v_old != common.end(); ++v_old,++v_new) for(; v_old != common.end(); ++v_old,++v_new)
......
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