QXRD  0.11.16
qxrdmaskpicker.cpp
Go to the documentation of this file.
1 #include "qxrdmaskpicker.h"
2 #include "qxrdimageplot.h"
3 #include "qxrdrasterdata.h"
4 #include "qwt_picker_machine.h"
5 
7  : QxrdImagePlotMeasurer(canvas, plot),
8  m_Plot(plot)
9 {
10  setTrackerMode(QwtPicker::AlwaysOn);
11 }
12 
14  : QxrdMaskPicker(canvas, plot)
15 {
16  qRegisterMetaType<QRectF>("QRectF");
17 
18  setStateMachine(new QwtPickerDragRectMachine());
19  setRubberBand(QwtPicker::EllipseRubberBand);
20 }
21 
22 QPolygon QxrdCircularMaskPicker::adjustedPoints(const QPolygon &points) const
23 {
24  QPolygon adjusted;
25 
26  if ( points.size() == 2 ) {
27  const int width = qAbs(points[1].x() - points[0].x());
28  const int height = qAbs(points[1].y() - points[0].y());
29 
30  QRect rect(0, 0, 2 * width, 2 * height);
31  rect.moveCenter(points[0]);
32 
33  adjusted += rect.topLeft();
34  adjusted += rect.bottomRight();
35  }
36 
37  return adjusted;
38 }
39 
41  : QxrdMaskPicker(canvas, plot)
42 {
43  qRegisterMetaType< QVector<QPointF> >("QVector<QPointF>");
44 
45  setStateMachine(new QwtPickerPolygonMachine());
46  setRubberBand(QwtPicker::PolygonRubberBand);
47 }
48 
49 void QxrdPolygonalMaskPicker::append(const QPoint &pt)
50 {
51  if (m_Plot) {
53  }
54 
55  QxrdMaskPicker::append(pt);
56 }
57 
59 {
60  if (m_Plot) {
62  }
63 
64  return QxrdMaskPicker::end(ok);
65 }
bool end(bool ok=true)
QxrdCircularMaskPicker(QWidget *canvas, QxrdImagePlot *plot)
QxrdMaskPicker(QWidget *canvas, QxrdImagePlot *plot)
void enableContextMenu()
QxrdImagePlot * m_Plot
void append(const QPoint &pt)
QxrdPolygonalMaskPicker(QWidget *canvas, QxrdImagePlot *plot)
QPolygon adjustedPoints(const QPolygon &points) const
void disableContextMenu()