- /******** in 3d use only */
- a = 400/2.;
- b = 1 - a*(-1);
- c = -300/2.;
- d = 300 - c*(-1);
- //angle = toradians(60);
-
- view3d.setUp( 1.0, 0.0, 0.0);
- view3d.setAngle(toradians(60));
- setAtPoint( &view3d);
- xmin = objxmin; xmax = objxmax; ymin = objymin; ymax = objymax; // 2d viewing needs this !!!!
- setFromPoint( &view3d);
- view3d.setEye();
- /****** end of 3d *****/
-
- /*
- //Testing distance counting
- Vector a1, a2;
- qreal dist;
- //a1.setX( xmin); a1.setY( ymin);
- //a2.setX( xmax); a2.setY( ymax);
- a1.setX( 25.483); a1.setY( 65.017); // Oulu
- a2.setX( 27.767); a2.setY( 64.283); // Kajaani
- dist = countDistance( &a1, &a2);
- QString str = QString("Min & Max datan välimatka %1").arg(dist);
- QMessageBox::about( 0, "Testi", str);
- */
- emit progressbar(100);
- return true;
+ if(count == 1) // Check is file empty.
+ {
+ progressbarInt = 50;
+ emit progressbar(progressbarInt);
+ qDebug() << "count: " + QString::number(count);
+ /******** in 3d use only */
+ a = 400/2.;
+ b = 1 - a*(-1);
+ c = -300/2.;
+ d = 300 - c*(-1);
+ emit progressbar(60);
+ //angle = toradians(60);
+ view3d.setUp( 1.0, 0.0, 0.0);
+ emit progressbar(70);
+ view3d.setAngle(toradians(60));
+ emit progressbar(80);
+ setAtPoint( &view3d); // If file is empty software crash here.
+ emit progressbar(90);
+ xmin = objxmin; xmax = objxmax; ymin = objymin; ymax = objymax; // 2d viewing needs this !!!!
+ emit progressbar(95);
+ setFromPoint( &view3d);
+ emit progressbar(98);
+ view3d.setEye();
+ emit progressbar(99);
+ /****** end of 3d *****/
+ /*
+ //Testing distance counting
+ Vector a1, a2;
+ qreal dist;
+ //a1.setX( xmin); a1.setY( ymin);
+ //a2.setX( xmax); a2.setY( ymax);
+ a1.setX( 25.483); a1.setY( 65.017); // Oulu
+ a2.setX( 27.767); a2.setY( 64.283); // Kajaani
+ dist = countDistance( &a1, &a2);
+ QString str = QString("Min & Max datan välimatka %1").arg(dist);
+ QMessageBox::about( 0, "Testi", str);
+ */
+ emit progressbar(100);
+ return true;
+ }
+ else // Probably file is empty.
+ {
+ QMessageBox::about(0, "Error", "Empty file");
+ return false;
+ }