mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Fix sampleweatherdata to accept negative Lat/Lon values
This commit is contained in:
committed by
Mat Sutcliffe
parent
a56ae0302a
commit
d50811c941
@@ -33,7 +33,7 @@ void CLineReader::run()
|
||||
{
|
||||
QFile file;
|
||||
file.open(stdin, QIODevice::ReadOnly | QIODevice::Text);
|
||||
QRegularExpression re("^(\\d+).([0,5])\\s(\\d+).([0,5])$");
|
||||
QRegularExpression re("^(-?\\d+).([0,5])\\s(-?\\d+).([0,5])$");
|
||||
forever
|
||||
{
|
||||
QString line = file.readLine().trimmed();
|
||||
@@ -48,8 +48,11 @@ void CLineReader::run()
|
||||
if (match.hasMatch())
|
||||
{
|
||||
double latitudeValue = match.captured(1).toDouble();
|
||||
latitudeValue += match.captured(2).toDouble() / 10;
|
||||
if (latitudeValue > 0) { latitudeValue += match.captured(2).toDouble() / 10; }
|
||||
else { { latitudeValue -= match.captured(2).toDouble() / 10; } }
|
||||
double longitudeValue = match.captured(3).toDouble();
|
||||
if (longitudeValue > 0) { longitudeValue += match.captured(4).toDouble() / 10; }
|
||||
else { longitudeValue -= match.captured(4).toDouble() / 10; }
|
||||
longitudeValue += match.captured(4).toDouble() / 10;
|
||||
const CLatitude latitude(latitudeValue, CAngleUnit::deg());
|
||||
const CLongitude longitude(longitudeValue, CAngleUnit::deg());
|
||||
|
||||
Reference in New Issue
Block a user