diff options
Diffstat (limited to 'Project/Element.h')
-rw-r--r-- | Project/Element.h | 29 |
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; |