Power System Platform  2026w10a-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_TEST = 1 << 11,
58 };
59
60 IOControl(int ioFlags, int id);
61 ~IOControl();
62
63 //virtual void Draw(wxPoint2DDouble translation, double scale) const;
64 virtual void DrawDC(wxPoint2DDouble translation, double scale, wxGraphicsContext* gc) const;
65 virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
66 virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
67 virtual bool ShowForm(wxWindow* parent, Element* element);
68 virtual void Rotate(bool clockwise = true);
69 virtual bool UpdateText();
70 virtual wxString GenerateText();
71 virtual void UpdatePoints();
72
73 virtual IOFlags GetValue() const { return m_value; }
74 virtual void SetValue(IOFlags value);
75 virtual int GetIOFlags() const { return m_ioFlags; }
76 virtual Node::NodeType GetType() { return m_ioNodeType; }
77 virtual wxString GetName() const { return m_name; }
78 virtual void SetName(const wxString& name) { m_name = name; }
79 virtual SimTestData GetSimTestData() const { return m_simTestData; }
80 virtual void SetSimTestData(const SimTestData& simTestData) { m_simTestData = simTestData; }
81 virtual double GetTestValue() const { return m_testValue; }
82 virtual void SetTestValue(const double& testValue) { m_testValue = testValue; }
83 virtual bool Initialize();
84
85 virtual rapidxml::xml_node<>* SaveElement(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementListNode);
86 virtual bool OpenElement(rapidxml::xml_node<>* elementNode);
87
88 virtual Element* GetCopy();
89
90protected:
91 IOFlags m_value;
92 int m_ioFlags;
93 wxString m_name = _("Input / Output");
94 SimTestData m_simTestData;
95 double m_testValue = 0.0;
96
97 Node::NodeType m_ioNodeType = Node::NodeType::NODE_IN;
98
99 //OpenGLText* m_glText = nullptr;
100 GCText* m_gcText = nullptr;
101};
102
103#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:112
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 Element * GetCopy()
Get a the element copy.
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition IOControl.h:65
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
virtual void DrawDC(wxPoint2DDouble translation, double scale, wxGraphicsContext *gc) const
Draw the element using GDI+.
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element's rect intersects other rect.
Definition IOControl.h:66