Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
ElementPlotData.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#ifndef ELEMENTPLOTDATA_H
19#define ELEMENTPLOTDATA_H
20
21#include <wx/treectrl.h>
22#include <wx/colour.h>
23#include <wx/pen.h>
24
25#include <vector>
26
35class PlotData : public wxTreeItemData
36{
37 public:
38 PlotData() {}
39 ~PlotData() {}
40 void SetAxis(int axis) { m_axis = axis; }
41 void SetColour(const wxColour& colour) { m_colour = colour; }
42 void SetName(const wxString& name) { m_name = name; }
43 void SetPenType(const wxPenStyle& penType) { m_penType = penType; }
44 void SetPlot(bool plot) { m_plot = plot; }
45 void SetThick(int thick) { m_thick = thick; }
46 void SetValues(const std::vector<double>& values) { m_values = values; }
47 int GetAxis() const { return m_axis; }
48 wxColour GetColour() const { return m_colour; }
49 wxString GetName() const { return m_name; }
50 wxPenStyle GetPenType() const { return m_penType; }
51 bool IsPlot() const { return m_plot; }
52 int GetThick() const { return m_thick; }
53 std::vector<double> GetValues() const { return m_values; }
54 void SetHighlight(bool highlight) { m_highlight = highlight; }
55 bool IsHighlighted() const { return m_highlight; }
56 protected:
57 std::vector<double> m_values;
58 wxString m_name = wxT("");
59 bool m_plot = false;
60 wxColour m_colour = *wxBLACK;
61 int m_thick = 2.0;
62 wxPenStyle m_penType = wxPenStyle::wxPENSTYLE_SOLID;
63 int m_axis = 0;
64 bool m_highlight = false;
65};
66
68{
69 public:
70 enum class CurveType : int {
71 CT_BUS = 0,
72 CT_SYNC_GENERATOR,
73 CT_SYNC_COMPENSATOR,
74 CT_TRANSFORMER,
75 CT_LINE,
76 CT_IND_MOTOR,
77 CT_SHUNT_INDUCTOR,
78 CT_SHUNT_CAPACITOR,
79 CT_LOAD,
80 CT_TEST,
81 NUM_ELEMENTS,
82 CT_TIME
83 };
85 ElementPlotData(wxString name, CurveType curveType);
87
88 wxString GetName() const { return m_name; }
89 void SetName(wxString name) { m_name = name; }
90 CurveType GetCurveType() const { return m_curveType; }
91 void SetCurveType(CurveType type) { m_curveType = type; }
92 PlotData* GetPlotData(int index) const { return m_elementData[index]; }
93 void AddData(std::vector<double> values, wxString name);
94
95 int GetElementDataNumber() const { return static_cast<int>(m_elementData.size()); }
96 std::vector<double> GetValues(int index) const { return m_elementData[index]->GetValues(); }
97 void SetValues(int index, std::vector<double> values) { m_elementData[index]->SetValues(values); }
98 void SetPlot(int index, bool plot = true) { m_elementData[index]->SetPlot(plot); }
99 wxString GetDataName(int index) const { return m_elementData[index]->GetName(); }
100 void SetDataName(int index, wxString name) { m_elementData[index]->SetName(name); }
101 wxColour GetColour(int index) const { return m_elementData[index]->GetColour(); }
102 void SetColour(int index, wxColour colour) { m_elementData[index]->SetColour(colour); }
103 int GetThick(int index) const { return m_elementData[index]->GetThick(); }
104 void SetThick(int index, int thick) { m_elementData[index]->SetThick(thick); }
105 wxPenStyle GetPenType(int index) const { return m_elementData[index]->GetPenType(); }
106 void SetPenType(int index, wxPenStyle penType) { m_elementData[index]->SetPenType(penType); }
107 int GetAxis(int index) const { return m_elementData[index]->GetAxis(); }
108 void SetAxis(int index, int axis) { m_elementData[index]->SetAxis(axis); }
109 protected:
110 wxString m_name;
111 CurveType m_curveType;
112 std::vector<PlotData*> m_elementData;
113};
114
115#endif // ELEMENTPLOTDATA_H
This class is responsible to manage the graphical data of electromechanical result to be plotted on c...