-
Notifications
You must be signed in to change notification settings - Fork 61
A ton of changes by Dale. Lots of new features. See VersionHistory for version 7.3.0 #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7aa9354
4b2e8aa
12165b6
0ce3740
a21649e
614cdb4
4b9a3f1
5fb2bec
446a48d
7a4a33c
ffdc477
4b8e2fc
4c1982c
e7041ae
cf07f1d
24b50c1
4dbe664
4631671
8ca70f5
98b1823
2de1bf0
00b5042
eb414c6
48b45d7
4358b49
b8a73e2
5357951
487e0a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| #include "astigpolargraph.h" | ||
| #include "ui_astigpolargraph.h" | ||
| #include "surfacemanager.h" | ||
|
|
||
| void astigPolargraph::makeChart(){ | ||
|
|
||
|
|
||
| QPolarChart *chart = new QPolarChart(); | ||
|
|
||
| // process each wave front and place astig on the chart | ||
| ui->waveFrontTable->setRowCount(m_list.size()); | ||
|
|
||
| QValueAxis *angularAxis = new QValueAxis(); | ||
| angularAxis->setTickCount(9); // First and last ticks are co-located on 0/360 angle. | ||
| angularAxis->setLabelFormat("%.0f"); | ||
| angularAxis->setShadesVisible(true); | ||
| angularAxis->setShadesBrush(QBrush(QColor(249, 249, 255))); | ||
| chart->addAxis(angularAxis, QPolarChart::PolarOrientationAngular); | ||
|
|
||
| QValueAxis *radialAxis = new QValueAxis(); | ||
| radialAxis->setTickCount(5); | ||
| radialAxis->setLabelFormat("%.1f"); | ||
| chart->addAxis(radialAxis, QPolarChart::PolarOrientationRadial); | ||
| double maxAstig = 1.; | ||
|
|
||
| QVector<wavefront *> wavefronts =SurfaceManager::get_instance()->m_wavefronts; | ||
|
|
||
| for(int ndx = 0; ndx < m_list.length(); ++ndx){ | ||
| wavefront *wf = wavefronts[m_list[ndx]]; | ||
| QString name = wf->name; | ||
| int slashndx = name.lastIndexOf('/'); | ||
| QString shortName = name.mid(name.lastIndexOf('/',slashndx-1)); | ||
| QTableWidgetItem *item = new QTableWidgetItem(shortName, 0); | ||
| ui->waveFrontTable->setItem(ndx,0,item); | ||
| double xastig = wf->InputZerns[4]; | ||
| double yastig = wf->InputZerns[5]; | ||
| double mag = sqrt(xastig * xastig + yastig * yastig); | ||
| if (mag > maxAstig) maxAstig = mag; | ||
|
|
||
| double angle = (atan2(yastig,xastig)/2.) * 180./M_PI; | ||
| angle = 90 - angle; | ||
| QScatterSeries *series = new QScatterSeries(); | ||
|
|
||
| int lastndx = name.lastIndexOf('/'); | ||
| if (lastndx != -1) | ||
| name = name.mid(lastndx); | ||
| series->setName(name); | ||
| series->append(angle,mag); | ||
| series->append(angle+180,mag); | ||
| chart->addSeries(series); | ||
| series->attachAxis(radialAxis); | ||
| series->attachAxis(angularAxis); | ||
|
|
||
| QLineSeries *line = new QLineSeries(); | ||
| line->append(angle,mag); | ||
| line->append(angle+180,mag); | ||
| chart->addSeries(line); | ||
| line->attachAxis(radialAxis); | ||
| line->attachAxis(angularAxis); | ||
| chart->legend()->markers(line)[0]->setVisible(false); | ||
|
|
||
| line->setPen(QPen(series->brush(),5)); | ||
|
|
||
| QTableWidgetItem *pv = new QTableWidgetItem(QString().number(mag), 0); | ||
| item->setForeground(series->brush()); | ||
| ui->waveFrontTable->setItem(ndx, 1, pv); | ||
| QTableWidgetItem *anglewidget = new QTableWidgetItem(QString().number(angle,'f',1), 0); | ||
| ui->waveFrontTable->setItem(ndx, 2, anglewidget); | ||
| } | ||
|
|
||
| chart->setTitle("Magnitude and axis of high edge"); | ||
| if (m_list.length() > 4) | ||
| chart->legend()->setAlignment(Qt::AlignRight); | ||
| else chart->legend()->setAlignment(Qt::AlignBottom); | ||
|
|
||
| maxAstig = ceil(maxAstig); | ||
| radialAxis->setRange(0, maxAstig); | ||
| angularAxis->setRange(0, 360); | ||
|
|
||
| ui->polarChart->setChart(chart); | ||
|
|
||
|
|
||
|
|
||
| } | ||
| astigPolargraph::astigPolargraph( QList<int>list, QWidget *parent) : | ||
| QDialog(parent), | ||
| ui(new Ui::astigPolargraph), m_list(list) | ||
| { | ||
| ui->setupUi(this); | ||
| //For some reason the original starter code of makeChart was in this function but it caused a crash. | ||
| // I could never figure out why because that code was taken from a working Qt example. When | ||
| // moved to inside another function it worked. So there you go. Exact same code with no changes worked there but not here. | ||
| makeChart(); | ||
|
Comment on lines
+90
to
+93
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this makes me super uncomfortable. Might just break later on if we don't understand it.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Me too but I did a lot of debugging that I did not list in the comment. I narrowed the issue down to the line where it attaches the radial axis to the plot. At that point there is no debug code to show what happens inside that call. Like I said that code works everywhere else except in that routine. At that point I had to punt. Others are welcome to dig deeper.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tested on linux and got no issue. I will try the linux build also. So far I did NOT reproduce your issue. |
||
|
|
||
|
|
||
| } | ||
|
|
||
| astigPolargraph::~astigPolargraph() | ||
| { | ||
| delete ui; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #ifndef ASTIGPOLARGRAPH_H | ||
| #define ASTIGPOLARGRAPH_H | ||
|
|
||
| #include <QDialog> | ||
| #include <QtCharts/QScatterSeries> | ||
| #include <QtCharts/QLineSeries> | ||
| #include <QtCharts/QSplineSeries> | ||
| #include <QtCharts/QAreaSeries> | ||
| #include <QtCharts/QValueAxis> | ||
| #include <QtCharts/QPolarChart> | ||
| #include "wavefront.h" | ||
|
|
||
| namespace Ui { | ||
| class astigPolargraph; | ||
| } | ||
|
|
||
| class astigPolargraph : public QDialog | ||
| { | ||
| Q_OBJECT | ||
|
|
||
| public: | ||
| explicit astigPolargraph(QList<int> list,QWidget *parent = nullptr); | ||
| ~astigPolargraph(); | ||
|
|
||
| private: | ||
| Ui::astigPolargraph *ui; | ||
| QList<int> m_list; // list index of selected wave fronts in surface manager's list. | ||
| void makeChart(); | ||
| }; | ||
|
|
||
| #endif // ASTIGPOLARGRAPH_H |
Uh oh!
There was an error while loading. Please reload this page.