-
Notifications
You must be signed in to change notification settings - Fork 59
/
astigscatterplot.cpp
68 lines (59 loc) · 2.1 KB
/
astigscatterplot.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "astigscatterplot.h"
#include <qwt_plot_grid.h>
#include <qwt_plot_marker.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_canvas.h>
#include <qwt_plot_marker.h>
#include <qwt_symbol.h>
#include "myplotpicker.h"
astigScatterPlot::astigScatterPlot(QWidget *parent):QwtPlot( parent ),m_max(.3)
{
Picker = new myPlotPicker( this );
connect(Picker, SIGNAL(selected(QString)),this,SLOT(selectedwave(QString)));
QwtPlotGrid *grid = new QwtPlotGrid();
grid->setPen( Qt::gray, 0.0, Qt::DotLine );
grid->enableX( true );
grid->enableXMin( true );
grid->enableY( true );
grid->enableYMin( false );
grid->attach( this );
d_origin = new QwtPlotMarker();
d_origin->setLineStyle( QwtPlotMarker::Cross );
d_origin->setValue( 0.,0. );
d_origin->setLinePen( Qt::gray, 1.0, Qt::DashLine );
d_origin->attach( this );
d_curve = new QwtPlotCurve();
d_curve->setStyle( QwtPlotCurve::Lines );
d_curve->setPen( canvas()->palette().color( QPalette::WindowText ) );
d_curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
d_curve->setPaintAttribute( QwtPlotCurve::ClipPolygons, false );
d_curve->attach( this );
setAxisScale(QwtPlot::xBottom, -.3, .3);
setAxisScale(QwtPlot::yLeft, -.3, .3);
setAxisTitle(QwtPlot::xBottom, "X");
setAxisTitle(QwtPlot::yLeft, "Y");
d_curve->setPen( Qt::red );
d_curve->setStyle( QwtPlotCurve::Dots );
d_curve->setSymbol( NULL );
setTitle("astig");
//setMinimumHeight(300);
replot();
}
void astigScatterPlot::selectedwave(QString m){
emit waveSeleted(m);
}
void astigScatterPlot::addValue(QString name, QPointF p){
QwtPlotMarker *m = new QwtPlotMarker(name);
if (fabs(p.x()) > m_max)
m_max = fabs(p.x());
if (fabs(p.y()) > m_max)
m_max = fabs(p.y());
setAxisScale(QwtPlot::xBottom, -m_max, m_max);
setAxisScale(QwtPlot::yLeft, -m_max, m_max);
m->setValue(p.x(), p.y());
QSize s = QSize(4,4);
m->setSymbol(new QwtSymbol(QwtSymbol::Ellipse, QColor(Qt::red),QColor(Qt::red), s));
m->attach(this);
replot();
}