p->setPen(pen);
p->drawLine(pt, pt2);
}
+
+
+ // aircraft pos and heading...
+ // paintAirplaneIcon(painter, );
}
void AirportDiagram::drawILS(QPainter* painter, FGRunwayRef runway) const
paintContents(&p);
}
+void BaseDiagram::paintAirplaneIcon(QPainter* painter, const SGGeod& geod, int headingDeg)
+{
+ QPointF pos = project(geod);
+ QPixmap pix(":/airplane-icon");
+ pos = painter->transform().map(pos);
+ painter->resetTransform();
+ painter->translate(pos.x(), pos.y());
+ painter->rotate(headingDeg);
+
+ painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
+ QRect airplaneIconRect = pix.rect();
+ airplaneIconRect.moveCenter(QPoint(0,0));
+ painter->drawPixmap(airplaneIconRect, pix);
+}
+
class MapFilter : public FGPositioned::TypeFilter
{
public:
static QPointF project(const SGGeod &geod, const SGGeod ¢er);
static SGGeod unproject(const QPointF &xy, const SGGeod ¢er);
+
+ void paintAirplaneIcon(QPainter *painter, const SGGeod &geod, int headingDeg);
private:
void paintNavaids(QPainter *p);
{
QPointF base = project(m_geod);
- QPointF airplaneIconPos = base;
-
+ SGGeod aircraftPos = m_geod;
if (m_offsetEnabled) {
double d = m_offsetDistanceNm * SG_NM_TO_METER;
SGGeod offsetGeod = SGGeodesy::direct(m_geod, m_offsetBearingDeg, d);
painter->setPen(pen);
painter->drawLine(base, offset);
- airplaneIconPos = offset;
+ aircraftPos = offsetGeod;
}
- QPixmap pix(":/airplane-icon");
- airplaneIconPos = painter->transform().map(airplaneIconPos);
- painter->resetTransform();
- painter->translate(airplaneIconPos.x(), airplaneIconPos.y());
- painter->rotate(m_headingDeg);
-
- painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
- QRect airplaneIconRect = pix.rect();
- airplaneIconRect.moveCenter(QPoint(0,0));
- painter->drawPixmap(airplaneIconRect, pix);
+ paintAirplaneIcon(painter, aircraftPos, m_headingDeg);
}
void NavaidDiagram::doComputeBounds()