Commit ae5d900e authored by Samuel Jackson's avatar Samuel Jackson
Browse files

Refs #16962 Fixes for clang-format

parent a54dacf3
......@@ -246,7 +246,7 @@ bool TSVSerialiser::asBool(const size_t i) const {
}
QRect TSVSerialiser::asQRect(const size_t i) const {
if (i+3 >= m_curValues.size())
if (i + 3 >= m_curValues.size())
return QRect();
std::string valStr = m_curValues.at(i);
......@@ -263,7 +263,7 @@ QRect TSVSerialiser::asQRect(const size_t i) const {
}
QColor TSVSerialiser::asQColor(const size_t i) const {
if (i+3 >= m_curValues.size())
if (i + 3 >= m_curValues.size())
return QColor();
std::string valStr = m_curValues.at(i);
......@@ -386,25 +386,18 @@ TSVSerialiser &TSVSerialiser::operator<<(const bool &val) {
TSVSerialiser &TSVSerialiser::operator<<(const QRect &val) {
auto point0 = val.topLeft();
auto point1 = val.bottomRight();
m_output << "\t"
<< point0.x() << "\t"
<< point0.y() << "\t"
<< point1.x() << "\t"
<< point1.y();
m_output << "\t" << point0.x() << "\t" << point0.y() << "\t" << point1.x()
<< "\t" << point1.y();
return *this;
}
TSVSerialiser &TSVSerialiser::operator<<(const QColor &val) {
m_output << "\t"
<< val.red() << "\t"
<< val.green() << "\t"
<< val.blue() << "\t"
<< val.alpha();
m_output << "\t" << val.red() << "\t" << val.green() << "\t" << val.blue()
<< "\t" << val.alpha();
return *this;
}
void TSVSerialiser::writeRaw(const std::string &raw) {
if (m_midLine) {
m_output << "\n";
......
......@@ -208,7 +208,7 @@ public:
QPointF getPoint(const QString &prop) const override;
void setPoint(const QString &prop, const QPointF &value) override;
/// Load state for the shape from a project file
static Shape2D* loadFromProject(const std::string &lines);
static Shape2D *loadFromProject(const std::string &lines);
/// Save state for the shape to a project file
virtual std::string saveToProject() const override;
......@@ -234,7 +234,7 @@ public:
}
void addToPath(QPainterPath &path) const override;
/// Load state for the shape from a project file
static Shape2D* loadFromProject(const std::string &lines);
static Shape2D *loadFromProject(const std::string &lines);
/// Save state for the shape to a project file
virtual std::string saveToProject() const override;
......@@ -270,7 +270,7 @@ public:
QColor getColor() const override { return m_outer_shape->getColor(); }
const Shape2D *getOuterShape() const { return m_outer_shape; }
/// Load state for the shape from a project file
static Shape2D* loadFromProject(const std::string &lines);
static Shape2D *loadFromProject(const std::string &lines);
/// Save state for the shape to a project file
virtual std::string saveToProject() const override;
......@@ -305,7 +305,7 @@ public:
void addPolygon(const QPolygonF &polygon);
void subtractPolygon(const QPolygonF &polygon);
/// Load state for the shape from a project file
static Shape2D* loadFromProject(const std::string &lines);
static Shape2D *loadFromProject(const std::string &lines);
/// Save state for the shape to a project file
virtual std::string saveToProject() const override;
......
......@@ -711,9 +711,8 @@ void InstrumentWidgetPickTab::loadFromProject(const std::string &lines) {
// load active push button
std::vector<QPushButton *> buttons{
m_zoom, m_edit, m_ellipse, m_rectangle,
m_ring_ellipse, m_ring_rectangle, m_free_draw, m_one,
m_tube, m_peak, m_peakSelect};
m_zoom, m_edit, m_ellipse, m_rectangle, m_ring_ellipse, m_ring_rectangle,
m_free_draw, m_one, m_tube, m_peak, m_peakSelect};
tab.selectLine("ActiveTools");
for (auto button : buttons) {
......@@ -732,9 +731,8 @@ std::string InstrumentWidgetPickTab::saveToProject() const {
// save active push button
std::vector<QPushButton *> buttons{
m_zoom, m_edit, m_ellipse, m_rectangle,
m_ring_ellipse, m_ring_rectangle, m_free_draw, m_one,
m_tube, m_peak, m_peakSelect};
m_zoom, m_edit, m_ellipse, m_rectangle, m_ring_ellipse, m_ring_rectangle,
m_free_draw, m_one, m_tube, m_peak, m_peakSelect};
tab.writeLine("ActiveTools");
for (auto button : buttons) {
......
......@@ -465,8 +465,7 @@ void Projection3D::setLightingModel(bool picking) const {
/** Load 3D projection state from a Mantid project file
* @param lines :: lines from the project file to load state from
*/
void Projection3D::loadFromProject(const std::string &lines)
{
void Projection3D::loadFromProject(const std::string &lines) {
ProjectionSurface::loadFromProject(lines);
TSVSerialiser tsv(lines);
......@@ -480,8 +479,7 @@ void Projection3D::loadFromProject(const std::string &lines)
/** Save the state of the 3D projection to a Mantid project file
* @return a string representing the state of the 3D projection
*/
std::string Projection3D::saveToProject() const
{
std::string Projection3D::saveToProject() const {
TSVSerialiser tsv;
tsv.writeRaw(ProjectionSurface::saveToProject());
tsv.writeSection("Viewport", m_viewport.saveToProject());
......
......@@ -728,7 +728,7 @@ void ProjectionSurface::loadFromProject(const std::string &lines) {
tsv >> m_backgroundColor;
}
if(tsv.selectSection("shapes")) {
if (tsv.selectSection("shapes")) {
std::string shapesLines;
tsv >> shapesLines;
m_maskShapes.loadFromProject(shapesLines);
......
......@@ -159,8 +159,7 @@ bool Shape2D::isMasked(const QPointF &p) const {
* @param lines :: lines from the project file to load state from
* @return a new shape2D with old state applied
*/
Shape2D* Shape2D::loadFromProject(const std::string &lines)
{
Shape2D *Shape2D::loadFromProject(const std::string &lines) {
TSVSerialiser tsv(lines);
if (!tsv.selectLine("Type"))
......@@ -225,17 +224,12 @@ Shape2D *Shape2D::loadShape2DFromType(const std::string &type,
/** Save the state of the shape 2D to a Mantid project file
* @return a string representing the state of the shape 2D
*/
std::string Shape2D::saveToProject() const
{
std::string Shape2D::saveToProject() const {
TSVSerialiser tsv;
bool props[] {
m_scalable,
m_editing,
m_selected,
m_visible };
bool props[]{m_scalable, m_editing, m_selected, m_visible};
tsv.writeLine("Properties");
for(auto prop : props) {
for (auto prop : props) {
tsv << prop;
}
......@@ -358,7 +352,7 @@ void Shape2DEllipse::setPoint(const QString &prop, const QPointF &value) {
* @param lines :: lines from the project file to load state from
* @return a new shape2D in the shape of a ellipse
*/
Shape2D* Shape2DEllipse::loadFromProject(const std::string &lines) {
Shape2D *Shape2DEllipse::loadFromProject(const std::string &lines) {
TSVSerialiser tsv(lines);
tsv.selectLine("Parameters");
double radius1, radius2, x, y;
......@@ -369,8 +363,7 @@ Shape2D* Shape2DEllipse::loadFromProject(const std::string &lines) {
/** Save the state of the shape 2D ellipe to a Mantid project file
* @return a string representing the state of the shape 2D
*/
std::string Shape2DEllipse::saveToProject() const
{
std::string Shape2DEllipse::saveToProject() const {
TSVSerialiser tsv;
double radius1 = getDouble("radius1");
double radius2 = getDouble("radius2");
......@@ -423,7 +416,7 @@ void Shape2DRectangle::addToPath(QPainterPath &path) const {
* @param lines :: lines from the project file to load state from
* @return a new shape2D in the shape of a rectangle
*/
Shape2D* Shape2DRectangle::loadFromProject(const std::string &lines) {
Shape2D *Shape2DRectangle::loadFromProject(const std::string &lines) {
TSVSerialiser tsv(lines);
tsv.selectLine("Parameters");
double x0, y0, x1, y1;
......@@ -436,8 +429,7 @@ Shape2D* Shape2DRectangle::loadFromProject(const std::string &lines) {
/** Save the state of the shape 2D rectangle to a Mantid project file
* @return a string representing the state of the shape 2D
*/
std::string Shape2DRectangle::saveToProject() const
{
std::string Shape2DRectangle::saveToProject() const {
TSVSerialiser tsv;
auto x0 = m_boundingRect.x0();
auto x1 = m_boundingRect.x1();
......@@ -593,7 +585,7 @@ void Shape2DRing::setColor(const QColor &color) {
* @param lines :: lines from the project file to load state from
* @return a new shape2D in the shape of a ring
*/
Shape2D* Shape2DRing::loadFromProject(const std::string &lines) {
Shape2D *Shape2DRing::loadFromProject(const std::string &lines) {
TSVSerialiser tsv(lines);
tsv.selectLine("Parameters");
double xWidth, yWidth;
......@@ -610,8 +602,7 @@ Shape2D* Shape2DRing::loadFromProject(const std::string &lines) {
/** Save the state of the shape 2D ring to a Mantid project file
* @return a string representing the state of the shape 2D
*/
std::string Shape2DRing::saveToProject() const
{
std::string Shape2DRing::saveToProject() const {
TSVSerialiser tsv;
auto xWidth = getDouble("xwidth");
auto yWidth = getDouble("ywidth");
......@@ -762,14 +753,14 @@ void Shape2DFree::subtractPolygon(const QPolygonF &polygon) {
* @param lines :: lines from the project file to load state from
* @return a new freefrom shape2D
*/
Shape2D* Shape2DFree::loadFromProject(const std::string &lines) {
Shape2D *Shape2DFree::loadFromProject(const std::string &lines) {
TSVSerialiser tsv(lines);
QPolygonF polygon;
size_t paramCount = tsv.values("Parameters").size()-1;
size_t paramCount = tsv.values("Parameters").size() - 1;
tsv.selectLine("Parameters");
for(size_t i = 0; i < paramCount; i+=2) {
for (size_t i = 0; i < paramCount; i += 2) {
double x, y;
tsv >> x >> y;
polygon << QPointF(x, y);
......@@ -781,25 +772,21 @@ Shape2D* Shape2DFree::loadFromProject(const std::string &lines) {
/** Save the state of the shape 2D to a Mantid project file
* @return a string representing the state of the shape 2D
*/
std::string Shape2DFree::saveToProject() const
{
std::string Shape2DFree::saveToProject() const {
TSVSerialiser tsv;
tsv.writeLine("Type") << "free";
tsv.writeLine("Parameters");
for(auto& point : m_polygon) {
for (auto &point : m_polygon) {
tsv << point.x() << point.y();
}
tsv.writeRaw(Shape2D::saveToProject());
return tsv.outputLines();
}
Shape2DFree::Shape2DFree(const QPolygonF &polygon)
: m_polygon(polygon)
{
Shape2DFree::Shape2DFree(const QPolygonF &polygon) : m_polygon(polygon) {
resetBoundingRect();
}
} // MantidWidgets
} // MantidQt
......@@ -668,8 +668,7 @@ void Shape2DCollection::eraseFree(const QPolygonF &polygon) {
/** Load shape 2D collection state from a Mantid project file
* @param lines :: lines from the project file to load state from
*/
void Shape2DCollection::loadFromProject(const std::string &lines)
{
void Shape2DCollection::loadFromProject(const std::string &lines) {
TSVSerialiser tsv(lines);
for (auto shapeLines : tsv.sections("shape")) {
Shape2D *shape = Shape2D::loadFromProject(shapeLines);
......@@ -680,10 +679,9 @@ void Shape2DCollection::loadFromProject(const std::string &lines)
/** Save the state of the shape 2D collection to a Mantid project file
* @return a string representing the state of the shape 2D collection
*/
std::string Shape2DCollection::saveToProject() const
{
std::string Shape2DCollection::saveToProject() const {
TSVSerialiser tsv;
for(auto shape : m_shapes) {
for (auto shape : m_shapes) {
tsv.writeSection("shape", shape->saveToProject());
}
return tsv.outputLines();
......
......@@ -469,8 +469,7 @@ void Viewport::transform(Mantid::Kernel::V3D &pos) const {
pos += Mantid::Kernel::V3D(m_xTrans, m_yTrans, 0.0);
}
void Viewport::loadFromProject(const std::string &lines)
{
void Viewport::loadFromProject(const std::string &lines) {
reset();
TSVSerialiser tsv(lines);
......@@ -485,7 +484,7 @@ void Viewport::loadFromProject(const std::string &lines)
setZoom(zoom);
tsv.selectLine("Rotation");
double w, a ,b, c;
double w, a, b, c;
tsv >> w >> a >> b >> c;
Mantid::Kernel::Quat quat(w, a, b, c);
setRotation(quat);
......@@ -497,7 +496,7 @@ std::string Viewport::saveToProject() const {
tsv.writeLine("Zoom") << m_zoomFactor;
tsv.writeLine("Rotation");
for(int i = 0; i < 4; ++i) {
for (int i = 0; i < 4; ++i) {
tsv << m_quaternion[i];
}
......
Markdown is supported
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