X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FGUI%2FMapWidget.cxx;h=249605c6bfe7f9ac9859cf76c71e0e49a51ac5ed;hb=ee1c8a8d662a0398711ee17c53dd64d249d2e030;hp=41525cde25059a85facca8b132e48f7e95951a63;hpb=433af2b51a3bcec7488ac2fbf94b8edfc1e1cb43;p=flightgear.git diff --git a/src/GUI/MapWidget.cxx b/src/GUI/MapWidget.cxx index 41525cde2..249605c6b 100644 --- a/src/GUI/MapWidget.cxx +++ b/src/GUI/MapWidget.cxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include
// fgGetKeyModifiers() #include @@ -537,8 +537,7 @@ void MapWidget::zoomOut() void MapWidget::draw(int dx, int dy) { - _aircraft = SGGeod::fromDeg(fgGetDouble("/position/longitude-deg"), - fgGetDouble("/position/latitude-deg")); + _aircraft = globals->get_aircraft_position(); bool mag = _root->getBoolValue("magnetic-headings"); if (mag != _magneticHeadings) { @@ -936,7 +935,8 @@ private: void MapWidget::drawAirports() { MapAirportFilter af(_root); - FGPositioned::List apts = FGPositioned::findWithinRange(_projectionCenter, _drawRangeNm, &af); + bool partial = false; + FGPositioned::List apts = FGPositioned::findWithinRangePartial(_projectionCenter, _drawRangeNm, &af, partial); for (unsigned int i=0; inumRunways(); ++r) { - FGRunway* rwy = apt->getRunwayByIndex(r); - if (!rwy->isReciprocal()) { - drawRunwayPre(rwy); - } + FGRunwayList runways(apt->getRunwaysWithoutReciprocals()); + + for (unsigned int r=0; rnumRunways(); ++r) { - FGRunway* rwy = apt->getRunwayByIndex(r); - if (!rwy->isReciprocal()) { - drawRunway(rwy); - } + for (unsigned int r=0; rILS()) { - drawILS(false, rwy); - } - } // of runway iteration + if (rwy->ILS()) { + drawILS(false, rwy); + } + + if (rwy->reciprocalRunway()) { + FGRunway* recip = rwy->reciprocalRunway(); + if (recip->ILS()) { + drawILS(false, recip); + } + } + } + + for (unsigned int r=0; rnumHelipads(); ++r) { + FGHelipad* hp = apt->getHelipadByIndex(r); + drawHelipad(hp); + } // of runway iteration } @@ -1219,14 +1228,11 @@ int MapWidget::scoreAirportRunways(FGAirport* apt) bool needHardSurface = _root->getBoolValue("hard-surfaced-airports", true); double minLength = _root->getDoubleValue("min-runway-length-ft", 2000.0); - int score = 0; - unsigned int numRunways(apt->numRunways()); - for (unsigned int r=0; rgetRunwayByIndex(r); - if (rwy->isReciprocal()) { - continue; - } + FGRunwayList runways(apt->getRunwaysWithoutReciprocals()); + int score = 0; + for (unsigned int r=0; risHardSurface()) { continue; } @@ -1392,6 +1398,32 @@ void MapWidget::drawTraffic() } // of ai/models iteration } +void MapWidget::drawHelipad(FGHelipad* hp) +{ + SGVec2d pos = project(hp->geod()); + glLineWidth(1.0); + glColor3f(1.0, 1.0, 1.0); + circleAt(pos, 16, 5.0); + + if (validDataForKey(hp)) { + setAnchorForKey(hp, pos); + return; + } + + char buffer[1024]; + ::snprintf(buffer, 1024, "%s\n%03d\n%.0f'", + hp->ident().c_str(), + displayHeading(hp->headingDeg()), + hp->lengthFt()); + + MapData* d = createDataForKey(hp); + d->setText(buffer); + d->setLabel(hp->ident()); + d->setPriority(40); + d->setOffset(MapData::HALIGN_CENTER | MapData::VALIGN_BOTTOM, 8); + d->setAnchor(pos); +} + void MapWidget::drawAIAircraft(const SGPropertyNode* model, const SGGeod& pos, double hdg) {