/* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #pragma once #include "application/uilayer.h" #include "utilities/Classes.h" class drivingaid_panel : public ui_expandable_panel { public: drivingaid_panel( std::string const &Name, bool const Isopen ) : ui_expandable_panel( Name, Isopen ) {} void update() override; void render_contents() override; private: // members std::array m_buffer; // the broken coupler next to the camera, which the panel offers to repair: the vehicle and its end TDynamicObject const *m_brokenvehicle { nullptr }; int m_brokenend { 0 }; }; class timetable_panel : public ui_expandable_panel { public: timetable_panel( std::string const &Name, bool const Isopen ) : ui_expandable_panel( Name, Isopen ) {} void update() override; void render() override; private: // members std::array m_buffer; std::vector m_tablelines; }; class scenario_panel : public ui_panel { public: scenario_panel( std::string const &Name, bool const Isopen ) : ui_panel( Name, Isopen ) {} void update() override; void render() override; bool is_expanded{ false }; private: // members TDynamicObject const *m_nearest { nullptr }; }; class debug_panel : public ui_panel { public: debug_panel( std::string const &Name, bool const Isopen ) : ui_panel( Name, Isopen ) { m_eventsearch.fill( 0 ); } void update() override; void render() override; private: // types struct input_data { TTrain const *train; TDynamicObject const *controlled; TCamera const *camera; TDynamicObject const *vehicle; TMoverParameters *mover; TController const *mechanik; }; // methods // generate and send section data to provided output void update_section_vehicle( std::vector &Output ); void update_section_engine( std::vector &Output ) const; void update_section_ai( std::vector &Output ) const; void update_section_scantable( std::vector &Output ) const; void update_section_scenario( std::vector &Output ) const; void update_section_eventqueue( std::vector &Output ); void update_section_powergrid( std::vector &Output ) const; void update_section_camera( std::vector &Output ) const; void update_section_renderer( std::vector &Output ) const; // the coupler nearest to the camera, and the state of its coupling void update_section_coupler( std::vector &Output ); #ifdef WITH_UART void update_section_uart( std::vector &Output ) const; #endif // section update helpers std::string update_vehicle_coupler( int const Side ); std::string update_vehicle_brake() const; // renders provided lines, under specified collapsing header bool render_section( std::string const &Header, std::vector const &Lines ); bool render_section( std::vector const &Lines ) const; bool render_section_scenario(); bool render_section_eventqueue(); // the coupler section, with the parameters of the physical model to try out in the debug mode bool render_section_coupler(); bool render_section_settings() const; bool render_section_developer() const; // members std::array m_buffer; std::array m_eventsearch; input_data m_input; std::vector m_vehiclelines; std::vector m_enginelines; std::vector m_ailines; std::vector m_scantablelines; std::vector m_cameralines; std::vector m_scenariolines; std::vector m_eventqueuelines; std::vector m_powergridlines; std::vector m_rendererlines; std::vector m_uartlines; std::vector m_couplerlines; // the coupler nearest to the camera struct coupler_pick { TDynamicObject const *vehicle { nullptr }; int end { 0 }; }; coupler_pick m_coupler; bool m_couplerbothends { true }; // changes to the parameters apply to the end of the other vehicle of the pair too double last_time = std::numeric_limits::quiet_NaN(); struct graph_data { double last_val = 0.0; std::array data = { 0.0f }; size_t pos = 0; float range = 25.0f; void update(float data); void render(); }; graph_data AccN_jerk_graph; graph_data AccN_acc_graph; float last_AccN; bool m_eventqueueactivevehicleonly { false }; }; class transcripts_panel : public ui_panel { public: transcripts_panel( std::string const &Name, bool const Isopen ) : ui_panel( Name, Isopen ) {} void update() override; void render() override; };