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

Refs #18120 Add highlight for 4th peak

parent b8436528
......@@ -352,6 +352,7 @@ protected:
std::vector<Mantid::Kernel::V3D> m_selectedAlignmentPlane;
std::vector<QPointF> m_selectedAlignmentMarkers;
Mantid::Geometry::IPeak *m_selectedAlignmentPeak;
QPointF m_selectedAlignmentPeakPosition;
std::pair<std::vector<Mantid::Geometry::IPeak *>,
std::vector<Mantid::Geometry::IPeak *>> m_selectedPeaks;
std::pair<QPointF, QPointF> m_selectedMarkers;
......
......@@ -626,13 +626,23 @@ void ProjectionSurface::drawPeakAlignmentMarkers(QPainter &painter) const {
auto windowRect = getSurfaceBounds();
windowRect.findTransform(transform, painter.viewport());
painter.setPen(Qt::blue);
// draw the 4th peak in a different colour
if (!m_selectedAlignmentPeakPosition.isNull()) {
painter.setPen(Qt::green);
auto point = transform.map(m_selectedAlignmentPeakPosition);
painter.drawEllipse(point, 8, 8);
}
// draw highlight around the first three peaks
QPolygonF poly;
painter.setPen(Qt::blue);
for (auto &origin : m_selectedAlignmentMarkers) {
auto point = transform.map(origin);
painter.drawEllipse(point, 8, 8);
if(origin != m_selectedAlignmentPeakPosition) {
auto point = transform.map(origin);
painter.drawEllipse(point, 8, 8);
}
}
}
/**
......@@ -743,6 +753,7 @@ void ProjectionSurface::clearAlignmentPlane() {
m_selectedAlignmentPlane.clear();
m_selectedAlignmentMarkers.clear();
m_selectedAlignmentPeak = nullptr;
m_selectedAlignmentPeakPosition = QPointF();
}
/**
......@@ -929,7 +940,8 @@ void ProjectionSurface::alignPeaks(const QRect &rect) {
}
}
if (!peak)
// check we found a peak
if (!marker || !peak)
return;
if (m_selectedAlignmentPlane.size() < 3) {
......@@ -945,6 +957,7 @@ void ProjectionSurface::alignPeaks(const QRect &rect) {
}
} else {
m_selectedAlignmentPeak = peak;
m_selectedAlignmentPeakPosition = origin;
}
if (m_selectedAlignmentPlane.size() >= 3 && m_selectedAlignmentPeak)
......
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