diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2018-01-08 20:09:35 -0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-08 20:09:35 -0200 |
commit | 29af4e28898f44df444fef5534134c6b6000418d (patch) | |
tree | 13fd8f4449f2cfeed8a6185e96a6889f9529285d /Project/Multiplier.cpp | |
parent | 0c0280cfcf540f943fd2dbfdf7ac0304ea96a465 (diff) | |
parent | c11a42ee83fcf535557d4f2cc259efae2da1b7ff (diff) | |
download | PSP.git-29af4e28898f44df444fef5534134c6b6000418d.tar.gz PSP.git-29af4e28898f44df444fef5534134c6b6000418d.tar.xz PSP.git-29af4e28898f44df444fef5534134c6b6000418d.zip |
Merge pull request #44 from Thales1330/org/file-handling-and-ctrl-init
Org file handling and ctrl init
Diffstat (limited to 'Project/Multiplier.cpp')
-rw-r--r-- | Project/Multiplier.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/Project/Multiplier.cpp b/Project/Multiplier.cpp index b25a406..7a9bcd8 100644 --- a/Project/Multiplier.cpp +++ b/Project/Multiplier.cpp @@ -15,8 +15,8 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#include "Multiplier.h" #include "ConnectionLine.h" +#include "Multiplier.h" Multiplier::Multiplier(int id) : MathOperation(id) {} Multiplier::~Multiplier() {} @@ -58,9 +58,7 @@ bool Multiplier::Solve(double* input, double timeStep) } m_output = 1.0; - for(unsigned int i = 0; i < inputVector.size(); ++i) { - m_output *= inputVector[i]; - } + for(unsigned int i = 0; i < inputVector.size(); ++i) { m_output *= inputVector[i]; } return true; } @@ -71,3 +69,24 @@ Element* Multiplier::GetCopy() *copy = *this; return copy; } + +rapidxml::xml_node<>* Multiplier::SaveElement(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementListNode) +{ + auto elementNode = XMLParser::AppendNode(doc, elementListNode, "Multiplier"); + XMLParser::SetNodeAttribute(doc, elementNode, "ID", m_elementID); + + SaveCADProperties(doc, elementNode); + SaveControlNodes(doc, elementNode); + + return elementNode; +} + +bool Multiplier::OpenElement(rapidxml::xml_node<>* elementNode) +{ + if(!OpenCADProperties(elementNode)) return false; + if(!OpenControlNodes(elementNode)) return false; + + StartMove(m_position); + UpdatePoints(); + return true; +} |