Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
Gain.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 GAIN_H
19#define GAIN_H
20
21#include "ControlElement.h"
22
23#include <wx/dcscreen.h>
24//#include "OpenGLText.h"
25#include "../GCText.h"
26
27class GainForm;
28
36class Gain : public ControlElement
37{
38 public:
39 Gain(int id);
40 ~Gain();
41
42 //virtual void Draw(wxPoint2DDouble translation, double scale) const;
43 virtual void DrawDC(wxPoint2DDouble translation, double scale, wxGraphicsContext* gc) const;
44 virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
45 virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
46 virtual bool ShowForm(wxWindow* parent, Element* element);
47 virtual void Rotate(bool clockwise = true);
48 virtual void Move(wxPoint2DDouble position);
49 virtual bool UpdateText();
50 virtual void SetValue(double value);
51 virtual double GetValue() const { return m_value; }
52 virtual void UpdatePoints();
61 virtual bool Solve(double* input, double timeStep);
62
63 virtual rapidxml::xml_node<>* SaveElement(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementListNode);
64 virtual bool OpenElement(rapidxml::xml_node<>* elementNode);
65
66 virtual Element* GetCopy();
67
68 protected:
69 double m_value = 1.0;
70
71 //OpenGLText* m_glText = nullptr;
72 GCText* m_gcText = nullptr;
73
74 std::vector<wxPoint2DDouble> m_triPts;
75};
76
77#endif // GAIN_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 gain control data.
Definition GainForm.h:32
Provide an output multiplying the input by a constant.
Definition Gain.h:37
virtual Element * GetCopy()
Get a the element copy.
Definition Gain.cpp:247
virtual bool UpdateText()
Update the OpenGL text in the element (if present).
Definition Gain.cpp:256
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition Gain.cpp:141
virtual bool Solve(double *input, double timeStep)
Multiply the input by a constant.
Definition Gain.cpp:237
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element's rect intersects other rect.
Definition Gain.h:45
virtual void DrawDC(wxPoint2DDouble translation, double scale, wxGraphicsContext *gc) const
Draw the element using GDI+.
Definition Gain.cpp:87
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition Gain.h:44
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition Gain.cpp:231
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition Gain.cpp:151