diff options
Diffstat (limited to 'Project/Line.cpp')
-rw-r--r-- | Project/Line.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Project/Line.cpp b/Project/Line.cpp index 836ca3c..3180cf8 100644 --- a/Project/Line.cpp +++ b/Project/Line.cpp @@ -31,6 +31,10 @@ bool Line::Contains(wxPoint2DDouble position) const void Line::Draw(wxPoint2DDouble translation, double scale) const { + OpenGLColour elementColour; + if(m_online) elementColour = m_onlineElementColour; + else elementColour = m_offlineElementColour; + std::vector<wxPoint2DDouble> pointList = m_pointList; if(!m_inserted && pointList.size() > 0) { wxPoint2DDouble secondPoint = m_position; @@ -44,7 +48,7 @@ void Line::Draw(wxPoint2DDouble translation, double scale) const // Line selected (Layer 1). if(m_selected) { glLineWidth(1.5 + m_borderSize * 2.0); - glColor4d(0.0, 0.5, 1.0, 0.5); + glColor4dv(m_selectionColour.GetRGBA()); DrawLine(pointList); // Draw nodes selection. @@ -58,7 +62,7 @@ void Line::Draw(wxPoint2DDouble translation, double scale) const // Draw line (Layer 2) glLineWidth(1.5); - glColor4d(0.2, 0.2, 0.2, 1.0); + glColor4dv(elementColour.GetRGBA()); DrawLine(pointList); if(m_inserted) { @@ -68,7 +72,7 @@ void Line::Draw(wxPoint2DDouble translation, double scale) const // Draw nodes. if(pointList.size() > 0) { - glColor4d(0.2, 0.2, 0.2, 1.0); + glColor4dv(elementColour.GetRGBA()); DrawCircle(pointList[0], 5.0, 10, GL_POLYGON); if(m_inserted) { DrawCircle(pointList[pointList.size() - 1], 5.0, 10, GL_POLYGON); @@ -487,3 +491,10 @@ void Line::SetPointList(std::vector<wxPoint2DDouble> pointList) UpdateSwitchesPosition(); UpdatePowerFlowArrowsPosition(); } + +Element* Line::GetCopy() +{ + Line* copy = new Line(); + *copy = *this; + return copy; +} |