X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FGUI%2FMapWidget.cxx;h=0b786f5a34d3538c68ce25732a582d9900936b86;hb=c5366cceb6d345d3526ab013b04eb815fe0a6845;hp=bdd73a11e7819bcc2cde47dea97d780e5978256f;hpb=02fb83c774020633cb62e3b8154337510bed1de3;p=flightgear.git diff --git a/src/GUI/MapWidget.cxx b/src/GUI/MapWidget.cxx index bdd73a11e..0b786f5a3 100644 --- a/src/GUI/MapWidget.cxx +++ b/src/GUI/MapWidget.cxx @@ -1285,6 +1285,22 @@ void MapWidget::drawILS(bool tuned, FGRunway* rwy) glVertex2dv(endCentre.data()); glVertex2dv(endR.data()); glEnd(); + + if (validDataForKey(loc)) { + setAnchorForKey(loc, endR); + return; + } + + char buffer[1024]; + ::snprintf(buffer, 1024, "%s\n%s\n%3.2fMHz", + loc->name().c_str(), loc->ident().c_str(),loc->get_freq()/100.0); + + MapData* d = createDataForKey(loc); + d->setPriority(40); + d->setLabel(loc->ident()); + d->setText(buffer); + d->setOffset(MapData::HALIGN_CENTER | MapData::VALIGN_BOTTOM, 10); + d->setAnchor(endR); } void MapWidget::drawTraffic() @@ -1302,7 +1318,7 @@ void MapWidget::drawTraffic() for (int i = 0; i < ai->nChildren(); ++i) { const SGPropertyNode *model = ai->getChild(i); // skip bad or dead entries - if (!model || model->getIntValue("id", -1) < 0) { + if (!model || model->getIntValue("id", -1) == -1) { continue; } @@ -1376,7 +1392,47 @@ void MapWidget::drawAIAircraft(const SGPropertyNode* model, const SGGeod& pos, d void MapWidget::drawAIShip(const SGPropertyNode* model, const SGGeod& pos, double hdg) { + SGVec2d p = project(pos); + glColor3f(0.0, 0.0, 0.0); + glLineWidth(2.0); + circleAt(p, 4, 6.0); // black diamond + +// draw heading vector + int speedKts = static_cast(model->getDoubleValue("velocities/true-airspeed-kt")); + if (speedKts > 1) { + glLineWidth(1.0); + + const double dt = 15.0 / (3600.0); // 15 seconds look-ahead + double distanceM = speedKts * SG_NM_TO_METER * dt; + + SGGeod advance; + double az2; + SGGeodesy::direct(pos, hdg, distanceM, advance, az2); + + drawLine(p, project(advance)); + } + + if (validDataForKey((void*) model)) { + setAnchorForKey((void*) model, p); + return; + } + + // draw callsign / altitude / speed + + + char buffer[1024]; + ::snprintf(buffer, 1024, "%s\n%d'\n%dkts", + model->getStringValue("callsign", "<>"), + static_cast(pos.getElevationFt() / 50.0) * 50, + speedKts); + + MapData* d = createDataForKey((void*) model); + d->setText(buffer); + d->setLabel(model->getStringValue("callsign", "<>")); + d->setPriority(speedKts > 5 ? 60 : 10); // low priority for parked aircraft + d->setOffset(MapData::VALIGN_CENTER | MapData::HALIGN_LEFT, 10); + d->setAnchor(p); } SGVec2d MapWidget::project(const SGGeod& geod) const