summaryrefslogtreecommitdiffstats
path: root/Project/Element.h
diff options
context:
space:
mode:
authorThales1330 <thaleslima.ufu@gmail.com>2016-08-18 19:10:04 -0300
committerThales1330 <thaleslima.ufu@gmail.com>2016-08-18 19:10:04 -0300
commit05525745c0b0d189484da3c45f95356d7558e2cf (patch)
treee05100d4711e4050985e3d550bf9053a3c22942f /Project/Element.h
parente58cec073cbd982246898c733ae21b9f2b92b2b7 (diff)
downloadPSP.git-05525745c0b0d189484da3c45f95356d7558e2cf.tar.gz
PSP.git-05525745c0b0d189484da3c45f95356d7558e2cf.tar.xz
PSP.git-05525745c0b0d189484da3c45f95356d7558e2cf.zip
Line improvements, context menu implemented
Line still under construction, contex menu base implemented
Diffstat (limited to 'Project/Element.h')
-rw-r--r--Project/Element.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/Project/Element.h b/Project/Element.h
index 1287bc4..eb89640 100644
--- a/Project/Element.h
+++ b/Project/Element.h
@@ -3,6 +3,7 @@
#include <wx/geometry.h>
#include <wx/cursor.h>
+#include <wx/menu.h>
#include <GL/gl.h>
enum PickboxID
@@ -16,6 +17,17 @@ enum PickboxID
ID_PB_LEFT_TOP
};
+enum ContextMenuID
+{
+ ID_EDIT_BUS = 0,
+ ID_EDIT_LINE,
+
+ ID_LINE_ADD_NODE,
+ ID_LINE_REMOVE_NODE,
+
+ ID_ROTATE
+};
+
class Element
{
public:
@@ -51,10 +63,12 @@ class Element
virtual wxCursor GetBestPickboxCursor() const = 0;
// General methods
- virtual void AddPoint(wxPoint2DDouble point){};
+ virtual bool GetContextMenu(wxMenu& menu) { return false; }
+ virtual void AddPoint(wxPoint2DDouble point) {}
virtual void StartMove(wxPoint2DDouble position);
virtual void Move(wxPoint2DDouble position);
virtual void MoveNode(Element* parent, wxPoint2DDouble position){};
+ virtual void RotateNode(Element* parent) {}
virtual wxPoint2DDouble GetSwitchPoint(Element* parent,
wxPoint2DDouble parentPoint,
wxPoint2DDouble secondPoint) const;
@@ -63,17 +77,21 @@ class Element
double scale,
double offsetX = 0.0,
double offsetY = 0.0) const;
+ virtual wxPoint2DDouble WorldToScreen(wxPoint2DDouble position,
+ wxPoint2DDouble translation,
+ double scale,
+ double offsetX = 0.0,
+ double offsetY = 0.0) const;
virtual void DrawCircle(wxPoint2DDouble position, double radius, int numSegments, GLenum mode = GL_LINE_LOOP) const;
virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode = GL_QUADS) const;
virtual void DrawRectangle(wxPoint2DDouble* points, GLenum mode = GL_QUADS) const;
virtual void DrawLine(std::vector<wxPoint2DDouble> points, GLenum mode = GL_LINE_STRIP) const;
virtual void DrawPickbox(wxPoint2DDouble position) const;
virtual wxPoint2DDouble RotateAtPosition(wxPoint2DDouble pointToRotate, double angle, bool degrees = true) const;
-
- virtual std::vector<Element*> GetParentList() const { return m_parentList; }
- virtual wxPoint2DDouble GetMoveStartPosition() const { return m_moveStartPt; }
- virtual wxPoint2DDouble GetMovePosition() const { return m_movePos; }
+ virtual std::vector<Element*> GetParentList() const { return m_parentList; }
+ virtual wxPoint2DDouble GetMoveStartPosition() const { return m_moveStartPt; }
+ virtual wxPoint2DDouble GetMovePosition() const { return m_movePos; }
protected:
std::vector<Element*> m_parentList;
@@ -83,6 +101,7 @@ class Element
double m_height = 0.0;
double m_angle = 0.0;
double m_borderSize = 2.0;
+ double m_rotationAngle = 45.0;
bool m_selected = false;
bool m_dragging = false;