Weather App
 
Loading...
Searching...
No Matches
PanelStation Class Reference

Represents a panel that displays sensor information for a selected station. More...

#include <PanelStation.h>

Inheritance diagram for PanelStation:
Collaboration diagram for PanelStation:

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.
 
- Public Member Functions inherited from Panel
 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.
 
- Public Attributes inherited from Panel
wxPanel * panel
 Pointer to the wxPanel instance managed by this class.
 

Data Fetching

HttpFetcherhttpFetcher = 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PanelStation()

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.

Parameters
originPointer to the parent panel.
stationIdUnique identifier of the station.
stationNameDisplay name of the station.
Here is the call graph for this function:

◆ ~PanelStation()

PanelStation::~PanelStation ( )

Destructor for PanelStation.

Cleans up dynamically allocated resources and unbinds events.

Member Function Documentation

◆ ButtonBack_OnButtonClick()

void PanelStation::ButtonBack_OnButtonClick ( wxCommandEvent & event)

Handles click events on the "Back" button. Closes the panel and returns to the previous screen.

Parameters
eventThe button click event.

◆ FetchParams()

void PanelStation::FetchParams ( )

Initiates fetching of sensor data for the selected station.

If a fetch operation is already in progress, this function does nothing.

◆ ListSensors_OnItemDoubleClicked()

void PanelStation::ListSensors_OnItemDoubleClicked ( wxCommandEvent & event)

Handles double-click events on the sensor list. Opens a new panel for the selected sensor.

Parameters
eventThe list box double-click event.

◆ OnDataFetched()

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.

Parameters
eventThe event containing the fetched data.

◆ OnFullScreen()

void PanelStation::OnFullScreen ( wxFullScreenEvent & event)

Handles full-screen events.

Parameters
eventThe full-screen event.

◆ OnWindowMaximized()

void PanelStation::OnWindowMaximized ( wxMaximizeEvent & event)

Handles window maximization events.

Parameters
eventThe window maximize event.

◆ OnWindowResized()

void PanelStation::OnWindowResized ( wxSizeEvent & event)

Handles window resize events.

Parameters
eventThe window resize event.

◆ UpdateGUI()

void PanelStation::UpdateGUI ( )

Updates the graphical user interface. Resizes UI elements based on the current window size.

Member Data Documentation

◆ button_back

wxButton* PanelStation::button_back

Button for navigating back to the previous panel.

◆ data

nlohmann::json PanelStation::data

JSON object holding sensor data.

◆ httpFetcher

HttpFetcher* PanelStation::httpFetcher = nullptr

Pointer to an HTTP fetcher instance.

◆ listSensors

wxListBox* PanelStation::listSensors

List box displaying available sensors.

◆ stationId

std::string PanelStation::stationId

Unique ID of the selected station.

◆ stationName

std::string PanelStation::stationName

Name of the selected station.

◆ styleObjectSpacingX

const int PanelStation::styleObjectSpacingX = 10

Horizontal spacing between UI elements.

◆ styleObjectSpacingY

const int PanelStation::styleObjectSpacingY = 10

Vertical spacing between UI elements.

◆ textTop

wxStaticText* PanelStation::textTop

Static text displaying the station selection message.


The documentation for this class was generated from the following file: