Power System Platform  2026w23a-beta
Loading...
Searching...
No Matches
IOControl.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 IOCONTROL_H
19#define IOCONTROL_H
20
21#include "ControlElement.h"
22
23 //#include "OpenGLText.h"
24#include "../GCText.h"
25
26class IOControlForm;
27
29 double startTime = 1.0;
30 double initialValue = 0.0;
31 double slope = 1.0;
32 int type = 0;
33};
34
43{
44public:
45 enum IOFlags {
46 IN_TERMINAL_VOLTAGE = 1 << 0,
47 IN_VELOCITY = 1 << 1,
48 IN_ACTIVE_POWER = 1 << 2,
49 IN_REACTIVE_POWER = 1 << 3,
50 OUT_FIELD_VOLTAGE = 1 << 4,
51 OUT_MEC_POWER = 1 << 5,
52 IN_INITIAL_TERMINAL_VOLTAGE = 1 << 6,
53 IN_INITIAL_MEC_POWER = 1 << 7,
54 IN_INITIAL_VELOCITY = 1 << 8,
55 IN_DELTA_VELOCITY = 1 << 9,
56 IN_DELTA_ACTIVE_POWER = 1 << 10,
57 IN_IO = 1 << 11,
58 IN_TEST = 1 << 12,
59 };
60
61 IOControl(int ioFlags, int id);
62 ~IOControl();
63
64 //virtual void Draw(wxPoint2DDouble translation, double scale) const;
65 virtual void DrawDC(GUIColour* guiColour, wxPoint2DDouble translation, double scale, wxGraphicsContext* gc) const;
66 virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
67 virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
68 virtual bool ShowForm(wxWindow* parent, Element* element, wxWindow* workspace = nullptr);
69 virtual void Rotate(bool clockwise = true);
70 virtual void SetFont(wxFont& font);
71 virtual bool UpdateText();
72 virtual wxString GenerateText();
73 virtual void UpdatePoints();
74
75 virtual IOFlags GetValue() const { return m_value; }
76 virtual void SetValue(IOFlags value);
77 virtual int GetIOFlags() const { return m_ioFlags; }
78 virtual Node::NodeType GetType() { return m_ioNodeType; }
79 virtual wxString GetName() const { return m_name; }
80 virtual void SetName(const wxString& name) { m_name = name; }
81 virtual SimTestData GetSimTestData() const { return m_simTestData; }
82 virtual void SetSimTestData(const SimTestData& simTestData) { m_simTestData = simTestData; }
83 virtual double GetTestValue() const { return m_testValue; }
84 virtual void SetTestValue(const double& testValue) { m_testValue = testValue; }
85 virtual bool Initialize();
86
87 virtual rapidxml::xml_node<>* SaveElement(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementListNode);
88 virtual bool OpenElement(rapidxml::xml_node<>* elementNode);
89
90 virtual Element* GetCopy();
91
92protected:
93 IOFlags m_value;
94 int m_ioFlags;
95 wxString m_name = _("Input / Output");
96 SimTestData m_simTestData;
97 double m_testValue = 0.0;
98
99 Node::NodeType m_ioNodeType = Node::NodeType::NODE_IN;
100
101 //OpenGLText* m_glText = nullptr;
102 GCText* m_gcText = nullptr;
103};
104
105#endif // IOCONTROL_H
Base class of a control element. Provide general methods to other control classes.
Base class of all elements of the program. This class is responsible for manage graphical and his dat...
Definition Element.h:114
Class to draw text on Graphics Context using wxWidgets.
Definition GCText.h:32
Form to edit the input/output control data.
Provides the communication with the power element.
Definition IOControl.h:43
virtual bool UpdateText()
Update the OpenGL text in the element (if present).
virtual void Rotate(bool clockwise=true)
Rotate the element.
virtual bool ShowForm(wxWindow *parent, Element *element, wxWindow *workspace=nullptr)
Show element data form.
virtual Element * GetCopy()
Get a the element copy.
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition IOControl.h:66
virtual void DrawDC(GUIColour *guiColour, wxPoint2DDouble translation, double scale, wxGraphicsContext *gc) const
Draw the element using GDI+.
Definition IOControl.cpp:44
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element's rect intersects other rect.
Definition IOControl.h:67