42 if (fp == m_flightplan)
47 disconnect(m_flightplan,
nullptr,
this,
nullptr);
82 qWarning() << Q_FUNC_INFO <<
"invalid leg index" <<
activeLegIndex;
89 const double halfLegDistance = m_path->distanceForIndex(m_activeLegIndex) * 0.5;
90 m_projectionCenter = m_path->positionForDistanceFrom(m_activeLegIndex, halfLegDistance);
101 QVector<QLineF> lines;
102 QVector<QLineF> activeLines;
103 for (
int l=0; l < fp->numLegs(); ++l) {
106 for (
auto g : m_path->pathForIndex(l)) {
110 }
else if (l == m_activeLegIndex) {
111 activeLines.append(QLineF(previous,
p));
113 lines.append(QLineF(previous,
p));
119 QPen linePen(Qt::magenta, 2);
120 linePen.setCosmetic(
true);
121 painter->setPen(linePen);
122 painter->drawLines(lines);
124 linePen.setColor(Qt::yellow);
125 painter->setPen(linePen);
126 painter->drawLines(activeLines);
132 const SGGeodVec gv(m_path->pathForIndex(m_activeLegIndex));
133 std::for_each(gv.begin(), gv.end(), [
this](
const SGGeod& g)
134 {this->extendBounds(this->project(g)); }
138void RouteDiagram::fpChanged()
142 m_activeLegIndex = 0;
144 if (fp && (fp->numLegs() > 0)) {
145 const double halfLegDistance = m_path->distanceForIndex(m_activeLegIndex) * 0.5;
146 m_projectionCenter = m_path->positionForDistanceFrom(m_activeLegIndex, halfLegDistance);
std::vector< SGGeod > SGGeodVec
BaseDiagram(QQuickItem *pr=nullptr)
SGGeod m_projectionCenter
QPointF project(const SGGeod &geod) const
void recomputeBounds(bool resetZoom)
flightgear::FlightPlanRef flightplan() const
RouteDiagram(QQuickItem *pr=nullptr)
void setFlightplan(FlightPlanController *fp)
void paintContents(QPainter *) override
void setActiveLegIndex(int activeLegIndex)
void flightplanChanged(FlightPlanController *flightplan)
void legIndexChanged(int activeLegIndex)
void doComputeBounds() override
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
SGSharedPtr< FlightPlan > FlightPlanRef