소스 검색

Fixed a radians to degrees conversion bug

ACalc::isNight() had an erroneous conversion to radians.
Felix Turo 3 년 전
부모
커밋
453f8e5a67
2개의 변경된 파일8개의 추가작업 그리고 15개의 파일을 삭제
  1. 6 13
      mainwindow.cpp
  2. 2 2
      src/functions/acalc.cpp

+ 6 - 13
mainwindow.cpp

@@ -30,19 +30,12 @@
 #include "src/functions/adatetime.h"
 void MainWindow::doDebugStuff()
 {
-    //NewNewFlightDialog nf(completionData, this);
-    //nf.exec();
-    QString dept = "KJFK";
-    QString dest = "EGLL";
-    QDateTime date_time = ADateTime::fromString(QDate::currentDate().toString(Qt::ISODate) + "22:00");
-    int tblk = 660;
-    int night_angle = -6;
-
-    //LOG << "Berlin Local" << date_time.toString() << "Total:" << tblk;
-    //LOG << "Night time:" << ACalc::calculateNightTime(dept, dest, date_time, tblk, night_angle);
-    //dest = "EDDB";
-    LOG << "JFK to LHR" << date_time.toString() << "Total:" << tblk;
-    LOG << "Night Time:" << ACalc::calculateNightTime(dept, dest, date_time, tblk, night_angle);
+    NewNewFlightDialog nf(completionData, this);
+    nf.exec();
+    //QString location = "KJFK";
+    //QString time = "22:40";
+    //QDateTime date_time = ADateTime::fromString(QDate::currentDate().toString(Qt::ISODate) + time);
+    //DEB << "Night at " << location << " at " << date_time << ACalc::isNight(location, date_time, -6);
 }
 MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent)

+ 2 - 2
src/functions/acalc.cpp

@@ -285,8 +285,8 @@ bool ACalc::isNight(const QString &icao, QDateTime event_time, int night_angle)
         return 0;
     }
 
-    double lat = degToRad(lat_lon[0].toDouble());
-    double lon = degToRad(lat_lon[1].toDouble());
+    double lat = lat_lon[0].toDouble();
+    double lon = lat_lon[1].toDouble();
 
     if(solarElevation(event_time, lat, lon) < night_angle){
         return true;