summaryrefslogtreecommitdiffstats
path: root/Project/ConnectionLine.cpp
diff options
context:
space:
mode:
authorThales1330 <thaleslima.ufu@gmail.com>2017-03-09 15:09:43 -0300
committerThales1330 <thaleslima.ufu@gmail.com>2017-03-09 15:09:43 -0300
commit21ebf63bb59357000f9bb44acde176d4ff169c01 (patch)
tree2e3603bb0640b089d81844c5d37a8f6b5ce8da33 /Project/ConnectionLine.cpp
parenta1890bd024e0baea393480810709f43208825b9a (diff)
downloadPSP.git-21ebf63bb59357000f9bb44acde176d4ff169c01.tar.gz
PSP.git-21ebf63bb59357000f9bb44acde176d4ff169c01.tar.xz
PSP.git-21ebf63bb59357000f9bb44acde176d4ff169c01.zip
Sum implemented
Diffstat (limited to 'Project/ConnectionLine.cpp')
-rw-r--r--Project/ConnectionLine.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/Project/ConnectionLine.cpp b/Project/ConnectionLine.cpp
index ecbec1d..8a232fe 100644
--- a/Project/ConnectionLine.cpp
+++ b/Project/ConnectionLine.cpp
@@ -27,7 +27,7 @@ void ConnectionLine::Draw(wxPoint2DDouble translation, double scale) const
glLineWidth(1.5);
glColor4d(0.0, 0.0, 0.0, 1.0);
DrawLine(m_pointList);
-
+
if(m_type == ELEMENT_LINE) {
glColor4d(0.0, 0.0, 0.0, 1.0);
DrawCircle(m_pointList[5], 3, 10, GL_POLYGON);
@@ -95,7 +95,7 @@ void ConnectionLine::UpdatePoints()
wxPoint2DDouble pt1 = m_nodeList[0]->GetPosition();
wxPoint2DDouble pt2 = m_parentLine->GetMidPoint();
wxPoint2DDouble midPt = (pt1 + pt2) / 2.0 + wxPoint2DDouble(0.0, m_lineOffset);
-
+
m_pointList[0] = pt1;
if(m_nodeList[0]->GetAngle() == 0.0)
m_pointList[1] = m_pointList[0] + wxPoint2DDouble(-10, 0);
@@ -157,7 +157,7 @@ bool ConnectionLine::SetParentLine(ConnectionLine* parent)
{
if(m_nodeList[0]->GetNodeType() != Node::NODE_IN) return false;
if(!parent) return false;
-
+
m_type = ELEMENT_LINE;
m_parentLine = parent;
return true;
@@ -172,3 +172,11 @@ std::vector<ConnectionLine*> ConnectionLine::GetLineChildList() const
}
return childList;
}
+
+void ConnectionLine::RemoveParent(Element* parent)
+{
+ for(auto it = m_parentList.begin(); it != m_parentList.end(); ++it) {
+ Element* element = *it;
+ if(element == parent) m_parentList.erase(it--);
+ }
+}