diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2020-06-13 00:01:53 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2020-06-13 00:01:53 -0300 |
commit | 6c0e98a2727d07e1fbb38b78c27d68e98ad09465 (patch) | |
tree | 12764ca986c9a1943bc2012b0cc751471773f6ee /Project/ConnectionLine.cpp | |
parent | 196389a70ef3a03aa8764b9532812a17dd55014b (diff) | |
download | PSP.git-6c0e98a2727d07e1fbb38b78c27d68e98ad09465.tar.gz PSP.git-6c0e98a2727d07e1fbb38b78c27d68e98ad09465.tar.xz PSP.git-6c0e98a2727d07e1fbb38b78c27d68e98ad09465.zip |
Device context implemented
Diffstat (limited to 'Project/ConnectionLine.cpp')
-rw-r--r-- | Project/ConnectionLine.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Project/ConnectionLine.cpp b/Project/ConnectionLine.cpp index 4ce7df8..0c79745 100644 --- a/Project/ConnectionLine.cpp +++ b/Project/ConnectionLine.cpp @@ -16,6 +16,8 @@ */ #include "ConnectionLine.h" +#include <wx/pen.h> +#include <wx/brush.h> ConnectionLine::ConnectionLine() : ControlElement(-1) {} ConnectionLine::ConnectionLine(Node* firstNode, int id) : ControlElement(id) @@ -48,6 +50,25 @@ void ConnectionLine::Draw(wxPoint2DDouble translation, double scale) const } } +void ConnectionLine::DrawDC(wxPoint2DDouble translation, double scale, wxGraphicsContext* gc) const +{ + gc->SetBrush(*wxTRANSPARENT_BRUSH); + if (m_selected) { + gc->SetPen(wxPen(m_selectionColour.GetDcRGBA(), 1.5 + m_borderSize * 2.0)); + gc->DrawLines(m_pointList.size(), &m_pointList[0]); + } + + // Draw line (Layer 2) + gc->SetPen(wxPen(wxColour(0, 0, 0, 255), 2.0)); + gc->DrawLines(m_pointList.size(), &m_pointList[0]); + + if (m_type == ConnectionLineType::ELEMENT_LINE) { + gc->SetPen(*wxTRANSPARENT_PEN); + gc->SetBrush(wxBrush(wxColour(0, 0, 0, 255))); + DrawDCCircle(m_pointList[5], 3, 10, gc); + } +} + bool ConnectionLine::Contains(wxPoint2DDouble position) const { if(PointToLineDistance(position) < 5.0) { return true; } |