inline void ChartControl::UpdateCrossSection(const MoreData &basic, const DerivedInfo &calculated, const GlideSettings &glide_settings, const GlidePolar &glide_polar, const MapSettings &map_settings) { cross_section_renderer.ReadBlackboard(basic, calculated, glide_settings, glide_polar, map_settings); if (basic.location_available && basic.track_available) { cross_section_renderer.SetDirection(basic.track); cross_section_renderer.SetStart(basic.location); } else cross_section_renderer.SetInvalid(); }
ChartControl(AnalysisWidget &_analysis_widget, const ChartLook &_chart_look, const MapLook &map_look, const CrossSectionLook &_cross_section_look, const ThermalBandLook &_thermal_band_look, const CrossSectionLook &cross_section_look, const AirspaceLook &airspace_look, const Airspaces *airspaces, const RasterTerrain *terrain, const FullBlackboard &_blackboard, const GlideComputer &_glide_computer) :analysis_widget(_analysis_widget), chart_look(_chart_look), cross_section_look(_cross_section_look), thermal_band_renderer(_thermal_band_look, chart_look), fs_renderer(chart_look, map_look), cross_section_renderer(cross_section_look, airspace_look, chart_look), blackboard(_blackboard), glide_computer(_glide_computer) { cross_section_renderer.SetAirspaces(airspaces); cross_section_renderer.SetTerrain(terrain); }
/** * Set CrossSection start point * @param _start Start GeoPoint to use for drawing */ void SetStart(GeoPoint start) { renderer.SetStart(start); }
/** * Set CrossSection direction * @param bearing Direction to draw */ void SetDirection(Angle bearing) { renderer.SetDirection(bearing); }
/** * Set CrossSection range * @param range Range to draw [m] */ void SetRange(fixed range) { renderer.SetRange(range); }
/** * Set RasterTerrain to use * @param _terrain Pointer to the RasterTerrain or NULL */ void SetTerrain(const RasterTerrain *terrain) { renderer.SetTerrain(terrain); }
/** * Set airspace database to use * @param _airspace_database Pointer to the airspace database or NULL */ void SetAirspaces(const Airspaces *airspace_database) { renderer.SetAirspaces(airspace_database); }
void ReadBlackboard(const MoreData &basic, const DerivedInfo &calculated, const AirspaceRendererSettings &ar_settings) { renderer.ReadBlackboard(basic, calculated, ar_settings); }
void SetInvalid() { renderer.SetInvalid(); }
void ChartControl::OnPaint(Canvas &canvas) { const ComputerSettings &settings_computer = blackboard.GetComputerSettings(); const MapSettings &settings_map = blackboard.GetMapSettings(); const MoreData &basic = blackboard.Basic(); const DerivedInfo &calculated = blackboard.Calculated(); const ProtectedTaskManager *const protected_task_manager = &glide_computer.GetProtectedTaskManager(); #ifdef ENABLE_OPENGL /* enable clipping */ GLCanvasScissor scissor(canvas); #endif canvas.Clear(COLOR_WHITE); canvas.SetTextColor(COLOR_BLACK); PixelRect rcgfx = GetClientRect(); // background is painted in the base-class switch (page) { case AnalysisPage::BAROGRAPH: RenderBarograph(canvas, rcgfx, chart_look, cross_section_look, glide_computer.GetFlightStats(), basic, calculated, protected_task_manager); break; case AnalysisPage::CLIMB: RenderClimbChart(canvas, rcgfx, chart_look, glide_computer.GetFlightStats(), settings_computer.polar.glide_polar_task); break; case AnalysisPage::THERMAL_BAND: { OrderedTaskSettings otb; if (protected_task_manager != NULL) { otb = protected_task_manager->GetOrderedTaskSettings(); } thermal_band_renderer.DrawThermalBand(basic, calculated, settings_computer, canvas, rcgfx, settings_computer.task, false, &otb); } break; case AnalysisPage::WIND: RenderWindChart(canvas, rcgfx, chart_look, glide_computer.GetFlightStats(), basic, glide_computer.GetWindStore()); break; case AnalysisPage::POLAR: RenderGlidePolar(canvas, rcgfx, chart_look, calculated.climb_history, settings_computer, settings_computer.polar.glide_polar_task); break; case AnalysisPage::TEMPTRACE: RenderTemperatureChart(canvas, rcgfx, chart_look, glide_computer.GetCuSonde()); break; case AnalysisPage::TASK: if (protected_task_manager != NULL) { const auto &trace_computer = glide_computer.GetTraceComputer(); fs_renderer.RenderTask(canvas, rcgfx, basic, settings_computer, settings_map, *protected_task_manager, &trace_computer); } break; case AnalysisPage::OLC: fs_renderer.RenderOLC(canvas, rcgfx, basic, settings_computer, settings_map, calculated.contest_stats, glide_computer.GetTraceComputer(), glide_computer.GetRetrospective()); break; case AnalysisPage::TASK_SPEED: if (protected_task_manager != NULL) { ProtectedTaskManager::Lease task(*protected_task_manager); RenderSpeed(canvas, rcgfx, chart_look, glide_computer.GetFlightStats(), basic, calculated, task); } break; case AnalysisPage::AIRSPACE: cross_section_renderer.Paint(canvas, rcgfx); break; default: // should never get here! break; } }