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

Represents a panel that displays a chart with sensor data over time. More...

#include <PanelSensor.h>

Inheritance diagram for PanelSensor:
Collaboration diagram for PanelSensor:

Public Member Functions

 PanelSensor (Panel *origin, std::string sensorId, std::string chartName)
 Constructor for PanelSensor.
 
 ~PanelSensor ()
 Destructor for PanelSensor.
 
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

Sensor Information
std::string sensorId
 Unique ID of the selected sensor.
 
std::string chartName
 Name displayed on the chart.
 
UI Styling Configuration
const int styleObjectSpacingX = 10
 Horizontal spacing between UI elements.
 
const int styleObjectSpacingY = 10
 Vertical spacing between UI elements.
 
UI Elements
wxStaticText * textTop
 Static text displaying the sensor selection message.
 
Chart Statistics
int chartValidCount
 Total number of valid data points.
 
float chartSum
 Sum of all data points.
 
size_t chartMinIndex = 0
 Index of the minimum value in the dataset.
 
size_t chartMaxIndex = 0
 Index of the maximum value in the dataset.
 
float chartStandardDeviationSum
 Sum of squared deviations for standard deviation calculation.
 
int chartLocalValidCount
 Number of valid points in the currently viewed range.
 
float chartLocalSum
 Sum of data points in the viewed range.
 
size_t chartLocalMinIndex = 0
 Index of the minimum value in the viewed range.
 
size_t chartLocalMaxIndex = 0
 Index of the maximum value in the viewed range.
 
float chartLocalStandardDeviationSum
 Sum of squared deviations for local standard deviation calculation.
 
- 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 FetchData ()
 Initiates fetching of sensor data.
 
void OnDataFetched (wxThreadEvent &event)
 Event handler for processing fetched sensor data.
 

Slider Control

wxSlider * slider
 Slider for adjusting displayed data range.
 
const int sliderMinValue = 0
 Minimum value of the slider.
 
const int sliderMaxValue = 1000
 Maximum value of the slider.
 
const int startingValueCount = 24
 Default number of data points displayed.
 
void OnSliderChanged (wxCommandEvent &event)
 Handles slider change events.
 

Summary Information

wxRichTextCtrl * summery1
 Rich text box displaying summary statistics.
 
wxRichTextCtrl * summery2
 Rich text box displaying transformed statistics.
 
void UpdateSummery1Text ()
 Updates the text in the summary box.
 
void UpdateSummeryTransofrm ()
 Applies transformations and updates the second summary box.
 

Chart and Data

nlohmann::json data
 JSON object holding sensor data.
 
wxLineChartCtrl * chart = nullptr
 Pointer to the line chart control.
 
void UpdateChart ()
 Updates the chart with the latest data.
 
void UpdateChartSize ()
 Adjusts the chart size based on the window size.
 

Navigation

wxButton * button_back
 Button for navigating back to the previous panel.
 
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 a chart with sensor data over time.

This panel is opened when a user selects a sensor from the PanelStation list. It fetches historical data, presents it in a chart, and provides statistical analysis.

Constructor & Destructor Documentation

◆ PanelSensor()

PanelSensor::PanelSensor ( Panel * origin,
std::string sensorId,
std::string chartName )

Constructor for PanelSensor.

Initializes UI components and starts fetching sensor data.

Parameters
originPointer to the parent panel.
sensorIdUnique identifier of the sensor.
chartNameDisplay name of the chart.
Here is the call graph for this function:

◆ ~PanelSensor()

PanelSensor::~PanelSensor ( )

Destructor for PanelSensor.

Cleans up dynamically allocated resources and unbinds events.

Member Function Documentation

◆ ButtonBack_OnButtonClick()

void PanelSensor::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.

◆ FetchData()

void PanelSensor::FetchData ( )

Initiates fetching of sensor data.

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

◆ OnDataFetched()

void PanelSensor::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 chart.

Parameters
eventThe event containing the fetched data.

◆ OnFullScreen()

void PanelSensor::OnFullScreen ( wxFullScreenEvent & event)

Handles full-screen events.

Parameters
eventThe full-screen event.

◆ OnSliderChanged()

void PanelSensor::OnSliderChanged ( wxCommandEvent & event)

Handles slider change events.

◆ OnWindowMaximized()

void PanelSensor::OnWindowMaximized ( wxMaximizeEvent & event)

Handles window maximization events.

Parameters
eventThe window maximize event.

◆ OnWindowResized()

void PanelSensor::OnWindowResized ( wxSizeEvent & event)

Handles window resize events.

Parameters
eventThe window resize event.

◆ UpdateChart()

void PanelSensor::UpdateChart ( )

Updates the chart with the latest data.

◆ UpdateChartSize()

void PanelSensor::UpdateChartSize ( )

Adjusts the chart size based on the window size.

◆ UpdateGUI()

void PanelSensor::UpdateGUI ( )

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

◆ UpdateSummery1Text()

void PanelSensor::UpdateSummery1Text ( )

Updates the text in the summary box.

◆ UpdateSummeryTransofrm()

void PanelSensor::UpdateSummeryTransofrm ( )

Applies transformations and updates the second summary box.

Member Data Documentation

◆ button_back

wxButton* PanelSensor::button_back

Button for navigating back to the previous panel.

◆ chart

wxLineChartCtrl* PanelSensor::chart = nullptr

Pointer to the line chart control.

◆ chartLocalMaxIndex

size_t PanelSensor::chartLocalMaxIndex = 0

Index of the maximum value in the viewed range.

◆ chartLocalMinIndex

size_t PanelSensor::chartLocalMinIndex = 0

Index of the minimum value in the viewed range.

◆ chartLocalStandardDeviationSum

float PanelSensor::chartLocalStandardDeviationSum

Sum of squared deviations for local standard deviation calculation.

◆ chartLocalSum

float PanelSensor::chartLocalSum

Sum of data points in the viewed range.

◆ chartLocalValidCount

int PanelSensor::chartLocalValidCount

Number of valid points in the currently viewed range.

◆ chartMaxIndex

size_t PanelSensor::chartMaxIndex = 0

Index of the maximum value in the dataset.

◆ chartMinIndex

size_t PanelSensor::chartMinIndex = 0

Index of the minimum value in the dataset.

◆ chartName

std::string PanelSensor::chartName

Name displayed on the chart.

◆ chartStandardDeviationSum

float PanelSensor::chartStandardDeviationSum

Sum of squared deviations for standard deviation calculation.

◆ chartSum

float PanelSensor::chartSum

Sum of all data points.

◆ chartValidCount

int PanelSensor::chartValidCount

Total number of valid data points.

◆ data

nlohmann::json PanelSensor::data

JSON object holding sensor data.

◆ httpFetcher

HttpFetcher* PanelSensor::httpFetcher = nullptr

Pointer to an HTTP fetcher instance.

◆ sensorId

std::string PanelSensor::sensorId

Unique ID of the selected sensor.

◆ slider

wxSlider* PanelSensor::slider

Slider for adjusting displayed data range.

◆ sliderMaxValue

const int PanelSensor::sliderMaxValue = 1000

Maximum value of the slider.

◆ sliderMinValue

const int PanelSensor::sliderMinValue = 0

Minimum value of the slider.

◆ startingValueCount

const int PanelSensor::startingValueCount = 24

Default number of data points displayed.

◆ styleObjectSpacingX

const int PanelSensor::styleObjectSpacingX = 10

Horizontal spacing between UI elements.

◆ styleObjectSpacingY

const int PanelSensor::styleObjectSpacingY = 10

Vertical spacing between UI elements.

◆ summery1

wxRichTextCtrl* PanelSensor::summery1

Rich text box displaying summary statistics.

◆ summery2

wxRichTextCtrl* PanelSensor::summery2

Rich text box displaying transformed statistics.

◆ textTop

wxStaticText* PanelSensor::textTop

Static text displaying the sensor selection message.


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