summaryrefslogtreecommitdiffstats
path: root/Project/ControlElement.h
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2017-04-24 17:39:03 -0300
committerGitHub <noreply@github.com>2017-04-24 17:39:03 -0300
commit7804c1bd2c0bd2a5f135c30b20991e8187581cc6 (patch)
tree725e524253d6fd714460402194b408cb33b80b3f /Project/ControlElement.h
parent69131a727782090ffd7cb467f449e8f26d3d2949 (diff)
parent9529a6ed44645842adc6f938478acc1dfa17a284 (diff)
downloadPSP.git-7804c1bd2c0bd2a5f135c30b20991e8187581cc6.tar.gz
PSP.git-7804c1bd2c0bd2a5f135c30b20991e8187581cc6.tar.xz
PSP.git-7804c1bd2c0bd2a5f135c30b20991e8187581cc6.zip
Merge pull request #28 from Thales1330/wip/generic-controllers
Wip generic controllers. Chart view implementation required, creating new branch....
Diffstat (limited to 'Project/ControlElement.h')
-rw-r--r--Project/ControlElement.h65
1 files changed, 64 insertions, 1 deletions
diff --git a/Project/ControlElement.h b/Project/ControlElement.h
index 69f9d83..1cf4e0b 100644
--- a/Project/ControlElement.h
+++ b/Project/ControlElement.h
@@ -3,12 +3,75 @@
#include "Element.h"
+class Node
+{
+public:
+ enum NodeType { NODE_IN = 0, NODE_OUT };
+
+ Node(wxPoint2DDouble position = wxPoint2DDouble(0, 0), NodeType nodeType = NODE_IN, double borderSize = 0.0);
+ ~Node();
+
+ wxRect2DDouble GetRect() const { return m_rect; }
+ void SetRect(wxRect2DDouble rect) { m_rect = rect; }
+
+ wxPoint2DDouble GetPosition() const;
+ void SetPosition(wxPoint2DDouble position);
+
+ NodeType GetNodeType() const { return m_nodeType; }
+ void SetNodeType(NodeType nodeType) { m_nodeType = nodeType; }
+
+ double GetRadius() const { return m_radius; }
+ std::vector<wxPoint2DDouble> GetInTrianglePts() const { return m_triPts; }
+
+ double GetAngle() const { return m_angle; }
+ void SetAngle(double angle) { m_angle = angle; }
+
+ void Rotate(bool clockwise = true);
+
+ void RotateTriPt(double angle);
+
+ void StartMove(wxPoint2DDouble position);
+ void Move(wxPoint2DDouble position);
+ bool Contains(wxPoint2DDouble position) const;
+
+ bool IsConnected() const { return m_connected; }
+ void SetConnected(bool connected = true) { m_connected = connected; }
+
+ int GetID() const { return m_id; }
+ void SetID(int id) { m_id = id; }
+
+protected:
+ int m_id = -1;
+
+ wxRect2DDouble m_rect;
+ NodeType m_nodeType;
+
+ bool m_connected = false;
+
+ wxPoint2DDouble m_moveStartPt;
+ wxPoint2DDouble m_movePos;
+
+ double m_radius = 3.0;
+ std::vector<wxPoint2DDouble> m_triPts;
+ double m_angle = 0.0;
+};
+
class ControlElement : public Element
{
public:
- ControlElement();
+ ControlElement(int id);
~ControlElement();
+ virtual void StartMove(wxPoint2DDouble position);
+ virtual void Move(wxPoint2DDouble position);
+
+ void SetNodeList(std::vector<Node*> nodeList) { m_nodeList = nodeList; }
+ std::vector<Node*> GetNodeList() const { return m_nodeList; }
+
+ virtual void DrawNodes() const;
+
+protected:
+ std::vector<Node*> m_nodeList;
};
#endif // CONTROLELEMENT_H