Power System Platform  2026w10a-beta
Loading...
Searching...
No Matches
Branch.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 BRANCH_H
19#define BRANCH_H
20
21#include "PowerElement.h"
22#include "Bus.h"
23
31class Branch : public PowerElement
32{
33 public:
34 Branch();
35 ~Branch();
36
37 virtual bool Contains(wxPoint2DDouble position) const { return false; }
38 virtual void Draw(wxPoint2DDouble translation, double scale) const {}
39 virtual void Move(wxPoint2DDouble position) {}
40 virtual void StartMove(wxPoint2DDouble position) {}
41 virtual void MoveNode(Element* parent, wxPoint2DDouble position) {}
42 virtual bool NodeContains(wxPoint2DDouble position);
43 virtual bool SetNodeParent(Element* parent);
44 virtual void RemoveParent(Element* parent);
45 virtual void UpdateNodes();
46 virtual wxCursor GetBestPickboxCursor() const { return wxCURSOR_ARROW; }
47 virtual bool Intersects(wxRect2DDouble rect) const { return false; }
48 virtual void MovePickbox(wxPoint2DDouble position) {}
49 virtual bool PickboxContains(wxPoint2DDouble position) { return false; }
50 virtual void RotateNode(Element* parent, bool clockwise = true);
51 virtual void AddPoint(wxPoint2DDouble point){};
52 virtual bool GetContextMenu(wxMenu& menu) { return false; }
53 virtual void UpdateSwitchesPosition();
54 virtual void UpdateSwitches();
55
56 //protected:
57 //bool m_inserted = false;
58};
59
60#endif // BRANCH_H
Abstract class for branch power elements.
Definition Branch.h:32
virtual void UpdateSwitches()
Update the switch position.
Definition Branch.cpp:179
virtual void RotateNode(Element *parent, bool clockwise=true)
Rotate a node.
Definition Branch.cpp:143
virtual void UpdateNodes()
Update the nodes according to the parents. If a parent is removed, use this method.
Definition Branch.cpp:116
virtual bool NodeContains(wxPoint2DDouble position)
Check if a node contains a point. If contains, set the attributes related to node movement.
Definition Branch.cpp:22
virtual wxCursor GetBestPickboxCursor() const
Get the best cursor to shown to the user when the mouse is above a pickbox.
Definition Branch.h:46
virtual bool Contains(wxPoint2DDouble position) const
Checks if the element contains a position.
Definition Branch.h:37
virtual bool GetContextMenu(wxMenu &menu)
Get the element contex menu.
Definition Branch.h:52
virtual void Move(wxPoint2DDouble position)
Move the element other position.
Definition Branch.h:39
virtual bool PickboxContains(wxPoint2DDouble position)
Check if a pickbox contains a point. If contains the attributes related to pickbox movement will be c...
Definition Branch.h:49
virtual void AddPoint(wxPoint2DDouble point)
Add point to the list of points that connect the element to the bus.
Definition Branch.h:51
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Definition Branch.h:40
virtual void RemoveParent(Element *parent)
Remove a parent.
Definition Branch.cpp:105
virtual bool Intersects(wxRect2DDouble rect) const
Check if the element's rect intersects other rect.
Definition Branch.h:47
virtual bool SetNodeParent(Element *parent)
Set a perent to the node. If all conditions are met, a new parent are added to the element and the po...
Definition Branch.cpp:43
virtual void MoveNode(Element *parent, wxPoint2DDouble position)
Move a node. StartMove(wxPoint2DDouble position) before start moving.
Definition Branch.h:41
virtual void MovePickbox(wxPoint2DDouble position)
Move the pickbox.
Definition Branch.h:48
Base class of all elements of the program. This class is responsible for manage graphical and his dat...
Definition Element.h:112
Abstract class of power elements.