diff options
author | Thales1330 <thaleslima.ufu@gmail.com> | 2017-03-08 18:26:37 -0300 |
---|---|---|
committer | Thales1330 <thaleslima.ufu@gmail.com> | 2017-03-08 18:26:37 -0300 |
commit | a1890bd024e0baea393480810709f43208825b9a (patch) | |
tree | 5eeb60b0e9d3085bbe2d2ba0c1939f26aa574f27 /Project/Sum.cpp | |
parent | 009849e49967af659354a94a16c51cab5eb8b5a4 (diff) | |
download | PSP.git-a1890bd024e0baea393480810709f43208825b9a.tar.gz PSP.git-a1890bd024e0baea393480810709f43208825b9a.tar.xz PSP.git-a1890bd024e0baea393480810709f43208825b9a.zip |
Sum form implementation start
Diffstat (limited to 'Project/Sum.cpp')
-rw-r--r-- | Project/Sum.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Project/Sum.cpp b/Project/Sum.cpp index e0951db..4d4303f 100644 --- a/Project/Sum.cpp +++ b/Project/Sum.cpp @@ -18,6 +18,8 @@ Sum::Sum() m_nodeList.push_back(nodeOut); m_signalList.push_back(SIGNAL_POSITIVE); m_signalList.push_back(SIGNAL_NEGATIVE); + + UpdatePoints(); } Sum::~Sum() {} @@ -49,8 +51,8 @@ void Sum::Draw(wxPoint2DDouble translation, double scale) const DrawLine(vLine); } } - - //Plot sigma. + + // Plot sigma. std::vector<wxPoint2DDouble> sigma; sigma.push_back(m_position + wxPoint2DDouble(10, 9)); sigma.push_back(m_position + wxPoint2DDouble(0, 9)); @@ -59,7 +61,7 @@ void Sum::Draw(wxPoint2DDouble translation, double scale) const sigma.push_back(m_position + wxPoint2DDouble(10, -9)); glColor4d(0.0, 0.3, 1.0, 1.0); DrawLine(sigma); - + glColor4d(0.0, 0.0, 0.0, 1.0); DrawNodes(); } @@ -74,3 +76,13 @@ bool Sum::ShowForm(wxWindow* parent, Element* element) sumForm->Destroy(); return false; } + +void Sum::UpdatePoints() +{ + m_height = 18.0 * (m_nodeList.size() - 1); + for(int i = 0; i < (int)m_nodeList.size() - 1; ++i) { + m_nodeList[i]->SetPosition(m_position + wxPoint2DDouble(-m_width / 2, 9 + 18 * i - m_height / 2)); + m_nodeList[i]->StartMove(m_position); + } + SetPosition(m_position); // Update rect. +} |