void FlightStatisticsRenderer::RenderOLC(Canvas &canvas, const PixelRect rc, const NMEAInfo &nmea_info, const DerivedInfo &calculated, const ComputerSettings &settings_computer, const MapSettings &settings_map, const ContestStatistics &contest, const TraceComputer &trace_computer) const { if (!trail_renderer.LoadTrace(trace_computer)) { ChartRenderer chart(chart_look, canvas, rc); chart.DrawNoData(); return; } ChartProjection proj(rc, trail_renderer.GetBounds(nmea_info.location)); RasterPoint aircraft_pos = proj.GeoToScreen(nmea_info.location); AircraftRenderer::Draw(canvas, settings_map, map_look.aircraft, calculated.heading, aircraft_pos); trail_renderer.Draw(canvas, proj); for (unsigned i=0; i< 3; ++i) { if (contest.GetResult(i).IsDefined()) { canvas.Select(map_look.contest_pens[i]); trail_renderer.DrawTraceVector(canvas, proj, contest.GetSolution(i)); } } }
void FlightStatisticsRenderer::RenderOLC(Canvas &canvas, const PixelRect rc, const NMEAInfo &nmea_info, const ComputerSettings &settings_computer, const MapSettings &settings_map, const ContestStatistics &contest, const TraceComputer &trace_computer) const { if (!trail_renderer.LoadTrace(trace_computer)) { ChartRenderer chart(chart_look, canvas, rc); chart.DrawNoData(); return; } TaskProjection task_projection(trail_renderer.GetBounds(nmea_info.location)); /* scan all solutions to make sure they are all visible */ for (unsigned i = 0; i < 3; ++i) { if (contest.GetResult(i).IsDefined()) { const ContestTraceVector &solution = contest.GetSolution(i); for (auto j = solution.begin(), end = solution.end(); j != end; ++j) task_projection.Scan(j->location); } } const ChartProjection proj(rc, task_projection); RasterPoint aircraft_pos = proj.GeoToScreen(nmea_info.location); AircraftRenderer::Draw(canvas, settings_map, map_look.aircraft, nmea_info.attitude.heading, aircraft_pos); trail_renderer.Draw(canvas, proj); for (unsigned i=0; i< 3; ++i) { if (contest.GetResult(i).IsDefined()) { canvas.Select(map_look.contest_pens[i]); trail_renderer.DrawTraceVector(canvas, proj, contest.GetSolution(i)); } } }
void FlightStatisticsRenderer::DrawContestTriangle(Canvas &canvas, const Projection &projection, const ContestStatistics &statistics, unsigned i) const { if (!statistics.GetResult(i).IsDefined() || statistics.GetSolution(i).size() != 5) return; canvas.Select(map_look.contest_pens[i]); canvas.SelectHollowBrush(); trail_renderer.DrawTriangle(canvas, projection, statistics.GetSolution(i)); }
void FlightStatisticsRenderer::DrawContestSolution(Canvas &canvas, const Projection &projection, const ContestStatistics &statistics, unsigned i) const { if (!statistics.GetResult(i).IsDefined()) return; canvas.Select(map_look.contest_pens[i]); trail_renderer.DrawTraceVector(canvas, projection, statistics.GetSolution(i)); }
void FlightStatisticsRenderer::RenderOLC(Canvas &canvas, const PixelRect rc, const NMEAInfo &nmea_info, const ComputerSettings &settings_computer, const MapSettings &settings_map, const ContestStatistics &contest, const TraceComputer &trace_computer, const Retrospective &retrospective) const { ChartRenderer chart(chart_look, canvas, rc); if (!trail_renderer.LoadTrace(trace_computer)) { chart.DrawNoData(); return; } const PixelRect &rc_chart = chart.GetChartRect(); GeoBounds bounds(nmea_info.location); trail_renderer.ScanBounds(bounds); /* scan all solutions to make sure they are all visible */ for (unsigned i = 0; i < 3; ++i) { if (contest.GetResult(i).IsDefined()) { const ContestTraceVector &solution = contest.GetSolution(i); for (auto j = solution.begin(), end = solution.end(); j != end; ++j) bounds.Extend(j->location); } } const ChartProjection proj(rc_chart, TaskProjection(bounds)); { // draw place names found in the retrospective task // canvas.Select(*dialog_look.small_font); canvas.Select(chart_look.label_font); canvas.SetBackgroundTransparent(); for (const auto &i : retrospective.getNearWaypointList()) { auto wp_pos = proj.GeoToScreen(i.waypoint->location); canvas.DrawText(wp_pos.x, wp_pos.y, i.waypoint->name.c_str()); } } auto aircraft_pos = proj.GeoToScreen(nmea_info.location); AircraftRenderer::Draw(canvas, settings_map, map_look.aircraft, nmea_info.attitude.heading, aircraft_pos); trail_renderer.Draw(canvas, proj); switch (settings_computer.contest.contest) { case Contest::NONE: break; case Contest::OLC_SPRINT: case Contest::OLC_CLASSIC: case Contest::SIS_AT: case Contest::NET_COUPE: case Contest::DMST: DrawContestSolution(canvas, proj, contest, 0); break; case Contest::OLC_FAI: DrawContestTriangle(canvas, proj, contest, 0); break; case Contest::OLC_LEAGUE: /* draw classic first, and triangle on top of it */ DrawContestSolution(canvas, proj, contest, 1); DrawContestSolution(canvas, proj, contest, 0); break; case Contest::OLC_PLUS: case Contest::XCONTEST: case Contest::DHV_XC: DrawContestSolution(canvas, proj, contest, 0); DrawContestTriangle(canvas, proj, contest, 1); break; } RenderMapScale(canvas, proj, rc_chart, map_look.overlay); }