7575#include " ui_oglrendered.h"
7676#include " astigpolargraph.h"
7777
78+
7879cv::Mat theMask;
7980cv::Mat deb;
8081double outputLambda;
@@ -438,6 +439,13 @@ cv::Mat SurfaceManager::computeWaveFrontFromZernikes(int wx, int wy, std::vector
438439
439440 double rho;
440441
442+ int maxZernToUse = 0 ;
443+ for (int value : zernsToUse) {
444+ if (value > maxZernToUse)
445+ maxZernToUse = value;
446+ }
447+
448+
441449 std::vector<bool > &en = zernEnables;
442450 mirrorDlg *md = mirrorDlg::get_Instance ();
443451 for (int i = 0 ; i < wx; ++i)
@@ -452,7 +460,7 @@ cv::Mat SurfaceManager::computeWaveFrontFromZernikes(int wx, int wy, std::vector
452460 {
453461 double S1 = 0 ;
454462 double theta = atan2 (y1,x1);
455- zernikePolar zpolar (rho, theta, zernsToUse. size () );
463+ zernikePolar zpolar (rho, theta, maxZernToUse+ 1 );
456464 for (int ii = 0 ; ii < zernsToUse.size (); ++ii) {
457465 int z = zernsToUse[ii];
458466
@@ -1099,19 +1107,22 @@ wavefront * SurfaceManager::readWaveFront(const QString &fileName){
10991107 QMessageBox::warning (NULL , tr (" Read Wavefront File" ),b);
11001108 return 0 ;
11011109 }
1110+ spdlog::get (" logger" )->trace (" readWaveFront() step 1" );
11021111 wavefront *wf = new wavefront ();
11031112 double width;
11041113 double height;
11051114 file >> width;
11061115 file >> height;
11071116 cv::Mat data (height,width, numType,0 .);
1117+ spdlog::get (" logger" )->trace (" readWaveFront() width {} height {}" , width, height);
11081118
11091119 for ( size_t y = 0 ; y < height; y++ ) {
11101120 for ( size_t x = 0 ; x < width; x++ ) {
11111121 file >> data.at <double >(height - y-1 ,x);
11121122 // data.at<double>(height - y - 1, x) += dist(generator);
11131123 }
11141124 }
1125+ spdlog::get (" logger" )->trace (" readWaveFront() step 2" );
11151126
11161127 std::string line;
11171128 QString l;
@@ -1160,6 +1171,7 @@ wavefront * SurfaceManager::readWaveFront(const QString &fileName){
11601171 }
11611172 }
11621173
1174+
11631175 wf->m_outside = CircleOutline (QPointF (xm,ym), radm);
11641176 if (rado == 0 ){
11651177 xo = xm;
@@ -1290,8 +1302,9 @@ bool SurfaceManager::loadWavefront(const QString &fileName){
12901302 QMessageBox::warning (NULL , tr (" Read Wavefront File" ),b);
12911303 }
12921304 wavefront *wf;
1293-
1305+ spdlog::get ( " logger " )-> trace ( " loadWavefront() " );
12941306 if (m_currentNdx == 0 && m_wavefronts[0 ]->name == " Demo" ){
1307+ spdlog::get (" logger" )->trace (" loadWavefront() delete current" );
12951308 deleteCurrent ();
12961309 }
12971310
@@ -1306,16 +1319,17 @@ bool SurfaceManager::loadWavefront(const QString &fileName){
13061319
13071320 // if resize to smaller
13081321 if (Settings2::getInstance ()->m_general ->shouldDownsize ()){
1322+ spdlog::get (" logger" )->trace (" loadWavefront() downSize" );
13091323 downSizeWf (wf);
13101324 }
13111325 makeMask (m_currentNdx);
1312-
13131326 m_surface_finished = false ;
13141327 try {
13151328 generateSurfacefromWavefront (m_currentNdx);
13161329 }
13171330 catch (int i){
13181331 deleteCurrent ();
1332+ spdlog::get (" logger" )->critical (" loadWavefront() crash while generating surface" );
13191333 throw i;
13201334 }
13211335
@@ -2414,7 +2428,7 @@ textres SurfaceManager::Phase2(QList<rotationDef *> list, QList<wavefront *> inp
24142428void SurfaceManager::computeStandAstig (define_input *wizPage, QList<rotationDef *> list){
24152429 // check for pairs
24162430 QVector<rotationDef*> lookat = list.toVector ();
2417-
2431+ spdlog::get ( " logger " )-> trace ( " computeStandAstig() " );
24182432 while (lookat.size ()){
24192433 for (int i = 0 ; i < lookat.size (); ++i){
24202434 double angle1 = wrapAngle (lookat[i]->angle );
@@ -2449,6 +2463,7 @@ void SurfaceManager::computeStandAstig(define_input *wizPage, QList<rotationDef
24492463 }
24502464 }
24512465 QApplication::setOverrideCursor (Qt::WaitCursor);
2466+ spdlog::get (" logger" )->trace (" computeStandAstig() create printer step 1" );
24522467 QPrinter printer (QPrinter::HighResolution);
24532468 printer.setColorMode ( QPrinter::Color );
24542469 printer.setFullPage ( true );
@@ -2486,6 +2501,7 @@ void SurfaceManager::computeStandAstig(define_input *wizPage, QList<rotationDef
24862501 html.append (" <td><p align='center'><b> Counter Rotated </b></p></td></tr>" );
24872502
24882503
2504+
24892505 QTextDocument *doc = editor->document ();
24902506 QList<QString> doc1Res;
24912507 doc->setPageSize (printer.pageLayout ().paintRectPixels (printer.resolution ()).size ()); // This is necessary if you want to hide the page number
0 commit comments