+
+ painter->setTransform(t);
+}
+
+void AirportDiagram::drawILS(QPainter* painter, FGRunwayRef runway) const
+{
+ if (!runway)
+ return;
+
+ FGNavRecord* loc = runway->ILS();
+ if (!loc)
+ return;
+
+ double halfBeamWidth = loc->localizerWidth() * 0.5;
+ QPointF threshold = project(runway->threshold());
+ double rangeM = loc->get_range() * SG_NM_TO_METER;
+ double radial = loc->get_multiuse();
+ SG_NORMALIZE_RANGE(radial, 0.0, 360.0);
+
+// compute the three end points at the wide end of the arrow
+ QPointF endCentre = project(SGGeodesy::direct(loc->geod(), radial, -rangeM));
+ QPointF endR = project(SGGeodesy::direct(loc->geod(), radial + halfBeamWidth, -rangeM * 1.1));
+ QPointF endL = project(SGGeodesy::direct(loc->geod(), radial - halfBeamWidth, -rangeM * 1.1));
+
+ painter->drawLine(threshold, endCentre);
+ painter->drawLine(threshold, endL);
+ painter->drawLine(threshold, endR);
+ painter->drawLine(endL, endCentre);
+ painter->drawLine(endR, endCentre);
+}
+
+void AirportDiagram::mouseReleaseEvent(QMouseEvent* me)
+{
+ if (m_didPan)
+ return; // ignore panning drag+release ops here
+
+ QTransform t(transform());
+ double minDist = std::numeric_limits<double>::max();
+ FGRunwayRef bestRunway;
+
+ Q_FOREACH(const RunwayData& r, m_runways) {
+ QPointF p1(t.map(r.p1)), p2(t.map(r.p2));
+ double t;
+ double d = distanceToLineSegment(QVector2D(me->pos()),
+ QVector2D(p1),
+ QVector2D(p2), &t);
+ if (d < minDist) {
+ if (t > 0.5) {
+ bestRunway = r.runway->reciprocalRunway();
+ } else {
+ bestRunway = r.runway;
+ }
+ minDist = d;
+ }