summaryrefslogtreecommitdiffstats
path: root/Project/Line.cpp
diff options
context:
space:
mode:
authorThales1330 <thaleslima.ufu@gmail.com>2016-12-29 14:14:21 -0200
committerGitHub <noreply@github.com>2016-12-29 14:14:21 -0200
commitc5343c718cf80620c2fc7452a4315f7ddb9e5826 (patch)
tree3d5dbd283f31004cc6ef826c2b75d5e5ed9d9f27 /Project/Line.cpp
parent28e9cc4d9df63cb12c01d49017172c5f39ca9c22 (diff)
parent3750a0691f4975045647f3f70d8215fb1884e6fb (diff)
downloadPSP.git-c5343c718cf80620c2fc7452a4315f7ddb9e5826.tar.gz
PSP.git-c5343c718cf80620c2fc7452a4315f7ddb9e5826.tar.xz
PSP.git-c5343c718cf80620c2fc7452a4315f7ddb9e5826.zip
Merge pull request #4 from Thales1330/wip/copy-paste
Wip copy paste
Diffstat (limited to 'Project/Line.cpp')
-rw-r--r--Project/Line.cpp17
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;
+}