#include <Navaids/navrecord.hxx>
#include <Navaids/navlist.hxx>
#include <Navaids/fix.hxx>
-#include <Airports/simple.hxx>
+#include <Airports/airport.hxx>
#include <Airports/runways.hxx>
#include <Main/fg_os.hxx> // fgGetKeyModifiers()
#include <Navaids/routePath.hxx>
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) {
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; i<apts.size(); ++i) {
drawAirport((FGAirport*) apts[i].get());
}
return;
}
- for (unsigned int r=0; r<apt->numRunways(); ++r) {
- FGRunway* rwy = apt->getRunwayByIndex(r);
- if (!rwy->isReciprocal()) {
- drawRunwayPre(rwy);
- }
+ FGRunwayList runways(apt->getRunwaysWithoutReciprocals());
+
+ for (unsigned int r=0; r<runways.size(); ++r) {
+ drawRunwayPre(runways[r]);
}
- for (unsigned int r=0; r<apt->numRunways(); ++r) {
- FGRunway* rwy = apt->getRunwayByIndex(r);
- if (!rwy->isReciprocal()) {
- drawRunway(rwy);
- }
+ for (unsigned int r=0; r<runways.size(); ++r) {
+ FGRunway* rwy = runways[r];
+ drawRunway(rwy);
- if (rwy->ILS()) {
- 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; r<apt->numHelipads(); ++r) {
+ FGHelipad* hp = apt->getHelipadByIndex(r);
+ drawHelipad(hp);
+ } // of runway iteration
}
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; r<numRunways; ++r) {
- FGRunway* rwy = apt->getRunwayByIndex(r);
- if (rwy->isReciprocal()) {
- continue;
- }
+ FGRunwayList runways(apt->getRunwaysWithoutReciprocals());
+ int score = 0;
+ for (unsigned int r=0; r<runways.size(); ++r) {
+ FGRunway* rwy = runways[r];
if (needHardSurface && !rwy->isHardSurface()) {
continue;
}
} // 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)
{