Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
Sum.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 SUM_H
19#define SUM_H
20
21#include "ControlElement.h"
22
23class SumForm;
24class ConnectionLine;
25
33class Sum : public ControlElement
34{
35 public:
36 enum Signal { SIGNAL_POSITIVE = 0, SIGNAL_NEGATIVE };
37 Sum(int id);
38 ~Sum();
39
40 //virtual void Draw(wxPoint2DDouble translation, double scale) const;
41 virtual void DrawDC(wxPoint2DDouble translation, double scale, wxGraphicsContext* gc) const;
42 virtual bool Contains(wxPoint2DDouble position) const { return m_rect.Contains(position); }
43 virtual bool Intersects(wxRect2DDouble rect) const { return m_rect.Intersects(rect); }
44 virtual bool ShowForm(wxWindow* parent, Element* element);
45 virtual void Rotate(bool clockwise = true);
46
47 virtual std::vector<Signal> GetSignalList() const { return m_signalList; }
48 virtual void SetSignalList(std::vector<Signal> signalList) { m_signalList = signalList; }
49 virtual bool Solve(double* input, double timeStep);
50
51 virtual void UpdatePoints();
52 void AddInNode();
53 void RemoveInNode();
54
55 virtual rapidxml::xml_node<>* SaveElement(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementListNode);
56 virtual bool OpenElement(rapidxml::xml_node<>* elementNode);
57
58 virtual Element* GetCopy();
59
60 protected:
61 std::vector<Signal> m_signalList;
62};
63
64#endif // SUM_H
Base class of a control element. Provide general methods to other control classes.
Connection between two control elements or other connection line and an element.
Base class of all elements of the program. This class is responsible for manage graphical and his dat...
Definition Element.h:112
Form to edit the sum control data.
Definition SumForm.h:33
Sum the all inputs (can choose the input signal).
Definition Sum.h:34
virtual Element * GetCopy()
Get a the element copy.
Definition Sum.cpp:323
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition Sum.h:42
virtual void DrawDC(wxPoint2DDouble translation, double scale, wxGraphicsContext *gc) const
Draw the element using GDI+.
Definition Sum.cpp:119
virtual void Rotate(bool clockwise=true)
Rotate the element.
Definition Sum.cpp:263
virtual bool ShowForm(wxWindow *parent, Element *element)
Show element data form.
Definition Sum.cpp:192
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element's rect intersects other rect.
Definition Sum.h:43