summaryrefslogtreecommitdiffstats
path: root/Project/Gain.cpp
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2018-01-08 20:09:35 -0200
committerGitHub <noreply@github.com>2018-01-08 20:09:35 -0200
commit29af4e28898f44df444fef5534134c6b6000418d (patch)
tree13fd8f4449f2cfeed8a6185e96a6889f9529285d /Project/Gain.cpp
parent0c0280cfcf540f943fd2dbfdf7ac0304ea96a465 (diff)
parentc11a42ee83fcf535557d4f2cc259efae2da1b7ff (diff)
downloadPSP.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/Gain.cpp')
-rw-r--r--Project/Gain.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/Project/Gain.cpp b/Project/Gain.cpp
index 95107d8..2977f1f 100644
--- a/Project/Gain.cpp
+++ b/Project/Gain.cpp
@@ -177,7 +177,7 @@ void Gain::Move(wxPoint2DDouble position)
bool Gain::Solve(double* input, double timeStep)
{
- if(!input){
+ if(!input) {
m_output = 0.0;
return true;
}
@@ -199,3 +199,29 @@ bool Gain::UpdateText()
if(!m_glText->IsTextureOK()) return false;
return true;
}
+
+rapidxml::xml_node<>* Gain::SaveElement(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementListNode)
+{
+ auto elementNode = XMLParser::AppendNode(doc, elementListNode, "Gain");
+ XMLParser::SetNodeAttribute(doc, elementNode, "ID", m_elementID);
+
+ SaveCADProperties(doc, elementNode);
+ SaveControlNodes(doc, elementNode);
+
+ // Element properties
+ auto value = XMLParser::AppendNode(doc, elementNode, "Value");
+ XMLParser::SetNodeValue(doc, value, m_value);
+
+ return elementNode;
+}
+
+bool Gain::OpenElement(rapidxml::xml_node<>* elementNode)
+{
+ if(!OpenCADProperties(elementNode)) return false;
+ if(!OpenControlNodes(elementNode)) return false;
+
+ // Element properties
+ double value = XMLParser::GetNodeValueDouble(elementNode, "Value");
+ SetValue(value);
+ return true;
+} \ No newline at end of file