Power System Platform  2026w34a-beta
Loading...
Searching...
No Matches
ConnectionLine.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 CONNECTIONLINE_H
19#define CONNECTIONLINE_H
20
21#include "ControlElement.h"
22
30class ConnectionLine : public ControlElement
31{
32 public:
33 enum class ConnectionLineType : int { ELEMENT_ELEMENT = 0, ELEMENT_LINE };
34 ConnectionLine();
35 ConnectionLine(Node* firstNode, int id);
36 ~ConnectionLine();
37
38 //virtual void Draw(wxPoint2DDouble translation, double scale) const;
39 virtual void DrawDC(GUIColour* guiColour, wxPoint2DDouble translation, double scale, wxGraphicsContext* gc) const;
40 virtual bool Contains(wxPoint2DDouble position) const;
41 virtual bool Intersects(wxRect2DDouble rect) const;
42 virtual void RemoveParent(Element* parent);
43 virtual void StartMove(wxPoint2DDouble position);
44 virtual void Move(wxPoint2DDouble position);
45 virtual bool AppendNode(Node* node, ControlElement* parent);
46 virtual void UpdatePoints();
47 virtual bool Initialize();
48 virtual void SetTemporarySecondPoint(wxPoint2DDouble point) { m_tmpSndPt = point; }
49 virtual wxPoint2DDouble GetMidPoint() const;
50 virtual double GetOffset() const { return m_lineOffset; }
51 virtual void SetOffset(double offset) { m_lineOffset = offset; }
52 virtual ConnectionLine::ConnectionLineType GetType() const { return m_type; }
53 virtual void SetType(ConnectionLineType newType) { m_type = newType; }
54 virtual ConnectionLine* GetParentLine() const { return m_parentLine; }
55 virtual bool SetParentLine(ConnectionLine* parent);
56
57 virtual std::vector<ConnectionLine*> GetLineChildList() const;
58
59 virtual double GetValue() const { return m_value; }
60 virtual void SetValue(double value) { m_value = value; }
62
63 protected:
64 double m_lineOffset = 0.0;
65 double m_moveStartPtY = 0.0;
66 double m_moveStartOffset = 0.0;
67 wxPoint2DDouble m_tmpSndPt;
68
69 ConnectionLineType m_type = ConnectionLineType::ELEMENT_ELEMENT;
70 ConnectionLine* m_parentLine = nullptr;
71
72 double m_value = 0.0;
73};
74
75#endif // CONNECTIONLINE_H
Base class of a control element. Provide general methods to other control classes.
Element * GetCopy()
Get a the element copy.
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
virtual void RemoveParent(Element *parent)
Remove a parent.
virtual void DrawDC(GUIColour *guiColour, wxPoint2DDouble translation, double scale, wxGraphicsContext *gc) const
Draw the element using GDI+.
virtual void Move(wxPoint2DDouble position)
Move the element other position.
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element's rect intersects other rect.
Element()
Constructor.
Definition Element.cpp:28
Node of a control element. This class manages the user interaction with the connection and control el...