From b006ef5c785861e4626c45377c889e8d49a64f5f Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 15 Apr 2017 14:17:54 +0100 Subject: [PATCH] Launcher: fix navaid map default scaling. --- src/GUI/BaseDiagram.cxx | 16 ++++++++-------- src/GUI/NavaidDiagram.cxx | 7 +++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/GUI/BaseDiagram.cxx b/src/GUI/BaseDiagram.cxx index b32803e85..fc714e71c 100644 --- a/src/GUI/BaseDiagram.cxx +++ b/src/GUI/BaseDiagram.cxx @@ -35,17 +35,17 @@ #include "QtLauncher_fwd.hxx" /* equatorial and polar earth radius */ -const float rec = 6378137; // earth radius, equator (?) -const float rpol = 6356752.314f; // earth radius, polar (?) +const double rec = 6378137; // earth radius, equator (?) +const double rpol = 6356752.314; // earth radius, polar (?) const double MINIMUM_SCALE = 0.002; //Returns Earth radius at a given latitude (Ellipsoide equation with two equal axis) -static float earth_radius_lat( float lat ) +static double earth_radius_lat( double lat ) { double a = cos(lat)/rec; double b = sin(lat)/rpol; - return 1.0f / sqrt( a * a + b * b ); + return 1.0 / sqrt( a * a + b * b ); } BaseDiagram::BaseDiagram(QWidget* pr) : @@ -98,7 +98,7 @@ void BaseDiagram::extendRect(QRectF &r, const QPointF &p) } } -void BaseDiagram::paintEvent(QPaintEvent* pe) +void BaseDiagram::paintEvent(QPaintEvent*) { QPainter p(this); p.setRenderHints(QPainter::Antialiasing); @@ -592,9 +592,9 @@ void BaseDiagram::extendBounds(const QPointF& p) // but the groundnet is for // https://en.wikipedia.org/wiki/Salar_de_Atacama_Airport // causing a rather large airport boundary. - QPointF v = (p - m_bounds.center()); - if (v.manhattanLength() > 20000) { - qWarning() << "Excessively distant point" << p << v.manhattanLength(); + QVector2D v(p - m_bounds.center()); + if (v.length() > 100000.0f) { + qWarning() << "Excessively distant point" << p << v.length(); return; } diff --git a/src/GUI/NavaidDiagram.cxx b/src/GUI/NavaidDiagram.cxx index a621ebd05..0f58ad83a 100644 --- a/src/GUI/NavaidDiagram.cxx +++ b/src/GUI/NavaidDiagram.cxx @@ -104,10 +104,10 @@ void NavaidDiagram::doComputeBounds() { extendBounds(project(m_geod)); -// project three points around the base location at 40nm to give some +// project four points around the base location at 20nm to give some // coverage - for (int i=0; i<3; ++i) { - SGGeod pt = SGGeodesy::direct(m_geod, i * 120, SG_NM_TO_METER * 40.0); + for (int i=0; i<4; ++i) { + SGGeod pt = SGGeodesy::direct(m_geod, i * 90, SG_NM_TO_METER * 20.0); extendBounds(project(pt)); } @@ -116,5 +116,4 @@ void NavaidDiagram::doComputeBounds() SGGeod offsetPos = SGGeodesy::direct(m_geod, m_offsetBearingDeg, d); extendBounds(project(offsetPos)); } - }