Represents a panel that displays sensor information for a selected station. More...
#include <PanelStation.h>
Public Member Functions | |
PanelStation (Panel *origin, std::string stationId, std::string stationName) | |
Constructor for PanelStation. | |
~PanelStation () | |
Destructor for PanelStation. | |
UI Updates | |
void | UpdateGUI () |
Updates the graphical user interface. Resizes UI elements based on the current window size. | |
void | OnWindowResized (wxSizeEvent &event) |
Handles window resize events. | |
void | OnWindowMaximized (wxMaximizeEvent &event) |
Handles window maximization events. | |
void | OnFullScreen (wxFullScreenEvent &event) |
Handles full-screen events. | |
![]() | |
Panel (Panel *origin) | |
Constructs a new Panel and hides the previous one if provided. | |
~Panel () | |
Destructor that deletes the current panel and restores the previous one. | |
void | SetTitle (std::string title) |
Sets the title of the main window. | |
Public Attributes | |
Station Information | |
std::string | stationId |
Unique ID of the selected station. | |
std::string | stationName |
Name of the selected station. | |
UI Styling Configuration | |
const int | styleObjectSpacingX = 10 |
Horizontal spacing between UI elements. | |
const int | styleObjectSpacingY = 10 |
Vertical spacing between UI elements. | |
![]() | |
wxPanel * | panel |
Pointer to the wxPanel instance managed by this class. | |
Data Fetching | |
HttpFetcher * | httpFetcher = nullptr |
Pointer to an HTTP fetcher instance. | |
void | FetchParams () |
Initiates fetching of sensor data for the selected station. | |
void | OnDataFetched (wxThreadEvent &event) |
Event handler for processing fetched sensor data. | |
UI Elements | |
wxStaticText * | textTop |
Static text displaying the station selection message. | |
nlohmann::json | data |
JSON object holding sensor data. | |
wxListBox * | listSensors |
List box displaying available sensors. | |
wxButton * | button_back |
Button for navigating back to the previous panel. | |
void | ListSensors_OnItemDoubleClicked (wxCommandEvent &event) |
Handles double-click events on the sensor list. Opens a new panel for the selected sensor. | |
void | ButtonBack_OnButtonClick (wxCommandEvent &event) |
Handles click events on the "Back" button. Closes the panel and returns to the previous screen. | |
Represents a panel that displays sensor information for a selected station.
This panel is opened when a user selects a station from the list in PanelStart. It fetches sensor data from an API and displays it in a list, allowing further interactions.
PanelStation::PanelStation | ( | Panel * | origin, |
std::string | stationId, | ||
std::string | stationName ) |
Constructor for PanelStation.
Initializes the UI components and starts fetching sensor data for the given station.
origin | Pointer to the parent panel. |
stationId | Unique identifier of the station. |
stationName | Display name of the station. |
PanelStation::~PanelStation | ( | ) |
Destructor for PanelStation.
Cleans up dynamically allocated resources and unbinds events.
void PanelStation::ButtonBack_OnButtonClick | ( | wxCommandEvent & | event | ) |
Handles click events on the "Back" button. Closes the panel and returns to the previous screen.
event | The button click event. |
void PanelStation::FetchParams | ( | ) |
Initiates fetching of sensor data for the selected station.
If a fetch operation is already in progress, this function does nothing.
void PanelStation::ListSensors_OnItemDoubleClicked | ( | wxCommandEvent & | event | ) |
Handles double-click events on the sensor list. Opens a new panel for the selected sensor.
event | The list box double-click event. |
void PanelStation::OnDataFetched | ( | wxThreadEvent & | event | ) |
Event handler for processing fetched sensor data.
This method is triggered when an HTTP fetch operation is completed. It updates the local database and refreshes the sensor list UI.
event | The event containing the fetched data. |
void PanelStation::OnFullScreen | ( | wxFullScreenEvent & | event | ) |
Handles full-screen events.
event | The full-screen event. |
void PanelStation::OnWindowMaximized | ( | wxMaximizeEvent & | event | ) |
Handles window maximization events.
event | The window maximize event. |
void PanelStation::OnWindowResized | ( | wxSizeEvent & | event | ) |
Handles window resize events.
event | The window resize event. |
void PanelStation::UpdateGUI | ( | ) |
Updates the graphical user interface. Resizes UI elements based on the current window size.
wxButton* PanelStation::button_back |
Button for navigating back to the previous panel.
nlohmann::json PanelStation::data |
JSON object holding sensor data.
HttpFetcher* PanelStation::httpFetcher = nullptr |
Pointer to an HTTP fetcher instance.
wxListBox* PanelStation::listSensors |
List box displaying available sensors.
std::string PanelStation::stationId |
Unique ID of the selected station.
std::string PanelStation::stationName |
Name of the selected station.
const int PanelStation::styleObjectSpacingX = 10 |
Horizontal spacing between UI elements.
const int PanelStation::styleObjectSpacingY = 10 |
Vertical spacing between UI elements.
wxStaticText* PanelStation::textTop |
Static text displaying the station selection message.