diff options
author | Thales1330 <thaleslima.ufu@gmail.com> | 2016-09-06 18:32:47 -0300 |
---|---|---|
committer | Thales1330 <thaleslima.ufu@gmail.com> | 2016-09-06 18:32:47 -0300 |
commit | 697baaa3cc92e945d2301238dc9bcabffdb465ef (patch) | |
tree | 01f3de93600a1036c8d693c5c8150434ebf75731 /Project/Bus.cpp | |
parent | d93ef357da510f2515556ff2cb51688a4e068805 (diff) | |
download | PSP.git-697baaa3cc92e945d2301238dc9bcabffdb465ef.tar.gz PSP.git-697baaa3cc92e945d2301238dc9bcabffdb465ef.tar.xz PSP.git-697baaa3cc92e945d2301238dc9bcabffdb465ef.zip |
Counter clockwise rotation implemented
Diffstat (limited to 'Project/Bus.cpp')
-rw-r--r-- | Project/Bus.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Project/Bus.cpp b/Project/Bus.cpp index 9d0775e..927d6c8 100644 --- a/Project/Bus.cpp +++ b/Project/Bus.cpp @@ -77,8 +77,8 @@ bool Bus::Contains(wxPoint2DDouble position) const bool Bus::Intersects(wxRect2DDouble rect) const { if(m_angle == 0.0 || m_angle == 180.0) return m_rect.Intersects(rect); - - return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0); + + return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0); } bool Bus::PickboxContains(wxPoint2DDouble position) @@ -150,16 +150,20 @@ void Bus::MovePickbox(wxPoint2DDouble position) SetPosition(m_position); } -void Bus::Rotate() +void Bus::Rotate(bool clockwise) { - m_angle += m_rotationAngle; + double rotAngle = m_rotationAngle; + if(!clockwise) rotAngle = -m_rotationAngle; + + m_angle += rotAngle; if(m_angle >= 360.0) m_angle = 0.0; } bool Bus::GetContextMenu(wxMenu& menu) { menu.Append(ID_EDIT_BUS, _("Edit bus")); - menu.Append(ID_ROTATE, _("Rotate")); - menu.Append(ID_DELETE, _("Delete")); + menu.Append(ID_ROTATE_CLOCK, _("Rotate clockwise")); + menu.Append(ID_ROTATE_COUNTERCLOCK, _("Rotate counter-clockwise")); + menu.Append(ID_DELETE, _("Delete")); return true; } |